Search in sources :

Example 11 with FixedTargeting

use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.

the class ObjectiveMaster method initObjectiveTrigger.

public static void initObjectiveTrigger(OBJECTIVE_TYPE type, String data, Location mission) {
    Dungeon dungeon = mission.getBossLevel();
    objectiveData = data;
    STANDARD_EVENT_TYPE eventType = null;
    Conditions conditions = new Conditions();
    Abilities abilities = new Abilities();
    abilities.add(new ActiveAbility(new FixedTargeting(), new EndGameEffect(true)));
    Ref ref = new Ref();
    Integer id = null;
    String name;
    switch(type) {
        case BOSS:
            eventType = STANDARD_EVENT_TYPE.UNIT_HAS_BEEN_KILLED;
            Coordinates c = DC_ObjInitializer.getCoordinatesFromObjString(objectiveData);
            // new Coordinates(s);
            name = DC_ObjInitializer.getNameFromObjString(objectiveData);
            // conditions.add(new ObjComparison(KEY, KEYS.TARGET.toString()));
            break;
        case CAPTURE_HOLD:
            // "As long as
            break;
        case SURVIVE_TIME:
            break;
        case ESCAPE:
            // eventType = STANDARD_EVENT_TYPE.UNIT_GONE_THRU_ENTRANCE;
            break;
        case ITEM:
            break;
    }
    // some objectives will be initialized on a condition, e.g. capture-hold
    addTrigger(eventType, conditions, abilities);
}
Also used : ActiveAbility(main.ability.ActiveAbility) Ref(main.entity.Ref) Abilities(main.ability.Abilities) FixedTargeting(main.elements.targeting.FixedTargeting) Dungeon(eidolons.game.battlecraft.logic.dungeon.universal.Dungeon) STANDARD_EVENT_TYPE(main.game.logic.event.Event.STANDARD_EVENT_TYPE) EndGameEffect(eidolons.ability.effects.special.meta.EndGameEffect) Coordinates(main.game.bf.Coordinates) Conditions(main.elements.conditions.Conditions)

Example 12 with FixedTargeting

use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.

the class BlockEffect method applyThis.

@Override
public boolean applyThis() {
    // effect interrupt
    String OBJ_REF = null;
    switch(BLOCK_TYPE) {
        case ATTACK:
            event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_ATTACKED;
            conditions.add(new RefCondition(KEYS.EVENT_TARGET, KEYS.SOURCE, false));
            break;
        case HOSTILE_ACTION:
            event_type = Event.STANDARD_EVENT_TYPE.HOSTILE_ACTION;
            conditions.add(new RefCondition(KEYS.EVENT_TARGET, KEYS.SOURCE, false));
            break;
        case DAMAGE:
            event_type = Event.STANDARD_EVENT_TYPE.UNIT_IS_BEING_DEALT_TOUGHNESS_DAMAGE;
            break;
        case DAMAGE_FROM_SOURCE:
            break;
        case DAMAGE_TYPE:
            break;
        case HOSTILE_SPELLS:
            event_type = Event.STANDARD_EVENT_TYPE.SPELL_BEING_RESOLVED;
            conditions.add(new RefCondition(KEYS.EVENT_TARGET, KEYS.TARGET, false));
            OBJ_REF = Ref.KEYS.SPELL.name();
            break;
        case SPELLS_FROM_SOURCE:
            break;
        default:
            break;
    }
    effects = new Effects(new InterruptEffect(OBJ_REF));
    ActiveAbility abilities = new ActiveAbility(new FixedTargeting(KEYS.SOURCE), effects);
    abilities.setRef(ref);
    new AddTriggerEffect(event_type, conditions, abilities).apply(ref);
    return true;
}
Also used : ActiveAbility(main.ability.ActiveAbility) InterruptEffect(main.ability.effects.triggered.InterruptEffect) FixedTargeting(main.elements.targeting.FixedTargeting) RefCondition(main.elements.conditions.RefCondition) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect)

Example 13 with FixedTargeting

use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.

the class DamageInversionEffect method applyThis.

@Override
public boolean applyThis() {
    // endurance damage; modify endurance only? above base?
    Targeting targeting = new FixedTargeting(KEYS.SOURCE);
    Effects effects = new Effects();
    if (restoreEndurance) {
        ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_ENDURANCE, code, formula.toString());
        if (!restoreEnduranceAboveBase) {
            effect.setMaxParam(PARAMS.ENDURANCE);
        }
        effects.add(effect);
    }
    if (restoreToughness) {
        ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_TOUGHNESS, code, formula.toString());
        if (!restoreToughnessAboveBase) {
            effect.setMaxParam(PARAMS.TOUGHNESS);
        }
        effects.add(effect);
    }
    ActiveAbility ability = new ActiveAbility(targeting, effects);
    new AddTriggerEffect(event_type, conditions, ability).apply(ref);
    return true;
}
Also used : ActiveAbility(main.ability.ActiveAbility) FixedTargeting(main.elements.targeting.FixedTargeting) Targeting(main.elements.targeting.Targeting) FixedTargeting(main.elements.targeting.FixedTargeting) ModifyValueEffect(eidolons.ability.effects.common.ModifyValueEffect) Effects(main.ability.effects.Effects) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect)

Example 14 with FixedTargeting

use of main.elements.targeting.FixedTargeting in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getZoneSpellPriority.

@Override
public int getZoneSpellPriority(Action action, boolean damage) {
    int base_priority = 0;
    DC_ActiveObj active = action.getActive();
    Targeting targeting = active.getTargeting();
    if (targeting instanceof FixedTargeting || targeting instanceof SelectiveTargeting) {
        targeting = TargetingMaster.getZoneEffect(active);
    }
    // Set<Obj> objects = targeting.getFilter().getObjects(action.getRef());
    Ref REF = action.getRef().getCopy();
    targeting.select(REF);
    List<Obj> objects = (REF.getGroup() != null) ? REF.getGroup().getObjects() : new ArrayList<>(targeting.getFilter().getObjects(action.getRef()));
    for (Obj obj : objects) {
        // TODO
        if (obj instanceof Unit) {
            if (obj.isNeutral() || obj.isDead()) {
                continue;
            }
            Unit target = (Unit) obj;
            int p = (damage) ? getDamagePriority(active, target, false) : getParamModSpellPriority(action);
            Boolean less_or_more_for_health = null;
            if (p == 200) {
                // ?
                less_or_more_for_health = null;
            }
            p = getUnitPriority(target, less_or_more_for_health) * p / 100;
            boolean ally = target.isOwnedBy(getUnit().getOwner());
            if (ally) {
                if (action.getSource().checkAiMod(AI_MODIFIERS.CRUEL)) {
                    p /= 2;
                }
                if (action.getSource().checkAiMod(AI_MODIFIERS.MERCIFUL)) {
                    p *= 2;
                }
                base_priority -= p;
            } else {
                if (action.getSource().checkAiMod(AI_MODIFIERS.TRUE_BRUTE)) {
                    p *= 2;
                }
                base_priority += p;
                base_priority += base_priority / 6;
            }
        }
    }
    return base_priority;
}
Also used : SelectiveTargeting(main.elements.targeting.SelectiveTargeting) Ref(main.entity.Ref) FixedTargeting(main.elements.targeting.FixedTargeting) Targeting(main.elements.targeting.Targeting) SelectiveTargeting(main.elements.targeting.SelectiveTargeting) FixedTargeting(main.elements.targeting.FixedTargeting) DC_WeaponObj(eidolons.entity.item.DC_WeaponObj) DC_SpellObj(eidolons.entity.active.DC_SpellObj) DC_Obj(eidolons.entity.obj.DC_Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) DC_HeroAttachedObj(eidolons.entity.obj.attach.DC_HeroAttachedObj) Obj(main.entity.obj.Obj) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Unit(eidolons.entity.obj.unit.Unit)

Aggregations

FixedTargeting (main.elements.targeting.FixedTargeting)14 ActiveAbility (main.ability.ActiveAbility)8 Targeting (main.elements.targeting.Targeting)8 Effects (main.ability.effects.Effects)7 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)5 Effect (main.ability.effects.Effect)4 Ref (main.entity.Ref)4 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)3 Obj (main.entity.obj.Obj)3 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)2 RemoveBuffEffect (eidolons.ability.effects.oneshot.buff.RemoveBuffEffect)2 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)2 DC_WeaponObj (eidolons.entity.item.DC_WeaponObj)2 Abilities (main.ability.Abilities)2 InterruptEffect (main.ability.effects.triggered.InterruptEffect)2 Conditions (main.elements.conditions.Conditions)2 RefCondition (main.elements.conditions.RefCondition)2 AutoTargeting (main.elements.targeting.AutoTargeting)2 SelectiveTargeting (main.elements.targeting.SelectiveTargeting)2 Coordinates (main.game.bf.Coordinates)2