mirror of
https://github.com/correl/mage.git
synced 2025-03-31 01:07:39 -09:00
Added possibility to check kind of cost to pay for conditional mana use.
This commit is contained in:
parent
d63f6d7d27
commit
c8f82b49ff
208 changed files with 770 additions and 571 deletions
Mage.Server.Plugins
Mage.Player.AI/src/main/java/mage/player/ai
Mage.Player.Human/src/mage/player/human
Mage.Sets/src/mage/sets
alarareborn
alliances
avacynrestored
battleforzendikar
betrayersofkamigawa
bornofthegods
championsofkamigawa
coldsnap
commander
AllianceOfArms.javaChorusOfTheConclave.javaCollectiveVoyage.javaManaChargedDragon.javaMindsAglow.javaSharedTrauma.javaVishKalBloodArbiter.java
commander2013
conspiracy
darkascension
darksteel
dragonsoftarkir
eventide
exodus
fallenempires
fifthdawn
fourthedition
futuresight
guildpact
iceage
innistrad
journeyintonyx
judgment
legends
limitedalpha
lorwyn
magic2011
magic2015
masterseditionii
masterseditioniii
masterseditioniv
mercadianmasques
mirage
mirrodin
modernmasters
nemesis
newphyrexia
oathofthegatewatch
odyssey
planarchaos
BrainGorgers.javaDashHopes.javaPhantasmagorian.javaShivanWumpus.javaShroudedLore.javaSimianSpiritGuide.java
planechase
planeshift
prophecy
ravnica
returntoravnica
saviorsofkamigawa
scarsofmirrodin
|
@ -1195,7 +1195,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
// pay phyrexian life costs
|
||||
if (cost instanceof PhyrexianManaCost) {
|
||||
if (cost.pay(null, game, null, playerId, false) || spendAnyMana) {
|
||||
if (cost.pay(null, game, null, playerId, false, null) || spendAnyMana) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -805,7 +805,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (cost instanceof PhyrexianManaCost) {
|
||||
PhyrexianManaCost ph = (PhyrexianManaCost) cost;
|
||||
if (ph.canPay(null, null, playerId, game)) {
|
||||
((PhyrexianManaCost) cost).pay(null, game, null, playerId, false);
|
||||
((PhyrexianManaCost) cost).pay(null, game, null, playerId, false, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class VectisDominatorEffect extends OneShotEffect {
|
|||
cost.clearPaid();
|
||||
final StringBuilder sb = new StringBuilder("Pay 2 life? (Otherwise ").append(targetCreature.getName()).append(" will be tapped)");
|
||||
if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
|
||||
cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), true);
|
||||
cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), true, null);
|
||||
}
|
||||
if (!cost.isPaid()) {
|
||||
return targetCreature.tap(game);
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.common.BasicManaEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
|
@ -83,7 +84,7 @@ class ExileSourceFromHandCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Card card = game.getCard(sourceId);
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null && player.getHand().contains(sourceId) && card != null) {
|
||||
|
|
|
@ -160,7 +160,7 @@ class ExileTopCardLibraryCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null) {
|
||||
card = controller.getLibrary().getFromTop(game);
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.Mana;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||
|
@ -136,7 +137,7 @@ class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID manaProducer) {
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) {
|
||||
// check: ... to cast a creature spell
|
||||
if (super.apply(game, source)) {
|
||||
// check: ... of the chosen type
|
||||
|
|
|
@ -95,7 +95,7 @@ class GrovetenderDruidsEffect extends OneShotEffect {
|
|||
if(player != null) {
|
||||
if(player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {1}?", source, game)) {
|
||||
Cost cost = new ManaCostsImpl("{1}");
|
||||
if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
new CreateTokenEffect(new GrovetenderDruidsPlantToken()).apply(game, source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -92,7 +93,7 @@ class BlindingPowderUnattachCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
for (UUID attachmentId : permanent.getAttachments()) {
|
||||
|
|
|
@ -100,7 +100,7 @@ class OgreMarauderEffect extends OneShotEffect {
|
|||
Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
|
||||
if (cost.canPay(source, source.getSourceId(), defendingPlayerId, game) &&
|
||||
defender.chooseUse(Outcome.LoseAbility, "Sacrifice a creature to prevent that " + sourceObject.getLogName() + " can't be blocked?", source, game)) {
|
||||
if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false)) {
|
||||
if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false, null)) {
|
||||
// cost was not payed - so source can't be blocked
|
||||
ContinuousEffect effect = new CantBeBlockedSourceEffect(Duration.EndOfTurn);
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -138,7 +138,7 @@ class ShurikenUnattachCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
for (UUID attachmentId :permanent.getAttachments()) {
|
||||
|
|
|
@ -109,7 +109,7 @@ class FloodtideSerpentReplacementEffect extends ReplacementEffectImpl {
|
|||
ReturnToHandChosenControlledPermanentCost attackCost = new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter));
|
||||
if (attackCost.canPay(source, source.getSourceId(), event.getPlayerId(), game)
|
||||
&& player.chooseUse(Outcome.Neutral, "Return an enchantment you control to hand to attack?", source, game)) {
|
||||
if (attackCost.pay(source, game, source.getSourceId(), event.getPlayerId(), true)) {
|
||||
if (attackCost.pay(source, game, source.getSourceId(), event.getPlayerId(), true, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class HeroOfLeinaTowerEffect extends OneShotEffect {
|
|||
if (you != null && you.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) {
|
||||
int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
|
||||
cost.add(new GenericManaCost(costX));
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
return new AddCountersSourceEffect(CounterType.P1P1.createInstance(costX), true).apply(game, source);
|
||||
|
|
|
@ -130,7 +130,7 @@ class DoUnlessTargetPaysCost extends OneShotEffect {
|
|||
message = CardUtil.replaceSourceName(message, mageObject.getLogName());
|
||||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, source, game)) {
|
||||
cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
}
|
||||
if (!cost.isPaid()) {
|
||||
executingEffect.setTargetPointer(this.targetPointer);
|
||||
|
|
|
@ -98,7 +98,7 @@ class CutTheTethersEffect extends OneShotEffect {
|
|||
boolean paid = false;
|
||||
if (player.chooseUse(outcome, new StringBuilder("Pay {3} to keep ").append(creature.getName()).append(" on the battlefield?").toString(), source, game)) {
|
||||
Cost cost = new GenericManaCost(3);
|
||||
if (!cost.pay(source, game, source.getSourceId(), creature.getControllerId(), false)) {
|
||||
if (!cost.pay(source, game, source.getSourceId(), creature.getControllerId(), false, null)) {
|
||||
paid = true;
|
||||
}
|
||||
if (!paid) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.constants.Zone;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -184,7 +185,7 @@ class HankyuCountersSourceCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent equipment = game.getPermanent(this.effectGivingEquipmentId);
|
||||
if (equipment != null ) {
|
||||
this.removedCounters = equipment.getCounters().getCount(CounterType.AIM);
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.constants.Rarity;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -98,7 +99,7 @@ class HisokaMinamoSenseiDiscardTargetCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
for (UUID targetId: targets.get(0).getTargets()) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.mana.ConditionalColorlessManaAbility;
|
||||
|
@ -62,7 +63,7 @@ public class UntaidakeTheCloudKeeper extends CardImpl {
|
|||
Ability ability = new ConditionalColorlessManaAbility(new TapSourceCost(), 2, new LegendarySpellManaBuilder());
|
||||
ability.addCost(new PayLifeCost(2));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public UntaidakeTheCloudKeeper(final UntaidakeTheCloudKeeper card) {
|
||||
|
@ -76,6 +77,7 @@ public class UntaidakeTheCloudKeeper extends CardImpl {
|
|||
}
|
||||
|
||||
class LegendarySpellManaBuilder extends ConditionalManaBuilder {
|
||||
|
||||
@Override
|
||||
public ConditionalMana build(Object... options) {
|
||||
return new LegendaryCastConditionalMana(this.mana);
|
||||
|
@ -97,6 +99,7 @@ class LegendaryCastConditionalMana extends ConditionalMana {
|
|||
}
|
||||
|
||||
class LegendaryCastManaCondition extends ManaCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
|
@ -109,7 +112,7 @@ class LegendaryCastManaCondition extends ManaCondition implements Condition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId) {
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) {
|
||||
return apply(game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.coldsnap;
|
|||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.keyword.CumulativeUpkeepAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -73,7 +74,7 @@ class BraidOfFireCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
player.getManaPool().addMana(Mana.RedMana(1), game, ability);
|
||||
paid = true;
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.coldsnap;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.keyword.CumulativeUpkeepAbility;
|
||||
import mage.cards.Card;
|
||||
|
@ -84,7 +85,7 @@ class JotunGruntCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null) {
|
||||
if (targets.choose(Outcome.Removal, controllerId, sourceId, game)) {
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.coldsnap;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.keyword.CumulativeUpkeepAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
@ -89,7 +90,7 @@ class ShelteringAncientCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null) {
|
||||
Target target = new TargetCreaturePermanent(1, 1, filter, true);
|
||||
|
|
|
@ -121,7 +121,7 @@ class AllianceOfArmsEffect extends OneShotEffect {
|
|||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class ChorusOfTheConclaveReplacementEffect extends ReplacementEffectImpl {
|
|||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ class CollectiveVoyageEffect extends OneShotEffect {
|
|||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class ManaChargedDragonEffect extends OneShotEffect {
|
|||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class MindsAglowEffect extends OneShotEffect {
|
|||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class SharedTraumaEffect extends OneShotEffect {
|
|||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class VishKalBloodArbiterCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
this.amount = permanent.getCounters().getCount(name);
|
||||
|
|
|
@ -57,6 +57,7 @@ import mage.target.common.TargetCreatureOrPlayer;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -200,7 +201,7 @@ class MarathWillOfTheWildRemoveCountersCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
int amount = new ManacostVariableValue().calculate(game, ability, null);
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) {
|
||||
|
|
|
@ -90,7 +90,7 @@ class VictimizeEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature")));
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)).getCards(game),
|
||||
Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class JarOfEyeballsCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(ability.getSourceId());
|
||||
if (permanent != null) {
|
||||
this.removedCounters = permanent.getCounters().getCount(CounterType.EYEBALL);
|
||||
|
|
|
@ -33,6 +33,7 @@ import mage.constants.*;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -90,7 +91,7 @@ class UnattachCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
Permanent attachment = game.getPermanent(attachmentid);
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -104,7 +105,7 @@ class SurestrikeTridentUnattachCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
for (UUID attachmentId : permanent.getAttachments()) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import mage.MageObject;
|
|||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -120,7 +121,7 @@ class HavenOfTheSpiritConditionalMana extends ConditionalMana {
|
|||
class HavenOfTheSpiritManaCondition extends CreatureCastManaCondition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID manaProducer) {
|
||||
public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) {
|
||||
if (super.apply(game, source)) {
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
if (object.hasSubtype("Dragon")
|
||||
|
|
|
@ -95,7 +95,7 @@ class MysticMeditationEffect extends OneShotEffect {
|
|||
&& controller.chooseUse(Outcome.Discard, "Do you want to discard a creature card? If you don't, you must discard 2 cards", source, game)) {
|
||||
Cost cost = new DiscardTargetCost(new TargetCardInHand(filter));
|
||||
if (cost.canPay(source, source.getSourceId(), controller.getId(), game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), controller.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), controller.getId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -101,7 +102,7 @@ class HatchetBullyCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.M1M1.createInstance(), game);
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.ObjectColor;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -111,7 +112,7 @@ class ImpelledGiantCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (target.choose(Outcome.Tap, controllerId, sourceId, game)) {
|
||||
for (UUID targetId: (List<UUID>)target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
|
|
|
@ -119,7 +119,7 @@ class RiseOfTheHobgoblinsEffect extends OneShotEffect {
|
|||
if (you != null && you.chooseUse(Outcome.Neutral, "Do you want to to pay {X}?", source, game)) {
|
||||
int costX = you.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
|
||||
cost.add(new GenericManaCost(costX));
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
Token token = new GoblinSoldierToken();
|
||||
return token.putOntoBattlefield(costX, game, source.getSourceId(), source.getControllerId());
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class ErraticPortalEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
cost.clearPaid();
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay {1}? (Otherwise " + targetCreature.getLogName() +" will be returned to its owner's hand)", source, game)) {
|
||||
cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false);
|
||||
cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null);
|
||||
}
|
||||
if (!cost.isPaid()) {
|
||||
controller.moveCards(targetCreature, Zone.BATTLEFIELD, Zone.HAND, source, game);
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
|||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.dynamicvalue.common.CountersCount;
|
||||
|
@ -127,7 +128,7 @@ class TidalInfluenceCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
this.paid = true;
|
||||
return paid;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class DisruptionAuraEffect extends OneShotEffect {
|
|||
Cost cost = permanent.getManaCost().copy();
|
||||
if (player.chooseUse(Outcome.Benefit, message, source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ class PlungeIntoDarknessSearchEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
VariableCost cost = new PayVariableLifeCost();
|
||||
int xValue = cost.announceXValue(source, game);
|
||||
cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false);
|
||||
cost.getFixedCostsFromAnnouncedValue(xValue).pay(source, game, source.getSourceId(), source.getControllerId(), false, null);
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
int count = Math.min(player.getLibrary().size(), xValue);
|
||||
|
|
|
@ -130,11 +130,11 @@ class PossessedPortalEffect extends OneShotEffect {
|
|||
Cost discardCost = new DiscardCardCost();
|
||||
if (discardCost.canPay(source, source.getSourceId(), playerId, game)
|
||||
&& player.chooseUse(Outcome.Discard, "Discard a card? (Otherwise sacrifice a permanent)", source, game)) {
|
||||
discardCost.pay(source, game, source.getSourceId(), playerId, true);
|
||||
discardCost.pay(source, game, source.getSourceId(), playerId, true, null);
|
||||
}
|
||||
else {
|
||||
Cost sacrificeCost = new SacrificeTargetCost(new TargetControlledPermanent());
|
||||
sacrificeCost.pay(source, game, source.getSourceId(), playerId, true);
|
||||
sacrificeCost.pay(source, game, source.getSourceId(), playerId, true, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -97,7 +97,7 @@ class ForceOfNatureEffect extends OneShotEffect {
|
|||
Cost cost = new ManaCostsImpl("{G}{G}{G}{G}");
|
||||
String message = "Would you like to pay {G}{G}{G}{G} to prevent taking 8 damage from {this}?";
|
||||
if (!(controller.chooseUse(Outcome.Benefit, message, source, game)
|
||||
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false))) {
|
||||
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) {
|
||||
controller.damage(8, source.getSourceId(), game, false, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.BasicManaEffect;
|
||||
|
@ -114,7 +115,7 @@ class FilterPermanentCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
this.paid = true;
|
||||
return paid;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class LeylineOfLightningEffect extends DamageTargetEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Cost cost = new GenericManaCost(1);
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
super.apply(game, source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -145,7 +145,7 @@ class MysticRemoraTriggeredAbility extends TriggeredAbilityImpl {
|
|||
if (controller != null && opponent != null && sourceObject != null) {
|
||||
Cost cost = new GenericManaCost(4);
|
||||
String message = "Would you like to pay {4} to prevent the opponent to draw a card?";
|
||||
if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false))) {
|
||||
if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) {
|
||||
if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) {
|
||||
controller.drawCards(1, game);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class SeizuresEffect extends OneShotEffect {
|
|||
if(cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " to avoid damage?", source, game)) {
|
||||
cost.clearPaid();
|
||||
if(cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
if(cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.innistrad;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect;
|
||||
|
@ -97,7 +98,7 @@ class BackFromTheBrinkCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (targets.choose(Outcome.Exile, controllerId, sourceId, game)) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (controller != null) {
|
||||
|
|
|
@ -95,7 +95,7 @@ class FrightfulDelusionEffect extends OneShotEffect {
|
|||
game.getPlayer(spell.getControllerId()).discard(
|
||||
1, false, source, game);
|
||||
if (!cost.pay(source, game, spell.getControllerId(),
|
||||
spell.getControllerId(), false)) {
|
||||
spell.getControllerId(), false, null)) {
|
||||
return game.getStack().counter(source.getFirstTarget(),
|
||||
source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class ScreechingBatTransformSourceEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Cost cost = new ManaCostsImpl("{2}{B}{B}");
|
||||
if (cost.pay(source, game, permanent.getControllerId(), permanent.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, permanent.getControllerId(), permanent.getControllerId(), false, null)) {
|
||||
if (permanent.canTransform()) {
|
||||
permanent.setTransformed(!permanent.isTransformed());
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class AthreosGodOfPassageReturnEffect extends OneShotEffect {
|
|||
Cost cost = new PayLifeCost(3);
|
||||
if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
|
||||
&& opponent.chooseUse(outcome, new StringBuilder("Pay 3 live to prevent that ").append(creature.getLogName()).append(" returns to ").append(controller.getLogName()).append("'s hand?").toString(), source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) {
|
||||
paid = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class DiscipleOfDeceitEffect extends OneShotEffect {
|
|||
String message = "Discard a nonland card to search your library?";
|
||||
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
|
||||
&& player.chooseUse(Outcome.Detriment, message, source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
Card card = game.getCard(cost.getTargets().getFirstTarget());
|
||||
if (card == null) {
|
||||
return false;
|
||||
|
|
|
@ -101,7 +101,7 @@ class SageOfHoursCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(ability.getSourceId());
|
||||
if (permanent != null) {
|
||||
this.removedCounters = permanent.getCounters().getCount(CounterType.P1P1);
|
||||
|
|
|
@ -33,6 +33,7 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
||||
|
@ -103,7 +104,7 @@ class WormfangDrakeExileCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
MageObject sourceObject = ability.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
|
|
|
@ -105,7 +105,7 @@ class ChainLightningEffect extends OneShotEffect {
|
|||
if (affectedPlayer != null) {
|
||||
if (affectedPlayer.chooseUse(Outcome.Copy, "Pay {R}{R} to copy the spell?", source, game)) {
|
||||
Cost cost = new ManaCostsImpl("{R}{R}");
|
||||
if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), affectedPlayer.getId(), false, null)) {
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
|
|
|
@ -100,7 +100,7 @@ class CosmicHorrorEffect extends OneShotEffect {
|
|||
}
|
||||
if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class DestroySourceUnlessPaysEffect extends OneShotEffect {
|
|||
if (player != null && permanent != null) {
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "?", source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class DemonicHordesEffect extends OneShotEffect {
|
|||
}
|
||||
if (controller.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class BrokenAmbitionsEffect extends OneShotEffect {
|
|||
message = costToPay.getText() + " to prevent counter effect?";
|
||||
}
|
||||
costToPay.clearPaid();
|
||||
if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) {
|
||||
if (!(controller.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) {
|
||||
game.getStack().counter(spell.getId(), source.getSourceId(), game);
|
||||
}
|
||||
if (ClashEffect.getInstance().apply(game, source)) {
|
||||
|
|
|
@ -131,7 +131,7 @@ class RingsOfBrighthearthEffect extends OneShotEffect {
|
|||
ManaCostsImpl cost = new ManaCostsImpl("{2}");
|
||||
if (player != null) {
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
Ability ability = (Ability) getValue("stackAbility");
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
|
@ -96,7 +97,7 @@ class SilvergillAdeptCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player == null) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
|
@ -137,7 +138,7 @@ class AncientHellkiteCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
this.paid = true;
|
||||
return paid;
|
||||
}
|
||||
|
|
|
@ -102,14 +102,14 @@ class IndulgentTormentorEffect extends OneShotEffect {
|
|||
Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
|
||||
if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
|
||||
&& opponent.chooseUse(outcome, "Sacrifice a creature to prevent the card draw?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cost = new PayLifeCost(3);
|
||||
if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
|
||||
&& opponent.chooseUse(outcome, "Pay 3 life to prevent the card draw?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.magic2015;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -92,7 +93,7 @@ class NecromancersStockpileDiscardTargetCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
for (UUID targetId : targets.get(0).getTargets()) {
|
||||
|
|
|
@ -29,11 +29,11 @@ package mage.sets.magic2015;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.decorator.ConditionalActivatedAbility;
|
||||
|
@ -124,7 +124,7 @@ class SliverHiveConditionalMana extends ConditionalMana {
|
|||
class SliverHiveManaCondition extends CreatureCastManaCondition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID manaProducer) {
|
||||
public boolean apply(Game game, Ability source, UUID manaProducer, Cost costToPay) {
|
||||
if (super.apply(game, source)) {
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
if (object.hasSubtype("Sliver")) {
|
||||
|
|
|
@ -117,7 +117,7 @@ class ForgottenLoreEffect extends OneShotEffect {
|
|||
if(!done) {
|
||||
if(cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) {
|
||||
cost.clearPaid();
|
||||
if(!cost.pay(source, game, source.getSourceId(), you.getId(), false)) {
|
||||
if(!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ class CounterSourceEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller.chooseUse(Outcome.Detriment, "Sacrifice a land to not counter " + spell.getName() + "?", source, game)){
|
||||
SacrificeTargetCost cost = new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent()));
|
||||
if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)){
|
||||
if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)){
|
||||
game.informPlayers(controller.getLogName() + " sacrifices a land to not counter " + spell.getName() + ".");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -124,7 +125,7 @@ class WanderingMageCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent permanent = game.getPermanent(ability.getTargets().get(1).getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.M1M1.createInstance(), game);
|
||||
|
|
|
@ -92,7 +92,7 @@ class HasranOgressEffect extends OneShotEffect {
|
|||
Cost cost = new ManaCostsImpl("{2}");
|
||||
String message = "Would you like to pay {2} to prevent taking 3 damage from Hasran Ogress?";
|
||||
if (!(controller.chooseUse(Outcome.Benefit, message, source, game)
|
||||
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false))) {
|
||||
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) {
|
||||
controller.damage(3, source.getSourceId(), game, false, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.MageObject;
|
|||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.mana.ConditionalColorlessManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
|
@ -109,7 +110,7 @@ class ArtifactAbilityManaCondition extends ManaCondition implements Condition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId) {
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) {
|
||||
return apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class HornOfPlentyEffect extends OneShotEffect {
|
|||
if (caster != null) {
|
||||
if (caster.chooseUse(Outcome.DrawCard, "Pay {1} to draw a card at the beginning of the next end step?", source, game)) {
|
||||
Cost cost = new ManaCostsImpl("{1}");
|
||||
if (cost.pay(source, game, source.getSourceId(), caster.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), caster.getId(), false, null)) {
|
||||
Effect effect = new DrawCardTargetEffect(1);
|
||||
effect.setTargetPointer(new FixedTarget(caster.getId()));
|
||||
return new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect, TargetController.ANY)).apply(game, source);
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -105,7 +106,7 @@ class LandGrantReavealCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null) {
|
||||
player.revealCards("Land Grant", player.getHand(), game);
|
||||
|
|
|
@ -105,7 +105,7 @@ class FlashEffect extends OneShotEffect {
|
|||
StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append("?");
|
||||
if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
|
||||
reducedCost.clearPaid();
|
||||
if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
@ -94,7 +95,7 @@ class PhyrexianDreadnoughtSacrificeCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
int sumPower = 0;
|
||||
if (targets.choose(Outcome.Sacrifice, controllerId, sourceId, game)) {
|
||||
for (UUID targetId: targets.get(0).getTargets()) {
|
||||
|
|
|
@ -98,7 +98,7 @@ class VaporousDjinnEffect extends OneShotEffect {
|
|||
Cost cost = new ManaCostsImpl("{U}{U}");
|
||||
String message = "Would you like to pay {U}{U} to prevent {this} from phasing out?";
|
||||
if (!(controller.chooseUse(Outcome.Benefit, message, source, game)
|
||||
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false))) {
|
||||
&& cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))) {
|
||||
permanent.phaseOut(game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -107,7 +107,7 @@ class CrystalShardEffect extends OneShotEffect {
|
|||
cost.clearPaid();
|
||||
final StringBuilder sb = new StringBuilder("Pay {1}? (Otherwise ").append(targetCreature.getName()).append(" will be returned to its owner's hand)");
|
||||
if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
|
||||
cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false);
|
||||
cost.pay(source, game, targetCreature.getControllerId(), targetCreature.getControllerId(), false, null);
|
||||
}
|
||||
if (!cost.isPaid()) {
|
||||
controller.moveCards(targetCreature, Zone.BATTLEFIELD, Zone.HAND, source, game);
|
||||
|
|
|
@ -97,7 +97,7 @@ class TajNarSwordsmithEffect extends OneShotEffect {
|
|||
if (player != null && player.chooseUse(Outcome.BoostCreature, "Do you want to to pay {X}?", source, game)) {
|
||||
int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source);
|
||||
Cost cost = new GenericManaCost(costX);
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
FilterCard filter = new FilterCard("Equipment card with converted mana cost " + costX + " or less");
|
||||
filter.add(new SubtypePredicate("Equipment"));
|
||||
filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, costX + 1));
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.RemoveCounterCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -141,7 +142,7 @@ class RemoveCounterFromCardCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
paid = false;
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
if (target.choose(Outcome.UnboostCreature, controllerId, sourceId, game)) {
|
||||
|
|
|
@ -99,7 +99,7 @@ class RootwaterThiefEffect extends OneShotEffect {
|
|||
}
|
||||
String message = "Pay {2} to exile a card from damaged player's library?";
|
||||
Cost cost = new ManaCostsImpl("{2}");
|
||||
if(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), controller.getId(), false))
|
||||
if(controller.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), controller.getId(), false, null))
|
||||
{
|
||||
TargetCardInLibrary target = new TargetCardInLibrary();
|
||||
if (controller.searchLibrary(target, game, damagedPlayer.getId())) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.constants.Rarity;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
|
@ -102,7 +103,7 @@ class GreenhiltTraineeCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
this.paid = true;
|
||||
return paid;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +50,12 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class GravityNegator extends CardImpl {
|
||||
|
||||
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature");
|
||||
|
||||
static {
|
||||
filter.add(new AnotherPredicate());
|
||||
}
|
||||
|
||||
public GravityNegator(UUID ownerId) {
|
||||
super(ownerId, 45, "Gravity Negator", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.expansionSetCode = "OGW";
|
||||
|
@ -65,7 +73,7 @@ public class GravityNegator extends CardImpl {
|
|||
// Whenenever Gravity Negator attacks, you may pay {C}. If you do, another target creature gains flying until end of turn.
|
||||
Ability ability = new AttacksTriggeredAbility(new DoIfCostPaid(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{C}")), false,
|
||||
"Whenever {this} attacks you may pay {C}. If you do, another target creature gains flying until end of turn.");
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.common.CardsInHandCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -133,7 +134,7 @@ class KozilekDiscardCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Spell targetSpell = game.getStack().getSpell(ability.getFirstTarget());
|
||||
if (targetSpell == null) {
|
||||
return false;
|
||||
|
|
|
@ -175,7 +175,7 @@ class DecayingSoilEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
if (player.chooseUse(Outcome.Benefit, " - Pay " + cost.getText() + "?", source, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
UUID target = this.getTargetPointer().getFirst(game, source);
|
||||
if (target != null) {
|
||||
Card card = game.getCard(target);
|
||||
|
|
|
@ -139,7 +139,7 @@ class DelayingShieldUpkeepEffect extends OneShotEffect {
|
|||
for (int i = numCounters; i > 0; i--) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Pay {1}{W}? (" + i + " counters left to pay)", source, game)) {
|
||||
Cost cost = new ManaCostsImpl<>("{1}{W}");
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class DivertEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
cost.clearPaid();
|
||||
if (!cost.pay(source, game, spell.getControllerId(),
|
||||
spell.getControllerId(), false)) {
|
||||
spell.getControllerId(), false, null)) {
|
||||
return spell.chooseNewTargets(game, source.getControllerId(), true, true, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class UnifyingTheoryEffect extends OneShotEffect {
|
|||
if (caster != null) {
|
||||
if (caster.chooseUse(Outcome.DrawCard, "Pay {2} to draw a card?", source, game)) {
|
||||
Cost cost = new ManaCostsImpl("{2}");
|
||||
if (cost.pay(source, game, source.getSourceId(), caster.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), caster.getId(), false, null)) {
|
||||
caster.drawCards(1, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class BrainGorgersCounterSourceEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(playerId);
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Sacrifice a creature to counter " + sourceObject.getIdName() + "?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " sacrifices a creature to counter " + sourceObject.getIdName() + ".");
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
|
|
|
@ -97,7 +97,7 @@ class DashHopesCounterSourceEffect extends OneShotEffect {
|
|||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Pay 5 life to counter " + sourceObject.getIdName() + "?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
game.informPlayers(player.getLogName() + " pays 5 life to counter " + sourceObject.getIdName() + ".");
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
|
|
|
@ -103,7 +103,7 @@ class CounterSourceEffect extends OneShotEffect {
|
|||
cost.clearPaid();
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + "?", source, game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), playerId, false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), playerId, false, null)) {
|
||||
game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + ".");
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (spell != null) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class ShivanWumpusEffect extends PutOnLibrarySourceEffect {
|
|||
if (player != null
|
||||
&& cost.canPay(source, source.getSourceId(), playerId, game)
|
||||
&& player.chooseUse(Outcome.Sacrifice, "Sacrifice a land?", source, game)
|
||||
&& cost.pay(source, game, source.getSourceId(), playerId, true)) {
|
||||
&& cost.pay(source, game, source.getSourceId(), playerId, true, null)) {
|
||||
costPaid = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class ShroudedLoreEffect extends OneShotEffect {
|
|||
if(!done) {
|
||||
if(cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {B} to choose a different card ?", source, game)) {
|
||||
cost.clearPaid();
|
||||
if(!cost.pay(source, game, source.getSourceId(), you.getId(), false)) {
|
||||
if(!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.constants.Rarity;
|
|||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.effects.common.BasicManaEffect;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
|
@ -84,7 +85,7 @@ class ExileSourceFromHandCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Card card = game.getCard(sourceId);
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player != null && player.getHand().contains(sourceId) && card != null) {
|
||||
|
|
|
@ -96,7 +96,7 @@ class ThirstforKnowledgeEffect extends OneShotEffect {
|
|||
&& you.chooseUse(Outcome.Discard, "Do you want to discard an artifact? If you don't, you must discard 2 cards", source, game)) {
|
||||
Cost cost = new DiscardTargetCost(new TargetCardInHand(filter));
|
||||
if (cost.canPay(source, source.getSourceId(), you.getId(), game)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), you.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ class PhyrexianTyrannyEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
Cost cost = new GenericManaCost(2);
|
||||
if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
|
||||
if (!cost.pay(source, game, player.getId(), player.getId(), false, null)) {
|
||||
player.damage(2, source.getSourceId(), game, false, true);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -92,7 +92,7 @@ class RhysticStudyDrawEffect extends OneShotEffect {
|
|||
if (controller != null && opponent != null && sourceObject != null) {
|
||||
Cost cost = new GenericManaCost(1);
|
||||
String message = "Would you like to pay {1} to prevent the opponent to draw a card?";
|
||||
if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false))) {
|
||||
if (!(opponent.chooseUse(Outcome.Benefit, message, source, game) && cost.pay(source, game, source.getSourceId(), opponent.getId(), false, null))) {
|
||||
if(controller.chooseUse(Outcome.DrawCard, "Draw a card (" + sourceObject.getLogName() +")", source, game)) {
|
||||
controller.drawCards(1, game);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import mage.ObjectColor;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -149,7 +150,7 @@ class UnattachSourceCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
Permanent attachment = game.getPermanent(sourceId);
|
||||
Permanent permanent = game.getPermanent(attachment.getAttachedTo());
|
||||
if (permanent != null) {
|
||||
|
|
|
@ -111,7 +111,7 @@ class SoulTitheEffect extends OneShotEffect {
|
|||
int cmc = permanent.getManaCost().convertedManaCost();
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay {" + cmc + "} for " + permanent.getName() + "? (otherwise you sacrifice it)", source, game)) {
|
||||
Cost cost = new GenericManaCost(cmc);
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.MageInt;
|
|||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -93,7 +94,7 @@ class SacrificeAllLandCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
for(Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), ability.getControllerId(), game)){
|
||||
paid |= permanent.sacrifice(sourceId, game);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
|
@ -100,7 +101,7 @@ class BloodshotTraineeCost extends CostImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
this.paid = true;
|
||||
return paid;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class EmbersmithEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Cost cost = new GenericManaCost(1);
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.damage(1, source.getSourceId(), game, false, true);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue