use of main.ability.effects.Effects 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 main.ability.effects.Effects in project Eidolons by IDemiurge.
the class DamageInversionEffect method applyThis.
@Override
public boolean applyThis() {
// endurance damage; modify endurance only? above base?
Targeting targeting = new FixedTargeting(KEYS.SOURCE);
Effects effects = new Effects();
if (restoreEndurance) {
ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_ENDURANCE, code, formula.toString());
if (!restoreEnduranceAboveBase) {
effect.setMaxParam(PARAMS.ENDURANCE);
}
effects.add(effect);
}
if (restoreToughness) {
ModifyValueEffect effect = new ModifyValueEffect(PARAMS.C_TOUGHNESS, code, formula.toString());
if (!restoreToughnessAboveBase) {
effect.setMaxParam(PARAMS.TOUGHNESS);
}
effects.add(effect);
}
ActiveAbility ability = new ActiveAbility(targeting, effects);
new AddTriggerEffect(event_type, conditions, ability).apply(ref);
return true;
}
use of main.ability.effects.Effects 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 main.ability.effects.Effects in project Eidolons by IDemiurge.
the class DualAttackMaster method createDual.
private static DC_UnitAction createDual(DC_UnitAction main, DC_UnitAction offhand) {
Costs costs = getDualCosts(main, offhand);
// cooldown!
ActiveAbility activateAttacks = new ActiveAbility(main.getTargeting(), new Effects(new ActivateEffect(main.getName(), true), new ActivateEffect(offhand.getName(), true)));
Ability setCooldown = new ActiveAbility(new AutoTargeting(new PropCondition(G_PROPS.ACTION_TAGS, "Dual", false)), new ModifyValueEffect(PARAMS.C_COOLDOWN, MOD.SET, getCooldown(main.getOwnerObj())));
Abilities abilities = new Abilities();
abilities.add(activateAttacks);
abilities.add(setCooldown);
ObjType newType = new ObjType("Dual: " + main.getName() + " and " + offhand.getName(), DataManager.getType("Dual Attack", DC_TYPE.ACTIONS));
for (Cost cost : costs.getCosts()) {
PARAMETER p = cost.getCostParam();
if (p == null)
continue;
newType.setParam(p, cost.getPayment().getAmountFormula().toString());
}
DC_UnitAction dual = new DC_UnitAction(newType, main.getOwner(), main.getGame(), new Ref(main.getOwnerObj()));
dual.setAbilities(abilities);
dual.setCosts(costs);
dual.setTargeting(main.getTargeting());
dual.getTargeter().setTargetingInitialized(true);
dual.setConstructed(true);
return dual;
}
use of main.ability.effects.Effects 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);
}
Aggregations