RepeatSubAbility host isn't set correctly if source changes zone

This commit is contained in:
Chris H
2018-01-08 23:44:40 -05:00
parent b63037caf3
commit eeccc8490d
2 changed files with 5 additions and 2 deletions

View File

@@ -28,11 +28,11 @@ public class RepeatEachEffect extends SpellAbilityEffect {
AbilitySub repeat = sa.getAdditionalAbility("RepeatSubAbility");
if (repeat != null && !repeat.getHostCard().equals(source)) {
if (repeat != null && !repeat.getHostCard().equalsWithTimestamp(source)) {
// TODO: for some reason, the host card of the original additional SA is set to the cloned card when
// the ability is copied (e.g. Clone Legion + Swarm Intelligence). Couldn't figure out why this happens,
// so this hack is necessary for now to work around this issue.
System.out.println("Warning: RepeatSubAbility had the wrong host set (potentially after cloning the root SA), attempting to correct...");
System.out.println("Warning: RepeatSubAbility had the wrong host set (potentially after cloning the root SA or changing zones), attempting to correct...");
repeat.setHostCard(source);
}

View File

@@ -4776,6 +4776,9 @@ public class Card extends GameEntity implements Comparable<Card> {
public final void setTimestamp(final long t) {
timestamp = t;
}
public boolean equalsWithTimestamp(Card c) {
return c == this && c.getTimestamp() == timestamp;
}
/**
* Assign a random foil finish depending on the card edition.