refactored Player.setLife() to include source, some more changes

This commit is contained in:
Evan Kranzler 2018-04-18 21:14:05 -04:00
parent 2205db105f
commit 3c2a8ee17d
41 changed files with 120 additions and 133 deletions

View file

@ -1,5 +1,6 @@
package org.mage.test.cards.single.vis;
import java.util.UUID;
import mage.game.permanent.Permanent;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -19,7 +20,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
@Test
public void should_display_correct_text() {
String expectedText = "When {this} dies, at the beginning of the next end step, you lose 1 life and return Brood of Cockroaches to your hand.";
String expectedText = "When {this} dies, at the beginning of the next end step, you lose 1 life and return Brood of Cockroaches to your hand.";
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
@ -33,7 +34,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
@Test
public void should_reduce_life_of_playerA_by_1_at_the_beginning_of_the_next_end_step() {
playerA.setLife(ANY_LIFE_TOTAL, currentGame);
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
@ -47,7 +48,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
@Test
public void should_not_reduce_life_of_playerA_by_1_at_post_combat_main_step() {
playerA.setLife(ANY_LIFE_TOTAL, currentGame);
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
@ -56,12 +57,12 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
setStopAt(TURN_1, PRECOMBAT_MAIN);
execute();
assertLife(playerA, ANY_LIFE_TOTAL );
assertLife(playerA, ANY_LIFE_TOTAL);
}
@Test
public void should_return_Brood_of_Cockroaches_to_playerA_hand_end_of_turn() {
playerA.setLife(ANY_LIFE_TOTAL, currentGame);
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
@ -75,7 +76,7 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
@Test
public void should_not_return_Brood_of_Cockroaches_to_playerA_at_post_combat_step() {
playerA.setLife(ANY_LIFE_TOTAL, currentGame);
playerA.setLife(ANY_LIFE_TOTAL, currentGame, UUID.randomUUID());
playerA_casts_Brood_of_Cockroaches_at_precombat_main_phase();
@ -87,7 +88,6 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
assertHandCount(playerA, BROOD_OF_COCKROACHES, 0);
}
private void brood_of_cockroaches_diesat_precombat_main_phase() {
addCard(BATTLEFIELD, playerB, "Mountain", 1);
addCard(HAND, playerB, SHOCK, 1);
@ -100,5 +100,4 @@ public class BroodOfCockroachesTest extends CardTestPlayerBase {
castSpell(TURN_1, PRECOMBAT_MAIN, playerA, BROOD_OF_COCKROACHES);
}
}

View file

@ -1547,8 +1547,13 @@ public class TestPlayer implements Player {
}
@Override
public void setLife(int life, Game game) {
computerPlayer.setLife(life, game);
public void setLife(int life, Game game, UUID sourceId) {
computerPlayer.setLife(life, game, sourceId);
}
@Override
public void setLife(int life, Game game, Ability source) {
computerPlayer.setLife(life, game, source);
}
@Override
@ -1593,7 +1598,12 @@ public class TestPlayer implements Player {
@Override
public int gainLife(int amount, Game game, Ability source) {
return computerPlayer.gainLife(amount, game);
return computerPlayer.gainLife(amount, game, source);
}
@Override
public int gainLife(int amount, Game game, UUID sourceId) {
return computerPlayer.gainLife(amount, game, sourceId);
}
@Override

View file

@ -140,7 +140,12 @@ public class PlayerStub implements Player {
}
@Override
public void setLife(int life, Game game) {
public void setLife(int life, Game game, Ability source) {
}
@Override
public void setLife(int life, Game game, UUID sourceId) {
}
@ -154,6 +159,11 @@ public class PlayerStub implements Player {
return 0;
}
@Override
public int gainLife(int amount, Game game, UUID sourceId) {
return 0;
}
@Override
public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) {
return 0;