Add confirm when discarding hand as payment

This commit is contained in:
tool4EvEr
2021-09-13 20:40:59 +02:00
parent 71eae2f1a8
commit 664a3471c9
7 changed files with 24 additions and 47 deletions

View File

@@ -9,16 +9,6 @@ import forge.game.spellability.SpellAbility;
public class LifeExchangeEffect extends SpellAbilityEffect { public class LifeExchangeEffect extends SpellAbilityEffect {
// *************************************************************************
// ************************ EXCHANGE LIFE **********************************
// *************************************************************************
// *************************************************************************
// ************************* LOSE LIFE *************************************
// *************************************************************************
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility) * @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility)
*/ */
@@ -28,7 +18,6 @@ public class LifeExchangeEffect extends SpellAbilityEffect {
final Player activatingPlayer = sa.getActivatingPlayer(); final Player activatingPlayer = sa.getActivatingPlayer();
final List<Player> tgtPlayers = getTargetPlayers(sa); final List<Player> tgtPlayers = getTargetPlayers(sa);
if (tgtPlayers.size() == 1) { if (tgtPlayers.size() == 1) {
sb.append(activatingPlayer).append(" exchanges life totals with "); sb.append(activatingPlayer).append(" exchanges life totals with ");
sb.append(tgtPlayers.get(0)); sb.append(tgtPlayers.get(0));
@@ -78,7 +67,6 @@ public class LifeExchangeEffect extends SpellAbilityEffect {
} else { } else {
// they are equal, so nothing to do // they are equal, so nothing to do
} }
} }
} }

View File

@@ -12,16 +12,6 @@ import forge.game.zone.ZoneType;
public class LifeExchangeVariantEffect extends SpellAbilityEffect { public class LifeExchangeVariantEffect extends SpellAbilityEffect {
// *************************************************************************
// ************************ EXCHANGE LIFE **********************************
// *************************************************************************
// *************************************************************************
// ************************* LOSE LIFE *************************************
// *************************************************************************
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility) * @see forge.card.abilityfactory.AbilityFactoryAlterLife.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility)
*/ */
@@ -88,7 +78,7 @@ public class LifeExchangeVariantEffect extends SpellAbilityEffect {
source.addNewPT(power, toughness, timestamp); source.addNewPT(power, toughness, timestamp);
game.fireEvent(new GameEventCardStatsChanged(source)); game.fireEvent(new GameEventCardStatsChanged(source));
} else { } else {
// do nothing if they are equal // do nothing if they are equal
} }
} }

View File

@@ -4,9 +4,7 @@ Types:Creature Human Warrior
PT:1/1 PT:1/1
K:Intimidate K:Intimidate
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigDiscard | CombatDamage$ True | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may discard a card. If you do, draw a card. T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigDiscard | CombatDamage$ True | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may discard a card. If you do, draw a card.
SVar:TrigDiscard:DB$ Discard | Defined$ You | NumCards$ 1 | Mode$ TgtChoose | RememberDiscarded$ True | SubAbility$ DBDraw SVar:TrigDiscard:AB$ Draw | NumCards$ 1 | Cost$ Discard<1/Card>
SVar:DBDraw:DB$ Draw | NumCards$ 1 | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ GE1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
AI:RemoveDeck:Random AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/academy_raider.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/academy_raider.jpg
Oracle:Intimidate (This creature can't be blocked except by artifact creatures and/or creatures that share a color with it.)\nWhenever Academy Raider deals combat damage to a player, you may discard a card. If you do, draw a card. Oracle:Intimidate (This creature can't be blocked except by artifact creatures and/or creatures that share a color with it.)\nWhenever Academy Raider deals combat damage to a player, you may discard a card. If you do, draw a card.

View File

@@ -2,5 +2,5 @@ Name:Assassin's Trophy
ManaCost:B G ManaCost:B G
Types:Instant Types:Instant
A:SP$ Destroy | Cost$ B G | ValidTgts$ Permanent.OppCtrl | AITgts$ Permanent.nonLand,Land.nonBasic | TgtPrompt$ Select target permanent an opponent controls | SubAbility$ DBChange | SpellDescription$ Destroy target permanent an opponent controls. Its controller may search their library for a basic land card, put it onto the battlefield, then shuffle. A:SP$ Destroy | Cost$ B G | ValidTgts$ Permanent.OppCtrl | AITgts$ Permanent.nonLand,Land.nonBasic | TgtPrompt$ Select target permanent an opponent controls | SubAbility$ DBChange | SpellDescription$ Destroy target permanent an opponent controls. Its controller may search their library for a basic land card, put it onto the battlefield, then shuffle.
SVar:DBChange:DB$ ChangeZone | Optional$ True | Origin$ Library | Destination$ Battlefield | DefinedPlayer$ TargetedController | ChangeType$ Land.Basic | ChangeNum$ 1 | DefinedPlayer$ TargetedController | ShuffleNonMandatory$ True SVar:DBChange:DB$ ChangeZone | Optional$ True | Origin$ Library | Destination$ Battlefield | ChangeType$ Land.Basic | ChangeNum$ 1 | DefinedPlayer$ TargetedController | ShuffleNonMandatory$ True
Oracle:Destroy target permanent an opponent controls. Its controller may search their library for a basic land card, put it onto the battlefield, then shuffle. Oracle:Destroy target permanent an opponent controls. Its controller may search their library for a basic land card, put it onto the battlefield, then shuffle.

View File

@@ -4,10 +4,8 @@ Types:Creature Beast
PT:4/5 PT:4/5
K:Trample K:Trample
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigDiscard | CombatDamage$ True | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may discard all the cards in your hand. If you do, draw that many cards. T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigDiscard | CombatDamage$ True | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may discard all the cards in your hand. If you do, draw that many cards.
SVar:TrigDiscard:DB$ Discard | Mode$ Hand | RememberDiscarded$ True | SubAbility$ DBDraw SVar:TrigDiscard:AB$ Draw | Cost$ Discard<1/Hand> | NumCards$ X
SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ X | SubAbility$ DBCleanup SVar:X:Discarded$Amount
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$Amount
DeckHas:Ability$Discard DeckHas:Ability$Discard
DeckHints:Keyword$Madness & Ability$Delirium DeckHints:Keyword$Madness & Ability$Delirium
Oracle:Trample\nWhenever Book Devourer deals combat damage to a player, you may discard all the cards in your hand. If you do, draw that many cards. Oracle:Trample\nWhenever Book Devourer deals combat damage to a player, you may discard all the cards in your hand. If you do, draw that many cards.

View File

@@ -2,7 +2,7 @@ Name:Ride Down
ManaCost:R W ManaCost:R W
Types:Instant Types:Instant
A:SP$ Pump | Cost$ R W | ValidTgts$ Creature.blocking | RememberObjects$ Targeted | TgtPrompt$ Select target blocking creature | SubAbility$ DBDestroy | SpellDescription$ Destroy target blocking creature. Creatures that were blocked by that creature this combat gain trample until end of turn. | StackDescription$ SpellDescription A:SP$ Pump | Cost$ R W | ValidTgts$ Creature.blocking | RememberObjects$ Targeted | TgtPrompt$ Select target blocking creature | SubAbility$ DBDestroy | SpellDescription$ Destroy target blocking creature. Creatures that were blocked by that creature this combat gain trample until end of turn. | StackDescription$ SpellDescription
SVar:DBDestroy:DB$ Destroy | Defined$ Remembered | RememberLKI$ True | SubAbility$ DBPump | StackDescription$ None SVar:DBDestroy:DB$ Destroy | Defined$ Remembered | SubAbility$ DBPump | StackDescription$ None
SVar:DBPump:DB$ PumpAll | ValidCards$ Creature.blockedByRemembered | KW$ Trample | SubAbility$ DBCleanup SVar:DBPump:DB$ PumpAll | ValidCards$ Creature.blockedByRemembered | KW$ Trample | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/ride_down.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/ride_down.jpg

View File

@@ -85,6 +85,9 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
if (discardType.equals("Hand")) { if (discardType.equals("Hand")) {
if (!controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblDoYouWantDiscardYourHand"), ability)) {
return null;
}
if (hand.size() > 1 && ability.getActivatingPlayer() != null) { if (hand.size() > 1 && ability.getActivatingPlayer() != null) {
hand = ability.getActivatingPlayer().getController().orderMoveToZoneList(hand, ZoneType.Graveyard, ability); hand = ability.getActivatingPlayer().getController().orderMoveToZoneList(hand, ZoneType.Graveyard, ability);
} }
@@ -205,7 +208,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblDrawNCardsConfirm", String.valueOf(c)), ability)) { if (!controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblDrawNCardsConfirm", String.valueOf(c)), ability)) {
return null; return null;
} }
@@ -240,7 +243,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
return source.getZone() == player.getZone(cost.from) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblExileConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null; return source.getZone() == player.getZone(cost.from) && controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblExileConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null;
} }
if (type.equals("All")) { if (type.equals("All")) {
@@ -366,7 +369,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
private PaymentDecision exileFromTop(final CostExile cost, final SpellAbility sa, final Player player, final int nNeeded) { private PaymentDecision exileFromTop(final CostExile cost, final SpellAbility sa, final Player player, final int nNeeded) {
final CardCollectionView list = player.getCardsIn(ZoneType.Library, nNeeded); final CardCollectionView list = player.getCardsIn(ZoneType.Library, nNeeded);
if (list.size() > nNeeded || !player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblExileNCardFromYourTopLibraryConfirm"), ability)) { if (list.size() > nNeeded || !controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblExileNCardFromYourTopLibraryConfirm"), ability)) {
return null; return null;
} }
return PaymentDecision.card(list); return PaymentDecision.card(list);
@@ -434,7 +437,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) { if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) {
return player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblExertCardConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null; return controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblExertCardConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null;
} }
return null; return null;
} }
@@ -470,7 +473,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblDoYouWantFlipNCoinAction", String.valueOf(c)), ability)) { if (!controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblDoYouWantFlipNCoinAction", String.valueOf(c)), ability)) {
return null; return null;
} }
@@ -486,7 +489,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblDoYouWantRollNDiceAction", String.valueOf(c), "d" + cost.getType()), ability)) { if (!controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblDoYouWantRollNDiceAction", String.valueOf(c), "d" + cost.getType()), ability)) {
return null; return null;
} }
@@ -551,7 +554,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblMillNCardsFromYourLibraryConfirm", String.valueOf(c)), ability)) { if (!controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblMillNCardsFromYourLibraryConfirm", String.valueOf(c)), ability)) {
return null; return null;
} }
return PaymentDecision.number(c); return PaymentDecision.number(c);
@@ -567,7 +570,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
// for costs declared mandatory, this is only reachable with a valid amount // for costs declared mandatory, this is only reachable with a valid amount
if (ability.getPayCosts().isMandatory() || (player.canPayLife(c) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPayNLifeConfirm", String.valueOf(c)), ability))) { if (ability.getPayCosts().isMandatory() || (player.canPayLife(c) && controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblPayNLifeConfirm", String.valueOf(c)), ability))) {
return PaymentDecision.number(c); return PaymentDecision.number(c);
} }
return null; return null;
@@ -583,7 +586,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
if (player.canPayEnergy(c) && if (player.canPayEnergy(c) &&
player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPayEnergyConfirm", cost.toString(), String.valueOf(player.getCounters(CounterEnumType.ENERGY)), "{E}"), ability)) { controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblPayEnergyConfirm", cost.toString(), String.valueOf(player.getCounters(CounterEnumType.ENERGY)), "{E}"), ability)) {
return PaymentDecision.number(c); return PaymentDecision.number(c);
} }
return null; return null;
@@ -608,7 +611,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
player.getCardsIn(cost.getFrom()), cost.getType().split(";"), player, source, ability); player.getCardsIn(cost.getFrom()), cost.getType().split(";"), player, source, ability);
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
return source.getZone() == player.getZone(cost.from) && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblPutCardToLibraryConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null; return source.getZone() == player.getZone(cost.from) && controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblPutCardToLibraryConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null;
} }
if (cost.from == ZoneType.Hand) { if (cost.from == ZoneType.Hand) {
@@ -718,7 +721,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final Card card = ability.getHostCard(); final Card card = ability.getHostCard();
if (card.getController() == player && card.isInPlay()) { if (card.getController() == player && card.isInPlay()) {
final CardView view = CardView.get(card); final CardView view = CardView.get(card);
return player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblReturnCardToHandConfirm", CardTranslation.getTranslatedName(view.getName())), ability) ? PaymentDecision.card(card) : null; return controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblReturnCardToHandConfirm", CardTranslation.getTranslatedName(view.getName())), ability) ? PaymentDecision.card(card) : null;
} }
} else { } else {
final CardCollectionView validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), final CardCollectionView validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield),
@@ -966,7 +969,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (maxCounters < cntRemoved) { if (maxCounters < cntRemoved) {
return null; return null;
} }
if (!player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblRemoveNTargetCounterFromCardPayCostConfirm", amount, cost.counter.getName().toLowerCase(), CardTranslation.getTranslatedName(source.getName())), ability)) { if (!controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblRemoveNTargetCounterFromCardPayCostConfirm", amount, cost.counter.getName().toLowerCase(), CardTranslation.getTranslatedName(source.getName())), ability)) {
return null; return null;
} }
} }
@@ -1022,7 +1025,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) { if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) {
return ability.getPayCosts().isMandatory() || player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblSacrificeCardConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null; return ability.getPayCosts().isMandatory() || controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblSacrificeCardConfirm", CardTranslation.getTranslatedName(source.getName())), ability) ? PaymentDecision.card(source) : null;
} }
return null; return null;
} }
@@ -1030,7 +1033,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (type.equals("OriginalHost")) { if (type.equals("OriginalHost")) {
Card host = ability.getOriginalHost(); Card host = ability.getOriginalHost();
if (host.getController() == ability.getActivatingPlayer() && host.isInPlay()) { if (host.getController() == ability.getActivatingPlayer() && host.isInPlay()) {
return player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblSacrificeCardConfirm", CardTranslation.getTranslatedName(host.getName())), ability) ? PaymentDecision.card(host) : null; return controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblSacrificeCardConfirm", CardTranslation.getTranslatedName(host.getName())), ability) ? PaymentDecision.card(host) : null;
} }
return null; return null;
} }
@@ -1200,7 +1203,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
@Override @Override
public PaymentDecision visit(final CostUnattach cost) { public PaymentDecision visit(final CostUnattach cost) {
final Card cardToUnattach = cost.findCardToUnattach(source, player, ability); final Card cardToUnattach = cost.findCardToUnattach(source, player, ability);
if (cardToUnattach != null && player.getController().confirmPayment(cost, Localizer.getInstance().getMessage("lblUnattachCardConfirm", CardTranslation.getTranslatedName(cardToUnattach.getName())), ability)) { if (cardToUnattach != null && controller.confirmPayment(cost, Localizer.getInstance().getMessage("lblUnattachCardConfirm", CardTranslation.getTranslatedName(cardToUnattach.getName())), ability)) {
return PaymentDecision.card(cardToUnattach); return PaymentDecision.card(cardToUnattach);
} }
return null; return null;