Search in sources :

Example 1 with RemoveBuffEffect

use of eidolons.ability.effects.oneshot.buff.RemoveBuffEffect in project Eidolons by IDemiurge.

the class ModeEffect method addDispelOnHitTrigger.

private void addDispelOnHitTrigger() {
    Effects effects = new Effects(new RemoveBuffEffect(addBuffEffect.getBuffTypeName()));
    if (!mode.equals(STD_MODES.ALERT)) {
        effects.add(InterruptRule.getEffect());
    } else {
        effects.add(AlertRule.getInterruptEffect());
    }
    if (mode.equals(STD_MODES.CHANNELING)) {
        effects.add(new EffectImpl() {

            @Override
            public boolean applyThis() {
                ChannelingRule.channelingInterrupted((Unit) getRef().getSourceObj());
                return true;
            }
        });
    }
    // TODO
    STANDARD_EVENT_TYPE event_type = STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE;
    Condition conditions = (mode.equals(STD_MODES.ALERT)) ? InterruptRule.getConditionsAlert() : InterruptRule.getConditions();
    addBuffEffect.addEffect(new DelayedEffect(event_type, effects, conditions));
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with RemoveBuffEffect

use of eidolons.ability.effects.oneshot.buff.RemoveBuffEffect 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 3 with RemoveBuffEffect

use of eidolons.ability.effects.oneshot.buff.RemoveBuffEffect in project Eidolons by IDemiurge.

the class WatchRule method updateWatchStatus.

public void updateWatchStatus(Unit watcher) {
    List<DC_Obj> list = getWatchersMap().get(watcher);
    boolean invalid = false;
    if (list != null) {
        if (!checkValidWatcher(watcher)) {
            invalid = true;
            removeWatcher(watcher);
        } else {
            for (DC_Obj watched : list) {
                if (!checkValidWatchTarget(watched)) {
                    breakWatch(watcher, watched);
                    break;
                } else if (!checkValidWatchPairTarget(watcher, watched)) {
                    breakWatch(watcher, watched);
                    break;
                }
            }
        }
    }
    BuffObj buff = watcher.getBuff("Watching", false);
    if (buff != null) {
        watcher.getGame().getManager().buffRemoved(buff);
    }
    if (!invalid) {
        if (watcher.getMode().equals(STD_MODES.ALERT)) {
            Ref ref = watcher.getRef().getCopy();
            try {
                SpectrumEffect spectrumEffect = new SpectrumEffect(new OwnershipCondition(true, "match", "source"), new WatchActionEffect(true));
                spectrumEffect.setRangeFormula(StringMaster.getValueRef(KEYS.SOURCE, PARAMS.SIGHT_RANGE));
                // for now...
                spectrumEffect.setApplyThrough(false);
                spectrumEffect.apply(ref);
                watcher.getBuff(STD_MODES.ALERT.getBuffName(), false).setOnDispelEffects(new RemoveBuffEffect("Watching ", false));
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
    }
    list = getWatchersMap().get(watcher);
    if (ListMaster.isNotEmpty(list)) // TODO alert???
    {
        getWatchBuffEffect(watcher, list).apply(Ref.getSelfTargetingRefCopy(watcher));
    }
}
Also used : DC_Obj(eidolons.entity.obj.DC_Obj) Ref(main.entity.Ref) OwnershipCondition(main.elements.conditions.standard.OwnershipCondition) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) SpectrumEffect(eidolons.ability.effects.common.SpectrumEffect) WatchActionEffect(eidolons.ability.effects.oneshot.rule.WatchActionEffect)

Example 4 with RemoveBuffEffect

use of eidolons.ability.effects.oneshot.buff.RemoveBuffEffect in project Eidolons by IDemiurge.

the class UpkeepRule method enactUpkeepFail.

public void enactUpkeepFail(UPKEEP_FAIL_ACTION ufa, Ref ref) {
    Obj targetObj = ref.getTargetObj();
    if (targetObj instanceof BuffObj) {
        BuffObj buffObj = (BuffObj) targetObj;
        ref.setTarget(buffObj.getBasis().getId());
        new RemoveBuffEffect(targetObj.getName()).apply(ref);
        ref.getGame().getLogManager().log(targetObj.getName() + " " + BUFF_DISPELLED_STRING);
        return;
    }
    ref.getGame().getLogManager().log(targetObj.getName() + " " + ufa.getLogString());
    // TODO enemy string should be different!
    Effect e = getFailEffects(ufa);
    e.apply(ref);
}
Also used : RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) Effect(main.ability.effects.Effect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) BuffObj(main.entity.obj.BuffObj)

Example 5 with RemoveBuffEffect

use of eidolons.ability.effects.oneshot.buff.RemoveBuffEffect in project Eidolons by IDemiurge.

the class ModeEffect method addRemoveTrigger.

private void addRemoveTrigger() {
    REMOVE_EVENT = mode.getRemoveEvent();
    if (REMOVE_EVENT == null) {
        return;
    }
    Condition c = null;
    if (REMOVE_EVENT == STANDARD_EVENT_TYPE.UNIT_TURN_STARTED) {
        c = new RefCondition(KEYS.EVENT_SOURCE, KEYS.MATCH);
    // ++ remove disable actions?!
    }
    addBuffEffect.addEffect(new DelayedEffect(REMOVE_EVENT, new RemoveBuffEffect(addBuffEffect.getBuffTypeName()), c));
// .apply(ref);
}
Also used : Condition(main.elements.conditions.Condition) RefCondition(main.elements.conditions.RefCondition) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) RefCondition(main.elements.conditions.RefCondition)

Aggregations

RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)8 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)4 Effect (main.ability.effects.Effect)3 Effects (main.ability.effects.Effects)3 RefCondition (main.elements.conditions.RefCondition)3 BuffObj (main.entity.obj.BuffObj)3 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)2 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)2 ActiveAbility (main.ability.ActiveAbility)2 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)2 Condition (main.elements.conditions.Condition)2 Conditions (main.elements.conditions.Conditions)2 OwnershipCondition (main.elements.conditions.standard.OwnershipCondition)2 FixedTargeting (main.elements.targeting.FixedTargeting)2 Ref (main.entity.Ref)2 Obj (main.entity.obj.Obj)2 SpectrumEffect (eidolons.ability.effects.common.SpectrumEffect)1 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)1 SetCustomModeEffect (eidolons.ability.effects.continuous.SetCustomModeEffect)1 WatchActionEffect (eidolons.ability.effects.oneshot.rule.WatchActionEffect)1