mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
[REX] Implement Indoraptor, the Perfect Hybrid (#12122)
* Implement Indoraptor, the Perfect Hybrid * Add tests
This commit is contained in:
parent
b0d7daa85e
commit
006f212b6b
3 changed files with 309 additions and 0 deletions
157
Mage.Sets/src/mage/cards/i/IndoraptorThePerfectHybrid.java
Normal file
157
Mage.Sets/src/mage/cards/i/IndoraptorThePerfectHybrid.java
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
package mage.cards.i;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
|
||||||
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SuperType;
|
||||||
|
import mage.abilities.keyword.MenaceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetSacrifice;
|
||||||
|
import mage.util.RandomUtil;
|
||||||
|
import mage.watchers.common.DamageDoneWatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jimga150
|
||||||
|
*/
|
||||||
|
public final class IndoraptorThePerfectHybrid extends CardImpl {
|
||||||
|
|
||||||
|
public IndoraptorThePerfectHybrid(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B/G}{R}");
|
||||||
|
|
||||||
|
this.supertype.add(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.DINOSAUR);
|
||||||
|
this.subtype.add(SubType.MUTANT);
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// Bloodthirst X (This creature enters the battlefield with X +1/+1 counters on it, where X is the damage
|
||||||
|
// dealt to your opponents this turn.)
|
||||||
|
this.addAbility(new EntersBattlefieldAbility(
|
||||||
|
new IndoraptorThePerfectHybridBloodthirstEffect(),
|
||||||
|
"Bloodthirst X "
|
||||||
|
+ "<i>(This creature enters the battlefield with X +1/+1 counters on it, "
|
||||||
|
+ "where X is the damage dealt to your opponents this turn.)</i>"
|
||||||
|
), new DamageDoneWatcher());
|
||||||
|
|
||||||
|
// Menace
|
||||||
|
this.addAbility(new MenaceAbility());
|
||||||
|
|
||||||
|
// Enrage -- Whenever Indoraptor, the Perfect Hybrid is dealt damage, choose an opponent at random.
|
||||||
|
// Indoraptor deals damage equal to its power to that player unless they sacrifice a nontoken creature.
|
||||||
|
this.addAbility(new DealtDamageToSourceTriggeredAbility(
|
||||||
|
new IndoraptorThePerfectHybridDamageEffect(), false, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IndoraptorThePerfectHybrid(final IndoraptorThePerfectHybrid card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IndoraptorThePerfectHybrid copy() {
|
||||||
|
return new IndoraptorThePerfectHybrid(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy-pasted PetrifiedWoodKinEffect
|
||||||
|
class IndoraptorThePerfectHybridBloodthirstEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
IndoraptorThePerfectHybridBloodthirstEffect() {
|
||||||
|
super(Outcome.BoostCreature);
|
||||||
|
staticText = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private IndoraptorThePerfectHybridBloodthirstEffect(final IndoraptorThePerfectHybridBloodthirstEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
DamageDoneWatcher watcher = game.getState().getWatcher(DamageDoneWatcher.class);
|
||||||
|
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||||
|
if (player == null || watcher == null || permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); // the basic event is the EntersBattlefieldEvent, so use already applied replacement effects from that event
|
||||||
|
int amount = 0;
|
||||||
|
for (UUID opponentId : game.getOpponents(player.getId())) {
|
||||||
|
MageObjectReference mor = new MageObjectReference(opponentId, game);
|
||||||
|
amount += watcher.getDamagedObjects().getOrDefault(mor, 0);
|
||||||
|
}
|
||||||
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), source.getControllerId(), source, game, appliedEffects);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IndoraptorThePerfectHybridBloodthirstEffect copy() {
|
||||||
|
return new IndoraptorThePerfectHybridBloodthirstEffect(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Based on BellowingMaulerEffect
|
||||||
|
class IndoraptorThePerfectHybridDamageEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
IndoraptorThePerfectHybridDamageEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "choose an opponent at random. " +
|
||||||
|
"{this} deals damage equal to its power to that player unless they sacrifice a nontoken creature.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private IndoraptorThePerfectHybridDamageEffect(final IndoraptorThePerfectHybridDamageEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IndoraptorThePerfectHybridDamageEffect copy() {
|
||||||
|
return new IndoraptorThePerfectHybridDamageEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<UUID> opponents = new ArrayList<>(game.getOpponents(controller.getId()));
|
||||||
|
Player opponent = game.getPlayer(opponents.get(RandomUtil.nextInt(opponents.size())));
|
||||||
|
if (opponent == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean sacrificed = false;
|
||||||
|
TargetSacrifice targetCreature = new TargetSacrifice(StaticFilters.FILTER_CONTROLLED_CREATURE_NON_TOKEN);
|
||||||
|
if (targetCreature.canChoose(opponent.getId(), source, game)
|
||||||
|
&& opponent.chooseUse(Outcome.Sacrifice, "Sacrifice a nontoken creature?", source, game)) {
|
||||||
|
opponent.choose(Outcome.Sacrifice, targetCreature, source, game);
|
||||||
|
Permanent permanentToSac = game.getPermanent(targetCreature.getFirstTarget());
|
||||||
|
sacrificed = permanentToSac != null && permanentToSac.sacrifice(source, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sacrificed) {
|
||||||
|
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
|
if (sourcePermanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return opponent.damage(sourcePermanent.getPower().getValue(), source, game) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sacrificed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,7 @@ public final class JurassicWorldCollection extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Grim Giganotosaurus", 11, Rarity.RARE, mage.cards.g.GrimGiganotosaurus.class));
|
cards.add(new SetCardInfo("Grim Giganotosaurus", 11, Rarity.RARE, mage.cards.g.GrimGiganotosaurus.class));
|
||||||
cards.add(new SetCardInfo("Henry Wu, InGen Geneticist", 12, Rarity.RARE, mage.cards.h.HenryWuInGenGeneticist.class));
|
cards.add(new SetCardInfo("Henry Wu, InGen Geneticist", 12, Rarity.RARE, mage.cards.h.HenryWuInGenGeneticist.class));
|
||||||
cards.add(new SetCardInfo("Hunting Velociraptor", 4, Rarity.RARE, mage.cards.h.HuntingVelociraptor.class));
|
cards.add(new SetCardInfo("Hunting Velociraptor", 4, Rarity.RARE, mage.cards.h.HuntingVelociraptor.class));
|
||||||
|
cards.add(new SetCardInfo("Indoraptor, the Perfect Hybrid", 15, Rarity.RARE, mage.cards.i.IndoraptorThePerfectHybrid.class));
|
||||||
cards.add(new SetCardInfo("Island", 22, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
|
cards.add(new SetCardInfo("Island", 22, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Island", "22b", Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
|
cards.add(new SetCardInfo("Island", "22b", Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Jurassic Park", 7, Rarity.RARE, mage.cards.j.JurassicPark.class));
|
cards.add(new SetCardInfo("Jurassic Park", 7, Rarity.RARE, mage.cards.j.JurassicPark.class));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
package org.mage.test.cards.single.rex;
|
||||||
|
|
||||||
|
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 IndoraptorThePerfectHybridTests extends CardTestPlayerBase {
|
||||||
|
// {1}{B/G}{R} 3/1 Legendary Creature - Dinosaur Mutant
|
||||||
|
// Bloodthirst X (This creature enters the battlefield with X +1/+1 counters on it, where X is the damage
|
||||||
|
// dealt to your opponents this turn.)
|
||||||
|
// Menace
|
||||||
|
// Enrage -- Whenever Indoraptor, the Perfect Hybrid is dealt damage, choose an opponent at random.
|
||||||
|
// Indoraptor deals damage equal to its power to that player unless they sacrifice a nontoken creature.
|
||||||
|
|
||||||
|
private static final String indoraptorName = "Indoraptor, the Perfect Hybrid";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNoDamageETB() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||||
|
addCard(Zone.HAND, playerA, indoraptorName);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, indoraptorName);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, indoraptorName, 3, 1);
|
||||||
|
assertCounterCount(playerA, indoraptorName, CounterType.P1P1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDamageETB() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
addCard(Zone.HAND, playerA, indoraptorName);
|
||||||
|
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, playerB);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, indoraptorName);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, indoraptorName, 3 + 3, 1 + 3);
|
||||||
|
assertCounterCount(playerA, indoraptorName, CounterType.P1P1, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEnrageNoCreaturesToSac() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||||
|
addCard(Zone.HAND, playerA, indoraptorName);
|
||||||
|
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, playerB);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, indoraptorName, true);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, indoraptorName);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, indoraptorName, 3 + 3, 1 + 3);
|
||||||
|
assertCounterCount(playerA, indoraptorName, CounterType.P1P1, 3);
|
||||||
|
|
||||||
|
//bolt and indoraptor damage
|
||||||
|
assertLife(playerB, currentGame.getStartingLife() - 3 - (3 + 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEnrageWithCreaturesToSac() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||||
|
addCard(Zone.HAND, playerA, indoraptorName);
|
||||||
|
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, playerB);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, indoraptorName, true);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, indoraptorName);
|
||||||
|
|
||||||
|
// Sac a creature?
|
||||||
|
setChoice(playerB, "Yes");
|
||||||
|
// Which one?
|
||||||
|
setChoice(playerB, "Memnite");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, indoraptorName, 3 + 3, 1 + 3);
|
||||||
|
assertCounterCount(playerA, indoraptorName, CounterType.P1P1, 3);
|
||||||
|
|
||||||
|
//bolt damage
|
||||||
|
assertLife(playerB, currentGame.getStartingLife() - 3);
|
||||||
|
assertGraveyardCount(playerB, "Memnite", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEnrageWithCreaturesToSacChooseNo() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||||
|
addCard(Zone.HAND, playerA, indoraptorName);
|
||||||
|
addCard(Zone.HAND, playerA, "Lightning Bolt", 2);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Memnite", 1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, playerB);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, indoraptorName, true);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", true);
|
||||||
|
addTarget(playerA, indoraptorName);
|
||||||
|
|
||||||
|
// Sac a creature?
|
||||||
|
setChoice(playerB, "No");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, indoraptorName, 3 + 3, 1 + 3);
|
||||||
|
assertCounterCount(playerA, indoraptorName, CounterType.P1P1, 3);
|
||||||
|
|
||||||
|
//bolt and indoraptor damage
|
||||||
|
assertLife(playerB, currentGame.getStartingLife() - 3 - (3 + 3));
|
||||||
|
assertPermanentCount(playerB, "Memnite", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue