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

@ -1565,14 +1565,14 @@ public abstract class GameImpl implements Game, Serializable {
}
state.addCommandObject(newPlane);
informPlayers("You have planeswalked to " + newPlane.getLogName());
// Fire off the planeswalked event
GameEvent event = new GameEvent(GameEvent.EventType.PLANESWALK, newPlane.getId(), null, newPlane.getId(), 0, true);
if (!replaceEvent(event)) {
GameEvent ge = new GameEvent(GameEvent.EventType.PLANESWALKED, newPlane.getId(), null, newPlane.getId(), 0, true);
fireEvent(ge);
}
return true;
}
@ -2821,7 +2821,7 @@ public abstract class GameImpl implements Game, Serializable {
if (s.length == 2) {
try {
Integer amount = Integer.parseInt(s[1]);
player.setLife(amount, this);
player.setLife(amount, this, ownerId);
logger.info("Setting player's life: ");
} catch (NumberFormatException e) {
logger.fatal("error setting life", e);

View file

@ -785,7 +785,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
if (source != null && sourceAbilities != null) {
if (sourceAbilities.containsKey(LifelinkAbility.getInstance().getId())) {
Player player = game.getPlayer(sourceControllerId);
player.gainLife(damageDone, game, source);
player.gainLife(damageDone, game, sourceId);
}
if (sourceAbilities.containsKey(DeathtouchAbility.getInstance().getId())) {
deathtouched = true;
@ -946,8 +946,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
}
if (abilities.containsKey(HexproofFromBlackAbility.getInstance().getId()) ) {
if (abilities.containsKey(HexproofFromBlackAbility.getInstance().getId())) {
if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game)
&& !game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, sourceControllerId, game)
&& source.getColor(game).isBlack()) {
@ -955,7 +954,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
}
}
if (abilities.containsKey(HexproofFromWhiteAbility.getInstance().getId()) ) {
if (abilities.containsKey(HexproofFromWhiteAbility.getInstance().getId())) {
if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game)
&& !game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, sourceControllerId, game)
&& source.getColor(game).isWhite()) {