mirror of
https://github.com/correl/mage.git
synced 2025-01-12 11:08:01 +00:00
* Improved some FixedTarget initializations.
This commit is contained in:
parent
50668a548f
commit
61315ec741
5 changed files with 95 additions and 13 deletions
|
@ -150,7 +150,7 @@ class JaceCunningCastawayCopyEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 2);
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 2);
|
||||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||||
effect.setIsntLegendary(true);
|
effect.setIsntLegendary(true);
|
||||||
return effect.apply(game, source);
|
return effect.apply(game, source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ class PeltCollectorAbility extends TriggeredAbilityImpl {
|
||||||
if (isPowerGreater(sourceCreature, triggeringCreature)
|
if (isPowerGreater(sourceCreature, triggeringCreature)
|
||||||
&& triggeringCreature.isCreature()
|
&& triggeringCreature.isCreature()
|
||||||
&& triggeringCreature.isControlledBy(this.getControllerId())) {
|
&& triggeringCreature.isControlledBy(this.getControllerId())) {
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
this.getEffects().setTargetPointer(new FixedTarget(triggeringCreature, game));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
package org.mage.test.cards.single.grn;
|
||||||
|
|
||||||
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.Filter;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class PeltCollectorTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_Simple() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||||
|
// Whenever another creature you control enters the battlefield or dies, if that creature's power is greater than Pelt Collector's, put a +1/+1 counter on Pelt Collector.
|
||||||
|
// As long as Pelt Collector has three or more +1/+1 counters on it, it has trample.
|
||||||
|
addCard(Zone.HAND, playerA, "Pelt Collector", 1); // Creature {G}
|
||||||
|
addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); // Creature {1}{W}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Pelt Collector", 1);// Creature {G}
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pelt Collector");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertPowerToughness(playerB, "Pelt Collector", 1, 1);
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Silvercoat Lion", 2, 2);
|
||||||
|
assertPowerToughness(playerA, "Pelt Collector", 2, 2);
|
||||||
|
assertAbility(playerA, "Pelt Collector", TrampleAbility.getInstance(), false);
|
||||||
|
assertAbility(playerB, "Pelt Collector", TrampleAbility.getInstance(), false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To determine if Pelt Collector’s first ability triggers when a creature
|
||||||
|
* enters the battlefield, use the creature’s power after applying any
|
||||||
|
* static abilities (such as that of Trostani Discordant) that modify its
|
||||||
|
* power.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void test_TrostaniDiscordant() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||||
|
// Whenever another creature you control enters the battlefield or dies, if that creature's power is greater than Pelt Collector's, put a +1/+1 counter on Pelt Collector.
|
||||||
|
// As long as Pelt Collector has three or more +1/+1 counters on it, it has trample.
|
||||||
|
addCard(Zone.HAND, playerA, "Pelt Collector", 1); // Creature {G}
|
||||||
|
addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); // Creature {1}{W}
|
||||||
|
// Other creatures you control get +1/+1.
|
||||||
|
// When Trostani Discordant enters the battlefield, create two 1/1 white Soldier creature tokens with lifelink.
|
||||||
|
// At the beginning of your end step, each player gains control of all creatures they own.
|
||||||
|
addCard(Zone.HAND, playerA, "Trostani Discordant", 1); // Creature {3}{G}{W} /1/4)
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Pelt Collector", 1);// Creature {G}
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Trostani Discordant");
|
||||||
|
|
||||||
|
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Pelt Collector");
|
||||||
|
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||||
|
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertPowerToughness(playerB, "Pelt Collector", 1, 1);
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Soldier", 2, 2, Filter.ComparisonScope.All);
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Silvercoat Lion", 3, 3);
|
||||||
|
assertPowerToughness(playerA, "Pelt Collector", 3, 3);
|
||||||
|
assertAbility(playerA, "Pelt Collector", TrampleAbility.getInstance(), false);
|
||||||
|
assertAbility(playerB, "Pelt Collector", TrampleAbility.getInstance(), false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,6 @@ import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -44,7 +43,6 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
* If true, the source that triggered the ability will be set as target to
|
* If true, the source that triggered the ability will be set as target to
|
||||||
* effect.
|
* effect.
|
||||||
*/
|
*/
|
||||||
protected boolean rememberSource = false;
|
|
||||||
|
|
||||||
public VenserTheSojournerSpellCastTriggeredAbility(Effect effect, boolean optional) {
|
public VenserTheSojournerSpellCastTriggeredAbility(Effect effect, boolean optional) {
|
||||||
super(Zone.COMMAND, effect, optional);
|
super(Zone.COMMAND, effect, optional);
|
||||||
|
@ -54,7 +52,6 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public VenserTheSojournerSpellCastTriggeredAbility(final VenserTheSojournerSpellCastTriggeredAbility ability) {
|
public VenserTheSojournerSpellCastTriggeredAbility(final VenserTheSojournerSpellCastTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
filter = ability.filter;
|
filter = ability.filter;
|
||||||
this.rememberSource = ability.rememberSource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,12 +63,7 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && filter.match(spell, game)) {
|
return spell != null && filter.match(spell, game);
|
||||||
if (rememberSource) {
|
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -35,6 +34,7 @@ public final class JaceCunningCastawayIllusionToken extends TokenImpl {
|
||||||
super(token);
|
super(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public JaceCunningCastawayIllusionToken copy() {
|
public JaceCunningCastawayIllusionToken copy() {
|
||||||
return new JaceCunningCastawayIllusionToken(this);
|
return new JaceCunningCastawayIllusionToken(this);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,6 @@ class IllusionTokenTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
MageObject eventSourceObject = game.getObject(event.getSourceId());
|
MageObject eventSourceObject = game.getObject(event.getSourceId());
|
||||||
if (event.getTargetId().equals(this.getSourceId()) && eventSourceObject instanceof Spell) {
|
if (event.getTargetId().equals(this.getSourceId()) && eventSourceObject instanceof Spell) {
|
||||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue