[REX] Implement Blue, Loyal Raptor (#12099)

This commit is contained in:
jimga150 2024-04-11 00:37:18 -04:00 committed by GitHub
parent 8bf75ed000
commit 50e8a3b530
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 142 additions and 0 deletions

View file

@ -0,0 +1,102 @@
package mage.cards.b;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.PartnerWithAbility;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author jimga150
*/
public final class BlueLoyalRaptor extends CardImpl {
public BlueLoyalRaptor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.DINOSAUR);
this.power = new MageInt(5);
this.toughness = new MageInt(4);
// Partner with Owen Grady, Raptor Trainer
this.addAbility(new PartnerWithAbility("Owen Grady, Raptor Trainer"));
// For each kind of counter on Blue, Loyal Raptor, each other Dinosaur you control enters the battlefield with a counter of that kind on it.
this.addAbility(new SimpleStaticAbility(new BlueLoyalRaptorEffect()));
// If Blue, Loyal Raptor enters the battlefield with one or more kinds of counters on it at the same time as
// other Dinosaurs you control, those other Dinosaurs won't get additional counters from Blue, Loyal Raptor's
// last ability. (2023-11-10)
}
private BlueLoyalRaptor(final BlueLoyalRaptor card) {
super(card);
}
@Override
public BlueLoyalRaptor copy() {
return new BlueLoyalRaptor(this);
}
}
// Based on Arwen, Weaver of Hope and Bribe Taker
class BlueLoyalRaptorEffect extends ReplacementEffectImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.DINOSAUR, "Dinosaur");
BlueLoyalRaptorEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "For each kind of counter on {this}, each other " + filter.getMessage() + " you control enters the battlefield with a counter of that kind on it.";
}
private BlueLoyalRaptorEffect(BlueLoyalRaptorEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null && creature.isControlledBy(source.getControllerId())
&& filter.match(creature, game)
&& !event.getTargetId().equals(source.getSourceId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
Permanent targetPermanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (sourcePermanent == null || targetPermanent == null) {
return false;
}
Set<String> counterTypes = sourcePermanent.getCounters(game).keySet();
for (String counterType : counterTypes) {
targetPermanent.addCounters(
CounterType.findByName(counterType).createInstance(), source.getControllerId(), source, game);
}
return false;
}
@Override
public BlueLoyalRaptorEffect copy() {
return new BlueLoyalRaptorEffect(this);
}
}

View file

@ -20,6 +20,7 @@ public final class JurassicWorldCollection extends ExpansionSet {
super("Jurassic World Collection", "REX", ExpansionSet.buildDate(2023, 11, 17), SetType.SUPPLEMENTAL);
this.hasBoosters = false;
cards.add(new SetCardInfo("Blue, Loyal Raptor", 8, Rarity.RARE, mage.cards.b.BlueLoyalRaptor.class));
cards.add(new SetCardInfo("Command Tower", 26, Rarity.COMMON, mage.cards.c.CommandTower.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Command Tower", "26b", Rarity.COMMON, mage.cards.c.CommandTower.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Compy Swarm", 9, Rarity.RARE, mage.cards.c.CompySwarm.class));

View file

@ -0,0 +1,39 @@
package org.mage.test.cards.replacement.entersBattlefield;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author jimga150
*/
public class BlueLoyalRaptorTests extends CardTestPlayerBase {
@Test
public void testCounterTypeAdding() {
addCard(Zone.BATTLEFIELD, playerA, "Blue, Loyal Raptor", 1);
addCard(Zone.HAND, playerA, "Huatli's Snubhorn", 1);
addCard(Zone.HAND, playerA, "Memnite", 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
addCounters(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blue, Loyal Raptor", CounterType.P1P1, 2);
addCounters(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blue, Loyal Raptor", CounterType.INDESTRUCTIBLE, 1);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Huatli's Snubhorn", true);
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", true);
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertCounterCount(playerA, "Huatli's Snubhorn", CounterType.P1P1, 1);
assertCounterCount(playerA, "Huatli's Snubhorn", CounterType.INDESTRUCTIBLE, 1);
assertCounterCount(playerA, "Memnite", CounterType.P1P1, 0);
assertCounterCount(playerA, "Memnite", CounterType.INDESTRUCTIBLE, 0);
}
}