forked from External/mage
game: turn modification improves:
- fixed miss phase changed events and logs in some use cases; - added source info in turn modification logs; - added game logs for take and lost control of the spell (example: Word of Command) - added game logs for skip step; - added game logs for extra step; - added game logs for skip phase;
This commit is contained in:
parent
e724166569
commit
3d3358cd05
14 changed files with 279 additions and 149 deletions
|
|
@ -61,7 +61,8 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
private boolean faceDown;
|
||||
private boolean countered;
|
||||
private boolean resolving = false;
|
||||
private UUID commandedBy = null; // for Word of Command
|
||||
private UUID commandedByPlayerId = null; // controller of the spell resolve, example: Word of Command
|
||||
private String commandedByInfo; // info about spell commanded, e.g. source
|
||||
private int startingLoyalty;
|
||||
private int startingDefense;
|
||||
|
||||
|
|
@ -132,7 +133,8 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
this.faceDown = spell.faceDown;
|
||||
this.countered = spell.countered;
|
||||
this.resolving = spell.resolving;
|
||||
this.commandedBy = spell.commandedBy;
|
||||
this.commandedByPlayerId = spell.commandedByPlayerId;
|
||||
this.commandedByInfo = spell.commandedByInfo;
|
||||
|
||||
this.currentActivatingManaAbilitiesStep = spell.currentActivatingManaAbilitiesStep;
|
||||
this.targetChanged = spell.targetChanged;
|
||||
|
|
@ -240,12 +242,16 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
return false;
|
||||
}
|
||||
this.resolving = true;
|
||||
if (commandedBy != null && !commandedBy.equals(getControllerId())) {
|
||||
Player turnController = game.getPlayer(commandedBy);
|
||||
if (turnController != null) {
|
||||
turnController.controlPlayersTurn(game, controller.getId());
|
||||
|
||||
// setup new turn controller for spell's resolve, example: Word of Command
|
||||
// original controller will be reset after spell's resolve
|
||||
if (commandedByPlayerId != null && !commandedByPlayerId.equals(getControllerId())) {
|
||||
Player newTurnController = game.getPlayer(commandedByPlayerId);
|
||||
if (newTurnController != null) {
|
||||
newTurnController.controlPlayersTurn(game, controller.getId(), commandedByInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isInstantOrSorcery(game)) {
|
||||
int index = 0;
|
||||
result = false;
|
||||
|
|
@ -1122,12 +1128,23 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
public void setCommandedBy(UUID playerId) {
|
||||
this.commandedBy = playerId;
|
||||
/**
|
||||
* Add temporary turn controller while resolving (e.g. all choices will be made by another player)
|
||||
* Example: Word of Command
|
||||
* @param newTurnControllerId
|
||||
* @param info additional info for game logs
|
||||
*/
|
||||
public void setCommandedBy(UUID newTurnControllerId, String info) {
|
||||
this.commandedByPlayerId = newTurnControllerId;
|
||||
this.commandedByInfo = info;
|
||||
}
|
||||
|
||||
public UUID getCommandedBy() {
|
||||
return commandedBy;
|
||||
public UUID getCommandedByPlayerId() {
|
||||
return commandedByPlayerId;
|
||||
}
|
||||
|
||||
public String getCommandedByInfo() {
|
||||
return commandedByInfo == null ? "" : commandedByInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue