From c033868795ea3e1b5b862cc038bfed3c60ce3b13 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 16 Apr 2017 13:04:38 +0200 Subject: [PATCH] [AKH] Added Vizier of Many Faces. --- .../src/mage/cards/a/ArtisanOfForms.java | 9 +- Mage.Sets/src/mage/cards/c/Cryptoplasm.java | 9 +- .../src/mage/cards/d/DacksDuplicate.java | 10 +- .../src/mage/cards/d/DimirDoppelganger.java | 9 +- Mage.Sets/src/mage/cards/e/EvilTwin.java | 9 +- Mage.Sets/src/mage/cards/g/Gigantoplasm.java | 9 +- .../mage/cards/l/LazavDimirMastermind.java | 6 +- .../src/mage/cards/p/PhantasmalImage.java | 7 +- .../src/mage/cards/p/PhyrexianMetamorph.java | 6 +- .../mage/cards/q/QuicksilverGargantuan.java | 6 +- .../mage/cards/s/SakashimaTheImpostor.java | 8 +- .../src/mage/cards/v/VesuvanDoppelganger.java | 4 +- .../src/mage/cards/v/VesuvanShapeshifter.java | 5 +- .../src/mage/cards/v/VizierOfManyFaces.java | 156 ++++++++++++++++++ Mage.Sets/src/mage/sets/Amonkhet.java | 1 + .../mage/abilities/keyword/EmbalmAbility.java | 2 + Mage/src/main/java/mage/game/GameImpl.java | 2 +- .../main/java/mage/game/events/GameEvent.java | 1 + .../util/functions/ApplyToMageObject.java | 4 +- .../mage/util/functions/ApplyToPermanent.java | 4 +- .../watchers/common/CreaturesDiedWatcher.java | 1 - .../PermanentsEnteredBattlefieldWatcher.java | 1 - 22 files changed, 213 insertions(+), 56 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/v/VizierOfManyFaces.java diff --git a/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java b/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java index 7520507587..2be9c0d280 100644 --- a/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java +++ b/Mage.Sets/src/mage/cards/a/ArtisanOfForms.java @@ -27,6 +27,7 @@ */ package mage.cards.a; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -42,8 +43,6 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.util.functions.ApplyToPermanent; -import java.util.UUID; - /** * * @author LevelX2 @@ -51,7 +50,7 @@ import java.util.UUID; public class ArtisanOfForms extends CardImpl { public ArtisanOfForms(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add("Human"); this.subtype.add("Wizard"); @@ -79,7 +78,7 @@ public class ArtisanOfForms extends CardImpl { class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent { @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent()); effect.setText("have {this} become a copy of target creature and gain this ability"); mageObject.getAbilities().add(new HeroicAbility(effect, true)); @@ -87,7 +86,7 @@ class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent { } @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { Effect effect = new CopyPermanentEffect(new ArtisanOfFormsApplyToPermanent()); effect.setText("have {this} become a copy of target creature and gain this ability"); permanent.addAbility(new HeroicAbility(effect, true), game); diff --git a/Mage.Sets/src/mage/cards/c/Cryptoplasm.java b/Mage.Sets/src/mage/cards/c/Cryptoplasm.java index 9ce1d174c4..6a01c6f0a7 100644 --- a/Mage.Sets/src/mage/cards/c/Cryptoplasm.java +++ b/Mage.Sets/src/mage/cards/c/Cryptoplasm.java @@ -27,6 +27,7 @@ */ package mage.cards.c; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -44,8 +45,6 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.util.functions.ApplyToPermanent; -import java.util.UUID; - /** * @author Loki */ @@ -58,7 +57,7 @@ public class Cryptoplasm extends CardImpl { } public Cryptoplasm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); this.subtype.add("Shapeshifter"); this.power = new MageInt(2); @@ -103,7 +102,7 @@ class CryptoplasmEffect extends OneShotEffect { if (creatureToCopy != null) { ApplyToPermanent applier = new ApplyToPermanent() { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true); upkeepAbility.addTarget(new TargetCreaturePermanent()); permanent.addAbility(upkeepAbility, source.getSourceId(), game); @@ -111,7 +110,7 @@ class CryptoplasmEffect extends OneShotEffect { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true); upkeepAbility.addTarget(new TargetCreaturePermanent()); mageObject.getAbilities().add(upkeepAbility); diff --git a/Mage.Sets/src/mage/cards/d/DacksDuplicate.java b/Mage.Sets/src/mage/cards/d/DacksDuplicate.java index eb51d75432..2ad15c3f0c 100644 --- a/Mage.Sets/src/mage/cards/d/DacksDuplicate.java +++ b/Mage.Sets/src/mage/cards/d/DacksDuplicate.java @@ -27,8 +27,10 @@ */ package mage.cards.d; +import java.util.UUID; import mage.MageInt; import mage.MageObject; +import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.common.CopyPermanentEffect; @@ -42,8 +44,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.util.functions.ApplyToPermanent; -import java.util.UUID; - /** * * @author LevelX2 @@ -51,7 +51,7 @@ import java.util.UUID; public class DacksDuplicate extends CardImpl { public DacksDuplicate(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}"); this.subtype.add("Shapeshifter"); this.power = new MageInt(0); @@ -76,7 +76,7 @@ public class DacksDuplicate extends CardImpl { class DacksDuplicateApplyToPermanent extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { /** * 29/05/2014 The ability of Dack’s Duplicate doesn’t target the * creature. @@ -87,7 +87,7 @@ class DacksDuplicateApplyToPermanent extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { mageObject.getAbilities().add(new DethroneAbility()); mageObject.getAbilities().add(HasteAbility.getInstance()); return true; diff --git a/Mage.Sets/src/mage/cards/d/DimirDoppelganger.java b/Mage.Sets/src/mage/cards/d/DimirDoppelganger.java index f81ac33312..c51dec4e3a 100644 --- a/Mage.Sets/src/mage/cards/d/DimirDoppelganger.java +++ b/Mage.Sets/src/mage/cards/d/DimirDoppelganger.java @@ -27,6 +27,7 @@ */ package mage.cards.d; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -47,8 +48,6 @@ import mage.players.Player; import mage.target.common.TargetCardInGraveyard; import mage.util.functions.ApplyToPermanent; -import java.util.UUID; - /** * * @author jeffwadsworth @@ -110,7 +109,7 @@ class DimirDoppelgangerEffect extends OneShotEffect { newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game); newBluePrint.assignNewId(); ApplyToPermanent applier = new DimirDoppelgangerApplier(); - applier.apply(game, newBluePrint); + applier.apply(game, newBluePrint, source); CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, dimirDoppelganger.getId()); copyEffect.newId(); copyEffect.setApplier(applier); @@ -127,7 +126,7 @@ class DimirDoppelgangerEffect extends OneShotEffect { class DimirDoppelgangerApplier extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source) { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}")); ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard"))); permanent.getAbilities().add(ability); @@ -135,7 +134,7 @@ class DimirDoppelgangerApplier extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source) { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}")); ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard"))); mageObject.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/e/EvilTwin.java b/Mage.Sets/src/mage/cards/e/EvilTwin.java index 14c1201f6b..22bbcd574a 100644 --- a/Mage.Sets/src/mage/cards/e/EvilTwin.java +++ b/Mage.Sets/src/mage/cards/e/EvilTwin.java @@ -27,6 +27,7 @@ */ package mage.cards.e; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -49,8 +50,6 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.util.functions.ApplyToPermanent; -import java.util.UUID; - /** * * @author BetaSteward @@ -58,7 +57,7 @@ import java.util.UUID; public class EvilTwin extends CardImpl { public EvilTwin(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}"); this.subtype.add("Shapeshifter"); this.power = new MageInt(0); @@ -90,7 +89,7 @@ class EvilTwinApplyToPermanent extends ApplyToPermanent { } @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{U}{B}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filter)); @@ -99,7 +98,7 @@ class EvilTwinApplyToPermanent extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{U}{B}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/cards/g/Gigantoplasm.java b/Mage.Sets/src/mage/cards/g/Gigantoplasm.java index 8c123ec4ad..0f186bf7b0 100644 --- a/Mage.Sets/src/mage/cards/g/Gigantoplasm.java +++ b/Mage.Sets/src/mage/cards/g/Gigantoplasm.java @@ -27,6 +27,7 @@ */ package mage.cards.g; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -49,8 +50,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.util.functions.ApplyToPermanent; -import java.util.UUID; - /** * * @author fireshoes @@ -58,7 +57,7 @@ import java.util.UUID; public class Gigantoplasm extends CardImpl { public Gigantoplasm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.subtype.add("Shapeshifter"); this.power = new MageInt(0); this.toughness = new MageInt(0); @@ -82,7 +81,7 @@ public class Gigantoplasm extends CardImpl { class GigantoplasmApplyToPermanent extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { DynamicValue variableMana = new ManacostVariableValue(); Effect effect = new SetPowerToughnessSourceEffect(variableMana, Duration.WhileOnBattlefield, SubLayer.SetPT_7b); effect.setText("This creature has base power and toughness X/X"); @@ -92,7 +91,7 @@ class GigantoplasmApplyToPermanent extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { DynamicValue variableMana = new ManacostVariableValue(); Effect effect = new SetPowerToughnessSourceEffect(variableMana, Duration.WhileOnBattlefield, SubLayer.SetPT_7b); effect.setText("This creature has base power and toughness X/X"); diff --git a/Mage.Sets/src/mage/cards/l/LazavDimirMastermind.java b/Mage.Sets/src/mage/cards/l/LazavDimirMastermind.java index 89238d190c..a83c8fbd7c 100644 --- a/Mage.Sets/src/mage/cards/l/LazavDimirMastermind.java +++ b/Mage.Sets/src/mage/cards/l/LazavDimirMastermind.java @@ -109,7 +109,7 @@ class LazavDimirMastermindEffect extends OneShotEffect { newBluePrint = new PermanentCard((Card) copyFromCard, source.getControllerId(), game); newBluePrint.assignNewId(); ApplyToPermanent applier = new LazavDimirMastermindApplier(); - applier.apply(game, newBluePrint); + applier.apply(game, newBluePrint, source); CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, lazavDimirMastermind.getId()); copyEffect.newId(); copyEffect.setApplier(applier); @@ -126,7 +126,7 @@ class LazavDimirMastermindEffect extends OneShotEffect { class LazavDimirMastermindApplier extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source) { Ability ability = new PutCardIntoGraveFromAnywhereAllTriggeredAbility( new LazavDimirMastermindEffect(), true, new FilterCreatureCard("a creature card"), @@ -139,7 +139,7 @@ class LazavDimirMastermindApplier extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source) { Ability ability = new PutCardIntoGraveFromAnywhereAllTriggeredAbility( new LazavDimirMastermindEffect(), true, new FilterCreatureCard("a creature card"), diff --git a/Mage.Sets/src/mage/cards/p/PhantasmalImage.java b/Mage.Sets/src/mage/cards/p/PhantasmalImage.java index 4d61e41c0e..e7e9809f7f 100644 --- a/Mage.Sets/src/mage/cards/p/PhantasmalImage.java +++ b/Mage.Sets/src/mage/cards/p/PhantasmalImage.java @@ -30,6 +30,7 @@ package mage.cards.p; import java.util.UUID; import mage.MageInt; import mage.MageObject; +import mage.abilities.Ability; import mage.abilities.common.BecomesTargetTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.effects.Effect; @@ -53,7 +54,7 @@ public class PhantasmalImage extends CardImpl { ApplyToPermanent phantasmalImageApplier = new ApplyToPermanent() { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { if (!permanent.getSubtype(game).contains("Illusion")) { permanent.getSubtype(game).add("Illusion"); } @@ -64,7 +65,7 @@ public class PhantasmalImage extends CardImpl { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { if (!mageObject.getSubtype(game).contains("Illusion")) { mageObject.getSubtype(game).add("Illusion"); } @@ -76,7 +77,7 @@ public class PhantasmalImage extends CardImpl { }; public PhantasmalImage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add("Illusion"); this.color.setBlue(true); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java b/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java index 805cda4b1c..26c3605d00 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianMetamorph.java @@ -69,12 +69,12 @@ public class PhyrexianMetamorph extends CardImpl { ApplyToPermanent phyrexianMetamorphApplier = new ApplyToPermanent() { @Override - public boolean apply(Game game, Permanent permanent) { - return apply(game, (MageObject) permanent); + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { + return apply(game, (MageObject) permanent, source, copyToObjectId); } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { if (!mageObject.isArtifact()) { mageObject.addCardType(CardType.ARTIFACT); } diff --git a/Mage.Sets/src/mage/cards/q/QuicksilverGargantuan.java b/Mage.Sets/src/mage/cards/q/QuicksilverGargantuan.java index 35a62c8d1a..370facf9dd 100644 --- a/Mage.Sets/src/mage/cards/q/QuicksilverGargantuan.java +++ b/Mage.Sets/src/mage/cards/q/QuicksilverGargantuan.java @@ -46,7 +46,7 @@ import mage.util.functions.ApplyToPermanent; public class QuicksilverGargantuan extends CardImpl { public QuicksilverGargantuan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}"); this.subtype.add("Shapeshifter"); this.power = new MageInt(7); @@ -70,14 +70,14 @@ public class QuicksilverGargantuan extends CardImpl { class QuicksilverGargantuanApplyToPermanent extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { permanent.getPower().modifyBaseValue(7); permanent.getToughness().modifyBaseValue(7); return true; } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { mageObject.getPower().modifyBaseValue(7); mageObject.getToughness().modifyBaseValue(7); return true; diff --git a/Mage.Sets/src/mage/cards/s/SakashimaTheImpostor.java b/Mage.Sets/src/mage/cards/s/SakashimaTheImpostor.java index ee8f447117..79066d5b54 100644 --- a/Mage.Sets/src/mage/cards/s/SakashimaTheImpostor.java +++ b/Mage.Sets/src/mage/cards/s/SakashimaTheImpostor.java @@ -28,9 +28,9 @@ package mage.cards.s; import java.util.UUID; - import mage.MageInt; import mage.MageObject; +import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; @@ -81,7 +81,7 @@ public class SakashimaTheImpostor extends CardImpl { class SakashimaTheImpostorApplier extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { permanent.addSuperType(SuperType.LEGENDARY); permanent.setName("Sakashima the Impostor"); @@ -94,8 +94,8 @@ class SakashimaTheImpostorApplier extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { - mageObject.addSuperType(SuperType.LEGENDARY); + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { + mageObject.addSuperType(SuperType.LEGENDARY); mageObject.setName("Sakashima the Impostor"); // {2}{U}{U}: Return Sakashima the Impostor to its owner's hand at the beginning of the next end step mageObject.getAbilities().add(new SimpleActivatedAbility(Zone.BATTLEFIELD, diff --git a/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java b/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java index d911fd2833..49adeaeb51 100644 --- a/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java +++ b/Mage.Sets/src/mage/cards/v/VesuvanDoppelganger.java @@ -113,7 +113,7 @@ class VesuvanDoppelgangerCopyEffect extends OneShotEffect { if (copyFromPermanent != null) { game.copyPermanent(copyFromPermanent, sourcePermanent.getId(), source, new ApplyToPermanent() { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { permanent.getColor(game).setColor(sourcePermanent.getColor(game)); permanent.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false, rule2)); @@ -121,7 +121,7 @@ class VesuvanDoppelgangerCopyEffect extends OneShotEffect { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { mageObject.getColor(game).setColor(sourcePermanent.getColor(game)); mageObject.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new VesuvanDoppelgangerCopyEffect(), TargetController.YOU, true, false, rule2)); diff --git a/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java b/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java index 2c03aeaa70..355654e9d1 100644 --- a/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java +++ b/Mage.Sets/src/mage/cards/v/VesuvanShapeshifter.java @@ -28,7 +28,6 @@ package mage.cards.v; import java.util.UUID; - import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -105,7 +104,7 @@ public class VesuvanShapeshifter extends CardImpl { class VesuvanShapeShifterFaceUpApplier extends ApplyToPermanent { @Override - public boolean apply(Game game, Permanent permanent) { + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { Effect effect = new VesuvanShapeshifterFaceDownEffect(); Ability ability = new BeginningOfUpkeepTriggeredAbility(effect, TargetController.YOU, true); permanent.getAbilities().add(ability); @@ -114,7 +113,7 @@ class VesuvanShapeShifterFaceUpApplier extends ApplyToPermanent { } @Override - public boolean apply(Game game, MageObject mageObject) { + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { Effect effect = new VesuvanShapeshifterFaceDownEffect(); Ability ability = new BeginningOfUpkeepTriggeredAbility(effect, TargetController.YOU, true); mageObject.getAbilities().add(ability); diff --git a/Mage.Sets/src/mage/cards/v/VizierOfManyFaces.java b/Mage.Sets/src/mage/cards/v/VizierOfManyFaces.java new file mode 100644 index 0000000000..62ae1b9d40 --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VizierOfManyFaces.java @@ -0,0 +1,156 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.v; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.MageObjectReference; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CopyPermanentEffect; +import mage.abilities.keyword.EmbalmAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; +import mage.util.functions.ApplyToPermanent; +import mage.watchers.Watcher; + +/** + * + * @author LevelX2 + */ +public class VizierOfManyFaces extends CardImpl { + + public VizierOfManyFaces(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); + + this.subtype.add("Shapeshifter"); + this.subtype.add("Cleric"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + // You may have Vizier of Many Faces enter the battlefield as a copy of any creature on the battlefield, except if Vizier of Many Faces was embalmed, the token has no mana cost, it's white, and it's a Zombie in addition to its other types. + Effect effect = new CopyPermanentEffect(new VizierOfManyFacesApplyToPermanent()); + effect.setText("as a copy of any creature on the battlefield, except if {this} was embalmed, the token has no mana cost, it's white, and it's a Zombie in addition to its other types."); + this.addAbility(new EntersBattlefieldAbility(effect, true), new EmbalmedThisTurnWatcher()); + + // Embalm {3}{U}{U} + this.addAbility(new EmbalmAbility(new ManaCostsImpl("{3}{U}{U}"), this)); + + } + + public VizierOfManyFaces(final VizierOfManyFaces card) { + super(card); + } + + @Override + public VizierOfManyFaces copy() { + return new VizierOfManyFaces(this); + } +} + +class VizierOfManyFacesApplyToPermanent extends ApplyToPermanent { + + @Override + public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) { + return true; + } + + @Override + public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { + for (Permanent entering : game.getPermanentsEntering().values()) { + if (entering.getId().equals(copyToObjectId) && entering instanceof PermanentToken) { + UUID originalCardId = ((PermanentToken) entering).getToken().getCopySourceCard().getId(); + EmbalmedThisTurnWatcher watcher = (EmbalmedThisTurnWatcher) game.getState().getWatchers().get(EmbalmedThisTurnWatcher.class.getName()); + if (watcher != null) { + for (MageObjectReference mor : watcher.getEmbalmedThisTurnCards()) { + if (mor.getSourceId().equals(originalCardId) && game.getState().getZoneChangeCounter(originalCardId) == mor.getZoneChangeCounter()) { + permanent.getManaCost().clear(); + if (!permanent.getSubtype(game).contains("Zombie")) { + permanent.getSubtype(game).add("Zombie"); + } + permanent.getColor(game).setColor(ObjectColor.WHITE); + + } + } + } + } + } + return true; + } + +} + +class EmbalmedThisTurnWatcher extends Watcher { + + private final Set embalmedThisTurnTokens; + + public EmbalmedThisTurnWatcher() { + super(EmbalmedThisTurnWatcher.class.getName(), WatcherScope.GAME); + embalmedThisTurnTokens = new HashSet<>(); + } + + public EmbalmedThisTurnWatcher(final EmbalmedThisTurnWatcher watcher) { + super(watcher); + embalmedThisTurnTokens = new HashSet<>(watcher.embalmedThisTurnTokens); + } + + @Override + public Watcher copy() { + return new EmbalmedThisTurnWatcher(this); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.EMBALMED_CREATURE) { + this.embalmedThisTurnTokens.add(new MageObjectReference(event.getSourceId(), game)); + } + } + + public Set getEmbalmedThisTurnCards() { + return this.embalmedThisTurnTokens; + } + + @Override + public void reset() { + super.reset(); + embalmedThisTurnTokens.clear(); + } + +} diff --git a/Mage.Sets/src/mage/sets/Amonkhet.java b/Mage.Sets/src/mage/sets/Amonkhet.java index 58030e1113..1084d1903d 100644 --- a/Mage.Sets/src/mage/sets/Amonkhet.java +++ b/Mage.Sets/src/mage/sets/Amonkhet.java @@ -327,6 +327,7 @@ public class Amonkhet extends ExpansionSet { cards.add(new SetCardInfo("Unwavering Initiate", 36, Rarity.COMMON, mage.cards.u.UnwaveringInitiate.class)); cards.add(new SetCardInfo("Violent Impact", 154, Rarity.COMMON, mage.cards.v.ViolentImpact.class)); cards.add(new SetCardInfo("Vizier of Deferment", 37, Rarity.UNCOMMON, mage.cards.v.VizierOfDeferment.class)); + cards.add(new SetCardInfo("Vizier of Many Faces", 74, Rarity.RARE, mage.cards.v.VizierOfManyFaces.class)); cards.add(new SetCardInfo("Vizier of Remedies", 38, Rarity.UNCOMMON, mage.cards.v.VizierOfRemedies.class)); cards.add(new SetCardInfo("Vizier of Tumbling Sands", 75, Rarity.UNCOMMON, mage.cards.v.VizierOfTumblingSands.class)); cards.add(new SetCardInfo("Vizier of the Menagerie", 192, Rarity.MYTHIC, mage.cards.v.VizierOfTheMenagerie.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java b/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java index 30a1866e17..db40c8646f 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EmbalmAbility.java @@ -38,6 +38,7 @@ import mage.constants.Outcome; import mage.constants.TimingRule; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.GameEvent; import mage.game.permanent.token.EmptyToken; import mage.players.Player; import mage.util.CardUtil; @@ -112,6 +113,7 @@ class EmbalmEffect extends OneShotEffect { token.getSubtype(game).add(0, "Zombie"); } token.getManaCost().clear(); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source.getSourceId(), controller.getId())); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false, null); // Probably it makes sense to remove also the Embalm ability (it's not shown on the token cards). // Also it can never get active or? But it's not mentioned in the reminder text. diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 0fd3405f60..94e933ea9c 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1454,7 +1454,7 @@ public abstract class GameImpl implements Game, Serializable { } } if (applier != null) { - applier.apply(this, newBluePrint); + applier.apply(this, newBluePrint, source, copyToPermanentId); } CopyEffect newEffect = new CopyEffect(duration, newBluePrint, copyToPermanentId); diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 635a5de253..21f99aece3 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -282,6 +282,7 @@ public class GameEvent implements Serializable { FIGHTED_PERMANENT, EXPLOITED_CREATURE, EVOLVED_CREATURE, + EMBALMED_CREATURE, ATTACH, ATTACHED, STAY_ATTACHED, UNATTACH, UNATTACHED, diff --git a/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java b/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java index 0de92b351c..13feb98d67 100644 --- a/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java +++ b/Mage/src/main/java/mage/util/functions/ApplyToMageObject.java @@ -27,7 +27,9 @@ */ package mage.util.functions; +import java.util.UUID; import mage.MageObject; +import mage.abilities.Ability; import mage.game.Game; /** @@ -36,5 +38,5 @@ import mage.game.Game; */ public abstract class ApplyToMageObject { - public abstract boolean apply(Game game, MageObject mageObject); + public abstract boolean apply(Game game, MageObject mageObject, Ability source, UUID targetObjectId); } diff --git a/Mage/src/main/java/mage/util/functions/ApplyToPermanent.java b/Mage/src/main/java/mage/util/functions/ApplyToPermanent.java index 22d25bb949..fa6947ee24 100644 --- a/Mage/src/main/java/mage/util/functions/ApplyToPermanent.java +++ b/Mage/src/main/java/mage/util/functions/ApplyToPermanent.java @@ -1,6 +1,8 @@ package mage.util.functions; import java.io.Serializable; +import java.util.UUID; +import mage.abilities.Ability; import mage.game.Game; import mage.game.permanent.Permanent; @@ -9,5 +11,5 @@ import mage.game.permanent.Permanent; */ public abstract class ApplyToPermanent extends ApplyToMageObject implements Serializable { - public abstract boolean apply(Game game, Permanent permanent); + public abstract boolean apply(Game game, Permanent permanent, Ability source, UUID targetObjectId); } diff --git a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java index caf6a155ab..5905a625dd 100644 --- a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java @@ -29,7 +29,6 @@ package mage.watchers.common; import java.util.HashMap; import java.util.UUID; -import mage.constants.CardType; import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.GameEvent; diff --git a/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java b/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java index 9965028257..f73cd79471 100644 --- a/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/PermanentsEnteredBattlefieldWatcher.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; -import mage.constants.CardType; import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.GameEvent;