Search in sources :

Example 16 with AddBuffEffect

use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.

the class EnchantItemEffect method applyThis.

@Override
public boolean applyThis() {
    // TODO select spell to use!
    // perhaps it is better to invoke spell with a special effect!
    // Ref REF = ref.getCopy();
    // this should be an effect - for other things too like traps
    // add spell filter!!!
    // if (selectSpell)
    // game.getManager().infoSelect(ref.getSourceObj());
    spell = (DC_SpellObj) ref.getTargetObj();
    Effects effects = EffectFinder.getEffectsFromSpell(spell);
    effects.add(new AnimationEffect(spell));
    effects.add(new SoundEffect(SOUNDS.IMPACT, ref.getTargetObj()));
    // TODO why was only that 1st spell in SB filtered in???
    if (!new TemplateSelectiveTargeting((weapon) ? SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON : SELECTIVE_TARGETING_TEMPLATES.MY_ARMOR).select(ref)) {
        return false;
    }
    // new ModifyPropertyEffect(G_PROPS.PASSIVES, MOD_PROP_TYPE.ADD,
    // passive)
    // .apply(ref);
    // 
    KEYS key;
    if (!weapon) {
        key = KEYS.ARMOR;
    } else {
        if (ref.getTargetObj() == ref.getObj(KEYS.WEAPON)) {
            key = KEYS.WEAPON;
        } else {
            key = KEYS.OFFHAND;
        }
    }
    int cost = Enchanter.calculateSpellEnergyCost(spell);
    if (case_type == null) {
        case_type = (weapon) ? SPECIAL_EFFECTS_CASE.ON_ATTACK : SPECIAL_EFFECTS_CASE.ON_HIT;
    }
    // another layer of customTargetEffect if ON SELF or so ! Some may even
    // be Zone-targeted!
    BuffType t = new BuffType(new Ref(ref.getGame(), ref.getSource()));
    t.setImage(ref.getActive().getProperty(G_PROPS.IMAGE, false));
    t.setName(buffName + " " + StringMaster.wrapInParenthesis(spell.getName()));
    t.setParam(G_PARAMS.DURATION, ref.getActive().getIntParam(G_PARAMS.DURATION, false));
    new AddBuffEffect(t, new AddSpecialEffects(case_type, new EnergyCostEffect(cost, key, effects))).apply(ref);
    ModifyValueEffect addEnergyEffect = new ModifyValueEffect(PARAMS.C_ENERGY, MOD.MODIFY_BY_CONST, energy);
    addEnergyEffect.setValueOverMax(true);
    addEnergyEffect.apply(ref);
    return true;
}
Also used : SoundEffect(eidolons.ability.effects.special.media.SoundEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Ref(main.entity.Ref) AddSpecialEffects(eidolons.ability.AddSpecialEffects) KEYS(main.entity.Ref.KEYS) BuffType(main.entity.type.BuffType) EnergyCostEffect(eidolons.ability.effects.containers.EnergyCostEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AnimationEffect(eidolons.ability.effects.special.media.AnimationEffect) Effects(main.ability.effects.Effects) AddSpecialEffects(eidolons.ability.AddSpecialEffects)

Example 17 with AddBuffEffect

use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.

the class RestEffect method getRestedBuffEffect.

private Effect getRestedBuffEffect() {
    Effects effects = new Effects();
    effects.add(new ModifyValueEffect(PARAMS.STAMINA, MOD.MODIFY_BY_PERCENT, "25"));
    effects.add(new ModifyValueEffect(PARAMS.ESSENCE, MOD.MODIFY_BY_PERCENT, "25"));
    effects.add(new ModifyValueEffect(PARAMS.WILLPOWER, MOD.MODIFY_BY_PERCENT, "25"));
    effects.add(new ModifyValueEffect(PARAMS.AGILITY, MOD.MODIFY_BY_PERCENT, "25"));
    effects.add(new ModifyValueEffect(PARAMS.DEXTERITY, MOD.MODIFY_BY_PERCENT, "25"));
    effects.add(new ModifyValueEffect(PARAMS.SPELLPOWER, MOD.MODIFY_BY_PERCENT, "25"));
    effects.add(new ModifyValueEffect(PARAMS.STRENGTH, MOD.MODIFY_BY_PERCENT, "25"));
    return new AddBuffEffect("Rested", effects, new Formula("10"));
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Formula(main.system.math.Formula) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects)

Example 18 with AddBuffEffect

use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.

the class KnockdownRule method knockdown.

public static void knockdown(Unit target) {
    Effects e = new Effects();
    target.getGame().getLogManager().newLogEntryNode(ENTRY_TYPE.KNOCKDOWN, target);
    e.add(new ModifyValueEffect(PARAMS.C_N_OF_ACTIONS, MOD.MODIFY_BY_CONST, "-3"));
    e.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, "-15"));
    (e).apply(Ref.getSelfTargetingRefCopy(target));
    e = new Effects();
    e.add(new ModifyPropertyEffect(G_PROPS.STATUS, MOD_PROP_TYPE.SET, UnitEnums.STATUS.PRONE.toString()));
    // e.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, ));
    e.add(new ModifyValueEffect(PARAMS.DEFENSE_MOD, MOD.MODIFY_BY_CONST, "-50"));
    new AddBuffEffect("Knocked Down", e, 1).apply(Ref.getSelfTargetingRefCopy(target));
    target.getGame().getLogManager().doneLogEntryNode(ENTRY_TYPE.KNOCKDOWN, target);
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect)

Example 19 with AddBuffEffect

use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getSpellCustomHostileEffectPriority.

@Override
public int getSpellCustomHostileEffectPriority(DC_Obj target, DC_ActiveObj action, Effect e) {
    if (e instanceof AddBuffEffect) {
        AddBuffEffect buffEffect = (AddBuffEffect) e;
        // duration
        int mod = 100;
        // getDurationPriorityMod(buffEffect.getDurationFormula().getInt(action.getRef()));
        return getSpellCustomHostileEffectPriority(target, action, buffEffect.getEffect()) * mod / 100;
    }
    if (e instanceof Effects) {
        Effects effects = (Effects) e;
        int p = 0;
        for (Effect eff : effects) {
            p += getSpellCustomHostileEffectPriority(target, action, eff);
        }
        return p;
    }
    if (e instanceof RollEffect) {
        RollEffect rollEffect = (RollEffect) e;
        int mod = getRollPriorityMod(rollEffect);
        return getSpellCustomHostileEffectPriority(target, action, rollEffect.getEffect()) * mod / 100;
    }
    if (e instanceof InstantDeathEffect) {
        return 2 * getUnitPriority(target, true);
    }
    if (e instanceof BehaviorModeEffect) {
        int duration = new Formula(action.getParam(G_PARAMS.DURATION)).getInt(action.getRef());
        BehaviorModeEffect behaviorModeEffect = (BehaviorModeEffect) e;
        switch(behaviorModeEffect.getMode()) {
            case BERSERK:
                return getUnitPriority(target, true) * (Math.min(4, duration / 5 * 3));
            case CONFUSED:
                return getUnitPriority(target, true) * (Math.min(2, duration / 2));
            case PANIC:
                return getUnitPriority(target, true) * (Math.min(3, duration / 3 * 2));
            default:
                break;
        }
    }
    if (e instanceof OwnershipChangeEffect) {
        int duration = new Formula(action.getParam(G_PARAMS.DURATION)).getInt(action.getRef());
        return getUnitPriority(target, true) * (Math.min(5, duration));
    }
    return 0;
}
Also used : BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) Formula(main.system.math.Formula) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) DrainEffect(eidolons.ability.effects.oneshot.mechanic.DrainEffect) AttackEffect(eidolons.ability.effects.oneshot.attack.AttackEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) RaiseEffect(eidolons.ability.effects.oneshot.unit.RaiseEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) SummonEffect(eidolons.ability.effects.oneshot.unit.SummonEffect) Effects(main.ability.effects.Effects)

Example 20 with AddBuffEffect

use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.

the class AI_SpellMaster method getLogicByTargeting.

private static AI_LOGIC getLogicByTargeting(DC_ActiveObj spell) {
    Targeting t = spell.getTargeting();
    TARGETING_MODE mode = spell.getTargetingMode();
    if (mode == null) {
        if (t instanceof TemplateSelectiveTargeting) {
            mode = ((TemplateSelectiveTargeting) t).getTemplate().getMode();
        }
        if (t instanceof TemplateAutoTargeting) {
            mode = ((TemplateAutoTargeting) t).getTemplate().getMode();
        }
    }
    Abilities actives = spell.getAbilities();
    if (mode != null) {
        switch(mode) {
            case ENEMY_WEAPON:
            case ENEMY_ARMOR:
                return AiEnums.AI_LOGIC.BUFF_NEGATIVE;
            case MY_WEAPON:
            case MY_ARMOR:
            case SELF:
                return AiEnums.AI_LOGIC.SELF;
            case ANY_ALLY:
                if (EffectFinder.check(actives, AddBuffEffect.class)) {
                    return AiEnums.AI_LOGIC.BUFF_POSITIVE;
                }
                if (EffectFinder.check(actives, ModifyValueEffect.class)) {
                    return AiEnums.AI_LOGIC.RESTORE;
                }
            case ANY_ENEMY:
                if (EffectFinder.check(actives, DealDamageEffect.class)) {
                    return AiEnums.AI_LOGIC.DAMAGE;
                }
                if (EffectFinder.check(actives, AddBuffEffect.class)) {
                    return AiEnums.AI_LOGIC.BUFF_NEGATIVE;
                }
                if (EffectFinder.check(actives, ModifyValueEffect.class)) {
                    return AiEnums.AI_LOGIC.DEBILITATE;
                }
                if (EffectFinder.check(actives, DrainEffect.class)) {
                    return AiEnums.AI_LOGIC.DEBILITATE;
                }
                break;
            case ANY_UNIT:
                if (EffectFinder.check(actives, AddBuffEffect.class)) {
                    if (((AddBuffEffect) EffectFinder.getEffectsOfClass(actives, AddBuffEffect.class).get(0)).getEffect().getFormula().getInt(spell.getOwnerObj().getRef()) > 0) {
                        return AiEnums.AI_LOGIC.BUFF_POSITIVE;
                    } else {
                        return AiEnums.AI_LOGIC.BUFF_NEGATIVE;
                    }
                }
                List<Effect> effects = EffectFinder.getEffectsOfClass(actives, ModifyValueEffect.class);
                if (effects.isEmpty()) {
                    effects = EffectFinder.getEffectsOfClass(actives, ModifyCounterEffect.class);
                }
                Effect effect = effects.get(0);
                if (effect instanceof ModifyCounterEffect) {
                    ModifyCounterEffect counterEffect = (ModifyCounterEffect) effect;
                    boolean positive = isCounterEffectPositive(spell, counterEffect);
                    if (positive) {
                        return AiEnums.AI_LOGIC.RESTORE;
                    }
                    return AiEnums.AI_LOGIC.DEBILITATE;
                }
                if (effect instanceof ModifyValueEffect) {
                    if (isModifyValueEffectPositive(spell, effect)) {
                        return AiEnums.AI_LOGIC.RESTORE;
                    }
                    return AiEnums.AI_LOGIC.DEBILITATE;
                }
                break;
            case BLAST:
                break;
            case CELL:
                break;
            case RAY:
                break;
            default:
                break;
        }
    }
    return null;
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) TARGETING_MODE(main.content.enums.entity.AbilityEnums.TARGETING_MODE) Abilities(main.ability.Abilities) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) Targeting(main.elements.targeting.Targeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) WaveEffect(eidolons.ability.effects.containers.customtarget.WaveEffect) DrainEffect(eidolons.ability.effects.oneshot.mechanic.DrainEffect) GatewayEffect(eidolons.ability.effects.oneshot.unit.GatewayEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ShapeEffect(eidolons.ability.effects.containers.customtarget.ShapeEffect) RaiseEffect(eidolons.ability.effects.oneshot.unit.RaiseEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) MoveEffect(eidolons.ability.effects.oneshot.move.MoveEffect) SpecialTargetingEffect(main.ability.effects.container.SpecialTargetingEffect) Effect(main.ability.effects.Effect) DealDamageEffect(eidolons.ability.effects.oneshot.DealDamageEffect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) CreateObjectEffect(eidolons.ability.effects.oneshot.unit.CreateObjectEffect) SummonEffect(eidolons.ability.effects.oneshot.unit.SummonEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Aggregations

AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)22 Effects (main.ability.effects.Effects)12 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)9 Effect (main.ability.effects.Effect)9 Ref (main.entity.Ref)6 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)5 Conditions (main.elements.conditions.Conditions)5 Formula (main.system.math.Formula)5 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)4 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)3 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)3 DC_Effect (eidolons.ability.effects.DC_Effect)2 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)2 ZoneEffect (eidolons.ability.effects.containers.customtarget.ZoneEffect)2 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)2 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)2 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)2 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)2 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)2