Search in sources :

Example 1 with TemplateAutoTargeting

use of eidolons.ability.targeting.TemplateAutoTargeting in project Eidolons by IDemiurge.

the class ActivesConstructor method getTargeting.

public static Targeting getTargeting(TARGETING_MODE mode, DC_ActiveObj obj) {
    Targeting targeting = null;
    switch(mode) {
        case BF_OBJ:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.BF_OBJ);
            break;
        case CORPSE:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.GRAVE_CELL);
            break;
        case BOLT_ANY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.SHOT);
            break;
        case BOLT_UNITS:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.SHOT, ConditionMaster.getBFObjTypesCondition());
            break;
        case SELF:
            targeting = getSelfTargeting(obj);
            break;
        case SINGLE:
            targeting = getSingleTargeting(obj);
            break;
        case RAY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.RAY);
            break;
        case CELL:
            // bolt-targeting?
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.CELL);
            break;
        case BLAST:
            // bolt-targeting?
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.BLAST);
            break;
        case DOUBLE:
            targeting = new MultiTargeting(getSingleTargeting(obj), getSingleTargeting(obj));
            ((MultiTargeting) targeting).setIgnoreGroupTargeting(false);
            break;
        case MULTI:
        case TRIPPLE:
            break;
        case ALL_UNITS:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL_UNITS);
            break;
        case ANY_UNIT:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_UNIT);
            break;
        case ANY_ENEMY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ENEMY);
            break;
        case ANY_ALLY:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ALLY);
            break;
        case ALL_ALLIES:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL_ALLIES);
            break;
        case ALL_ENEMIES:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL_ENEMIES);
            break;
        case ALL:
            targeting = new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ALL);
            break;
        case NOVA:
            targeting = new FixedTargeting(KEYS.SOURCE);
            break;
        case WAVE:
            targeting = new FixedTargeting(KEYS.SOURCE);
            break;
        case SPRAY:
            targeting = new FixedTargeting(KEYS.SOURCE);
            break;
        case TRAP:
            break;
        case ANY_ARMOR:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ARMOR);
            break;
        case ANY_ITEM:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_ITEM);
            break;
        case ANY_WEAPON:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ANY_WEAPON);
            break;
        case ENEMY_ARMOR:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ENEMY_ARMOR);
            break;
        case ENEMY_ITEM:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ENEMY_ITEM);
            break;
        case ENEMY_WEAPON:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.ENEMY_WEAPON);
            break;
        case MY_ARMOR:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.MY_ARMOR);
            break;
        case MY_ITEM:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.MY_ITEM);
            break;
        case MY_WEAPON:
            targeting = new TemplateSelectiveTargeting(SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON);
            break;
        default:
            break;
    }
    if (targeting == null) {
        targeting = getSingleTargeting(obj);
    }
    if (targeting != null) {
        if (!targeting.isModsAdded()) {
            addTargetingMods(targeting, obj);
        }
    }
    return targeting;
}
Also used : TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) FixedTargeting(main.elements.targeting.FixedTargeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Targeting(main.elements.targeting.Targeting) MultiTargeting(main.elements.targeting.MultiTargeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) FixedTargeting(main.elements.targeting.FixedTargeting) MultiTargeting(main.elements.targeting.MultiTargeting) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Example 2 with TemplateAutoTargeting

use of eidolons.ability.targeting.TemplateAutoTargeting in project Eidolons by IDemiurge.

the class DC_CounterRule method check.

public boolean check(Unit unit) {
    if (!checkApplies(unit)) {
        return false;
    }
    this.unit = unit;
    if (getNumberOfCounters(unit) <= 0) {
        if (!isAppliedAlways()) {
            // if (checkAlreadyApplied(unit)) TODO that's bullshit!
            // log(getLiftedLogString());
            // removeBuff(unit); // may not be needed now
            removeEffects(unit);
            return false;
        }
    }
    if (ImmunityRule.checkImmune(unit, getCounterName())) {
        return false;
    }
    // if (!checkAlreadyApplied(unit))
    // log(getAppliedLogString());
    Ref ref = unit.getRef().getCopy();
    ref.setTarget(unit.getId());
    initEffects();
    addBuff(unit);
    if (getSpread() != null) {
        new CustomTargetEffect(new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ADJACENT), new ModifyCounterEffect(getCounterName(), MOD.MODIFY_BY_CONST, getSpread())).apply(Ref.getSelfTargetingRefCopy(unit));
    }
    // it only once!
    return true;
// effects.apply(ref);
}
Also used : Ref(main.entity.Ref) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect) TemplateAutoTargeting(eidolons.ability.targeting.TemplateAutoTargeting)

Example 3 with TemplateAutoTargeting

use of eidolons.ability.targeting.TemplateAutoTargeting 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

TemplateAutoTargeting (eidolons.ability.targeting.TemplateAutoTargeting)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)2 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)2 Targeting (main.elements.targeting.Targeting)2 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)1 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)1 ShapeEffect (eidolons.ability.effects.containers.customtarget.ShapeEffect)1 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)1 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)1 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)1 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)1 MoveEffect (eidolons.ability.effects.oneshot.move.MoveEffect)1 CreateObjectEffect (eidolons.ability.effects.oneshot.unit.CreateObjectEffect)1 GatewayEffect (eidolons.ability.effects.oneshot.unit.GatewayEffect)1 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)1 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)1 Abilities (main.ability.Abilities)1 Effect (main.ability.effects.Effect)1 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)1 SpecialTargetingEffect (main.ability.effects.container.SpecialTargetingEffect)1