mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Fixed splicing spells with subAbilities.
This commit is contained in:
@@ -1334,25 +1334,36 @@ public final class GameActionUtil {
|
|||||||
}
|
}
|
||||||
String newSubSAString = c.getCharacteristics().getIntrinsicAbility().get(0);
|
String newSubSAString = c.getCharacteristics().getIntrinsicAbility().get(0);
|
||||||
newSubSAString = newSubSAString.replace("SP", "DB");
|
newSubSAString = newSubSAString.replace("SP", "DB");
|
||||||
final AbilitySub newSubSA = (AbilitySub) AbilityFactory.getAbility(newSubSAString, source);
|
final AbilitySub newSubSA = (AbilitySub) AbilityFactory.getAbility(newSubSAString, c);
|
||||||
ArrayList<SpellAbility> addSAs = new ArrayList<SpellAbility>();
|
ArrayList<SpellAbility> addSAs = new ArrayList<SpellAbility>();
|
||||||
// Add the subability to all existing variants
|
// Add the subability to all existing variants
|
||||||
for (SpellAbility s : allSAs) {
|
for (SpellAbility s : allSAs) {
|
||||||
|
//create a new spell copy
|
||||||
final SpellAbility newSA = s.copy();
|
final SpellAbility newSA = s.copy();
|
||||||
newSA.setBasicSpell(false);
|
newSA.setBasicSpell(false);
|
||||||
newSA.setPayCosts(combineCosts(newSA, keyword.substring(19)));
|
newSA.setPayCosts(combineCosts(newSA, keyword.substring(19)));
|
||||||
newSA.setManaCost(ManaCost.NO_COST);
|
newSA.setManaCost(ManaCost.NO_COST);
|
||||||
newSA.setDescription(s.getDescription() + " (Splicing " + c + " onto it)");
|
newSA.setDescription(s.getDescription() + " (Splicing " + c + " onto it)");
|
||||||
newSA.addSplicedCards(c);
|
newSA.addSplicedCards(c);
|
||||||
|
|
||||||
|
// copy all subAbilities
|
||||||
SpellAbility child = newSA;
|
SpellAbility child = newSA;
|
||||||
while (child.getSubAbility() != null) {
|
while (child.getSubAbility() != null) {
|
||||||
AbilitySub newChild = child.getSubAbility().getCopy();
|
AbilitySub newChild = child.getSubAbility().getCopy();
|
||||||
child.setSubAbility(newChild);
|
child.setSubAbility(newChild);
|
||||||
newChild.setParent(child);
|
|
||||||
child = newChild;
|
child = newChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add the spliced ability to the end of the chain
|
||||||
child.setSubAbility(newSubSA);
|
child.setSubAbility(newSubSA);
|
||||||
newSubSA.setParent(child);
|
|
||||||
|
//set correct source and activating player to all the spliced abilities
|
||||||
|
child = newSubSA;
|
||||||
|
while (child != null) {
|
||||||
|
child.setSourceCard(source);
|
||||||
|
child.setActivatingPlayer(s.getActivatingPlayer());
|
||||||
|
child = child.getSubAbility();
|
||||||
|
}
|
||||||
newSAs.add(0, newSA);
|
newSAs.add(0, newSA);
|
||||||
addSAs.add(newSA);
|
addSAs.add(newSA);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user