Search in sources :

Example 1 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class DC_Masteries method boostParameter.

private void boostParameter(int i, PARAMS p, MOD modval) {
    Ref ref = new Ref(hero.getGame(), hero.getId());
    ref.setTarget(hero.getId());
    ref.setBase(true);
    ref.setQuiet(true);
    new ModifyValueEffect(p, modval, i + "").apply(ref);
}
Also used : Ref(main.entity.Ref) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect)

Example 2 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect 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)

Example 3 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect 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;
}
Also used : Ref(main.entity.Ref) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Unit(eidolons.entity.obj.unit.Unit) ModeEffect(eidolons.ability.effects.oneshot.mechanic.ModeEffect)

Example 4 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class CadenceRule method checkDualAttackCadence.

public static void checkDualAttackCadence(DC_UnitAction action, Unit unit) {
    if (action.getActionGroup() != ActionEnums.ACTION_TYPE_GROUPS.ATTACK) {
        return;
    }
    boolean singleCadence = checkSingleWeaponCadence(unit, action);
    if (!UnitAnalyzer.checkDualWielding(unit) && !UnitAnalyzer.checkDualNaturalWeapons(unit) && !singleCadence) // || checkSingleCadence(action)
    {
        return;
    }
    Boolean offhand = null;
    if (action.checkProperty(PROP, MAIN_HAND)) {
        offhand = false;
    } else if (action.checkProperty(PROP, OFF_HAND)) {
        offhand = true;
    } else if (singleCadence) // offhand = !action.isOffhand();
    {
        offhand = false;
    }
    if (offhand == null) {
        return;
    }
    Ref ref = new Ref(unit.getGame(), unit.getId());
    DC_WeaponObj weapon = unit.getActiveWeapon(offhand);
    List<Obj> targets = new ArrayList<>();
    if (unit.getWeapon(!offhand) != null) {
        targets.add(unit.getWeapon(!offhand));
    }
    if (unit.getNaturalWeapon(!offhand) != null) {
        targets.add(unit.getNaturalWeapon(!offhand));
    }
    GroupImpl group = new GroupImpl(targets);
    LogMaster.log(LogMaster.RULES_DEBUG, "Cadence Rule applies to " + group);
    ref.setGroup(group);
    if (checkFocusBonusApplies(unit, action, singleCadence)) {
        Integer amount = action.getOwnerObj().getIntParam(PARAMS.CADENCE_FOCUS_BOOST);
        amount += action.getIntParam(PARAMS.CADENCE_FOCUS_BOOST);
        amount += action.getOwnerObj().getActiveWeapon(!offhand).getIntParam(PARAMS.CADENCE_FOCUS_BOOST);
        action.getOwnerObj().modifyParameter(PARAMS.C_FOCUS, amount, 100);
    }
    // INIT COST CADENCE EFFECTS
    Effects effects = new Effects();
    String cadence = unit.getParam(PARAMS.CADENCE_AP_MOD);
    if (cadence.isEmpty()) {
        cadence = DC_Formulas.DEFAULT_CADENCE_AP_MOD + "";
    }
    ModifyValueEffect valueEffect = new ModifyValueEffect(PARAMS.ATTACK_AP_PENALTY, MOD.MODIFY_BY_CONST, cadence);
    valueEffect.appendFormulaByMod(100 + weapon.getIntParam(PARAMS.CADENCE_BONUS));
    effects.add(valueEffect);
    cadence = unit.getParam(PARAMS.CADENCE_STA_MOD);
    if (cadence.isEmpty()) {
        cadence = DC_Formulas.DEFAULT_CADENCE_STA_MOD + "";
    }
    valueEffect = new ModifyValueEffect(PARAMS.ATTACK_STA_PENALTY, MOD.MODIFY_BY_CONST, cadence);
    valueEffect.appendFormulaByMod(100 + weapon.getIntParam(PARAMS.CADENCE_BONUS));
    effects.add(valueEffect);
    if (unit.getIntParam(PARAMS.CADENCE_DAMAGE_MOD) > 0) {
        effects.add(new ModifyValueEffect(PARAMS.DAMAGE_MOD, MOD.MODIFY_BY_CONST, unit.getParam(PARAMS.CADENCE_DAMAGE_MOD)));
    }
    if (unit.getIntParam(PARAMS.CADENCE_ATTACK_MOD) > 0) {
        effects.add(new ModifyValueEffect(PARAMS.ATTACK_MOD, MOD.MODIFY_BY_CONST, unit.getParam(PARAMS.CADENCE_ATTACK_MOD)));
    }
    String buffTypeName = (!offhand) ? buffTypeNameOffHand : buffTypeNameMainHand;
    // ADD REMOVE TRIGGER
    int percentage = 100 - unit.getIntParam(PARAMS.CADENCE_RETAINMENT_CHANCE) - action.getIntParam(PARAMS.CADENCE_RETAINMENT_CHANCE) - weapon.getIntParam(PARAMS.CADENCE_RETAINMENT_CHANCE);
    Conditions conditions = new Conditions(new RefCondition(KEYS.EVENT_SOURCE, KEYS.SOURCE));
    if (percentage != 100) {
        conditions.add(new ChanceCondition(new Formula("" + percentage)));
    }
    effects.add(new AddTriggerEffect(STANDARD_EVENT_TYPE.UNIT_ACTION_COMPLETE, conditions, new ActiveAbility(new FixedTargeting(KEYS.BASIS), new RemoveBuffEffect(buffTypeName))));
    // effect = new AddBuffEffect(buffTypeName, effects, DURATION);
    // Condition condition = new StringComparison(StringMaster.getValueRef(KEYS.MATCH, PROP),
    // (offhand) ? MAIN_HAND : OFF_HAND, false);
    // retain condition - hero hasBuff()
    // add remove trigger on attack? either off/main hand, so there is no
    // stacking...
    // linked buffs?
    // effect.setIrresistible(false);
    AddBuffEffect addBuffEffect = new AddBuffEffect(buffTypeName, // new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ACTIONS, condition),
    effects, DURATION);
    // preCheck perk
    addBuffEffect.addEffect(new // what about
    AddTriggerEffect(// counters/AoO?
    STANDARD_EVENT_TYPE.UNIT_ACTION_COMPLETE, new RefCondition(KEYS.EVENT_SOURCE, KEYS.SOURCE), new ActiveAbility(new FixedTargeting(KEYS.SOURCE), new RemoveBuffEffect(buffTypeName))));
    Integer param = unit.getIntParam(PARAMS.CADENCE_DEFENSE_MOD);
    if (param != 0) {
        addBuffEffect.addEffect(new ModifyValueEffect(PARAMS.DEFENSE_MOD, MOD.MODIFY_BY_CONST, "" + param));
    }
    addBuffEffect.setIrresistible(true);
    addBuffEffect.apply(ref);
// TODO defense mod effect
}
Also used : ChanceCondition(main.elements.conditions.standard.ChanceCondition) ActiveAbility(main.ability.ActiveAbility) ArrayList(java.util.ArrayList) RefCondition(main.elements.conditions.RefCondition) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) Conditions(main.elements.conditions.Conditions) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect) Formula(main.system.math.Formula) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Ref(main.entity.Ref) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) FixedTargeting(main.elements.targeting.FixedTargeting) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) GroupImpl(main.entity.group.GroupImpl)

Example 5 with ModifyValueEffect

use of eidolons.ability.effects.common.ModifyValueEffect in project Eidolons by IDemiurge.

the class VampirismEffect method applyThis.

@Override
public boolean applyThis() {
    if (conditions == null) {
        initConditions();
    }
    // TODO Auto-generated method stub
    // endurance damage; modify endurance only? above base?
    // if (triggerEffect!=null) triggerEffect.apply(ref); else {
    Targeting targeting = new FixedTargeting(KEYS.SOURCE);
    Effects effects = new Effects();
    if (restoreEndurance) {
        ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_ENDURANCE, code, formula.toString());
        if (!restoreEnduranceAboveBase) {
            effect.setMaxParam(PARAMS.ENDURANCE);
        }
        effects.add(effect);
    }
    if (restoreToughness) {
        ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_TOUGHNESS, code, formula.toString());
        if (!restoreToughnessAboveBase) {
            effect.setMaxParam(PARAMS.TOUGHNESS);
        }
        effects.add(effect);
    }
    if (fromEnduranceDamage) {
        ActiveAbility ability = new ActiveAbility(targeting, effects);
        new AddTriggerEffect(// TODO
        STANDARD_EVENT_TYPE.UNIT_IS_DEALT_ENDURANCE_DAMAGE, // damage?
        conditions, ability).apply(ref);
    }
    if (fromToughnessDamage) {
    }
    return true;
}
Also used : ActiveAbility(main.ability.ActiveAbility) FixedTargeting(main.elements.targeting.FixedTargeting) Targeting(main.elements.targeting.Targeting) FixedTargeting(main.elements.targeting.FixedTargeting) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects)

Aggregations

ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)27 Effects (main.ability.effects.Effects)17 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)11 Ref (main.entity.Ref)8 Formula (main.system.math.Formula)7 PARAMETER (main.content.values.parameters.PARAMETER)5 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)4 ActiveAbility (main.ability.ActiveAbility)4 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)3 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)3 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)3 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)3 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)3 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)3 Abilities (main.ability.Abilities)3 Effect (main.ability.effects.Effect)3 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)3 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)3 Targeting (main.elements.targeting.Targeting)3