Fixed Awakening of Vitu-Ghazi that it doesn't change the name of the land it is cast on

This commit is contained in:
Oleg Agafonov 2019-04-23 17:58:34 +04:00
parent e058a9d02e
commit 0ef003a4a7
2 changed files with 24 additions and 4 deletions

View file

@ -28,7 +28,7 @@ public final class AwakeningOfVituGhazi extends CardImpl {
// Put nine +1/+1 counters on target land you control. It becomes a legendary 0/0 Elemental creature with haste named Vitu-Ghazi. It's still a land.
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(9)));
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(
new AwakeningOfVituGhaziToken(), false, true, Duration.Custom
new AwakeningOfVituGhaziToken(), false, true, Duration.Custom, true
).setText("It becomes a legendary 0/0 Elemental creature with haste named Vitu-Ghazi. It's still a land."));
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND));
}

View file

@ -20,25 +20,34 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
protected Token token;
protected boolean loseAllAbilities;
protected boolean addStillALandText;
protected boolean loseName;
public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) {
this(token, loseAllAbilities, stillALand, duration, false);
}
/**
* @param token
* @param loseAllAbilities loses all subtypes and colors
* @param stillALand add rule text, "it's still a land"
* @param loseName permanent lose name and get's it from token
* @param duration
*/
public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) {
public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration, boolean loseName) {
super(duration, Outcome.BecomeCreature);
this.token = token;
this.loseAllAbilities = loseAllAbilities;
this.addStillALandText = stillALand;
this.loseName = loseName;
}
public BecomesCreatureTargetEffect(final BecomesCreatureTargetEffect effect) {
super(effect);
token = effect.token.copy();
this.token = effect.token.copy();
this.loseAllAbilities = effect.loseAllAbilities;
this.addStillALandText = effect.addStillALandText;
this.loseName = effect.loseName;
}
@Override
@ -53,6 +62,13 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null) {
switch (layer) {
case TextChangingEffects_3:
if (sublayer == SubLayer.NA) {
if (loseName) {
permanent.setName(token.getName());
}
}
break;
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (loseAllAbilities) {
@ -125,7 +141,11 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.ColorChangingEffects_5 || layer == Layer.TypeChangingEffects_4;
return layer == Layer.PTChangingEffects_7
|| layer == Layer.AbilityAddingRemovingEffects_6
|| layer == Layer.ColorChangingEffects_5
|| layer == Layer.TypeChangingEffects_4
|| layer == Layer.TextChangingEffects_3;
}
@Override