Search in sources :

Example 1 with Effects

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;
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Ref(main.entity.Ref) RandomWizard(main.system.auxiliary.RandomWizard) PROPERTY(main.content.values.properties.PROPERTY) Obj(main.entity.obj.Obj) DC_Effect(eidolons.ability.effects.DC_Effect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Effect(main.ability.effects.Effect) Effects(main.ability.effects.Effects) PARAMETER(main.content.values.parameters.PARAMETER)

Example 2 with Effects

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;
}
Also used : INJURY(main.content.CONTENT_CONSTS2.INJURY) Effects(main.ability.effects.Effects)

Example 3 with Effects

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;
}
Also used : Ref(main.entity.Ref) Effects(main.ability.effects.Effects) AddStatusEffect(main.ability.effects.common.AddStatusEffect)

Example 4 with 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!
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) RefCondition(main.elements.conditions.RefCondition) Effects(main.ability.effects.Effects) AddStatusEffect(main.ability.effects.common.AddStatusEffect) Conditions(main.elements.conditions.Conditions) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect)

Example 5 with Effects

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;
}
Also used : Ref(main.entity.Ref) DC_HeroItemObj(eidolons.entity.item.DC_HeroItemObj) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) DC_QuickItemObj(eidolons.entity.item.DC_QuickItemObj) Effects(main.ability.effects.Effects) Unit(eidolons.entity.obj.unit.Unit) LinkedList(java.util.LinkedList)

Aggregations

Effects (main.ability.effects.Effects)50 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)23 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)18 Effect (main.ability.effects.Effect)17 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)8 FixedTargeting (main.elements.targeting.FixedTargeting)8 Ref (main.entity.Ref)8 ActiveAbility (main.ability.ActiveAbility)7 Formula (main.system.math.Formula)7 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)6 Targeting (main.elements.targeting.Targeting)6 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)5 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)5 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)5 DC_Effect (eidolons.ability.effects.DC_Effect)4 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)4 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)4 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)4 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)4 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)4