Search in sources :

Example 1 with RollEffect

use of eidolons.ability.effects.oneshot.mechanic.RollEffect in project Eidolons by IDemiurge.

the class SleepEffect method applyThis.

@Override
public boolean applyThis() {
    // makes another throw each time when hit?
    // statically parsed Spellpower/Mastery?
    // add roll on hit - dmg vs max toughness
    RollEffect rollEffect = new RollEffect(GenericEnums.ROLL_TYPES.MIND_AFFECTING, new RemoveBuffEffect(getBuffName()));
    Conditions conditions = new Conditions(new RefCondition(KEYS.EVENT_TARGET, KEYS.TARGET));
    return new AddBuffEffect(getBuffName(), new Effects(new AddStatusEffect(UnitEnums.STATUS.ASLEEP), new AddTriggerEffect(STANDARD_EVENT_TYPE.UNIT_IS_DEALT_TOUGHNESS_DAMAGE, conditions, KEYS.EVENT_TARGET, rollEffect))).apply(ref);
// roll ref needs to be tested!
}
Also used : AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) RefCondition(main.elements.conditions.RefCondition) Effects(main.ability.effects.Effects) AddStatusEffect(main.ability.effects.common.AddStatusEffect) Conditions(main.elements.conditions.Conditions) AddTriggerEffect(eidolons.ability.effects.attachment.AddTriggerEffect)

Example 2 with RollEffect

use of eidolons.ability.effects.oneshot.mechanic.RollEffect in project Eidolons by IDemiurge.

the class PriorityManagerImpl method getPriorityForActionSequence.

@Override
public int getPriorityForActionSequence(ActionSequence as) {
    priority = 0;
    modifier = 0;
    // compare damage or default priority on non-damage actions (formula?)
    // 
    setUnit(as.getAi().getUnit());
    GOAL_TYPE goal = as.getType();
    initLogChannel(goal);
    Action action = as.getLastAction();
    try {
        action.getActive().getGame().getEffectManager().setEffectRefs(action.getActive().getAbilities(), action.getRef());
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
    }
    if (!action.getActive().getProperty(PROPS.AI_PRIORITY_FORMULA).isEmpty()) {
        setBasePriority(evaluatePriorityFormula(action, action.getActive().getProperty(PROPS.AI_PRIORITY_FORMULA)));
        if (EffectFinder.check(action.getActive(), RollEffect.class)) {
            try {
                applyRollPriorityMod((RollEffect) EffectFinder.getEffectsOfClass(action.getActive(), RollEffect.class).get(0));
            } catch (Exception e) {
                main.system.ExceptionMaster.printStackTrace(e);
            }
        }
        applyResistPenalty(action);
    } else {
        switch(goal) {
            case PROTECT:
                setBasePriority(getGuardPriority(action));
                break;
            case ATTACK:
                setBasePriority(getAttackPriority(as));
                break;
            case WAIT:
                setBasePriority(getWaitPriority(action));
                break;
            case DEFEND:
            case PREPARE:
                setBasePriority(getModePriority(action));
                break;
            case SUMMONING:
                setBasePriority(getSummonPriority(action));
                break;
            case AUTO_DAMAGE:
            case ZONE_DAMAGE:
            case AUTO_DEBUFF:
            case AUTO_BUFF:
            case SELF:
            case BUFF:
            case DEBUFF:
            case RESTORE:
            case DEBILITATE:
            case CUSTOM_HOSTILE:
            case CUSTOM_SUPPORT:
                setBasePriority(getSpellPriority(goal, action));
                break;
            case STEALTH:
                setBasePriority(getStealthPriority(action));
                break;
            case SEARCH:
                // TODO sight range/detection factors,
                setBasePriority(getSearchPriority(as));
                break;
            case COWER:
                setBasePriority(getCowerPriority(getUnit()));
                break;
            case RETREAT:
                setBasePriority(getRetreatPriority(as));
                break;
            case COATING:
                setBasePriority(getCoatingPriority(action.getActive(), action.getTarget()));
                break;
            case AGGRO:
            case AMBUSH:
            case APPROACH:
            case STAND_GUARD:
            case MOVE:
            case OTHER:
            case PATROL:
            case STALK:
            case WANDER:
                priority = 100;
                break;
            case ZONE_SPECIAL:
            default:
                setBasePriority(getSpellPriority(goal, action));
                break;
        }
    }
    if (priority <= 0) {
        if (goal == GOAL_TYPE.ATTACK)
            LogMaster.log(1, "ATK FAILED" + priority + " priority for " + as);
        else
            LogMaster.log(1, priority + " priority for " + as);
        return priority;
    }
    // Integer bonus = unit_ai.getActionPriorityBonuses().get(action.getActive().getName());
    // if (bonus != null) {
    // priority += bonus;
    // }
    as.setPriority(priority);
    Integer mod = as.getPriorityMultiplier();
    mod += (int) (modifier);
    if (mod != null) {
        priority = MathMaster.applyMod(priority, mod);
    }
    LogMaster.log(1, "AI: " + priority + " priority for " + as);
    return priority;
}
Also used : Action(eidolons.game.battlecraft.ai.elements.actions.Action) AiQuickItemAction(eidolons.game.battlecraft.ai.elements.actions.AiQuickItemAction) DC_UnitAction(eidolons.entity.active.DC_UnitAction) DC_QuickItemAction(eidolons.entity.active.DC_QuickItemAction) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) GOAL_TYPE(main.content.enums.system.AiEnums.GOAL_TYPE)

Example 3 with RollEffect

use of eidolons.ability.effects.oneshot.mechanic.RollEffect 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)

Example 4 with RollEffect

use of eidolons.ability.effects.oneshot.mechanic.RollEffect in project Eidolons by IDemiurge.

the class EffectFinder method getRollEffects.

public static List<RollEffect> getRollEffects(DC_ActiveObj active) {
    List<RollEffect> list = new ArrayList<>();
    for (Effect e : getEffectsOfClass(active, RollEffect.class)) {
        // construct!
        ((RollEffect) e).getEffect();
        list.add(((RollEffect) e));
    }
    return list;
}
Also used : RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) 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)

Example 5 with RollEffect

use of eidolons.ability.effects.oneshot.mechanic.RollEffect in project Eidolons by IDemiurge.

the class ActivesConstructor method constructActive.

public static void constructActive(TARGETING_MODE mode, DC_ActiveObj entity) {
    if (mode == AbilityEnums.TARGETING_MODE.MULTI) {
        addMultiTargetingMods(entity);
        return;
    }
    if (entity.checkBool(GenericEnums.STD_BOOLS.MULTI_TARGETING)) {
        // constructMultiAbilities(entity);
        return;
    }
    if (entity.getActives() == null) {
        return;
    }
    List<ActiveObj> list = new ArrayList<>(entity.getActives());
    Effects effects = new Effects();
    for (Active active : list) {
        for (Ability abil : ((AbilityObj) active).getAbilities().getAbils()) {
            for (Effect effect : abil.getEffects().getEffects()) {
                // anything?
                if (effect instanceof DC_Effect) {
                    DC_Effect effect2 = (DC_Effect) effect;
                    effect2.setAnimationActive(entity);
                }
                effects.add(effect);
            }
        }
    }
    // TODO what if the effects should have different targetings like in
    // damage+light?
    String saveRoll = entity.getProperty(PROPS.ROLL_TYPES_TO_SAVE);
    if (!StringMaster.isEmpty(saveRoll)) {
        wrapInSaveRollEffect(effects, saveRoll);
    }
    String wrap = entity.getProperty(PROPS.EFFECTS_WRAP);
    Effect wrappedEffect;
    if (StringMaster.isEmpty(wrap)) {
        wrappedEffect = wrapEffects(mode, effects, entity);
    } else {
        EFFECTS_WRAP WRAP = new EnumMaster<EFFECTS_WRAP>().retrieveEnumConst(EFFECTS_WRAP.class, wrap);
        wrappedEffect = wrapEffects(WRAP, effects, entity);
    }
    Targeting targeting = getTargeting(mode, entity);
    if (targeting == null) {
        try {
            targeting = entity.getActives().get(0).getActives().get(0).getTargeting();
        } catch (Exception e) {
        // targeting = getDefaultSingleTargeting(entity);TODO necessary?
        }
    }
    if (targeting != null)
        entity.setTargeting(targeting);
    Abilities abilities = new Abilities();
    abilities.add(new ActiveAbility(null, wrappedEffect));
    entity.setAbilities(abilities);
// TODO wrapping in RollEffect - each single effect or the resulting
// wrapped Effects?
}
Also used : 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) DC_Effect(eidolons.ability.effects.DC_Effect) ArrayList(java.util.ArrayList) Effects(main.ability.effects.Effects) Active(main.entity.obj.Active) DC_ActiveObj(eidolons.entity.active.DC_ActiveObj) ActiveObj(main.entity.obj.ActiveObj) EFFECTS_WRAP(main.content.enums.entity.AbilityEnums.EFFECTS_WRAP) DC_Effect(eidolons.ability.effects.DC_Effect) AddBuffEffect(eidolons.ability.effects.attachment.AddBuffEffect) RollEffect(eidolons.ability.effects.oneshot.mechanic.RollEffect) Effect(main.ability.effects.Effect) RayEffect(eidolons.ability.effects.containers.customtarget.RayEffect) WaveEffect(eidolons.ability.effects.containers.customtarget.WaveEffect) ZoneEffect(eidolons.ability.effects.containers.customtarget.ZoneEffect)

Aggregations

RollEffect (eidolons.ability.effects.oneshot.mechanic.RollEffect)8 AddBuffEffect (eidolons.ability.effects.attachment.AddBuffEffect)6 Effect (main.ability.effects.Effect)5 ModifyValueEffect (eidolons.ability.effects.common.ModifyValueEffect)4 AttackEffect (eidolons.ability.effects.oneshot.attack.AttackEffect)4 Effects (main.ability.effects.Effects)4 BehaviorModeEffect (eidolons.ability.effects.continuous.BehaviorModeEffect)3 DealDamageEffect (eidolons.ability.effects.oneshot.DealDamageEffect)3 DrainEffect (eidolons.ability.effects.oneshot.mechanic.DrainEffect)3 ModifyCounterEffect (eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect)3 RaiseEffect (eidolons.ability.effects.oneshot.unit.RaiseEffect)3 SummonEffect (eidolons.ability.effects.oneshot.unit.SummonEffect)3 OwnershipChangeEffect (main.ability.effects.common.OwnershipChangeEffect)3 InstantDeathEffect (main.ability.effects.oneshot.InstantDeathEffect)3 ArrayList (java.util.ArrayList)2 DC_Effect (eidolons.ability.effects.DC_Effect)1 AddTriggerEffect (eidolons.ability.effects.attachment.AddTriggerEffect)1 ModifyPropertyEffect (eidolons.ability.effects.common.ModifyPropertyEffect)1 RayEffect (eidolons.ability.effects.containers.customtarget.RayEffect)1 WaveEffect (eidolons.ability.effects.containers.customtarget.WaveEffect)1