Search in sources :

Example 1 with TARGETING_MODIFIERS

use of main.content.enums.entity.AbilityEnums.TARGETING_MODIFIERS in project Eidolons by IDemiurge.

the class ActivesConstructor method addTargetingMods.

public static void addTargetingMods(Targeting targeting, DC_ActiveObj obj) {
    Conditions c = new Conditions();
    String property = obj.getProperty(PROPS.TARGETING_MODIFIERS);
    if (obj.getActionGroup() == ActionEnums.ACTION_TYPE_GROUPS.MOVE) {
        // SPELL_TAGS.TELEPORT
        if (!obj.checkProperty(G_PROPS.ACTION_TAGS, ActionEnums.ACTION_TAGS.FLYING.toString())) {
            if (!obj.checkProperty(PROPS.TARGETING_MODIFIERS, AbilityEnums.TARGETING_MODIFIERS.CLEAR_SHOT.toString())) {
                property += AbilityEnums.TARGETING_MODIFIERS.CLEAR_SHOT.toString();
            }
            if (!obj.checkProperty(PROPS.TARGETING_MODIFIERS, AbilityEnums.TARGETING_MODIFIERS.SPACE.toString())) {
                property += AbilityEnums.TARGETING_MODIFIERS.SPACE.toString();
            }
        }
    }
    if (StringMaster.isEmpty(property)) {
        return;
    }
    for (String mod : StringMaster.open(property)) {
        Condition targetingModConditions;
        TARGETING_MODIFIERS MOD = new EnumMaster<TARGETING_MODIFIERS>().retrieveEnumConst(TARGETING_MODIFIERS.class, mod);
        if (MOD == null) {
            targetingModConditions = ConditionMaster.toConditions(mod);
        } else {
            targetingModConditions = DC_ConditionMaster.getTargetingModConditions(MOD);
        }
        if (targetingModConditions != null) {
            if (!c.contains(targetingModConditions)) // if (ConditionMaster.contains(c,
            // targetingModConditions.getClass())) //you sure?
            {
                c.add(targetingModConditions);
            }
        }
    }
    if (targeting instanceof TemplateSelectiveTargeting) {
        TemplateSelectiveTargeting tst = (TemplateSelectiveTargeting) targeting;
        if (tst.getTemplate() == SELECTIVE_TARGETING_TEMPLATES.GRAVE_CELL) {
            // TODO
            if (tst.getConditions() != null) {
                try {
                    ((GraveCondition) tst.getConditions().get(0)).getConditions().add(c);
                } catch (Exception e) {
                    main.system.auxiliary.log.LogMaster.log(1, tst.getConditions().get(0) + " in " + obj);
                    main.system.ExceptionMaster.printStackTrace(e);
                }
            }
        }
    }
    if (!c.isEmpty()) {
        targeting.getFilter().addCondition(c);
    }
    targeting.setModsAdded(true);
}
Also used : Condition(main.elements.conditions.Condition) GraveCondition(eidolons.ability.conditions.special.GraveCondition) TARGETING_MODIFIERS(main.content.enums.entity.AbilityEnums.TARGETING_MODIFIERS) TemplateSelectiveTargeting(eidolons.ability.targeting.TemplateSelectiveTargeting) Conditions(main.elements.conditions.Conditions)

Aggregations

GraveCondition (eidolons.ability.conditions.special.GraveCondition)1 TemplateSelectiveTargeting (eidolons.ability.targeting.TemplateSelectiveTargeting)1 TARGETING_MODIFIERS (main.content.enums.entity.AbilityEnums.TARGETING_MODIFIERS)1 Condition (main.elements.conditions.Condition)1 Conditions (main.elements.conditions.Conditions)1