- More correct implementation of the way GameEventCardModeChosen game event is processed.

This commit is contained in:
Agetian
2015-05-19 18:04:33 +00:00
parent 4e56670a23
commit 842167d1ff
3 changed files with 9 additions and 4 deletions

View File

@@ -100,8 +100,11 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
@Override @Override
public GameLogEntry visit(GameEventCardModeChosen ev) { public GameLogEntry visit(GameEventCardModeChosen ev) {
String modeChoiceOutcome = String.format("%s has chosen %s for %s.", ev.player, ev.mode, ev.cardName); if (!ev.log) {
return null;
}
String modeChoiceOutcome = String.format("%s has chosen %s for %s.", ev.player, ev.mode, ev.cardName);
return new GameLogEntry(GameLogEntryType.STACK_RESOLVE, modeChoiceOutcome); return new GameLogEntry(GameLogEntryType.STACK_RESOLVE, modeChoiceOutcome);
} }

View File

@@ -57,14 +57,14 @@ public class ChooseGenericEffect extends SpellAbilityEffect {
chosenName = choices[idxChosen]; chosenName = choices[idxChosen];
} }
SpellAbility chosenSA = AbilityFactory.getAbility(host.getSVar(chosenName), host); SpellAbility chosenSA = AbilityFactory.getAbility(host.getSVar(chosenName), host);
String chosenValue = abilities.get(idxChosen).getDescription();
if (sa.hasParam("ShowChoice")) { if (sa.hasParam("ShowChoice")) {
boolean dontNotifySelf = sa.getParam("ShowChoice").equals("ExceptSelf"); boolean dontNotifySelf = sa.getParam("ShowChoice").equals("ExceptSelf");
String chosenValue = abilities.get(idxChosen).getDescription();
p.getGame().getAction().nofityOfValue(sa, p, chosenValue, dontNotifySelf ? sa.getActivatingPlayer() : null); p.getGame().getAction().nofityOfValue(sa, p, chosenValue, dontNotifySelf ? sa.getActivatingPlayer() : null);
p.getGame().fireEvent(new GameEventCardModeChosen(p, host.getName(), chosenValue));
} }
chosenSA.setActivatingPlayer(sa.getActivatingPlayer()); chosenSA.setActivatingPlayer(sa.getActivatingPlayer());
((AbilitySub) chosenSA).setParent(sa); ((AbilitySub) chosenSA).setParent(sa);
p.getGame().fireEvent(new GameEventCardModeChosen(p, host.getName(), chosenValue, sa.hasParam("ShowChoice")));
AbilityUtils.resolve(chosenSA); AbilityUtils.resolve(chosenSA);
} }
} }

View File

@@ -7,11 +7,13 @@ public class GameEventCardModeChosen extends GameEvent {
public final Player player; public final Player player;
public final String cardName; public final String cardName;
public final String mode; public final String mode;
public final boolean log;
public GameEventCardModeChosen(Player player, String cardName, String mode) { public GameEventCardModeChosen(Player player, String cardName, String mode, boolean log) {
this.player = player; this.player = player;
this.cardName = cardName; this.cardName = cardName;
this.mode = mode; this.mode = mode;
this.log = log;
} }
@Override @Override