use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.
the class PriorityManagerImpl method getCounterModSpellPriority.
@Override
public int getCounterModSpellPriority(Action action) {
// preCheck immunity? find counter rule by name and preCheck....
List<Effect> effects = EffectFinder.getEffectsOfClass(action.getActive().getAbilities(), ModifyCounterEffect.class);
initRollMap(action.getActive(), effects);
for (Effect e : effects) {
if (e instanceof ModifyCounterEffect) {
ModifyCounterEffect modifyCounterEffect = (ModifyCounterEffect) e;
float mod = DC_CounterMaster.getCounterPriority(modifyCounterEffect.getCounterName(), action.getTarget());
if (rollMap.get(e) != null) {
mod = mod * 100 / getRollPriorityMod(rollMap.get(e));
}
int amount = modifyCounterEffect.getFormula().getInt(action.getRef());
setBasePriority(getUnitPriority(action.getTarget(), true));
addMultiplier(Math.round(mod * amount), modifyCounterEffect.getCounterName() + StringMaster.wrapInParenthesis(amount + ""));
}
}
applyResistPenalty(action);
return priority;
}
use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.
the class AI_SpellMaster method getZoneLogic.
private static AI_LOGIC getZoneLogic(DC_ActiveObj spell) {
List<Effect> zoneEffects = EffectFinder.getEffectsOfClass(spell, SpecialTargetingEffect.class);
if (!zoneEffects.isEmpty()) {
for (Effect effect : zoneEffects) {
SpecialTargetingEffect zoneEffect = (SpecialTargetingEffect) effect;
if (EffectFinder.check(zoneEffect.getEffect(), DealDamageEffect.class)) {
if (zoneEffect instanceof WaveEffect) {
return AiEnums.AI_LOGIC.AUTO_DAMAGE;
}
if (zoneEffect instanceof ShapeEffect) {
return AiEnums.AI_LOGIC.AUTO_DAMAGE;
}
if (spell.getTargetingMode() == AbilityEnums.TARGETING_MODE.NOVA) {
return AiEnums.AI_LOGIC.AUTO_DAMAGE;
}
if (spell.getTargetingMode() == AbilityEnums.TARGETING_MODE.SPRAY) {
return AiEnums.AI_LOGIC.AUTO_DAMAGE;
}
if (spell.getTargetingMode() == AbilityEnums.TARGETING_MODE.WAVE) {
return AiEnums.AI_LOGIC.AUTO_DAMAGE;
}
return AiEnums.AI_LOGIC.DAMAGE_ZONE;
}
if (EffectFinder.check(zoneEffect.getEffect(), ModifyValueEffect.class)) {
if (isModifyValueEffectPositive(spell, zoneEffect)) {
return AiEnums.AI_LOGIC.RESTORE_ZONE;
} else {
return AiEnums.AI_LOGIC.DEBILITATE_ZONE;
}
}
if (EffectFinder.check(zoneEffect.getEffect(), ModifyCounterEffect.class)) {
Effect e = EffectFinder.getEffectsOfClass(zoneEffect.getEffect(), ModifyCounterEffect.class).get(0);
ModifyCounterEffect counterEffect = (ModifyCounterEffect) e;
if (isCounterEffectPositive(spell, counterEffect)) {
return AiEnums.AI_LOGIC.RESTORE_ZONE;
} else {
return AiEnums.AI_LOGIC.DEBILITATE_ZONE;
}
}
}
}
return null;
}
use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.
the class DC_CounterRule method check.
public boolean check(Unit unit) {
if (!checkApplies(unit)) {
return false;
}
this.unit = unit;
if (getNumberOfCounters(unit) <= 0) {
if (!isAppliedAlways()) {
// if (checkAlreadyApplied(unit)) TODO that's bullshit!
// log(getLiftedLogString());
// removeBuff(unit); // may not be needed now
removeEffects(unit);
return false;
}
}
if (ImmunityRule.checkImmune(unit, getCounterName())) {
return false;
}
// if (!checkAlreadyApplied(unit))
// log(getAppliedLogString());
Ref ref = unit.getRef().getCopy();
ref.setTarget(unit.getId());
initEffects();
addBuff(unit);
if (getSpread() != null) {
new CustomTargetEffect(new TemplateAutoTargeting(AUTO_TARGETING_TEMPLATES.ADJACENT), new ModifyCounterEffect(getCounterName(), MOD.MODIFY_BY_CONST, getSpread())).apply(Ref.getSelfTargetingRefCopy(unit));
}
// it only once!
return true;
// effects.apply(ref);
}
use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.
the class ModifyValueEffect method applyThis.
@Override
public boolean applyThis() {
if (modString != null) {
return EffectFinder.initParamModEffects(modString, ref).apply(ref);
}
if (param == null) {
this.param = ContentManager.getPARAM(sparam);
if (param == null) {
if (param == null) {
this.param = ContentManager.getMastery(sparam);
}
}
if (param == null) {
if (StringMaster.openContainer(sparam, StringMaster.AND_SEPARATOR).size() > 1) {
params = game.getValueManager().getParamsFromContainer(sparam);
} else {
params = game.getValueManager().getValueGroupParams(sparam);
}
}
}
Obj obj = ref.getTargetObj();
if (obj instanceof DC_Obj) {
((DC_Obj) obj).modified(this);
}
if (ref.getTargetObj() == null) {
LogMaster.log(1, "null target!" + this);
return false;
}
Map<PARAMETER, String> map = new HashMap<>();
if (param == null) {
if (params == null) {
// TODO
return new ModifyCounterEffect(sparam, mod_type, formula.toString()).apply(ref);
}
for (PARAMETER p : params) {
if (p == null) {
continue;
}
param = p;
modify(obj, map);
}
param = null;
return true;
}
// TODO how to determined when formula should be statically parsed?
// what if some part of the formula depends on the target instead?
boolean result = modify(obj, map);
if (result) {
if (!isAnimationDisabled()) {
if (map != null) {
if (!map.isEmpty()) {
if (getAnimation() != null) {
if (!isContinuousWrapped()) {
getAnimation().addPhaseArgs(PHASE_TYPE.PARAM_MODS, map);
// getAnimation().start(); // TODO sync?
} else {
wrapInBuffPhase(map);
}
}
}
}
}
}
return result;
}
use of eidolons.ability.effects.oneshot.mechanic.ModifyCounterEffect in project Eidolons by IDemiurge.
the class PriorityManagerImpl method getCoatingPriority.
@Override
public int getCoatingPriority(DC_ActiveObj active, DC_Obj targetObj) {
List<Effect> effects = EffectFinder.getEffectsOfClass(active, ModifyCounterEffect.class);
if (effects.isEmpty()) {
return priority;
}
ModifyCounterEffect e = (ModifyCounterEffect) effects.get(0);
setBasePriority(getUnitPriority(getUnit(), true));
addConstant(getItemPriority(targetObj), targetObj.getName());
Integer amount = e.getFormula().getInt(active.getRef());
int mod = amount;
mod *= DC_CounterMaster.getCounterPriority(e.getCounterName(), targetObj);
addMultiplier(mod, e.getCounterName() + " coating " + StringMaster.wrapInParenthesis(amount + ""));
if (targetObj.getCounter(e.getCounterName()) > 0) {
addMultiplier(-75 * targetObj.getCounter(e.getCounterName()) / amount, e.getCounterName() + " - Already Coated " + StringMaster.wrapInParenthesis(targetObj.getCounter(e.getCounterName()) + ""));
}
// TODO if (quick) if (ammo) if (alreadyCoated)
return priority;
}
Aggregations