[MIR] implemented Basalt Golem (#10285)

* added MIR Basalt Golem + Wall Token

* fixed card number, effect text, possible NPE
simplified effect code
This commit is contained in:
Paul Davies 2023-04-29 13:40:11 +01:00 committed by GitHub
parent 62b1eeb4ed
commit 70cf2158a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 121 additions and 1 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.WallToken;
import mage.players.Player;
/**
*
* @author lagdotcom
*/
public final class BasaltGolem extends CardImpl {
public BasaltGolem(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
this.subtype.add(SubType.GOLEM);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Basalt Golem can't be blocked by artifact creatures.
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(
StaticFilters.FILTER_PERMANENTS_ARTIFACT_CREATURE, Duration.WhileOnBattlefield)));
// Whenever Basalt Golem becomes blocked by a creature, that creature's controller sacrifices it at end of combat. If the player does, they put a 0/2 colorless Wall artifact creature token with defender onto the battlefield.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new BasaltGolemEffect()), true);
effect.setText("that creature's controller sacrifices it at end of combat. If the player does, they put a 0/2 colorless Wall artifact creature token with defender onto the battlefield.");
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(effect, false));
}
private BasaltGolem(final BasaltGolem card) {
super(card);
}
@Override
public BasaltGolem copy() {
return new BasaltGolem(this);
}
}
class BasaltGolemEffect extends OneShotEffect {
BasaltGolemEffect() {
super(Outcome.DestroyPermanent);
staticText = "that creature's controller sacrifices it. If the player does, they create a 0/2 colorless Wall artifact creature token with defender.";
}
private BasaltGolemEffect(final BasaltGolemEffect effect) {
super(effect);
}
@Override
public BasaltGolemEffect copy() {
return new BasaltGolemEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
if (creature == null)
return false;
Player player = game.getPlayer(creature.getControllerId());
if (player == null)
return false;
if (!creature.sacrifice(source, game))
return false;
return new WallToken().putOntoBattlefield(1, game, source, player.getId());
}
}

View file

@ -43,6 +43,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Bad River", 324, Rarity.UNCOMMON, mage.cards.b.BadRiver.class)); cards.add(new SetCardInfo("Bad River", 324, Rarity.UNCOMMON, mage.cards.b.BadRiver.class));
cards.add(new SetCardInfo("Barbed Foliage", 207, Rarity.UNCOMMON, mage.cards.b.BarbedFoliage.class)); cards.add(new SetCardInfo("Barbed Foliage", 207, Rarity.UNCOMMON, mage.cards.b.BarbedFoliage.class));
cards.add(new SetCardInfo("Barbed-Back Wurm", 105, Rarity.UNCOMMON, mage.cards.b.BarbedBackWurm.class)); cards.add(new SetCardInfo("Barbed-Back Wurm", 105, Rarity.UNCOMMON, mage.cards.b.BarbedBackWurm.class));
cards.add(new SetCardInfo("Basalt Golem", 294, Rarity.UNCOMMON, mage.cards.b.BasaltGolem.class));
cards.add(new SetCardInfo("Bay Falcon", 54, Rarity.COMMON, mage.cards.b.BayFalcon.class)); cards.add(new SetCardInfo("Bay Falcon", 54, Rarity.COMMON, mage.cards.b.BayFalcon.class));
cards.add(new SetCardInfo("Bazaar of Wonders", 55, Rarity.RARE, mage.cards.b.BazaarOfWonders.class)); cards.add(new SetCardInfo("Bazaar of Wonders", 55, Rarity.RARE, mage.cards.b.BazaarOfWonders.class));
cards.add(new SetCardInfo("Benevolent Unicorn", 4, Rarity.COMMON, mage.cards.b.BenevolentUnicorn.class)); cards.add(new SetCardInfo("Benevolent Unicorn", 4, Rarity.COMMON, mage.cards.b.BenevolentUnicorn.class));
@ -354,4 +355,4 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Zombie Mob", 153, Rarity.UNCOMMON, mage.cards.z.ZombieMob.class)); cards.add(new SetCardInfo("Zombie Mob", 153, Rarity.UNCOMMON, mage.cards.z.ZombieMob.class));
cards.add(new SetCardInfo("Zuberi, Golden Feather", 51, Rarity.RARE, mage.cards.z.ZuberiGoldenFeather.class)); cards.add(new SetCardInfo("Zuberi, Golden Feather", 51, Rarity.RARE, mage.cards.z.ZuberiGoldenFeather.class));
} }
} }

View file

@ -0,0 +1,31 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.DefenderAbility;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author lagdotcom
*/
public final class WallToken extends TokenImpl {
public WallToken() {
super("Wall Token", "0/2 colorless Wall artifact creature token with defender");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
subtype.add(SubType.WALL);
power = new MageInt(0);
toughness = new MageInt(2);
addAbility(DefenderAbility.getInstance());
}
public WallToken(final WallToken token) {
super(token);
}
public WallToken copy() {
return new WallToken(this);
}
}