mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
Paralyze implemented
This commit is contained in:
parent
3ea167857c
commit
ee65d08160
8 changed files with 432 additions and 4 deletions
|
|
@ -14,7 +14,7 @@ import mage.players.Player;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
public class DoIfCostPaid extends OneShotEffect {
|
||||
private final Effect executingEffect;
|
||||
protected final Effect executingEffect;
|
||||
private final Cost cost;
|
||||
private String chooseUseText;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player player = getPayingPlayer(game, source);
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (player != null && mageObject != null) {
|
||||
String message;
|
||||
|
|
@ -50,7 +50,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
message = CardUtil.replaceSourceName(message, mageObject.getName());
|
||||
if (cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(executingEffect.getOutcome(), message, game)) {
|
||||
cost.clearPaid();
|
||||
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
executingEffect.setTargetPointer(this.targetPointer);
|
||||
if (executingEffect instanceof OneShotEffect) {
|
||||
if (!(executingEffect instanceof PostResolveEffect)) {
|
||||
|
|
@ -67,6 +67,10 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected Player getPayingPlayer(Game game, Ability source) {
|
||||
return game.getPlayer(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (!staticText.isEmpty()) {
|
||||
|
|
@ -75,7 +79,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
return new StringBuilder("you may ").append(getCostText()).append(". If you do, ").append(executingEffect.getText(mode)).toString();
|
||||
}
|
||||
|
||||
private String getCostText() {
|
||||
protected String getCostText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String costText = cost.getText();
|
||||
if (costText != null &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue