mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Some small improvements to framework classes.
This commit is contained in:
parent
8561234793
commit
d2c2c9b4a4
3 changed files with 10 additions and 5 deletions
|
@ -74,7 +74,7 @@ public class RevealTargetFromHandCost extends CostImpl<RevealTargetFromHandCost>
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
paid = true;
|
paid = true;
|
||||||
}
|
}
|
||||||
player.revealCards("Revealed card", cards, game); // this is not a boolean
|
player.revealCards("card cost", cards, game); // this is not a boolean
|
||||||
return paid;
|
return paid;
|
||||||
}
|
}
|
||||||
paid = false;
|
paid = false;
|
||||||
|
|
|
@ -33,9 +33,13 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect<SacrificeSour
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && permanent != null) {
|
if (player != null && permanent != null) {
|
||||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() /* + " or sacrifice " + permanent.getName() */ + "?", game)) {
|
StringBuilder sb = new StringBuilder(cost.getText()).append("?");
|
||||||
|
if (!sb.toString().toLowerCase().startsWith("exile ") && !sb.toString().toLowerCase().startsWith("return ") ) {
|
||||||
|
sb.insert(0, "Pay ");
|
||||||
|
}
|
||||||
|
if (player.chooseUse(Outcome.Benefit, sb.toString(), game)) {
|
||||||
cost.clearPaid();
|
cost.clearPaid();
|
||||||
if (cost.pay(source, game, source.getId(), source.getControllerId(), false))
|
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
|
@ -53,7 +57,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect<SacrificeSour
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
StringBuilder sb = new StringBuilder("sacrifice {this} unless you ");
|
StringBuilder sb = new StringBuilder("sacrifice {this} unless you ");
|
||||||
String costText = cost.getText();
|
String costText = cost.getText();
|
||||||
if (costText.toLowerCase().startsWith("discard") || costText.toLowerCase().startsWith("remove") || costText.toLowerCase().startsWith("return")) {
|
if (costText.toLowerCase().startsWith("discard") || costText.toLowerCase().startsWith("remove") || costText.toLowerCase().startsWith("return") || costText.toLowerCase().startsWith("exile")) {
|
||||||
sb.append(costText.substring(0, 1).toLowerCase());
|
sb.append(costText.substring(0, 1).toLowerCase());
|
||||||
sb.append(costText.substring(1));
|
sb.append(costText.substring(1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,8 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect<TapSourceUnlessPays
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && permanent != null) {
|
if (player != null && permanent != null) {
|
||||||
if (player.chooseUse(Outcome.Benefit, cost.getText() + " or " + permanent.getName() + " comes into play tapped?", game)) {
|
if (cost.canPay(source.getSourceId(), source.getControllerId(), game)
|
||||||
|
&& player.chooseUse(Outcome.Benefit, cost.getText() + " or " + permanent.getName() + " comes into play tapped?", game)) {
|
||||||
cost.clearPaid();
|
cost.clearPaid();
|
||||||
if (cost.pay(source, game, source.getId(), source.getControllerId(), false))
|
if (cost.pay(source, game, source.getId(), source.getControllerId(), false))
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue