initial commit for changing CDAs interacting with Scarab God/God-Pharaoh's gift (untested)(#4082)

This commit is contained in:
Evan Kranzler 2017-10-02 12:47:18 -04:00
parent aa6e4dfd6a
commit 6b2c20b29e
9 changed files with 28 additions and 5 deletions

View file

@ -111,6 +111,7 @@ class GodPharaohsGiftEffect extends OneShotEffect {
&& cardChosen.moveToExile(exileId, sourceObject.getIdName(), source.getSourceId(), game)) { && cardChosen.moveToExile(exileId, sourceObject.getIdName(), source.getSourceId(), game)) {
EmptyToken token = new EmptyToken(); EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(cardChosen); CardUtil.copyTo(token).from(cardChosen);
token.removePTCDA();
token.getPower().modifyBaseValue(4); token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4); token.getToughness().modifyBaseValue(4);
token.getColor(game).setColor(ObjectColor.BLACK); token.getColor(game).setColor(ObjectColor.BLACK);

View file

@ -103,6 +103,7 @@ class HourOfEternityEffect extends OneShotEffect {
if (game.getState().getZone(card.getId()) == Zone.EXILED) { if (game.getState().getZone(card.getId()) == Zone.EXILED) {
EmptyToken token = new EmptyToken(); EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); CardUtil.copyTo(token).from(card);
token.removePTCDA();
token.getPower().modifyBaseValue(4); token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4); token.getToughness().modifyBaseValue(4);
token.getColor(game).setColor(ObjectColor.BLACK); token.getColor(game).setColor(ObjectColor.BLACK);

View file

@ -72,6 +72,7 @@ class QuicksilverGargantuanApplyToPermanent extends ApplyToPermanent {
@Override @Override
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
permanent.removePTCDA();
permanent.getPower().modifyBaseValue(7); permanent.getPower().modifyBaseValue(7);
permanent.getToughness().modifyBaseValue(7); permanent.getToughness().modifyBaseValue(7);
return true; return true;
@ -79,6 +80,7 @@ class QuicksilverGargantuanApplyToPermanent extends ApplyToPermanent {
@Override @Override
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
mageObject.removePTCDA();
mageObject.getPower().modifyBaseValue(7); mageObject.getPower().modifyBaseValue(7);
mageObject.getToughness().modifyBaseValue(7); mageObject.getToughness().modifyBaseValue(7);
return true; return true;

View file

@ -73,7 +73,7 @@ public class Tarmogoyf extends CardImpl {
class TarmogoyfEffect extends ContinuousEffectImpl { class TarmogoyfEffect extends ContinuousEffectImpl {
public TarmogoyfEffect() { public TarmogoyfEffect() {
super(Duration.EndOfGame, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); super(Duration.EndOfGame, Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, Outcome.BoostCreature);
staticText = "{this}'s power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1"; staticText = "{this}'s power is equal to the number of card types among cards in all graveyards and its toughness is equal to that number plus 1";
} }

View file

@ -17,8 +17,11 @@ import mage.util.SubTypeList;
import java.io.Serializable; import java.io.Serializable;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
public interface MageObject extends MageItem, Serializable { public interface MageObject extends MageItem, Serializable {
@ -198,6 +201,8 @@ public interface MageObject extends MageItem, Serializable {
TextPart addTextPart(TextPart textPart); TextPart addTextPart(TextPart textPart);
public void removePTCDA();
default void changeSubType(SubType fromSubType, SubType toSubType) { default void changeSubType(SubType fromSubType, SubType toSubType) {
} }

View file

@ -29,6 +29,7 @@ package mage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Abilities; import mage.abilities.Abilities;
@ -38,12 +39,15 @@ import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.keyword.ChangelingAbility; import mage.abilities.keyword.ChangelingAbility;
import mage.abilities.mana.ActivatedManaAbilityImpl; import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.text.TextPart; import mage.abilities.text.TextPart;
import mage.abilities.text.TextPartSubType; import mage.abilities.text.TextPartSubType;
import mage.cards.FrameStyle; import mage.cards.FrameStyle;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubLayer;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SubTypeSet; import mage.constants.SubTypeSet;
import mage.constants.SuperType; import mage.constants.SuperType;
@ -338,4 +342,15 @@ public abstract class MageObjectImpl implements MageObject {
} }
} }
public void removePTCDA() {
for (Iterator<Ability> iter = this.getAbilities().iterator(); iter.hasNext();) {
Ability ability = iter.next();
for (Effect effect : ability.getEffects()) {
if (effect instanceof ContinuousEffect && ((ContinuousEffect) effect).getSublayer() == SubLayer.CharacteristicDefining_7a) {
iter.remove();
break;
}
}
}
}
} }

View file

@ -233,9 +233,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
token.addAbility(FlyingAbility.getInstance()); token.addAbility(FlyingAbility.getInstance());
} }
if (tokenPower != Integer.MIN_VALUE) { if (tokenPower != Integer.MIN_VALUE) {
token.removePTCDA();
token.getPower().modifyBaseValue(tokenPower); token.getPower().modifyBaseValue(tokenPower);
} }
if (tokenToughness != Integer.MIN_VALUE) { if (tokenToughness != Integer.MIN_VALUE) {
token.removePTCDA();
token.getToughness().modifyBaseValue(tokenToughness); token.getToughness().modifyBaseValue(tokenToughness);
} }
if (additionalSubType != null && !token.hasSubtype(additionalSubType, game)) { if (additionalSubType != null && !token.hasSubtype(additionalSubType, game)) {

View file

@ -119,6 +119,7 @@ class EternalizeEffect extends OneShotEffect {
token.getSubtype(game).add(0, SubType.ZOMBIE); token.getSubtype(game).add(0, SubType.ZOMBIE);
} }
token.getManaCost().clear(); token.getManaCost().clear();
token.removePTCDA();
token.getPower().modifyBaseValue(4); token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4); token.getToughness().modifyBaseValue(4);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ETERNALIZED_CREATURE, token.getId(), source.getSourceId(), controller.getId())); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ETERNALIZED_CREATURE, token.getId(), source.getSourceId(), controller.getId()));

View file

@ -310,8 +310,4 @@ public class Token extends MageObjectImpl {
this.setExpansionSetCodeForImage(setCode); this.setExpansionSetCodeForImage(setCode);
return true; return true;
} }
} }