mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 05:52:06 -08:00
* Felhide Spiritbinder - Fixed a bug that the copied token did not have a supertype l(e.g. Legendary).
This commit is contained in:
parent
ae8da01ba8
commit
022587e6f9
4 changed files with 34 additions and 12 deletions
|
|
@ -13,17 +13,24 @@ import mage.util.CardUtil;
|
|||
public class DoIfCostPaid extends OneShotEffect<DoIfCostPaid> {
|
||||
private final OneShotEffect executingEffect;
|
||||
private final Cost cost;
|
||||
private String chooseUseText;
|
||||
|
||||
public DoIfCostPaid(OneShotEffect effect, Cost cost) {
|
||||
this(effect, cost, null);
|
||||
}
|
||||
|
||||
public DoIfCostPaid(OneShotEffect effect, Cost cost, String chooseUseText) {
|
||||
super(Outcome.Benefit);
|
||||
this.executingEffect = effect;
|
||||
this.cost = cost;
|
||||
this.chooseUseText = chooseUseText;
|
||||
}
|
||||
|
||||
public DoIfCostPaid(final DoIfCostPaid effect) {
|
||||
super(effect);
|
||||
this.executingEffect = (OneShotEffect) effect.executingEffect.copy();
|
||||
this.cost = effect.cost.copy();
|
||||
this.chooseUseText = effect.chooseUseText;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -31,7 +38,12 @@ public class DoIfCostPaid extends OneShotEffect<DoIfCostPaid> {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (player != null && mageObject != null) {
|
||||
String message = new StringBuilder(getCostText()).append(" and ").append(executingEffect.getText(source.getModes().getMode())).append("?").toString();
|
||||
String message;
|
||||
if (chooseUseText == null) {
|
||||
message = new StringBuilder(getCostText()).append(" and ").append(executingEffect.getText(source.getModes().getMode())).append("?").toString();
|
||||
} else {
|
||||
message = chooseUseText;
|
||||
}
|
||||
message = CardUtil.replaceSourceName(message, mageObject.getName());
|
||||
if (player.chooseUse(executingEffect.getOutcome(), message, game)) {
|
||||
cost.clearPaid();
|
||||
|
|
|
|||
|
|
@ -75,11 +75,12 @@ public class PermanentToken extends PermanentImpl<PermanentToken> {
|
|||
for (ManaCost cost: token.getManaCost()) {
|
||||
this.getManaCost().add(cost.copy());
|
||||
}
|
||||
this.cardType = token.getCardType();
|
||||
this.color = token.getColor();
|
||||
this.power = token.getPower();
|
||||
this.toughness = token.getToughness();
|
||||
this.subtype = token.getSubtype();
|
||||
this.cardType.addAll(token.getCardType());
|
||||
this.color = token.getColor().copy();
|
||||
this.power.initValue(token.getPower().getValue());
|
||||
this.toughness.initValue(token.getToughness().getValue());
|
||||
this.supertype.addAll(token.getSupertype());
|
||||
this.subtype.addAll(token.getSubtype());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -117,7 +117,12 @@ public class Token extends MageObjectImpl<Token> {
|
|||
|
||||
public boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking) {
|
||||
Card source = game.getCard(sourceId);
|
||||
String setCode = source != null ? source.getExpansionSetCode() : null;
|
||||
String setCode;
|
||||
if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) {
|
||||
setCode = this.getOriginalExpansionSetCode();
|
||||
} else {
|
||||
setCode = source != null ? source.getExpansionSetCode() : null;
|
||||
}
|
||||
GameEvent event = GameEvent.getEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount);
|
||||
if (!game.replaceEvent(event)) {
|
||||
amount = event.getAmount();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue