mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Fix issue where a spell's target wouldn't be correctly shown in the game log message.
The problem was that by the time the log sees the spell, its target has been swapped with the stack ability.
This commit is contained in:
@@ -12,6 +12,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
import forge.util.maps.MapOfLists;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
@@ -49,7 +50,12 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
|
||||
|
||||
if (event.sa.getTargetRestrictions() != null) {
|
||||
sb.append(" targeting ");
|
||||
for (TargetChoices ch : event.sa.getAllTargetChoices()) {
|
||||
|
||||
ArrayList<TargetChoices> targets = event.sa.getAllTargetChoices();
|
||||
// Include the TargetChoices from the stack instance, since the real target choices
|
||||
// are on that object at this point (see SpellAbilityStackInstance constructor).
|
||||
targets.add(event.si.getTargetChoices());
|
||||
for (TargetChoices ch : targets) {
|
||||
if (null != ch) {
|
||||
sb.append(ch.getTargetedString());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package forge.game.event;
|
||||
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.SpellAbilityStackInstance;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
@@ -9,10 +10,12 @@ import forge.game.spellability.SpellAbility;
|
||||
public class GameEventSpellAbilityCast extends GameEvent {
|
||||
|
||||
public final SpellAbility sa;
|
||||
public final SpellAbilityStackInstance si;
|
||||
public final boolean replicate;
|
||||
|
||||
public GameEventSpellAbilityCast(SpellAbility sp, boolean replicate) {
|
||||
public GameEventSpellAbilityCast(SpellAbility sp, SpellAbilityStackInstance si, boolean replicate) {
|
||||
sa = sp;
|
||||
this.si = si;
|
||||
this.replicate = replicate;
|
||||
}
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
sp.getActivatingPlayer().setActivateLoyaltyAbilityThisTurn(true);
|
||||
}
|
||||
game.updateStackForView();
|
||||
game.fireEvent(new GameEventSpellAbilityCast(sp, false));
|
||||
game.fireEvent(new GameEventSpellAbilityCast(sp, si, false));
|
||||
return si;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user