mirror of
https://github.com/correl/mage.git
synced 2025-04-03 17:00:16 -09:00
Little refactor, additional logs for CheckPlayableState error;
This commit is contained in:
parent
7b298f84a7
commit
2efdb464fc
5 changed files with 12 additions and 9 deletions
Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human
Mage.Sets/src/mage/cards
Mage/src/main/java/mage/abilities/costs/mana
|
@ -2609,6 +2609,10 @@ public class HumanPlayer extends PlayerImpl {
|
|||
private boolean gameInCheckPlayableState(Game game, boolean ignoreWarning) {
|
||||
if (game.inCheckPlayableState()) {
|
||||
if (!ignoreWarning) {
|
||||
logger.warn(String.format("Current stack: %d - %s",
|
||||
game.getStack().size(),
|
||||
game.getStack().stream().map(Object::toString).collect(Collectors.joining(", "))
|
||||
));
|
||||
logger.warn("Player interaction in checkPlayableState", new Throwable());
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -63,7 +63,7 @@ class FadeAwayEffect extends OneShotEffect {
|
|||
String message = "For how many creatures will you pay (up to " + creaturesNumber + ")?";
|
||||
int payAmount = 0;
|
||||
boolean paid = false;
|
||||
while (!paid) {
|
||||
while (player.canRespond() && !paid) {
|
||||
payAmount = player.getAmount(0, creaturesNumber, message, game);
|
||||
ManaCostsImpl cost = new ManaCostsImpl();
|
||||
cost.add(new GenericManaCost(payAmount));
|
||||
|
|
|
@ -84,13 +84,12 @@ class ShroudedLoreEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
if (!done) {
|
||||
done = true;
|
||||
if (cost.canPay(source, source, you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {B} to choose a different card ?", source, game)) {
|
||||
cost.clearPaid();
|
||||
if (!cost.pay(source, game, source, you.getId(), false, null)) {
|
||||
done = true;
|
||||
if (cost.pay(source, game, source, you.getId(), false, null)) {
|
||||
done = false;
|
||||
}
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
|
|||
assignPayment(game, ability, player.getManaPool(), costToPay != null ? costToPay : this);
|
||||
}
|
||||
game.getState().getSpecialActions().removeManaActions();
|
||||
while (!isPaid()) {
|
||||
while (player.canRespond() && !isPaid()) {
|
||||
ManaCost unpaid = this.getUnpaid();
|
||||
String promptText = ManaUtil.addSpecialManaPayAbilities(ability, game, unpaid);
|
||||
if (player.playMana(ability, unpaid, promptText, game)) {
|
||||
|
@ -251,7 +251,7 @@ public abstract class ManaCostImpl extends CostImpl implements ManaCost {
|
|||
}
|
||||
game.getState().getSpecialActions().removeManaActions();
|
||||
}
|
||||
return true;
|
||||
return isPaid();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -128,7 +128,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
assignPayment(game, ability, player.getManaPool(), this);
|
||||
}
|
||||
game.getState().getSpecialActions().removeManaActions();
|
||||
while (!isPaid()) {
|
||||
while (player.canRespond() && !isPaid()) {
|
||||
ManaCost unpaid = this.getUnpaid();
|
||||
String promptText = ManaUtil.addSpecialManaPayAbilities(ability, game, unpaid);
|
||||
if (player.playMana(ability, unpaid, promptText, game)) {
|
||||
|
@ -138,7 +138,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
}
|
||||
game.getState().getSpecialActions().removeManaActions();
|
||||
}
|
||||
return true;
|
||||
return isPaid();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue