mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
inverted the value of variabel for HumanPlaySpellAbility
moved split cards state restoration to the depths of changeZone, removed excessive action from HumanPlaySpellAbility
This commit is contained in:
@@ -50,7 +50,7 @@ public class HumanPlaySpellAbility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final void fillRequirements(boolean isAlreadyTargeted, boolean isFree, boolean skipStack) {
|
public final void playAbility(boolean mayChoseTargets, boolean isFree, boolean skipStack) {
|
||||||
final Game game = ability.getActivatingPlayer().getGame();
|
final Game game = ability.getActivatingPlayer().getGame();
|
||||||
|
|
||||||
// used to rollback
|
// used to rollback
|
||||||
@@ -71,7 +71,7 @@ public class HumanPlaySpellAbility {
|
|||||||
// is only executed or evaluated if the first argument does not suffice to determine the value of the expression
|
// is only executed or evaluated if the first argument does not suffice to determine the value of the expression
|
||||||
boolean prerequisitesMet = this.announceValuesLikeX()
|
boolean prerequisitesMet = this.announceValuesLikeX()
|
||||||
&& this.announceType()
|
&& this.announceType()
|
||||||
&& ( isAlreadyTargeted || setupTargets() )
|
&& ( !mayChoseTargets || setupTargets() ) // if you can choose targets, then do choose them.
|
||||||
&& ( isFree || this.payment.payCost(game) );
|
&& ( isFree || this.payment.payCost(game) );
|
||||||
|
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public class HumanPlaySpellAbility {
|
|||||||
|
|
||||||
// no worries here. The same thread must resolve, and by this moment ability will have been resolved already
|
// no worries here. The same thread must resolve, and by this moment ability will have been resolved already
|
||||||
// Triggers haven't resolved yet ??
|
// Triggers haven't resolved yet ??
|
||||||
if (!isAlreadyTargeted) {
|
if (mayChoseTargets) {
|
||||||
clearTargets(ability);
|
clearTargets(ability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,11 +131,6 @@ public class HumanPlaySpellAbility {
|
|||||||
final Game game = ability.getActivatingPlayer().getGame();
|
final Game game = ability.getActivatingPlayer().getGame();
|
||||||
final Card c = ability.getSourceCard();
|
final Card c = ability.getSourceCard();
|
||||||
|
|
||||||
// split cards transform back to full form if targeting is canceled
|
|
||||||
if (c.isSplitCard()) {
|
|
||||||
c.setState(CardCharacteristicName.Original);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fromZone != null) { // and not a copy
|
if (fromZone != null) { // and not a copy
|
||||||
// add back to where it came from
|
// add back to where it came from
|
||||||
game.getAction().moveTo(fromZone, c, zonePosition >= 0 ? Integer.valueOf(zonePosition) : null);
|
game.getAction().moveTo(fromZone, c, zonePosition >= 0 ? Integer.valueOf(zonePosition) : null);
|
||||||
|
|||||||
@@ -152,6 +152,11 @@ public class GameAction {
|
|||||||
lastKnownInfo = c;
|
lastKnownInfo = c;
|
||||||
copied = c;
|
copied = c;
|
||||||
} else {
|
} else {
|
||||||
|
if (c.isSplitCard() && !zoneTo.is(ZoneType.Stack)) {
|
||||||
|
c.setState(CardCharacteristicName.Original);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
lastKnownInfo = CardUtil.getLKICopy(c);
|
lastKnownInfo = CardUtil.getLKICopy(c);
|
||||||
|
|
||||||
if (c.isCloned()) {
|
if (c.isCloned()) {
|
||||||
|
|||||||
@@ -118,15 +118,11 @@ public class HumanPlay {
|
|||||||
|
|
||||||
// System.out.println("Playing:" + sa.getDescription() + " of " + sa.getSourceCard() + " new = " + newAbility);
|
// System.out.println("Playing:" + sa.getDescription() + " of " + sa.getSourceCard() + " new = " + newAbility);
|
||||||
if (newAbility) {
|
if (newAbility) {
|
||||||
CostPayment payment = null;
|
Cost abCost = sa.getPayCosts() == null ? new Cost("0", sa.isAbility()) : sa.getPayCosts();
|
||||||
if (sa.getPayCosts() == null) {
|
CostPayment payment = new CostPayment(abCost, sa);
|
||||||
payment = new CostPayment(new Cost("0", sa.isAbility()), sa);
|
|
||||||
} else {
|
|
||||||
payment = new CostPayment(sa.getPayCosts(), sa);
|
|
||||||
}
|
|
||||||
|
|
||||||
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, payment);
|
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, payment);
|
||||||
req.fillRequirements(false, false, false);
|
req.playAbility(true, false, false);
|
||||||
} else {
|
} else {
|
||||||
if (payManaCostIfNeeded(p, sa)) {
|
if (payManaCostIfNeeded(p, sa)) {
|
||||||
if (sa.isSpell() && !source.isCopiedSpell()) {
|
if (sa.isSpell() && !source.isCopiedSpell()) {
|
||||||
@@ -210,7 +206,7 @@ public class HumanPlay {
|
|||||||
final CostPayment payment = new CostPayment(sa.getPayCosts(), sa);
|
final CostPayment payment = new CostPayment(sa.getPayCosts(), sa);
|
||||||
|
|
||||||
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, payment);
|
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, payment);
|
||||||
req.fillRequirements(!mayChooseNewTargets, true, false);
|
req.playAbility(mayChooseNewTargets, true, false);
|
||||||
} else {
|
} else {
|
||||||
if (sa.isSpell()) {
|
if (sa.isSpell()) {
|
||||||
final Card c = sa.getSourceCard();
|
final Card c = sa.getSourceCard();
|
||||||
@@ -242,7 +238,7 @@ public class HumanPlay {
|
|||||||
if (sa.getPayCosts() != null) {
|
if (sa.getPayCosts() != null) {
|
||||||
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, new CostPayment(sa.getPayCosts(), sa));
|
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, new CostPayment(sa.getPayCosts(), sa));
|
||||||
|
|
||||||
req.fillRequirements(useOldTargets, false, true);
|
req.playAbility(!useOldTargets, false, true);
|
||||||
} else {
|
} else {
|
||||||
if (payManaCostIfNeeded(player, sa)) {
|
if (payManaCostIfNeeded(player, sa)) {
|
||||||
AbilityUtils.resolve(sa);
|
AbilityUtils.resolve(sa);
|
||||||
|
|||||||
Reference in New Issue
Block a user