mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
[EVE] fixed implementation of Hotheaded Giant
This commit is contained in:
parent
63de2dc258
commit
6c643fdc5e
5 changed files with 63 additions and 11 deletions
|
@ -4,7 +4,6 @@ import mage.MageInt;
|
|||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -38,11 +37,11 @@ public final class HotheadedGiant extends CardImpl {
|
|||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// Hotheaded Giant enters the battlefield with two -1/-1 counters on it unless you've cast another red spell this turn.
|
||||
this.addAbility(new EntersBattlefieldAbility(new ConditionalOneShotEffect(
|
||||
this.addAbility(new EntersBattlefieldAbility(
|
||||
new AddCountersSourceEffect(CounterType.M1M1.createInstance(2)),
|
||||
HotheadedGiantWatcher::checkSpell, ""
|
||||
), "with two -1/-1 counters on it unless you've cast another red spell this turn"), new HotheadedGiantWatcher());
|
||||
|
||||
HotheadedGiantWatcher::checkSpell, null,
|
||||
"\"with two -1/-1 counters on it unless you've cast another red spell this turn\""
|
||||
), new HotheadedGiantWatcher());
|
||||
}
|
||||
|
||||
private HotheadedGiant(final HotheadedGiant card) {
|
||||
|
@ -88,7 +87,6 @@ class HotheadedGiantWatcher extends Watcher {
|
|||
.spellMap
|
||||
.getOrDefault(source.getControllerId(), emptyList)
|
||||
.stream()
|
||||
.noneMatch(mor -> !mor.getSourceId().equals(source.getSourceId())
|
||||
|| mor.getZoneChangeCounter() != source.getSourceObjectZoneChangeCounter());
|
||||
.noneMatch(mor -> !mor.refersTo(source, game));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,6 @@ class SoulReapWatcher extends Watcher {
|
|||
.spellMap
|
||||
.getOrDefault(source.getControllerId(), emptyList)
|
||||
.stream()
|
||||
.anyMatch(mor -> !mor.getSourceId().equals(source.getSourceId())
|
||||
|| mor.getZoneChangeCounter() != source.getSourceObjectZoneChangeCounter());
|
||||
.anyMatch(mor -> !mor.refersTo(source, game));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package org.mage.test.cards.single.eve;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class HotheadedGiantTest extends CardTestPlayerBase {
|
||||
private static final String giant = "Hotheaded Giant";
|
||||
private static final String goblin = "Mons's Goblin Raiders";
|
||||
|
||||
@Test
|
||||
public void testSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Zone.HAND, playerA, goblin);
|
||||
addCard(Zone.HAND, playerA, giant);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, goblin);
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, giant);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertCounterCount(playerA, giant, CounterType.M1M1, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
addCard(Zone.HAND, playerA, giant);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, giant);
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertCounterCount(playerA, giant, CounterType.M1M1, 2);
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ public class SoulReapTest extends CardTestPlayerBase {
|
|||
private static final String rats = "Muck Rats";
|
||||
|
||||
@Test
|
||||
public void t() {
|
||||
public void testSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, lion);
|
||||
addCard(Zone.HAND, playerA, reap);
|
||||
|
@ -36,7 +36,7 @@ public class SoulReapTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void t2() {
|
||||
public void testNoSpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, lion);
|
||||
addCard(Zone.HAND, playerA, reap);
|
||||
|
|
|
@ -147,6 +147,14 @@ public class MageObjectReference implements Comparable<MageObjectReference>, Ser
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean refersTo(Ability source, Game game) {
|
||||
if (source == null || !source.getSourceId().equals(sourceId)) {
|
||||
return false;
|
||||
}
|
||||
return zoneChangeCounter * source.getSourceObjectZoneChangeCounter() == 0
|
||||
|| zoneChangeCounter == source.getSourceObjectZoneChangeCounter();
|
||||
}
|
||||
|
||||
public Permanent getPermanent(Game game) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null && permanent.getZoneChangeCounter(game) == zoneChangeCounter) {
|
||||
|
|
Loading…
Add table
Reference in a new issue