mirror of
https://github.com/correl/mage.git
synced 2025-04-10 09:11:04 -09:00
* Do unless any player pays - fixed that it asks to pay remaining players even after payed;
This commit is contained in:
parent
9022c76af6
commit
af4ec9b3e7
4 changed files with 36 additions and 27 deletions
Mage.Sets/src/mage/cards
Mage/src/main/java/mage/abilities/effects
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.r;
|
package mage.cards.r;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
|
@ -15,8 +13,9 @@ import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author L_J
|
* @author L_J
|
||||||
*/
|
*/
|
||||||
public final class RhysticScrying extends CardImpl {
|
public final class RhysticScrying extends CardImpl {
|
||||||
|
@ -61,13 +60,16 @@ class RhysticScryingEffect extends OneShotEffect {
|
||||||
// check if any player is willing to pay
|
// check if any player is willing to pay
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, "Pay " + cost.getText() + " for " + sourceObject.getLogName() + "?", source, game)) {
|
if (player != null && player.canRespond()
|
||||||
|
&& cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||||
|
&& player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " for " + sourceObject.getLogName() + "?", source, game)) {
|
||||||
cost.clearPaid();
|
cost.clearPaid();
|
||||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(player.getLogName() + " pays the cost for " + sourceObject.getLogName());
|
game.informPlayers(player.getLogName() + " pays the cost for " + sourceObject.getLogName());
|
||||||
}
|
}
|
||||||
doEffect = true;
|
doEffect = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -21,18 +19,15 @@ import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||||
import mage.abilities.keyword.ForestwalkAbility;
|
import mage.abilities.keyword.ForestwalkAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetArtifactPermanent;
|
import mage.target.common.TargetArtifactPermanent;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author L_J
|
* @author L_J
|
||||||
*/
|
*/
|
||||||
public final class ScarwoodBandits extends CardImpl {
|
public final class ScarwoodBandits extends CardImpl {
|
||||||
|
@ -117,13 +112,17 @@ class DoUnlessAnyOpponentPaysEffect extends OneShotEffect {
|
||||||
// check if any opponent is willing to pay
|
// check if any opponent is willing to pay
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null && !player.equals(controller) && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) {
|
if (player != null && player.canRespond()
|
||||||
|
&& !player.equals(controller)
|
||||||
|
&& cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||||
|
&& player.chooseUse(Outcome.Benefit, message, source, game)) {
|
||||||
cost.clearPaid();
|
cost.clearPaid();
|
||||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
|
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
|
||||||
}
|
}
|
||||||
doEffect = false;
|
doEffect = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.Mode;
|
||||||
import mage.abilities.costs.Cost;
|
import mage.abilities.costs.Cost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
@ -15,9 +13,11 @@ import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
import mage.util.ManaUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect {
|
public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect {
|
||||||
|
@ -65,34 +65,39 @@ public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
Cost costToPay;
|
Cost costToPay;
|
||||||
if (controller != null
|
String costValueMessage;
|
||||||
&& sourceObject != null) {
|
if (controller != null && sourceObject != null) {
|
||||||
if (cost != null) {
|
if (cost != null) {
|
||||||
costToPay = cost.copy();
|
costToPay = cost.copy();
|
||||||
|
costValueMessage = costToPay.getText();
|
||||||
} else {
|
} else {
|
||||||
costToPay = new GenericManaCost(genericMana.calculate(game, source, this));
|
costToPay = ManaUtil.createManaCost(genericMana, game, source, this);
|
||||||
|
costValueMessage = "{" + genericMana.calculate(game, source, this) + "}";
|
||||||
}
|
}
|
||||||
String message;
|
String message;
|
||||||
if (chooseUseText == null) {
|
if (chooseUseText == null) {
|
||||||
String effectText = executingEffects.getText(source.getModes().getMode());
|
String effectText = executingEffects.getText(source.getModes().getMode());
|
||||||
message = "Pay " + costToPay.getText() + " to prevent (" + effectText.substring(0, effectText.length() - 1) + ")?";
|
message = "Pay " + costValueMessage + " to prevent (" + effectText.substring(0, effectText.length() - 1) + ")?";
|
||||||
} else {
|
} else {
|
||||||
message = chooseUseText;
|
message = chooseUseText;
|
||||||
}
|
}
|
||||||
message = CardUtil.replaceSourceName(message, sourceObject.getName());
|
message = CardUtil.replaceSourceName(message, sourceObject.getName());
|
||||||
|
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
boolean doEffect = true;
|
boolean doEffect = true;
|
||||||
// check if any player is willing to pay
|
// check if any player is willing to pay
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null
|
if (player != null && player.canRespond()
|
||||||
&& costToPay.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) {
|
&& costToPay.canPay(source, source.getSourceId(), player.getId(), game)
|
||||||
|
&& player.chooseUse(Outcome.Detriment, message, source, game)) {
|
||||||
costToPay.clearPaid();
|
costToPay.clearPaid();
|
||||||
if (costToPay.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
if (costToPay.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
|
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
|
||||||
}
|
}
|
||||||
doEffect = false;
|
doEffect = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.abilities.effects.mana;
|
package mage.abilities.effects.mana;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -19,8 +16,11 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class DoUnlessAnyPlayerPaysManaEffect extends ManaEffect {
|
public class DoUnlessAnyPlayerPaysManaEffect extends ManaEffect {
|
||||||
|
@ -53,13 +53,16 @@ public class DoUnlessAnyPlayerPaysManaEffect extends ManaEffect {
|
||||||
// check if any player is willing to pay
|
// check if any player is willing to pay
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) {
|
if (player != null && player.canRespond()
|
||||||
|
&& cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||||
|
&& player.chooseUse(Outcome.Detriment, message, source, game)) {
|
||||||
cost.clearPaid();
|
cost.clearPaid();
|
||||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
|
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
|
||||||
}
|
}
|
||||||
doEffect = false;
|
doEffect = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue