Added SpliceOntoArcane Ability. It's working but it will need some handling improvements.

This commit is contained in:
LevelX2 2013-06-26 17:34:14 +02:00
parent 2aa984d4d6
commit 725ee6e042
8 changed files with 470 additions and 15 deletions

View file

@ -118,9 +118,21 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
public boolean activate(Game game, boolean noMana) {
if (!spellAbilities.get(0).activate(game, noMana)) {
return false;
}
// if there are more abilities (fused split spell) or first ability added new abilities (splice), activate the additional abilities
boolean ignoreAbility = true;
boolean payNoMana = noMana;
for (SpellAbility spellAbility: spellAbilities) {
if (!spellAbility.activate(game, noMana)) {
return false;
// costs for spliced abilities were added to main spellAbility, so pay no man for spliced abilities
payNoMana |= spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE);
if (ignoreAbility) {
ignoreAbility = false;
} else {
if (!spellAbility.activate(game, payNoMana)) {
return false;
}
}
}
return true;
@ -142,7 +154,9 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
spellAbility.getModes().setMode(spellAbility.getModes().get(modeId));
if (spellAbility.getTargets().stillLegal(spellAbility, game)) {
legalParts = true;
updateOptionalCosts(index);
if (!spellAbility.getSpellAbilityType().equals(SpellAbilityType.SPLICE)) {
updateOptionalCosts(index);
}
result |= spellAbility.resolve(game);
}
}
@ -351,6 +365,10 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
return card.getOwnerId();
}
public void addSpellAbility(SpellAbility spellAbility) {
spellAbilities.add(spellAbility);
}
@Override
public void addAbility(Ability ability) {}