mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Removed the necessity to use a special parameter for spell abilities of split cards.
- Fixed a NPE related to back-transformation of split cards.
This commit is contained in:
@@ -153,8 +153,10 @@ public class SpellAbilityRequirements {
|
||||
final Card c = this.ability.getSourceCard();
|
||||
|
||||
// split cards transform back to full form if targeting is canceled
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
if (c.getRules() != null) {
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
||||
@@ -213,8 +215,10 @@ public class SpellAbilityRequirements {
|
||||
final Card c = this.ability.getSourceCard();
|
||||
|
||||
// split cards transform back to full form if mana cost is not paid
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
if (c.getRules() != null) {
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
||||
|
||||
@@ -341,8 +341,10 @@ public class GameAction {
|
||||
*/
|
||||
public final Card moveTo(final Zone zoneTo, Card c) {
|
||||
// if a split card is moved, convert it back to its full form before moving (unless moving to stack)
|
||||
if ((c.getRules().getSplitType() == CardSplitType.Split) && (zoneTo != game.getStackZone())) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
if (c.getRules() != null) {
|
||||
if ((c.getRules().getSplitType() == CardSplitType.Split) && (zoneTo != game.getStackZone())) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
}
|
||||
|
||||
return moveTo(zoneTo, c, null);
|
||||
|
||||
@@ -368,17 +368,20 @@ public class GameActionPlay {
|
||||
final Card source = sa.getSourceCard();
|
||||
|
||||
// Split card support
|
||||
if (source.getRules().getSplitType() == CardSplitType.Split) {
|
||||
if (sa.hasParam("SplitSide")) {
|
||||
if (sa.getParam("SplitSide").equals("LeftSplit")) {
|
||||
source.setState(CardCharacteristicName.LeftSplit);
|
||||
} else if (sa.getParam("SplitSide").equals("RightSplit")) {
|
||||
source.setState(CardCharacteristicName.RightSplit);
|
||||
} else {
|
||||
System.out.println(String.format("ERROR: Split card %s does not define the split face abilities properly.", source.getName()));
|
||||
if (source.getRules() != null) {
|
||||
if (source.getRules().getSplitType() == CardSplitType.Split) {
|
||||
List<SpellAbility> leftSplitAbilities = source.getState(CardCharacteristicName.LeftSplit).getSpellAbility();
|
||||
List<SpellAbility> rightSplitAbilities = source.getState(CardCharacteristicName.RightSplit).getSpellAbility();
|
||||
for (SpellAbility a : leftSplitAbilities) {
|
||||
if (sa == a) {
|
||||
source.setState(CardCharacteristicName.LeftSplit);
|
||||
}
|
||||
}
|
||||
for (SpellAbility a : rightSplitAbilities) {
|
||||
if (sa == a) {
|
||||
source.setState(CardCharacteristicName.RightSplit);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println(String.format("ERROR: Split card %s does not define the split face abilities properly.", source.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user