use of main.ability.effects.Effects 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.ability.effects.Effects in project Eidolons by IDemiurge.
the class InjuryEffect method applyThis.
@Override
public boolean applyThis() {
int mod = 100 - getTarget().getIntParam(PARAMS.INJURY_RESISTANCE);
if (mod <= 0) {
return true;
}
INJURY injury;
if (template != null) {
injury = template;
} else {
injury = getRandomInjury();
}
// preCheck applicable
getTarget().addProperty(PROPS.INJURIES, StringMaster.getWellFormattedString(injury.toString()));
Effects effects = EffectFinder.initParamModEffects(injury.getModString(), ref);
// TODO ++ PROPS
if (mod != 100) {
effects.appendFormulaByMod(mod);
}
effects.apply(ref);
return true;
}
use of main.ability.effects.Effects 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.ability.effects.Effects in project Eidolons by IDemiurge.
the class SleepEffect method applyThis.
@Override
public boolean applyThis() {
// makes another throw each time when hit?
// statically parsed Spellpower/Mastery?
// add roll on hit - dmg vs max toughness
RollEffect rollEffect = new RollEffect(GenericEnums.ROLL_TYPES.MIND_AFFECTING, new RemoveBuffEffect(getBuffName()));
Conditions conditions = new Conditions(new RefCondition(KEYS.EVENT_TARGET, KEYS.TARGET));
return new AddBuffEffect(getBuffName(), new Effects(new AddStatusEffect(UnitEnums.STATUS.ASLEEP), new AddTriggerEffect(STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE, conditions, KEYS.EVENT_TARGET, rollEffect))).apply(ref);
// roll ref needs to be tested!
}
use of main.ability.effects.Effects 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;
}
Aggregations