Small fix on mutate keyword

This commit is contained in:
Lyu Zong-Hong
2021-02-09 01:47:03 +09:00
parent 0eef317c42
commit 94de589620
3 changed files with 14 additions and 8 deletions

View File

@@ -18,14 +18,9 @@ public class MutateEffect extends SpellAbilityEffect {
@Override
public void resolve(SpellAbility sa) {
final Player p = sa.getActivatingPlayer();
final Card host = sa.getHostCard();
final Player p = host.getOwner();
final Game game = host.getGame();
// There shouldn't be any mutate abilities, but for now.
if (sa.isSpell()) {
host.setController(p, 0);
}
// 111.11. A copy of a permanent spell becomes a token as it resolves.
// The token has the characteristics of the spell that became that token.
// The token is not “created” for the purposes of any replacement effects or triggered abilities that refer to creating a token.
@@ -47,6 +42,11 @@ public class MutateEffect extends SpellAbilityEffect {
);
final boolean putOnTop = (topCard == host);
// There shouldn't be any mutate abilities, but for now.
if (sa.isSpell()) {
host.setController(p, 0);
}
host.setMergedToCard(target);
// If first time mutate, add target first.
if (target.getMergedCards().isEmpty()) {
@@ -64,8 +64,8 @@ public class MutateEffect extends SpellAbilityEffect {
target.setMutatedTimestamp(-1);
}
// Now add all abilities from bottom cards
final Long ts = game.getNextTimestamp();
if (topCard.getCurrentStateName() != CardStateName.FaceDown) {
final Long ts = game.getNextTimestamp();
final CardCloneStates mutatedStates = CardFactory.getMutatedCloneStates(target, sa);
target.addCloneState(mutatedStates, ts);
target.setMutatedTimestamp(ts);

View File

@@ -2681,6 +2681,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
// is this "Card" supposed to be a token?
public final boolean isToken() {
if (!getMergedCards().isEmpty()) {
return getMergedCards().get(0).token;
}
return token;
}
public final void setToken(boolean token0) {
@@ -2707,6 +2710,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
public final boolean isFaceDown() {
//return currentStateName == CardStateName.FaceDown;
if (!getMergedCards().isEmpty()) {
return getMergedCards().get(0).facedown;
}
return facedown;
}

View File

@@ -4283,7 +4283,7 @@ public class CardFactoryUtil {
final StringBuilder sbMutate = new StringBuilder();
sbMutate.append("SP$ Mutate | Cost$ ");
sbMutate.append(cost);
sbMutate.append(" | Mutate True | ValidTgts$ Creature.YouOwn+nonHuman");
sbMutate.append(" | Mutate True | ValidTgts$ Creature.sharesOwnerWith+nonHuman");
final SpellAbility sa = AbilityFactory.getAbility(sbMutate.toString(), card);
sa.setDescription("Mutate " + ManaCostParser.parse(cost) +