1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-02-18 03:00:15 +00:00

[40K] Implement Genestealer Patriarch ()

This commit is contained in:
PurpleCrowbar 2022-10-30 15:31:53 +00:00 committed by GitHub
parent dea6289ed1
commit 832aef3159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,133 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class GenestealerPatriarch extends CardImpl {
public static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
static {
filter.add(DefendingPlayerControlsPredicate.instance);
}
public GenestealerPatriarch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}");
this.subtype.add(SubType.TYRANID);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Genestealer's Kiss Whenever Genestealer Patriarch attacks, put an infection counter on target creature defending player controls.
Ability ability = new AttacksTriggeredAbility(new AddCountersTargetEffect(CounterType.INFECTION.createInstance())).withFlavorWord("Genestealer's Kiss");
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
// Children of the Cult Whenever a creature with an infection counter on it dies, you create
// a token that's a copy of that creature, except it's a Tyranid in addition to its other types.
this.addAbility(new GenestealerPatriarchTriggeredAbility().withFlavorWord("Children of the Cult"));
}
private GenestealerPatriarch(final GenestealerPatriarch card) {
super(card);
}
@Override
public GenestealerPatriarch copy() {
return new GenestealerPatriarch(this);
}
}
class GenestealerPatriarchTriggeredAbility extends TriggeredAbilityImpl {
public GenestealerPatriarchTriggeredAbility() {
super(Zone.BATTLEFIELD, new GenestealerPatriarchCloneEffect());
}
public GenestealerPatriarchTriggeredAbility(GenestealerPatriarchTriggeredAbility ability) {
super(ability);
setTriggerPhrase("Whenever a creature with an infection counter on it dies, ");
}
@Override
public GenestealerPatriarchTriggeredAbility copy() {
return new GenestealerPatriarchTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) {
Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
if (permanent != null
&& permanent.isCreature(game)
&& permanent.getCounters(game).containsKey(CounterType.INFECTION)) {
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
}
return false;
}
}
class GenestealerPatriarchCloneEffect extends OneShotEffect {
public GenestealerPatriarchCloneEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "you create a token that's a copy of that creature, except it's a Tyranid in addition to its other types";
}
public GenestealerPatriarchCloneEffect(final GenestealerPatriarchCloneEffect effect) {
super(effect);
}
@Override
public GenestealerPatriarchCloneEffect copy() {
return new GenestealerPatriarchCloneEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card creature = game.getCard(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId());
effect.setTargetPointer(new FixedTarget(creature, game));
effect.setAdditionalSubType(SubType.TYRANID);
effect.apply(game, source);
return true;
}
return false;
}
}

View file

@ -122,6 +122,7 @@ public final class Warhammer40000 extends ExpansionSet {
cards.add(new SetCardInfo("Game Trail", 282, Rarity.RARE, mage.cards.g.GameTrail.class));
cards.add(new SetCardInfo("Gargoyle Flock", 123, Rarity.RARE, mage.cards.g.GargoyleFlock.class));
cards.add(new SetCardInfo("Genestealer Locus", 21, Rarity.UNCOMMON, mage.cards.g.GenestealerLocus.class));
cards.add(new SetCardInfo("Genestealer Patriarch", 22, Rarity.RARE, mage.cards.g.GenestealerPatriarch.class));
cards.add(new SetCardInfo("Ghost Ark", 156, Rarity.RARE, mage.cards.g.GhostArk.class));
cards.add(new SetCardInfo("Ghyrson Starn, Kelermorph", 124, Rarity.RARE, mage.cards.g.GhyrsonStarnKelermorph.class));
cards.add(new SetCardInfo("Gilded Lotus", 239, Rarity.RARE, mage.cards.g.GildedLotus.class));