mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09:00
Fixed HeavyArbalest. +1 test passed.
This commit is contained in:
parent
a96bb99199
commit
16c873dc2c
3 changed files with 14 additions and 5 deletions
|
@ -41,6 +41,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreatureOrPlayer;
|
import mage.target.common.TargetCreatureOrPlayer;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -108,7 +109,13 @@ class HeavyArbalestEffect extends ReplacementEffectImpl<HeavyArbalestEffect> {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP
|
if (game.getTurn().getStepType() == PhaseStep.UNTAP
|
||||||
&& event.getType() == EventType.UNTAP
|
&& event.getType() == EventType.UNTAP
|
||||||
&& event.getTargetId().equals(source.getSourceId())) {
|
&& event.getTargetId().equals(source.getSourceId())) {
|
||||||
return true;
|
Permanent p = game.getPermanent(source.getSourceId());
|
||||||
|
for (Ability ability : p.getAbilities()) {
|
||||||
|
if (ability.getRule().startsWith(staticText)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
used = true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,17 +37,18 @@ public class HeavyArbalestTest extends CardTestPlayerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that creature with Heavy Arbalest will use it and untap later
|
* Tests that creature with Heavy Arbalest will use it and untap later after equip is equipped to another creature
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUntapsLater() {
|
public void testUntapsLater() {
|
||||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 8);
|
||||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
|
||||||
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
|
||||||
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
addCard(Constants.Zone.BATTLEFIELD, playerA, "Llanowar Elves");
|
||||||
|
|
||||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
|
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
|
||||||
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 2 damage", playerB);
|
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 2 damage", playerB);
|
||||||
|
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Llanowar Elves");
|
||||||
|
|
||||||
setStopAt(5, Constants.PhaseStep.BEGIN_COMBAT);
|
setStopAt(5, Constants.PhaseStep.BEGIN_COMBAT);
|
||||||
execute();
|
execute();
|
||||||
|
@ -56,7 +57,7 @@ public class HeavyArbalestTest extends CardTestPlayerBase {
|
||||||
assertLife(playerB, 18);
|
assertLife(playerB, 18);
|
||||||
|
|
||||||
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
|
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
|
||||||
Assert.assertTrue(eliteVanguard.getAttachments().size() > 0);
|
Assert.assertTrue(eliteVanguard.getAttachments().size() == 0);
|
||||||
Assert.assertFalse(eliteVanguard.isTapped());
|
Assert.assertFalse(eliteVanguard.isTapped());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
||||||
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
||||||
MageObject object = game.getObject(id);
|
MageObject object = game.getObject(id);
|
||||||
if (object != null && object.getName().equals(t)) {
|
if (object != null && object.getName().equals(t)) {
|
||||||
|
ability.getTargets().get(0).clearChosen();
|
||||||
ability.getTargets().get(0).addTarget(id, ability, game);
|
ability.getTargets().get(0).addTarget(id, ability, game);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue