mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Some minor log changes and added tests.
This commit is contained in:
parent
1561ed3fa4
commit
e2cb40de70
7 changed files with 123 additions and 26 deletions
|
|
@ -54,6 +54,7 @@ public class SunscorchRegent extends CardImpl {
|
||||||
|
|
||||||
// Flying
|
// Flying
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// Whenever an opponent casts a spell, put a +1/+1 counter on Sunscorch Regent and you gain 1 life.
|
// Whenever an opponent casts a spell, put a +1/+1 counter on Sunscorch Regent and you gain 1 life.
|
||||||
Ability ability = new SpellCastOpponentTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
Ability ability = new SpellCastOpponentTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false);
|
||||||
ability.addEffect(new GainLifeEffect(1));
|
ability.addEffect(new GainLifeEffect(1));
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.sets.judgment;
|
package mage.sets.judgment;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
|
|
@ -57,11 +58,10 @@ public class CabalTherapy extends CardImpl {
|
||||||
super(ownerId, 62, "Cabal Therapy", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{B}");
|
super(ownerId, 62, "Cabal Therapy", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{B}");
|
||||||
this.expansionSetCode = "JUD";
|
this.expansionSetCode = "JUD";
|
||||||
|
|
||||||
this.color.setBlack(true);
|
|
||||||
|
|
||||||
// Name a nonland card. Target player reveals his or her hand and discards all cards with that name.
|
// Name a nonland card. Target player reveals his or her hand and discards all cards with that name.
|
||||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||||
this.getSpellAbility().addEffect(new CabalTherapyEffect());
|
this.getSpellAbility().addEffect(new CabalTherapyEffect());
|
||||||
|
|
||||||
// Flashback-Sacrifice a creature.
|
// Flashback-Sacrifice a creature.
|
||||||
this.addAbility(new FlashbackAbility(
|
this.addAbility(new FlashbackAbility(
|
||||||
new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,new FilterControlledCreaturePermanent("a creature"), true)),
|
new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,new FilterControlledCreaturePermanent("a creature"), true)),
|
||||||
|
|
@ -91,10 +91,12 @@ class CabalTherapyEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player != null && controller != null) {
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
Choice cardChoice = new ChoiceImpl();
|
if (targetPlayer != null && controller != null && sourceObject != null) {
|
||||||
|
Choice cardChoice = new ChoiceImpl(true);
|
||||||
|
cardChoice.setMessage("Name a nonland card.");
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
|
|
||||||
|
|
@ -105,14 +107,14 @@ class CabalTherapyEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Cabal Therapy, named card: [" + cardName + "]");
|
game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]");
|
||||||
for (Card card : player.getHand().getCards(game)) {
|
for (Card card : targetPlayer.getHand().getCards(game)) {
|
||||||
if (card.getName().equals(cardName)) {
|
if (card.getName().equals(cardName)) {
|
||||||
player.discard(card, source, game);
|
targetPlayer.discard(card, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.lookAtCards("Cabal Therapy Hand", player.getHand(), game);
|
controller.lookAtCards(sourceObject.getLogName() + " Hand", targetPlayer.getHand(), game);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,11 +117,9 @@ class ChiefEngineerGainAbilitySpellsEffect extends ContinuousEffectImpl {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && permanent != null) {
|
if (player != null && permanent != null) {
|
||||||
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext();) {
|
for (StackObject stackObject : game.getStack()) {
|
||||||
StackObject stackObject = iterator.next();
|
// only spells cast, so no copies of spells
|
||||||
// only cast spells, so no copies
|
if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) {
|
||||||
if (!stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) {
|
|
||||||
if (stackObject instanceof Spell) {
|
|
||||||
Spell spell = (Spell) stackObject;
|
Spell spell = (Spell) stackObject;
|
||||||
if (filter.match(spell, game)) {
|
if (filter.match(spell, game)) {
|
||||||
if (!spell.getAbilities().contains(ability)) {
|
if (!spell.getAbilities().contains(ability)) {
|
||||||
|
|
@ -130,7 +128,6 @@ class ChiefEngineerGainAbilitySpellsEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -138,4 +138,34 @@ public class ConvokeTest extends CardTestPlayerBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void testConvokeFromChiefEngineer() {
|
||||||
|
/**
|
||||||
|
* Chief Engineer {1}{U}
|
||||||
|
* Creature - Vedalken, Artificer
|
||||||
|
* Artifact spells you cast have convoke.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// THIS TEST IS NOT FINISHED
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1); // creatures to use for convoek
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Chief Engineer", 1);
|
||||||
|
|
||||||
|
addCard(Zone.HAND, playerA, "ARTIFACT TO CAST", 1);
|
||||||
|
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "ARTIFACT TO CAST");
|
||||||
|
setChoice(playerA, "Yes");
|
||||||
|
addTarget(playerA, "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package org.mage.test.cards.triggers;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SpellCastTriggerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests Sunscorch Regent
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSunscorchRegent() {
|
||||||
|
// Creature - Dragon 4/3
|
||||||
|
// Flying
|
||||||
|
// Whenever an opponent casts a spell, put a +1/+1 counter on Sunscorch Regent and you gain 1 life.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Sunscorch Regent", 1);
|
||||||
|
|
||||||
|
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 18); // 20 -3 +1
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Sunscorch Regent", 5, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -97,10 +97,10 @@ class DredgeEffect extends ReplacementEffectImpl {
|
||||||
}
|
}
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
if (player != null && player.getLibrary().size() >= amount
|
if (player != null && player.getLibrary().size() >= amount
|
||||||
&& player.chooseUse(outcome, new StringBuilder("Dredge ").append(sourceCard.getName()).
|
&& player.chooseUse(outcome, new StringBuilder("Dredge ").append(sourceCard.getLogName()).
|
||||||
append("? (").append(amount).append(" cards go from top of library to graveyard)").toString(), game)) {
|
append("? (").append(amount).append(" cards go from top of library to graveyard)").toString(), game)) {
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(new StringBuilder(player.getLogName()).append(" dreges ").append(sourceCard.getName()).toString());
|
game.informPlayers(new StringBuilder(player.getLogName()).append(" dreges ").append(sourceCard.getLogName()).toString());
|
||||||
}
|
}
|
||||||
Cards cardsToGrave = new CardsImpl();
|
Cards cardsToGrave = new CardsImpl();
|
||||||
cardsToGrave.addAll(player.getLibrary().getTopCards(game, amount));
|
cardsToGrave.addAll(player.getLibrary().getTopCards(game, amount));
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,11 @@ public class Token extends MageObjectImpl {
|
||||||
if (attacking && game.getCombat() != null) {
|
if (attacking && game.getCombat() != null) {
|
||||||
game.getCombat().addAttackingCreature(newToken.getId(), game);
|
game.getCombat().addAttackingCreature(newToken.getId(), game);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(new StringBuilder(controller.getLogName()).append(" puts ")
|
game.informPlayers(controller.getLogName() + " puts a " + newToken.getLogName() + " token onto the battlefield");
|
||||||
.append(CardUtil.numberToText(amount, "a")).append(" ").append(this.getName()).append(" token").append(amount==1?"":"s")
|
|
||||||
.append(" onto the battlefield").toString());
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue