use of main.entity.Ref in project Eidolons by IDemiurge.
the class HeroObjectModifyingEffect method applyThis.
/**
* Modstring format: valueName(value);valueName2(value2);... Use [mod],
* [set], [remove] to change the default ADD function of modstring
*/
public boolean applyThis() {
if (ref.getTargetObj().isDead() || ref.getSourceObj().isDead()) {
removeEffects();
return false;
}
if (game.isSimulation()) {
if (!checkApplyInSimulation()) {
return true;
}
}
// what if the group has changed? perhaps there should be a map...
if (prop) {
if (propMap == null) {
propMap = new RandomWizard<PROPERTY>().constructStringWeightMap(modString, PROPERTY.class);
} else {
LogMaster.log(1, "prop map " + propMap.toString());
}
} else if (// TODO support PROPERTY?
map == null) {
map = new RandomWizard<PARAMETER>().constructStringWeightMap(modString, PARAMETER.class);
} else {
LogMaster.log(0, "map " + map.toString());
}
List<? extends Obj> list = getObjectsToModify();
LogMaster.log(0, "list " + list.toString());
LogMaster.log(0, "effects " + effects.toString());
for (Obj obj : list) {
if (obj == null) {
continue;
}
if (obj.isDead()) {
// TODO clean up for owner is dead!
continue;
}
Effect effect = effects.get(obj);
if (effect != null) {
// if (isPermanent() && isApplied())
// continue;
effect.applyThis();
applied = true;
continue;
}
Ref REF = ref.getCopy();
REF.setTarget(obj.getId());
// map = new MapMaster<PARAMETER, String>().constructVarMap(
// modString, PARAMETER.class);
Effects modEffects = new Effects();
if (map != null) {
EffectFinder.initParamModEffects(modEffects, map, ref);
} else if (propMap != null) {
EffectFinder.initPropModEffects(modEffects, propMap, ref);
}
applied = true;
for (Effect e : modEffects.getEffects()) {
e.resetOriginalFormula();
e.appendFormulaByMod(getFormula().toString());
}
if (buff) {
AddBuffEffect buffEffect = new AddBuffEffect(buffName, modEffects);
// TODO LAYER?
buffEffect.setForcedLayer(getModEffectLayer());
modEffects.setForcedLayer(getModEffectLayer());
if (isPermanent()) {
buffEffect.setDuration(ContentManager.INFINITE_VALUE);
}
if (!game.isSimulation()) {
effects.put(obj, buffEffect);
}
buffEffect.apply(REF);
} else {
if (!game.isSimulation()) {
effects.put(obj, modEffects);
}
modEffects.apply(REF);
}
}
return true;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class TossItemEffect method roll.
private boolean roll(Unit source, Unit unit, DC_HeroItemObj item) {
String fail = "5*1.5*sqrt" + StringMaster.wrapInParenthesis("" + (1 + PositionMaster.getDistance(unit, source)));
// account for range
if (item instanceof DC_QuickItemObj) {
DC_QuickItemObj quickItemObj = (DC_QuickItemObj) item;
}
Ref REF = ref.getCopy();
REF.setTarget(source.getId());
boolean result = RollMaster.roll(GenericEnums.ROLL_TYPES.ACCURACY, "-", fail, ref, "@, missing the " + item.getName() + " toss", item.getName() + " toss");
fail = "5";
if (!result) {
fail += "*2";
}
REF.setTarget(unit.getId());
result = !RollMaster.roll(GenericEnums.ROLL_TYPES.REFLEX, "-", fail, ref, "@, dropping the tossed " + item.getName(), item.getName() + " toss");
return result;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class UnconsciousBuffEffect method getEffects.
private static Effect getEffects() {
Effects effects = EffectFinder.initParamModEffects(PARAM_MOD_EFFECTS_STRING, new Ref());
effects.add(new AddStatusEffect(UnitEnums.STATUS.PRONE));
effects.add(new AddStatusEffect(UnitEnums.STATUS.IMMOBILE));
effects.add(new AddStatusEffect(UnitEnums.STATUS.UNCONSCIOUS));
return effects;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class CampEffect method applyThis.
@Override
public boolean applyThis() {
/*
restore fully, dispel all timed buffs, apply bonus
*/
List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
if (allies.isEmpty())
getGame().getMetaMaster().getPartyManager().getParty().addMember(getGame().getMetaMaster().getPartyManager().getParty().getLeader());
// mystery fix
for (Unit sub : new LinkedList<>(allies)) {
DC_HeroItemObj item = sub.getItemFromInventory("Food");
if (item != null) {
sub.removeFromInventory(item);
continue;
}
DC_QuickItemObj qitem = sub.getQuickItem("Food");
if (item != null) {
sub.removeQuickItem(qitem);
continue;
}
allies.remove(sub);
continue;
// remove
}
if (allies.isEmpty()) {
FloatingTextMaster.getInstance().createFloatingText(TEXT_CASES.REQUIREMENT, "You need food supplies to camp!", ref.getSourceObj());
return false;
}
Effects restorationEffects = new Effects();
restorationEffects.add(new ModifyValueEffect(PARAMS.C_ENDURANCE, MOD.SET_TO_PERCENTAGE, "125", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.SET_TO_PERCENTAGE, "70", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_ESSENCE, MOD.SET_TO_PERCENTAGE, "100", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_STAMINA, MOD.SET_TO_PERCENTAGE, "125", true));
restorationEffects.add(new ModifyValueEffect(PARAMS.C_TOUGHNESS, MOD.SET_TO_PERCENTAGE, "100", true));
for (Unit sub : allies) {
Ref REF = sub.getRef().getTargetingRef(sub);
restorationEffects.apply(REF);
}
float time = 20;
getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
// applyRested();
for (Unit sub : allies) {
}
return true;
}
use of main.entity.Ref in project Eidolons by IDemiurge.
the class RestEffect method applyThis.
@Override
public boolean applyThis() {
// whole party!
/*
add regen and wait()
interrupt?
remove buff?
or rely on reset() ?
block actions
add shader
*/
List<Unit> allies = getGame().getMetaMaster().getPartyManager().getParty().getMembers();
for (Unit sub : allies) {
Ref REF = sub.getRef().getTargetingRef(sub);
new ModeEffect(STD_MODES.SLEEPING).apply(REF);
}
float time = 120;
// (Boolean) WaitMaster.waitForInput(WAIT_OPERATIONS.WAIT_COMPLETE);
Boolean result = getGame().getDungeonMaster().getExplorationMaster().getTimeMaster().playerRests(time);
if (result) {
// applyRested();
for (Unit sub : allies) {
sub.removeBuff("Sleeping");
Ref REF = sub.getRef().getTargetingRef(sub);
getRestedBuffEffect().apply(REF);
new ModifyValueEffect(PARAMS.C_MORALE, MOD.MODIFY_BY_PERCENT, "15").apply(REF);
}
}
return true;
}
Aggregations