use of main.ability.effects.Effect 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 main.ability.effects.Effect in project Eidolons by IDemiurge.
the class FutureBuilder method precalculateDamage.
public static int precalculateDamage(DC_ActiveObj active, Obj targetObj, boolean attack, Boolean min_max_normal) {
// TODO basically, I have to use a copy of the gamestate...! To make it
// precise...
Map<String, Integer> cache = getCache(min_max_normal);
Integer damage = cache.get(getCacheKey(active, targetObj));
if (damage != null)
return damage;
damage = 0;
if (!active.isConstructed()) {
active.construct();
}
List<Effect> effects;
effects = EffectFinder.getEffectsOfClass(EffectFinder.getEffectsFromSpell(active), attack ? AttackEffect.class : DealDamageEffect.class);
// TODO special effects?!
for (Effect e : effects) {
damage += getDamage(active, targetObj, e, min_max_normal);
}
cache.put(active.getNameAndId() + targetObj.getNameAndId(), damage);
return damage;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class DealDamageEffectTest method dealDamageEffectTest.
@Test
public void dealDamageEffectTest() {
assertTrue(source != null);
assertTrue(target != null);
int origToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
int origEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
Effect eff = new DealDamageEffect(new Formula("50"), GenericEnums.DAMAGE_TYPE.BLUDGEONING.getName(), DAMAGE_MODIFIER.UNBLOCKABLE);
Ref ref = new Ref(source);
ref.setTarget(target.getId());
ref.setID(KEYS.ACTIVE, source.getAction("Attack").getId());
eff.apply(ref);
Integer newToughness = target.getIntParam(PARAMS.C_TOUGHNESS);
Integer newEndurance = target.getIntParam(PARAMS.C_ENDURANCE);
assertTrue(newToughness < origToughness);
assertTrue(newEndurance < origEndurance);
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class AbilityConstructor method constructAbility.
private static Ability constructAbility(Node node) {
Effect effects = null;
Targeting targeting = null;
for (Node NODE : XML_Converter.getNodeList(node)) {
if (NODE.getNodeName().equals(EFFECTS) || NODE.getNodeName().contains(EFFECTS)) {
effects = constructEffects(NODE);
}
if (NODE.getNodeName().equals(TARGETING) || NODE.getNodeName().contains(TARGETING)) {
targeting = constructTargeting(NODE);
}
}
if (effects == null) {
LogMaster.log(1, "null abil effects!");
effects = new Effects();
}
if (targeting == null) {
LogMaster.log(1, "null abil targeting!");
targeting = new FixedTargeting();
}
Ability abil = null;
if (node.getNodeName().equals(ACTIVE_ABILITY)) {
abil = new ActiveAbility(targeting, effects);
} else if (node.getNodeName().equals(ONESHOT_ABILITY)) {
abil = new OneshotAbility(targeting, effects);
} else if (node.getNodeName().equals(PASSIVE_ABILITY)) {
abil = new PassiveAbility(targeting, effects);
}
abil.setXml(XML_Converter.getStringFromXML(node));
return abil;
}
use of main.ability.effects.Effect in project Eidolons by IDemiurge.
the class GameManager method attachmentRemoved.
public void attachmentRemoved(Attachment attachment, Obj basis) {
for (Effect e : attachment.getEffects()) {
e.remove();
getState().removeEffect(e);
// TODO when addTrigger effect is removed, so is the trigger
}
}
Aggregations