mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +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();
|
final Card c = this.ability.getSourceCard();
|
||||||
|
|
||||||
// split cards transform back to full form if targeting is canceled
|
// split cards transform back to full form if targeting is canceled
|
||||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
if (c.getRules() != null) {
|
||||||
c.setState(CardCharacteristicName.Original);
|
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||||
|
c.setState(CardCharacteristicName.Original);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
||||||
@@ -213,8 +215,10 @@ public class SpellAbilityRequirements {
|
|||||||
final Card c = this.ability.getSourceCard();
|
final Card c = this.ability.getSourceCard();
|
||||||
|
|
||||||
// split cards transform back to full form if mana cost is not paid
|
// split cards transform back to full form if mana cost is not paid
|
||||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
if (c.getRules() != null) {
|
||||||
c.setState(CardCharacteristicName.Original);
|
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||||
|
c.setState(CardCharacteristicName.Original);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
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) {
|
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 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())) {
|
if (c.getRules() != null) {
|
||||||
c.setState(CardCharacteristicName.Original);
|
if ((c.getRules().getSplitType() == CardSplitType.Split) && (zoneTo != game.getStackZone())) {
|
||||||
|
c.setState(CardCharacteristicName.Original);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return moveTo(zoneTo, c, null);
|
return moveTo(zoneTo, c, null);
|
||||||
|
|||||||
@@ -368,17 +368,20 @@ public class GameActionPlay {
|
|||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
// Split card support
|
// Split card support
|
||||||
if (source.getRules().getSplitType() == CardSplitType.Split) {
|
if (source.getRules() != null) {
|
||||||
if (sa.hasParam("SplitSide")) {
|
if (source.getRules().getSplitType() == CardSplitType.Split) {
|
||||||
if (sa.getParam("SplitSide").equals("LeftSplit")) {
|
List<SpellAbility> leftSplitAbilities = source.getState(CardCharacteristicName.LeftSplit).getSpellAbility();
|
||||||
source.setState(CardCharacteristicName.LeftSplit);
|
List<SpellAbility> rightSplitAbilities = source.getState(CardCharacteristicName.RightSplit).getSpellAbility();
|
||||||
} else if (sa.getParam("SplitSide").equals("RightSplit")) {
|
for (SpellAbility a : leftSplitAbilities) {
|
||||||
source.setState(CardCharacteristicName.RightSplit);
|
if (sa == a) {
|
||||||
} else {
|
source.setState(CardCharacteristicName.LeftSplit);
|
||||||
System.out.println(String.format("ERROR: Split card %s does not define the split face abilities properly.", source.getName()));
|
}
|
||||||
|
}
|
||||||
|
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