mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
commit
05349be8c3
6 changed files with 204 additions and 25 deletions
|
@ -27,8 +27,6 @@
|
|||
*/
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -36,6 +34,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.keyword.ChangelingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
@ -43,6 +42,8 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author fireshoes
|
||||
*/
|
||||
|
@ -93,7 +94,7 @@ class KasetoEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
game.addEffect(new CantBeBlockedTargetEffect(Duration.EndOfTurn), source);
|
||||
if (permanent.getSubtype(game).contains("Snake")) {
|
||||
if (permanent.hasSubtype("Snake", game)) {
|
||||
game.addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn), source);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package org.mage.test.cards.single;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class FinalPunishmentTest extends CardTestPlayerBase {
|
||||
|
||||
final String finalPunishment = "Final Punishment";
|
||||
final String shock = "Shock";
|
||||
final String bob = "Dark Confidant";
|
||||
|
||||
@Test
|
||||
public void lifelossBecauseOfDirectDamage() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
|
||||
addCard(Zone.HAND, playerA, finalPunishment);
|
||||
addCard(Zone.HAND, playerA, shock);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, shock, playerB);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, finalPunishment, playerB);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 16);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lifelossBecauseOfCombat() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
addCard(Zone.HAND, playerA, finalPunishment);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bob);
|
||||
|
||||
attack(1, playerA, bob, playerB);
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, finalPunishment, playerB);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 16);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nolifelossInNextTurn() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
addCard(Zone.HAND, playerA, finalPunishment);
|
||||
addCard(Zone.BATTLEFIELD, playerA, bob);
|
||||
|
||||
attack(1, playerA, bob, playerB);
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerA, finalPunishment, playerB);
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 18);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.mage.test.cards.single.akh;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class BontuTheGlorifiedTest extends CardTestPlayerBase {
|
||||
|
||||
String bontu = "Bontu the Glorified";
|
||||
String swamp = "Swamp";
|
||||
String grizzly = "Grizzly Bears";
|
||||
|
||||
|
||||
@Test
|
||||
public void testBontuNotAttack() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, bontu);
|
||||
addCard(Zone.BATTLEFIELD, playerA, swamp, 10);
|
||||
addCard(Zone.BATTLEFIELD, playerA, grizzly);
|
||||
|
||||
attack(1, playerA, bontu);
|
||||
|
||||
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBontuAttack() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, bontu);
|
||||
addCard(Zone.BATTLEFIELD, playerA, swamp, 10);
|
||||
addCard(Zone.BATTLEFIELD, playerA, grizzly);
|
||||
addCard(Zone.HAND, playerA, "Terror");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Terror", grizzly);
|
||||
|
||||
attack(1, playerA, bontu);
|
||||
|
||||
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 16);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBontuSacAbility() {
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, bontu);
|
||||
addCard(Zone.BATTLEFIELD, playerA, swamp, 10);
|
||||
addCard(Zone.BATTLEFIELD, playerA, grizzly);
|
||||
addCard(Zone.HAND, playerA, "Terror");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{B}");
|
||||
|
||||
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 19);
|
||||
assertPermanentCount(playerA, grizzly, 0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBontuSacAbilityTriggersAttack() {
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, bontu);
|
||||
addCard(Zone.BATTLEFIELD, playerA, swamp, 10);
|
||||
addCard(Zone.BATTLEFIELD, playerA, grizzly);
|
||||
addCard(Zone.HAND, playerA, "Terror");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{B}");
|
||||
attack(1, playerA, bontu);
|
||||
setStopAt(4, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 15);
|
||||
assertPermanentCount(playerA, grizzly, 0);
|
||||
|
||||
}
|
||||
}
|
|
@ -10,21 +10,21 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
* Created by IGOUDT on 30-3-2017.
|
||||
*/
|
||||
public class KiraGreatGlassSpinnerTest extends CardTestPlayerBase {
|
||||
|
||||
private final String kira = "Kira, Great Glass-Spinner";
|
||||
|
||||
@Test
|
||||
public void counterFirst() {
|
||||
|
||||
String ugin = "Ugin, the Spirit Dragon";
|
||||
addCard(Zone.BATTLEFIELD, playerA, ugin); // starts with 7 Loyality counters
|
||||
|
||||
/*
|
||||
Kira, Great Glass-Spinner {1}{U}{U}
|
||||
Legendary Creature - Spirit 2/2
|
||||
Flying
|
||||
Creatures you control have "Whenever this creature becomes the target of a spell or ability for the first time each turn, counter that spell or ability."
|
||||
*/
|
||||
private final String kira = "Kira, Great Glass-Spinner";
|
||||
private final String ugin = "Ugin, the Spirit Dragon";
|
||||
|
||||
@Test
|
||||
public void counterFirst() {
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, ugin); // starts with 7 Loyality counters
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, kira);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira); // Ugin ability
|
||||
|
||||
|
@ -34,4 +34,45 @@ public class KiraGreatGlassSpinnerTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, kira, 1);
|
||||
assertCounterCount(playerA, ugin, CounterType.LOYALTY, 9);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void counterFirstResolveSecond() {
|
||||
|
||||
String ugin = "Ugin, the Spirit Dragon";
|
||||
addCard(Zone.BATTLEFIELD, playerA, ugin); // starts with 7 Loyality counters
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||
addCard(Zone.HAND, playerA, "Unsummon", 1);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, kira);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira); // Ugin ability
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unsummon", kira);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, kira, 0);
|
||||
assertCounterCount(playerA, ugin, CounterType.LOYALTY, 9);
|
||||
assertGraveyardCount(playerA, "Unsummon", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void counterFirstThisTurn_counterFirstOnNextTurn() {
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, ugin); // starts with 7 Loyality counters
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, kira);
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira); // Ugin ability
|
||||
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "+2: {source} deals 3 damage to target creature or player.", kira); // Ugin ability
|
||||
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, kira, 1);
|
||||
assertCounterCount(playerA, ugin, CounterType.LOYALTY, 11);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ package mage.watchers.common;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -36,12 +38,10 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CreaturesDiedWatcher extends Watcher {
|
||||
|
||||
private int amountOfCreaturesThatDied;
|
||||
private final HashMap<UUID, Integer> amountOfCreaturesThatDiedByController = new HashMap<>();
|
||||
|
||||
public CreaturesDiedWatcher() {
|
||||
|
@ -50,7 +50,6 @@ public class CreaturesDiedWatcher extends Watcher {
|
|||
|
||||
public CreaturesDiedWatcher(final CreaturesDiedWatcher watcher) {
|
||||
super(watcher);
|
||||
this.amountOfCreaturesThatDied = watcher.amountOfCreaturesThatDied;
|
||||
this.amountOfCreaturesThatDiedByController.putAll(watcher.amountOfCreaturesThatDiedByController);
|
||||
}
|
||||
|
||||
|
@ -61,11 +60,7 @@ public class CreaturesDiedWatcher extends Watcher {
|
|||
if (zEvent.isDiesEvent()
|
||||
&& zEvent.getTarget() != null
|
||||
&& zEvent.getTarget().isCreature()) {
|
||||
amountOfCreaturesThatDied++;
|
||||
int amount = 0;
|
||||
if (amountOfCreaturesThatDiedByController.containsKey(zEvent.getTarget().getControllerId())) {
|
||||
amount = amountOfCreaturesThatDiedByController.get(zEvent.getTarget().getControllerId());
|
||||
}
|
||||
int amount = getAmountOfCreaturesDiesThisTurn(zEvent.getTarget().getControllerId());
|
||||
amountOfCreaturesThatDiedByController.put(zEvent.getTarget().getControllerId(), amount + 1);
|
||||
}
|
||||
}
|
||||
|
@ -73,13 +68,9 @@ public class CreaturesDiedWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void reset() {
|
||||
amountOfCreaturesThatDied = 0;
|
||||
amountOfCreaturesThatDiedByController.clear();
|
||||
}
|
||||
|
||||
public int getAmountOfCreaturesDiesThisTurn() {
|
||||
return amountOfCreaturesThatDied;
|
||||
}
|
||||
|
||||
public int getAmountOfCreaturesDiesThisTurn(UUID playerId) {
|
||||
return amountOfCreaturesThatDiedByController.getOrDefault(playerId, 0);
|
||||
|
@ -90,4 +81,7 @@ public class CreaturesDiedWatcher extends Watcher {
|
|||
return new CreaturesDiedWatcher(this);
|
||||
}
|
||||
|
||||
public int getAmountOfCreaturesDiesThisTurn() {
|
||||
return amountOfCreaturesThatDiedByController.values().stream().mapToInt(x -> x).sum();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue