implement [MH3] Harbinger of the Seas

This commit is contained in:
Susucre 2024-05-25 13:17:08 +02:00
parent 68f715d17d
commit 9ae855196c
3 changed files with 145 additions and 48 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.h;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.mana.BlueManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author Susucr
*/
public final class HarbingerOfTheSeas extends CardImpl {
public HarbingerOfTheSeas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
this.subtype.add(SubType.MERFOLK);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Nonbasic lands are Islands.
this.addAbility(new SimpleStaticAbility(new HarbingerOfTheSeasEffect()));
}
private HarbingerOfTheSeas(final HarbingerOfTheSeas card) {
super(card);
}
@Override
public HarbingerOfTheSeas copy() {
return new HarbingerOfTheSeas(this);
}
}
// Very similar to Magus of the Moon
class HarbingerOfTheSeasEffect extends ContinuousEffectImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent();
static {
filter.add(Predicates.not(SuperType.BASIC.getPredicate()));
}
HarbingerOfTheSeasEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Nonbasic lands are Islands";
dependencyTypes.add(DependencyType.BecomeIsland);
}
private HarbingerOfTheSeasEffect(final HarbingerOfTheSeasEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public HarbingerOfTheSeasEffect copy() {
return new HarbingerOfTheSeasEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent land : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
land.addSubType(game, SubType.ISLAND);
// Islands have the blue mana ability intrinsically so the ability must be added in this layer
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
break;
}
}
return true;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TypeChangingEffects_4;
}
}

View file

@ -20,12 +20,6 @@ import java.util.UUID;
*/
public final class MagusOfTheMoon extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent();
static {
filter.add(Predicates.not(SuperType.BASIC.getPredicate()));
}
public MagusOfTheMoon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.HUMAN);
@ -35,7 +29,7 @@ public final class MagusOfTheMoon extends CardImpl {
this.toughness = new MageInt(2);
// Nonbasic lands are Mountains.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MagusOfTheMoonEffect()));
this.addAbility(new SimpleStaticAbility(new MagusOfTheMoonEffect()));
}
private MagusOfTheMoon(final MagusOfTheMoon card) {
@ -47,50 +41,56 @@ public final class MagusOfTheMoon extends CardImpl {
return new MagusOfTheMoon(this);
}
static class MagusOfTheMoonEffect extends ContinuousEffectImpl {
}
MagusOfTheMoonEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Nonbasic lands are Mountains";
dependencyTypes.add(DependencyType.BecomeMountain);
}
class MagusOfTheMoonEffect extends ContinuousEffectImpl {
private MagusOfTheMoonEffect(final MagusOfTheMoonEffect effect) {
super(effect);
}
private static final FilterLandPermanent filter = new FilterLandPermanent();
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public MagusOfTheMoonEffect copy() {
return new MagusOfTheMoonEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent land : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
land.addSubType(game, SubType.MOUNTAIN);
// Mountains have the red mana ability intrinsically so the ability must be added in this layer
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
break;
}
}
return true;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TypeChangingEffects_4;
}
static {
filter.add(Predicates.not(SuperType.BASIC.getPredicate()));
}
MagusOfTheMoonEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Nonbasic lands are Mountains";
dependencyTypes.add(DependencyType.BecomeMountain);
}
private MagusOfTheMoonEffect(final MagusOfTheMoonEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public MagusOfTheMoonEffect copy() {
return new MagusOfTheMoonEffect(this);
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (Permanent land : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
// So the ability removing has to be done before Layer 6
land.removeAllAbilities(source.getSourceId(), game);
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
land.addSubType(game, SubType.MOUNTAIN);
// Mountains have the red mana ability intrinsically so the ability must be added in this layer
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
break;
}
}
return true;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TypeChangingEffects_4;
}
}

View file

@ -67,6 +67,7 @@ public final class ModernHorizons3 extends ExpansionSet {
cards.add(new SetCardInfo("Grist, Voracious Larva", 251, Rarity.MYTHIC, mage.cards.g.GristVoraciousLarva.class));
cards.add(new SetCardInfo("Grist, the Plague Swarm", 251, Rarity.MYTHIC, mage.cards.g.GristThePlagueSwarm.class));
cards.add(new SetCardInfo("Guide of Souls", 29, Rarity.RARE, mage.cards.g.GuideOfSouls.class));
cards.add(new SetCardInfo("Harbinger of the Seas", 63, Rarity.RARE, mage.cards.h.HarbingerOfTheSeas.class));
cards.add(new SetCardInfo("Island", 305, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("It That Heralds the End", 9, Rarity.UNCOMMON, mage.cards.i.ItThatHeraldsTheEnd.class));
cards.add(new SetCardInfo("Jet Medallion", 292, Rarity.RARE, mage.cards.j.JetMedallion.class));