mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
HumanPlay.playSpellAbility now returns boolean if the spell was cast successful. (and returns false on rollback)
This commit is contained in:
@@ -81,12 +81,12 @@ public class HumanPlay {
|
||||
* @param sa
|
||||
* a {@link forge.game.spellability.SpellAbility} object.
|
||||
*/
|
||||
public final static void playSpellAbility(final PlayerControllerHuman controller, final Player p, SpellAbility sa) {
|
||||
public final static boolean playSpellAbility(final PlayerControllerHuman controller, final Player p, SpellAbility sa) {
|
||||
FThreads.assertExecutedByEdt(false);
|
||||
|
||||
if (sa == controller.getGame().PLAY_LAND_SURROGATE) {
|
||||
p.playLand(sa.getHostCard(), false);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean castFaceDown = sa instanceof Spell && ((Spell)sa).isCastFaceDown();
|
||||
@@ -98,7 +98,7 @@ public class HumanPlay {
|
||||
source.setSplitStateToPlayAbility(sa);
|
||||
sa = chooseOptionalAdditionalCosts(p, sa);
|
||||
if (sa == null) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flippedToCast && !castFaceDown) {
|
||||
@@ -133,6 +133,7 @@ public class HumanPlay {
|
||||
if (flippedToCast && !castFaceDown) {
|
||||
source.turnFaceDown(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else if (payManaCostIfNeeded(controller, p, sa)) {
|
||||
if (sa.isSpell() && !source.isCopiedSpell()) {
|
||||
@@ -145,7 +146,9 @@ public class HumanPlay {
|
||||
if (flippedToCast && !castFaceDown) {
|
||||
source.turnFaceDown(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1268,8 +1268,7 @@ public class PlayerControllerHuman
|
||||
|
||||
@Override
|
||||
public boolean playSaFromPlayEffect(final SpellAbility tgtSA) {
|
||||
HumanPlay.playSpellAbility(this, player, tgtSA);
|
||||
return true;
|
||||
return HumanPlay.playSpellAbility(this, player, tgtSA);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user