[40K] Implement The Lost and the Damned (#9648)

* [40K] Implement The Lost and the Damned

Heavily inspired by Faldorn, but this triggers on "anywhere but hand" instead of "exile".

* Add The Lost and the Damned to the 40k set.

* Make Spawn tokens red, rather than colorless.

* Add slightly-jank handling for lands and spells which you do not own, which cannot have been played from your hand and thus should trigger The Lost and the Damned.

* Clean up land ownership check with proper method rather than just comparison.
This commit is contained in:
Grath 2022-10-14 21:39:42 -04:00 committed by GitHub
parent b8ba92589b
commit 7cd97ffd02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,82 @@
package mage.cards.t;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.token.SpawnToken;
import mage.game.stack.Spell;
import java.util.Optional;
import java.util.UUID;
public final class TheLostAndTheDamned extends CardImpl {
public TheLostAndTheDamned(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{R}");
// Whenever a land enters the battlefield under your control from anywhere other than your hand or you cast a spell from anywhere other than your hand, create 3/3 red Spawn creature token.
this.addAbility(new TheLostAndTheDamnedTriggeredAbility());
}
private TheLostAndTheDamned(final TheLostAndTheDamned card) {
super(card);
}
@Override
public TheLostAndTheDamned copy() {
return new TheLostAndTheDamned(this);
}
}
class TheLostAndTheDamnedTriggeredAbility extends TriggeredAbilityImpl {
TheLostAndTheDamnedTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SpawnToken()));
setTriggerPhrase("Whenever a land enters the battlefield under your control from anywhere other than your hand or you cast a spell from anywhere other than your hand, ");
}
private TheLostAndTheDamnedTriggeredAbility(final TheLostAndTheDamnedTriggeredAbility ability) {
super(ability);
}
@Override
public TheLostAndTheDamnedTriggeredAbility copy() {
return new TheLostAndTheDamnedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|| event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!this.isControlledBy(event.getPlayerId())) {
return false;
}
switch (event.getType()) {
case ENTERS_THE_BATTLEFIELD:
EntersTheBattlefieldEvent eEvent = (EntersTheBattlefieldEvent) event;
return (!eEvent.getFromZone().match(Zone.HAND) || !(eEvent.getTarget().isOwnedBy(this.controllerId))) // if it's someone else's land, you can't have played it from your hand. This handles playing lands from opponent's hands.
&& eEvent.getTarget().isLand(game);
case SPELL_CAST:
return (!Optional
.ofNullable(game.getSpell(event.getTargetId()))
.map(Spell::getFromZone)
.orElse(Zone.ALL)
.equals(Zone.HAND) || !Optional
.ofNullable(game.getSpell(event.getTargetId()))
.map(Spell::getOwnerId)
.orElse(this.controllerId)
.equals(this.controllerId)); // if it's someone else's spell, it can't have been in your hand. This handles playing spells from opponent's hands.
}
return false;
}
}

View file

@ -241,6 +241,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Tervigon", 100, Rarity.RARE, mage.cards.t.Tervigon.class));
cards.add(new SetCardInfo("The First Tyrannic War", 121, Rarity.RARE, mage.cards.t.TheFirstTyrannicWar.class));
cards.add(new SetCardInfo("The Flesh Is Weak", 122, Rarity.RARE, mage.cards.t.TheFleshIsWeak.class));
cards.add(new SetCardInfo("The Lost and the Damned", 129, Rarity.UNCOMMON, mage.cards.t.TheLostAndTheDamned.class));
cards.add(new SetCardInfo("The Swarmlord", 4, Rarity.MYTHIC, mage.cards.t.TheSwarmlord.class));
cards.add(new SetCardInfo("The War in Heaven", 69, Rarity.RARE, mage.cards.t.TheWarInHeaven.class));
cards.add(new SetCardInfo("Their Name Is Death", 62, Rarity.RARE, mage.cards.t.TheirNameIsDeath.class));

View file

@ -12,6 +12,7 @@ public final class SpawnToken extends TokenImpl {
public SpawnToken() {
super("Spawn Token", "3/3 red Spawn creature token");
cardType.add(CardType.CREATURE);
color.setRed(true);
this.subtype.add(SubType.SPAWN);
power = new MageInt(3);
toughness = new MageInt(3);