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!
}
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;
}
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;
}
}
}
}
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;
}
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?
}
Aggregations