forked from External/mage
[SPM] Implement Parker Luck
This commit is contained in:
parent
0f1c19900c
commit
0b5638fbae
3 changed files with 172 additions and 0 deletions
91
Mage.Sets/src/mage/cards/p/ParkerLuck.java
Normal file
91
Mage.Sets/src/mage/cards/p/ParkerLuck.java
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public final class ParkerLuck extends CardImpl {
|
||||
|
||||
public ParkerLuck(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
|
||||
|
||||
|
||||
// At the beginning of your end step, two target players each reveal the top card of their library. They each lose life equal to the mana value of the card revealed by the other player. Then they each put the card they revealed into their hand.
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(new ParkerLuckEffect());
|
||||
ability.addTarget(new TargetPlayer(2));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private ParkerLuck(final ParkerLuck card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParkerLuck copy() {
|
||||
return new ParkerLuck(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ParkerLuckEffect extends OneShotEffect {
|
||||
|
||||
public ParkerLuckEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "two target players each reveal the top card of their library. " +
|
||||
"They each lose life equal to the mana value of the card " +
|
||||
"revealed by the other player. Then they each put the card they revealed into their hand";
|
||||
}
|
||||
|
||||
protected ParkerLuckEffect(final ParkerLuckEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParkerLuckEffect copy() {
|
||||
return new ParkerLuckEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetOne = game.getPlayer(getTargetPointer().getTargets(game, source).get(0));
|
||||
Player targetTwo = game.getPlayer(getTargetPointer().getTargets(game, source).get(1));
|
||||
if (targetOne == null || targetTwo == null) {
|
||||
return false;
|
||||
}
|
||||
// each reveal top card
|
||||
Card targetOneCard = targetOne.getLibrary().getFromTop(game);
|
||||
int targetOneMv = 0;
|
||||
Card targetTwoCard = targetTwo.getLibrary().getFromTop(game);
|
||||
int targetTwoMv = 0;
|
||||
if (targetOneCard != null) {
|
||||
targetOne.revealCards(source, new CardsImpl(targetOneCard), game);
|
||||
targetOneMv = targetOneCard.getManaValue();
|
||||
}
|
||||
if (targetTwoCard != null) {
|
||||
targetTwo.revealCards(source, new CardsImpl(targetTwoCard), game);
|
||||
targetTwoMv = targetTwoCard.getManaValue();
|
||||
}
|
||||
// lose life to mana value of each others card
|
||||
targetOne.loseLife(targetTwoMv, game, source, false);
|
||||
targetTwo.loseLife(targetOneMv, game, source, false);
|
||||
// each put card into their hand
|
||||
targetOne.moveCards(targetOneCard, Zone.HAND, source, game);
|
||||
targetTwo.moveCards(targetTwoCard, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -130,6 +130,8 @@ public final class MarvelsSpiderMan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Origin of Spider-Man", 9, Rarity.RARE, mage.cards.o.OriginOfSpiderMan.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Oscorp Industries", 182, Rarity.RARE, mage.cards.o.OscorpIndustries.class));
|
||||
cards.add(new SetCardInfo("Oscorp Research Team", 40, Rarity.COMMON, mage.cards.o.OscorpResearchTeam.class));
|
||||
cards.add(new SetCardInfo("Parker Luck", 258, Rarity.RARE, mage.cards.p.ParkerLuck.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Parker Luck", 60, Rarity.RARE, mage.cards.p.ParkerLuck.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Peter Parker", 10, Rarity.MYTHIC, mage.cards.p.PeterParker.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Peter Parker", 208, Rarity.MYTHIC, mage.cards.p.PeterParker.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Peter Parker", 232, Rarity.MYTHIC, mage.cards.p.PeterParker.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package org.mage.test.cards.single.spm;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestCommander4Players;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jmlundeen
|
||||
*/
|
||||
public class ParkerLuckTest extends CardTestCommander4Players {
|
||||
|
||||
/*
|
||||
Parker Luck
|
||||
{2}{B}
|
||||
Enchantment
|
||||
At the beginning of your end step, two target players each reveal the top card of their library. They each lose life equal to the mana value of the card revealed by the other player. Then they each put the card they revealed into their hand.
|
||||
*/
|
||||
private static final String parkerLuck = "Parker Luck";
|
||||
|
||||
/*
|
||||
Bear Cub
|
||||
{1}{G}
|
||||
Creature - Bear
|
||||
|
||||
2/2
|
||||
*/
|
||||
private static final String bearCub = "Bear Cub";
|
||||
|
||||
/*
|
||||
Fugitive Wizard
|
||||
{U}
|
||||
Creature - Human Wizard
|
||||
|
||||
1/1
|
||||
*/
|
||||
private static final String fugitiveWizard = "Fugitive Wizard";
|
||||
|
||||
@Test
|
||||
public void testParkerLuck() {
|
||||
setStrictChooseMode(true);
|
||||
skipInitShuffling();
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, parkerLuck);
|
||||
addCard(Zone.LIBRARY, playerD, bearCub);
|
||||
addCard(Zone.LIBRARY, playerC, fugitiveWizard);
|
||||
|
||||
addTarget(playerA, playerC);
|
||||
addTarget(playerA, playerD);
|
||||
|
||||
setStopAt(1, PhaseStep.CLEANUP);
|
||||
execute();
|
||||
|
||||
assertLife(playerC, 20 - 2);
|
||||
assertLife(playerD, 20 - 1);
|
||||
assertHandCount(playerC, 1);
|
||||
assertHandCount(playerD, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParkerLuckOneLibraryEmpty() {
|
||||
setStrictChooseMode(true);
|
||||
skipInitShuffling();
|
||||
removeAllCardsFromLibrary(playerC);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, parkerLuck);
|
||||
addCard(Zone.LIBRARY, playerD, bearCub);
|
||||
|
||||
addTarget(playerA, playerC);
|
||||
addTarget(playerA, playerD);
|
||||
|
||||
setStopAt(1, PhaseStep.CLEANUP);
|
||||
execute();
|
||||
|
||||
assertLife(playerC, 20 - 2);
|
||||
assertHandCount(playerD, 1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue