forked from External/mage
game engine, tests and other fixes:
tests: fixed wrong permanent structure for battlefield cards (addCard command); tests: added docs and additional runtime checks; game: Modal double-faced cards - improved support, no more other side effects on battlefield; game: Copy abilities - improved stability and cards support; game: Player under control - improved stability and related cards support (possible NPE errors, additional runtime checks); server: fixed bloated logs with game timer; AI: fixed wrong timer in computer games;
This commit is contained in:
parent
824e4c6b7a
commit
229e8d3075
35 changed files with 303 additions and 151 deletions
|
|
@ -71,9 +71,32 @@ public class ModalDoubleFacedCardHalfImpl extends CardImpl implements ModalDoubl
|
|||
|
||||
@Override
|
||||
public void setZone(Zone zone, Game game) {
|
||||
// see ModalDoubleFacedCard.checkGoodZones for details
|
||||
game.setZone(parentCard.getId(), zone);
|
||||
game.setZone(parentCard.getLeftHalfCard().getId(), zone);
|
||||
game.setZone(parentCard.getRightHalfCard().getId(), zone);
|
||||
game.setZone(this.getId(), zone);
|
||||
|
||||
// find another side to sync
|
||||
ModalDoubleFacedCardHalf otherSide;
|
||||
if (!parentCard.getLeftHalfCard().getId().equals(this.getId())) {
|
||||
otherSide = parentCard.getLeftHalfCard();
|
||||
} else if (!parentCard.getRightHalfCard().getId().equals(this.getId())) {
|
||||
otherSide = parentCard.getRightHalfCard();
|
||||
} else {
|
||||
throw new IllegalStateException("Wrong code usage: MDF halves must use different ids");
|
||||
}
|
||||
|
||||
switch (zone) {
|
||||
case STACK:
|
||||
case BATTLEFIELD:
|
||||
// stack and battlefield must have only one side
|
||||
game.setZone(otherSide.getId(), Zone.OUTSIDE);
|
||||
break;
|
||||
default:
|
||||
game.setZone(otherSide.getId(), zone);
|
||||
break;
|
||||
}
|
||||
|
||||
ModalDoubleFacedCard.checkGoodZones(game, parentCard);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue