use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class EnchantItemEffect method applyThis.
@Override
public boolean applyThis() {
// TODO select spell to use!
// perhaps it is better to invoke spell with a special effect!
// Ref REF = ref.getCopy();
// this should be an effect - for other things too like traps
// add spell filter!!!
// if (selectSpell)
// game.getManager().infoSelect(ref.getSourceObj());
spell = (DC_SpellObj) ref.getTargetObj();
Effects effects = EffectFinder.getEffectsFromSpell(spell);
effects.add(new AnimationEffect(spell));
effects.add(new SoundEffect(SOUNDS.IMPACT, ref.getTargetObj()));
// TODO why was only that 1st spell in SB filtered in???
if (!new TemplateSelectiveTargeting((weapon) ? SELECTIVE_TARGETING_TEMPLATES.MY_WEAPON : SELECTIVE_TARGETING_TEMPLATES.MY_ARMOR).select(ref)) {
return false;
}
// new ModifyPropertyEffect(G_PROPS.PASSIVES, MOD_PROP_TYPE.ADD,
// passive)
// .apply(ref);
//
KEYS key;
if (!weapon) {
key = KEYS.ARMOR;
} else {
if (ref.getTargetObj() == ref.getObj(KEYS.WEAPON)) {
key = KEYS.WEAPON;
} else {
key = KEYS.OFFHAND;
}
}
int cost = Enchanter.calculateSpellEnergyCost(spell);
if (case_type == null) {
case_type = (weapon) ? SPECIAL_EFFECTS_CASE.ON_ATTACK : SPECIAL_EFFECTS_CASE.ON_HIT;
}
// another layer of customTargetEffect if ON SELF or so ! Some may even
// be Zone-targeted!
BuffType t = new BuffType(new Ref(ref.getGame(), ref.getSource()));
t.setImage(ref.getActive().getProperty(G_PROPS.IMAGE, false));
t.setName(buffName + " " + StringMaster.wrapInParenthesis(spell.getName()));
t.setParam(G_PARAMS.DURATION, ref.getActive().getIntParam(G_PARAMS.DURATION, false));
new AddBuffEffect(t, new AddSpecialEffects(case_type, new EnergyCostEffect(cost, key, effects))).apply(ref);
ModifyValueEffect addEnergyEffect = new ModifyValueEffect(PARAMS.C_ENERGY, MOD.MODIFY_BY_CONST, energy);
addEnergyEffect.setValueOverMax(true);
addEnergyEffect.apply(ref);
return true;
}
use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class RestEffect method getRestedBuffEffect.
private Effect getRestedBuffEffect() {
Effects effects = new Effects();
effects.add(new ModifyValueEffect(PARAMS.STAMINA, MOD.MODIFY_BY_PERCENT, "25"));
effects.add(new ModifyValueEffect(PARAMS.ESSENCE, MOD.MODIFY_BY_PERCENT, "25"));
effects.add(new ModifyValueEffect(PARAMS.WILLPOWER, MOD.MODIFY_BY_PERCENT, "25"));
effects.add(new ModifyValueEffect(PARAMS.AGILITY, MOD.MODIFY_BY_PERCENT, "25"));
effects.add(new ModifyValueEffect(PARAMS.DEXTERITY, MOD.MODIFY_BY_PERCENT, "25"));
effects.add(new ModifyValueEffect(PARAMS.SPELLPOWER, MOD.MODIFY_BY_PERCENT, "25"));
effects.add(new ModifyValueEffect(PARAMS.STRENGTH, MOD.MODIFY_BY_PERCENT, "25"));
return new AddBuffEffect("Rested", effects, new Formula("10"));
}
use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class KnockdownRule method knockdown.
public static void knockdown(Unit target) {
Effects e = new Effects();
target.getGame().getLogManager().newLogEntryNode(ENTRY_TYPE.KNOCKDOWN, target);
e.add(new ModifyValueEffect(PARAMS.C_N_OF_ACTIONS, MOD.MODIFY_BY_CONST, "-3"));
e.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, "-15"));
(e).apply(Ref.getSelfTargetingRefCopy(target));
e = new Effects();
e.add(new ModifyPropertyEffect(G_PROPS.STATUS, MOD_PROP_TYPE.SET, UnitEnums.STATUS.PRONE.toString()));
// e.add(new ModifyValueEffect(PARAMS.C_FOCUS, MOD.MODIFY_BY_CONST, ));
e.add(new ModifyValueEffect(PARAMS.DEFENSE_MOD, MOD.MODIFY_BY_CONST, "-50"));
new AddBuffEffect("Knocked Down", e, 1).apply(Ref.getSelfTargetingRefCopy(target));
target.getGame().getLogManager().doneLogEntryNode(ENTRY_TYPE.KNOCKDOWN, target);
}
use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class PriorityManagerImpl method getSpellCustomHostileEffectPriority.
@Override
public int getSpellCustomHostileEffectPriority(DC_Obj target, DC_ActiveObj action, Effect e) {
if (e instanceof AddBuffEffect) {
AddBuffEffect buffEffect = (AddBuffEffect) e;
// duration
int mod = 100;
// getDurationPriorityMod(buffEffect.getDurationFormula().getInt(action.getRef()));
return getSpellCustomHostileEffectPriority(target, action, buffEffect.getEffect()) * mod / 100;
}
if (e instanceof Effects) {
Effects effects = (Effects) e;
int p = 0;
for (Effect eff : effects) {
p += getSpellCustomHostileEffectPriority(target, action, eff);
}
return p;
}
if (e instanceof RollEffect) {
RollEffect rollEffect = (RollEffect) e;
int mod = getRollPriorityMod(rollEffect);
return getSpellCustomHostileEffectPriority(target, action, rollEffect.getEffect()) * mod / 100;
}
if (e instanceof InstantDeathEffect) {
return 2 * getUnitPriority(target, true);
}
if (e instanceof BehaviorModeEffect) {
int duration = new Formula(action.getParam(G_PARAMS.DURATION)).getInt(action.getRef());
BehaviorModeEffect behaviorModeEffect = (BehaviorModeEffect) e;
switch(behaviorModeEffect.getMode()) {
case BERSERK:
return getUnitPriority(target, true) * (Math.min(4, duration / 5 * 3));
case CONFUSED:
return getUnitPriority(target, true) * (Math.min(2, duration / 2));
case PANIC:
return getUnitPriority(target, true) * (Math.min(3, duration / 3 * 2));
default:
break;
}
}
if (e instanceof OwnershipChangeEffect) {
int duration = new Formula(action.getParam(G_PARAMS.DURATION)).getInt(action.getRef());
return getUnitPriority(target, true) * (Math.min(5, duration));
}
return 0;
}
use of eidolons.ability.effects.attachment.AddBuffEffect in project Eidolons by IDemiurge.
the class AI_SpellMaster method getLogicByTargeting.
private static AI_LOGIC getLogicByTargeting(DC_ActiveObj spell) {
Targeting t = spell.getTargeting();
TARGETING_MODE mode = spell.getTargetingMode();
if (mode == null) {
if (t instanceof TemplateSelectiveTargeting) {
mode = ((TemplateSelectiveTargeting) t).getTemplate().getMode();
}
if (t instanceof TemplateAutoTargeting) {
mode = ((TemplateAutoTargeting) t).getTemplate().getMode();
}
}
Abilities actives = spell.getAbilities();
if (mode != null) {
switch(mode) {
case ENEMY_WEAPON:
case ENEMY_ARMOR:
return AiEnums.AI_LOGIC.BUFF_NEGATIVE;
case MY_WEAPON:
case MY_ARMOR:
case SELF:
return AiEnums.AI_LOGIC.SELF;
case ANY_ALLY:
if (EffectFinder.check(actives, AddBuffEffect.class)) {
return AiEnums.AI_LOGIC.BUFF_POSITIVE;
}
if (EffectFinder.check(actives, ModifyValueEffect.class)) {
return AiEnums.AI_LOGIC.RESTORE;
}
case ANY_ENEMY:
if (EffectFinder.check(actives, DealDamageEffect.class)) {
return AiEnums.AI_LOGIC.DAMAGE;
}
if (EffectFinder.check(actives, AddBuffEffect.class)) {
return AiEnums.AI_LOGIC.BUFF_NEGATIVE;
}
if (EffectFinder.check(actives, ModifyValueEffect.class)) {
return AiEnums.AI_LOGIC.DEBILITATE;
}
if (EffectFinder.check(actives, DrainEffect.class)) {
return AiEnums.AI_LOGIC.DEBILITATE;
}
break;
case ANY_UNIT:
if (EffectFinder.check(actives, AddBuffEffect.class)) {
if (((AddBuffEffect) EffectFinder.getEffectsOfClass(actives, AddBuffEffect.class).get(0)).getEffect().getFormula().getInt(spell.getOwnerObj().getRef()) > 0) {
return AiEnums.AI_LOGIC.BUFF_POSITIVE;
} else {
return AiEnums.AI_LOGIC.BUFF_NEGATIVE;
}
}
List<Effect> effects = EffectFinder.getEffectsOfClass(actives, ModifyValueEffect.class);
if (effects.isEmpty()) {
effects = EffectFinder.getEffectsOfClass(actives, ModifyCounterEffect.class);
}
Effect effect = effects.get(0);
if (effect instanceof ModifyCounterEffect) {
ModifyCounterEffect counterEffect = (ModifyCounterEffect) effect;
boolean positive = isCounterEffectPositive(spell, counterEffect);
if (positive) {
return AiEnums.AI_LOGIC.RESTORE;
}
return AiEnums.AI_LOGIC.DEBILITATE;
}
if (effect instanceof ModifyValueEffect) {
if (isModifyValueEffectPositive(spell, effect)) {
return AiEnums.AI_LOGIC.RESTORE;
}
return AiEnums.AI_LOGIC.DEBILITATE;
}
break;
case BLAST:
break;
case CELL:
break;
case RAY:
break;
default:
break;
}
}
return null;
}
Aggregations