Search in sources :

Example 6 with Abilities

use of main.ability.Abilities in project Eidolons by IDemiurge.

the class AI_SpellMaster method getModValueLogic.

private static AI_LOGIC getModValueLogic(DC_ActiveObj spell) {
    Abilities actives = spell.getAbilities();
    List<Effect> effects = EffectFinder.getEffectsOfClass(actives, ModifyValueEffect.class);
    if (effects.isEmpty()) {
        effects = EffectFinder.getEffectsOfClass(actives, ModifyCounterEffect.class);
    }
    if (!effects.isEmpty()) {
        Effect effect = effects.get(0);
        if (effect instanceof ModifyCounterEffect) {
            ModifyCounterEffect counterEffect = (ModifyCounterEffect) effect;
            if (isCounterEffectPositive(spell, counterEffect)) {
                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;
        }
    }
    return null;
}
Also used : Abilities(main.ability.Abilities) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) 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)

Example 7 with Abilities

use of main.ability.Abilities 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)

Example 8 with Abilities

use of main.ability.Abilities in project Eidolons by IDemiurge.

the class EffectFinder method getEffectsFromAbilityType.

public static List<Effect> getEffectsFromAbilityType(AbilityType type) {
    if (type.getAbilities() == null) {
        type.construct();
    }
    Abilities abils = type.getAbilities();
    List<Effect> list = new ArrayList<>();
    for (Effect e : abils.getEffects()) {
        list.add(e);
    }
    return list;
}
Also used : Abilities(main.ability.Abilities) ArrayList(java.util.ArrayList) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) ContainerEffect(main.ability.effects.ContainerEffect) AttackEffect(eidolons.ability.effects.oneshot.attack.AttackEffect) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) ModifyPropertyEffect(eidolons.ability.effects.common.ModifyPropertyEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect)

Aggregations

Abilities (main.ability.Abilities)8 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)4 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)3 ActiveAbility (main.ability.ActiveAbility)3 Effect (main.ability.effects.Effect)3 ShapeEffect (eidolons.ability.effects.containers.customtarget.ShapeEffect)2 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)2 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)2 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)2 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)2 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)2 MoveEffect (eidolons.ability.effects.oneshot.move.MoveEffect)2 CreateObjectEffect (eidolons.ability.effects.oneshot.unit.CreateObjectEffect)2 GatewayEffect (eidolons.ability.effects.oneshot.unit.GatewayEffect)2 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)2 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)2 Effects (main.ability.effects.Effects)2 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)2 SpecialTargetingEffect (main.ability.effects.container.SpecialTargetingEffect)2 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)2