Merge branch 'Fix-RepeatEach-Changing-Zones' into 'master'

RepeatSubAbility host isn't set correctly if source changes zone

See merge request core-developers/forge!61
This commit is contained in:
Michael Kamensky
2018-01-09 05:18:46 +00:00
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.