New ConditionalMana support.

This commit is contained in:
magenoxx 2011-08-04 18:10:57 +04:00
parent 67a6c9dcf5
commit ed3f96c668
58 changed files with 612 additions and 145 deletions

View file

@ -93,7 +93,7 @@ class GhostlyPrisonReplacementEffect extends ReplacementEffectImpl<GhostlyPrison
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
player.chooseUse(Constants.Outcome.Benefit, "Pay {2} to declare attacker?", game) )
{
propagandaTax.pay(game, this.getId(), event.getPlayerId(), false);
propagandaTax.pay(source, game, this.getId(), event.getPlayerId(), false);
if ( propagandaTax.isPaid() ) {
return false;

View file

@ -34,6 +34,7 @@ import mage.Constants.ColoredManaSymbol;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.mana.ColoredManaCost;
@ -132,7 +133,7 @@ class AncientHellkiteCost extends CostImpl<AncientHellkiteCost> {
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = true;
return paid;
}

View file

@ -101,7 +101,7 @@ class GreenhiltTraineeCost extends CostImpl<GreenhiltTraineeCost> {
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = true;
return paid;
}

View file

@ -91,7 +91,7 @@ class NornsAnnexReplacementEffect extends ReplacementEffectImpl<NornsAnnexReplac
ManaCostsImpl propagandaTax = new ManaCostsImpl("{WP}");
if (propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
player.chooseUse(Constants.Outcome.Benefit, "Pay {WP} to declare attacker?", game)) {
propagandaTax.pay(game, this.getId(), event.getPlayerId(), false);
propagandaTax.pay(source, game, this.getId(), event.getPlayerId(), false);
if (propagandaTax.isPaid()) {
return false;

View file

@ -32,6 +32,7 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.common.TapSourceCost;
@ -100,7 +101,7 @@ class BloodshotTraineeCost extends CostImpl<BloodshotTraineeCost> {
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = true;
return paid;
}

View file

@ -93,7 +93,7 @@ class EmbersmithEffect extends OneShotEffect<EmbersmithEffect> {
public boolean apply(Game game, Ability source) {
Cost cost = new GenericManaCost(1);
cost.clearPaid();
if (cost.pay(game, source.getId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(1, source.getId(), game, true, false);

View file

@ -106,7 +106,7 @@ class LeoninArbiterReplacementEffect extends ReplacementEffectImpl<LeoninArbiter
if ( arbiterTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
player.chooseUse(Outcome.Neutral, "Pay {2} to search your library?", game) )
{
arbiterTax.pay(game, this.getId(), event.getPlayerId(), false);
arbiterTax.pay(source, game, this.getId(), event.getPlayerId(), false);
if ( arbiterTax.isPaid() ) {
paidPlayers.add(event.getPlayerId());

View file

@ -89,7 +89,7 @@ class LifesmithEffect extends OneShotEffect<LifesmithEffect> {
public boolean apply(Game game, Ability source) {
Cost cost = new GenericManaCost(1);
cost.clearPaid();
if (cost.pay(game, source.getId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.gainLife(3, game);

View file

@ -104,7 +104,7 @@ class MyrBattlesphereAbility extends TriggeredAbilityImpl<MyrBattlesphereAbility
public boolean checkInterveningIfClause(Game game) {
if (costs.isPaid())
return true;
return costs.pay(game, this.getId(), this.getControllerId(), false);
return costs.pay(this, game, this.getId(), this.getControllerId(), false);
}
@Override

View file

@ -90,7 +90,7 @@ class MyrsmithEffect extends OneShotEffect<MyrsmithEffect> {
public boolean apply(Game game, Ability source) {
Cost cost = new GenericManaCost(1);
cost.clearPaid();
if (cost.pay(game, source.getId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
new MyrToken().putOntoBattlefield(game, source.getControllerId(), source.getControllerId());
}
return true;

View file

@ -158,7 +158,7 @@ class NimDeathmantleEffect extends OneShotEffect<NimDeathmantleEffect> {
if (player != null && equipment != null) {
if (player.chooseUse(Constants.Outcome.Benefit, equipment.getName() + " - Pay " + cost.getText() + "?", game)) {
cost.clearPaid();
if (cost.pay(game, source.getId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
UUID target = targetPointer.getFirst(source);
if (target != null && equipment != null) {
Card card = game.getCard(target);

View file

@ -121,7 +121,7 @@ class PainfulQuandryEffect extends OneShotEffect<PainfulQuandryEffect> {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
Cost cost = new DiscardTargetCost(new TargetCardInHand());
if (!cost.pay(game, player.getId(), player.getId(), false)) {
if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
player.loseLife(5, game);
}
return true;

View file

@ -117,7 +117,7 @@ class VigilForTheLostEffect extends OneShotEffect<VigilForTheLostEffect> {
public boolean apply(Game game, Ability source) {
ManaCostsImpl cost = new ManaCostsImpl("{X}");
cost.clearPaid();
if (cost.pay(game, source.getId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
Player player = game.getPlayer(source.getControllerId());
player.gainLife(((VariableCost)cost.getVariableCosts().get(0)).getAmount(), game);
return true;

View file

@ -92,7 +92,7 @@ class FlameblastDragonEffect extends OneShotEffect<FlameblastDragonEffect> {
if (player != null) {
if (player.chooseUse(Constants.Outcome.Damage, "Pay " + cost.getText() + "? If you do, Flameblast Dragon deals X damage to target creature or player", game)) {
cost.clearPaid();
if (cost.pay(game, source.getId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
int costX = ((VariableCost) cost.getVariableCosts().get(0)).getAmount();
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {

View file

@ -93,7 +93,7 @@ class PropagandaReplacementEffect extends ReplacementEffectImpl<PropagandaReplac
if ( propagandaTax.canPay(source.getSourceId(), event.getPlayerId(), game) &&
player.chooseUse(Constants.Outcome.Neutral, "Pay {2} to declare attacker?", game) )
{
propagandaTax.pay(game, this.getId(), event.getPlayerId(), false);
propagandaTax.pay(source, game, this.getId(), event.getPlayerId(), false);
if ( propagandaTax.isPaid() ) {
return false;

View file

@ -106,7 +106,7 @@ class TectonicEdgeCost extends CostImpl<TectonicEdgeCost> {
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = true;
return paid;
}