Search in sources :

Example 11 with Effect

use of main.ability.effects.Effect in project Eidolons by IDemiurge.

the class UpkeepRule method enactUpkeepFail.

public void enactUpkeepFail(UPKEEP_FAIL_ACTION ufa, Ref ref) {
    Obj targetObj = ref.getTargetObj();
    if (targetObj instanceof BuffObj) {
        BuffObj buffObj = (BuffObj) targetObj;
        ref.setTarget(buffObj.getBasis().getId());
        new RemoveBuffEffect(targetObj.getName()).apply(ref);
        ref.getGame().getLogManager().log(targetObj.getName() + " " + BUFF_DISPELLED_STRING);
        return;
    }
    ref.getGame().getLogManager().log(targetObj.getName() + " " + ufa.getLogString());
    // TODO enemy string should be different!
    Effect e = getFailEffects(ufa);
    e.apply(ref);
}
Also used : RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) BuffObj(main.entity.obj.BuffObj) Obj(main.entity.obj.Obj) PassiveAbilityObj(main.ability.PassiveAbilityObj) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) BehaviorModeEffect(eidolons.ability.effects.continuous.BehaviorModeEffect) Effect(main.ability.effects.Effect) OwnershipChangeEffect(main.ability.effects.common.OwnershipChangeEffect) RemoveBuffEffect(eidolons.ability.effects.oneshot.buff.RemoveBuffEffect) ImmobilizeEffect(eidolons.ability.effects.oneshot.status.ImmobilizeEffect) InstantDeathEffect(main.ability.effects.oneshot.InstantDeathEffect) BuffObj(main.entity.obj.BuffObj)

Example 12 with Effect

use of main.ability.effects.Effect in project Eidolons by IDemiurge.

the class DC_CounterRule method applyEffects.

protected void applyEffects(Unit unit) {
    Effect effects = getWrappedEffects(unit);
    effects.apply(Ref.getSelfTargetingRefCopy(unit));
    if (effects instanceof AddBuffEffect) {
        ((AddBuffEffect) effects).getBuff().setCounterRef(getCounterName());
    }
// TODO animation?
// startContinuousAnimation();
// playAddAnimation();
// playIntensifyAnimation();
// playTickAnimation();
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) ContinuousEffect(main.ability.effects.continuous.ContinuousEffect) Effect(main.ability.effects.Effect) AddStatusEffect(main.ability.effects.common.AddStatusEffect) ModifyCounterEffect(eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect) CustomTargetEffect(main.ability.effects.continuous.CustomTargetEffect)

Example 13 with Effect

use of main.ability.effects.Effect in project Eidolons by IDemiurge.

the class PathChoiceMaster method getChoices.

List<Choice> getChoices(ActionPath path, Coordinates c_coordinate, Coordinates targetCoordinate, FACING_DIRECTION c_facing) {
    Chronos.mark("Finding choices for " + path);
    pathBuilder.adjustUnit();
    List<Choice> choices = new ArrayList<>();
    for (Coordinates c : getDefaultCoordinateTargets(path, c_coordinate)) {
        Choice stdMoveChoice = constructStdMoveChoice(c, c_coordinate, c_facing);
        if (stdMoveChoice != null) {
            choices.add(stdMoveChoice);
        }
    }
    Chronos.mark("Finding custom choices for " + path);
    List<Choice> specialChoices = new ArrayList<>();
    if (ListMaster.isNotEmpty(moveActions)) {
        for (DC_ActiveObj a : moveActions) {
            if (!a.canBeActivated()) {
                if (firstStep) {
                    if (!ReasonMaster.checkReasonCannotActivate(a, PARAMS.C_N_OF_ACTIONS.getName())) {
                        // exception for AP TODO
                        continue;
                    }
                }
            }
            if (path.hasAction(a)) {
                if (a.getIntParam(PARAMS.COOLDOWN) >= 0) {
                    continue;
                }
            }
            Targeting targeting = a.getTargeting();
            Collection<Obj> objects = null;
            if (targeting instanceof FixedTargeting) {
                Targeting t = a.getAbilities().getTargeting();
                if (t != null) {
                    objects = t.getFilter().getObjects(a.getRef());
                }
                Effect e = a.getAbilities().getEffects().getEffects().get(0);
                e.setRef(unit.getRef());
                if (e instanceof SelfMoveEffect) {
                    try {
                        Coordinates coordinates = ((SelfMoveEffect) e).getCoordinates();
                        if (coordinates != null) {
                            objects = new ArrayList<>(Arrays.asList(unit.getGame().getCellByCoordinate(coordinates)));
                        }
                    } catch (Exception ex) {
                        main.system.ExceptionMaster.printStackTrace(ex);
                    }
                }
            } else {
                pathBuilder.adjustUnit();
                objects = targeting.getFilter().getObjects(a.getRef());
            }
            if (objects != null) {
                List<Choice> choicesForAction = new ArrayList<>();
                for (Object obj : objects) {
                    if (obj instanceof DC_Cell) {
                        Coordinates coordinates = ((DC_Cell) obj).getCoordinates();
                        // if (a.getName().equals("Clumsy Leap"))
                        if (PositionMaster.getDistance(coordinates, c_coordinate) > Math.max(1, a.getIntParam(PARAMS.RANGE))) {
                            continue;
                        }
                        if (PositionMaster.getDistance(coordinates, targetCoordinate) > PositionMaster.getDistance(c_coordinate, targetCoordinate)) {
                            // TODO will this not eliminate good
                            continue;
                        }
                        // choices?
                        Ref ref = unit.getRef().getCopy();
                        ref.setTarget(((DC_Cell) obj).getId());
                        Choice choice = new Choice(coordinates, c_coordinate, new Action(a, ref));
                        choicesForAction.add(choice);
                    }
                }
                Chronos.mark("Filter custom choices for " + a);
                specialChoices.addAll(filterSpecialMoveChoices(choicesForAction, a, c_coordinate, path));
                Chronos.logTimeElapsedForMark("Filter custom choices for " + a);
            }
        // if (choices.size() > 1)
        }
    }
    Chronos.logTimeElapsedForMark("Finding custom choices for " + path);
    choices.addAll(specialChoices);
    Chronos.mark("Sort choices");
    sortChoices(choices);
    Chronos.logTimeElapsedForMark("Sort choices");
    // resetUnit();// TODO is that right?
    Chronos.logTimeElapsedForMark("Finding choices for " + path);
    // Chronos.logTimeElapsedForMark("Sorting choices for " + path);
    return choices;
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) DC_UnitAction(eidolons.entity.active.DC_UnitAction) FixedTargeting(main.elements.targeting.FixedTargeting) Targeting(main.elements.targeting.Targeting) Coordinates(main.game.bf.Coordinates) Ref(main.entity.Ref) FixedTargeting(main.elements.targeting.FixedTargeting) DC_Cell(eidolons.entity.obj.DC_Cell) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) Obj(main.entity.obj.Obj) SelfMoveEffect(eidolons.ability.effects.oneshot.move.SelfMoveEffect) SelfMoveEffect(eidolons.ability.effects.oneshot.move.SelfMoveEffect) Effect(main.ability.effects.Effect) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj)

Example 14 with Effect

use of main.ability.effects.Effect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getSelfSpellPriority.

@Override
public int getSelfSpellPriority(Action action) {
    Effects effects = null;
    if (action instanceof AiQuickItemAction)
        effects = EffectFinder.getEffectsFromSpell(((DC_QuickItemAction) action.getActive()).getItem().getActives().get(0));
    else
        effects = EffectFinder.getEffectsFromSpell(action.getActive());
    if (effects.getEffects().isEmpty())
        return 0;
    setBasePriority(getUnitPriority(getUnit(), false));
    for (Effect e : effects) {
        addEffectPriority(action, e);
    }
    return priority;
}
Also used : AiQuickItemAction(eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction) 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 15 with Effect

use of main.ability.effects.Effect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method initRollMap.

private void initRollMap(DC_ActiveObj spell, List<Effect> effects) {
    rollMap = new ConcurrentMap<>();
    List<RollEffect> rollEffects = EffectFinder.getRollEffects(spell);
    for (RollEffect roll : rollEffects) {
        for (Effect e : effects) {
            Effect effect = roll.getEffect();
            if (effect instanceof Effects) {
                Effects rolledEffects = (Effects) effect;
                for (Effect e1 : rolledEffects.getEffects()) {
                    rollMap.put(e1, roll);
                }
                break;
            }
            if (effect == e) {
                rollMap.put(e, roll);
                break;
            }
        }
    }
}
Also used : RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) 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)

Aggregations

Effect (main.ability.effects.Effect)55 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)31 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)18 Effects (main.ability.effects.Effects)17 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)16 RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)16 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)15 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)14 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)13 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)13 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)13 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)12 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)12 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)12 ArrayList (java.util.ArrayList)10 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)8 DC_Effect (eidolons.ability.effects.DC_Effect)7 Ref (main.entity.Ref)7 DC_ActiveObj (eidolons.entity.active.DC_ActiveObj)6 SpecialTargetingEffect (main.ability.effects.container.SpecialTargetingEffect)6