mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
fix Obeka, Splitter of Seconds' extra phase calling beginning of turn method
This commit is contained in:
parent
110e9903f5
commit
ff4bd9b430
3 changed files with 41 additions and 5 deletions
|
|
@ -37,4 +37,31 @@ public class ObekaSplitterOfSecondsTest extends CardTestPlayerBase {
|
||||||
assertTapped(obeka, true); // checks that no extra untap happened
|
assertTapped(obeka, true); // checks that no extra untap happened
|
||||||
assertHandCount(playerA, 0); // checks that no draw step happened
|
assertHandCount(playerA, 0); // checks that no draw step happened
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bug: Extra upkeep is wrongly changing summoning sickness status
|
||||||
|
@Test
|
||||||
|
public void test_ExtraUpkeep_TapAbility() {
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, obeka);
|
||||||
|
// At the beginning of your upkeep, you gain 1 life.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Fountain of Renewal");
|
||||||
|
addCard(Zone.HAND, playerA, "Soulmender"); // "{T}: You gain 1 life
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains");
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Soulmender", true);
|
||||||
|
checkPlayableAbility("Soulmender summoning sick pre-combat", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: You gain 1 life", false);
|
||||||
|
|
||||||
|
attack(1, playerA, obeka, playerB);
|
||||||
|
checkLife("Extra upkeeps are in extra phases after combat", 1, PhaseStep.END_COMBAT, playerA, 20 + 1);
|
||||||
|
checkPlayableAbility("Soulmender summoning sick after extra upkeep", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: You gain 1 life", false);
|
||||||
|
|
||||||
|
checkPlayableAbility("Soulmender no longer summoning sick turn 3", 3, PhaseStep.UPKEEP, playerA, "{T}: You gain 1 life", true);
|
||||||
|
activateAbility(3, PhaseStep.UPKEEP, playerA, "{T}: You gain 1 life");
|
||||||
|
|
||||||
|
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20 + 2 + 2 + 1); // 2 regular upkeep + 2 obeka ones + 1 Soulmender activation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,24 @@
|
||||||
|
|
||||||
package mage.game.turn;
|
package mage.game.turn;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.constants.TurnPhase;
|
import mage.constants.TurnPhase;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class BeginningPhase extends Phase {
|
public class BeginningPhase extends Phase {
|
||||||
|
|
||||||
|
private final boolean isExtra;
|
||||||
|
|
||||||
public BeginningPhase() {
|
public BeginningPhase() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeginningPhase(boolean isExtra) {
|
||||||
this.type = TurnPhase.BEGINNING;
|
this.type = TurnPhase.BEGINNING;
|
||||||
this.event = EventType.BEGINNING_PHASE;
|
this.event = EventType.BEGINNING_PHASE;
|
||||||
this.preEvent = EventType.BEGINNING_PHASE_PRE;
|
this.preEvent = EventType.BEGINNING_PHASE_PRE;
|
||||||
|
|
@ -21,17 +27,20 @@ public class BeginningPhase extends Phase {
|
||||||
this.steps.add(new UntapStep());
|
this.steps.add(new UntapStep());
|
||||||
this.steps.add(new UpkeepStep());
|
this.steps.add(new UpkeepStep());
|
||||||
this.steps.add(new DrawStep());
|
this.steps.add(new DrawStep());
|
||||||
|
this.isExtra = isExtra;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean beginPhase(Game game, UUID activePlayerId) {
|
public boolean beginPhase(Game game, UUID activePlayerId) {
|
||||||
|
if (!isExtra) {
|
||||||
game.getBattlefield().beginningOfTurn(game);
|
game.getBattlefield().beginningOfTurn(game);
|
||||||
|
}
|
||||||
return super.beginPhase(game, activePlayerId);
|
return super.beginPhase(game, activePlayerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected BeginningPhase(final BeginningPhase phase) {
|
protected BeginningPhase(final BeginningPhase phase) {
|
||||||
super(phase);
|
super(phase);
|
||||||
|
this.isExtra = phase.isExtra;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ public class Turn implements Serializable {
|
||||||
Phase phase;
|
Phase phase;
|
||||||
switch (extraPhase) {
|
switch (extraPhase) {
|
||||||
case BEGINNING:
|
case BEGINNING:
|
||||||
phase = new BeginningPhase();
|
phase = new BeginningPhase(true);
|
||||||
break;
|
break;
|
||||||
case PRECOMBAT_MAIN:
|
case PRECOMBAT_MAIN:
|
||||||
phase = new PreCombatMainPhase();
|
phase = new PreCombatMainPhase();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue