mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Fixed a bug that winning with alternate win condition (e.g. Biovisionary) did not set game end date. That leads to a NPE in client.
This commit is contained in:
parent
484a4fe0f6
commit
f0e8041906
3 changed files with 80 additions and 2 deletions
|
@ -66,7 +66,11 @@ public class Biovisionary extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
//At the beginning of the end step, if you control four or more creatures named Biovisionary, you win the game.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new WinGameSourceControllerEffect(), TargetController.ANY, new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 3), false));
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new WinGameSourceControllerEffect(),
|
||||
TargetController.ANY,
|
||||
new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 3),
|
||||
false));
|
||||
}
|
||||
|
||||
public Biovisionary(final Biovisionary card) {
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.triggers;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*
|
||||
*/
|
||||
public class BiovisionaryTest extends CardTestPlayerBase {
|
||||
/**
|
||||
* Biovisionary {1}{G}{U}
|
||||
* Creature 2/3
|
||||
* At the beginning of the end step, if you control four or more creatures named Biovisionary, you win the game.
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testFourWin() {
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Biovisionary", 4);
|
||||
|
||||
setStopAt(2, PhaseStep.UNTAP);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Biovisionary", 4);
|
||||
|
||||
Assert.assertTrue("Player B loses",playerB.hasLost());
|
||||
Assert.assertTrue("Player A wins with four Biovisionary",playerA.hasWon());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFourWithThreeClonesWin() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 12);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Biovisionary", 1);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Clone", 3);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clone");
|
||||
setChoice(playerA, "Yes");
|
||||
setChoice(playerA, "Biovisionary");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clone");
|
||||
setChoice(playerA, "Yes");
|
||||
setChoice(playerA, "Biovisionary");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Clone");
|
||||
setChoice(playerA, "Yes");
|
||||
setChoice(playerA, "Biovisionary");
|
||||
|
||||
setStopAt(2, PhaseStep.UNTAP);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Biovisionary", 4);
|
||||
Assert.assertTrue("Player B loses",playerB.hasLost());
|
||||
Assert.assertTrue("Player A wins with four Biovisionary",playerA.hasWon());
|
||||
|
||||
}
|
||||
}
|
|
@ -459,7 +459,6 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
player.won(this);
|
||||
}
|
||||
}
|
||||
endTime = new Date();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -869,6 +868,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
@Override
|
||||
public void end() {
|
||||
if (!state.isGameOver()) {
|
||||
endTime = new Date();
|
||||
state.endGame();
|
||||
for (Player player: state.getPlayers().values()) {
|
||||
player.abort();
|
||||
|
|
Loading…
Reference in a new issue