mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Test for Copied Gilded Drake reverting control when killed (#9198)
This commit is contained in:
parent
5d11bab6dd
commit
c34c6a59df
5 changed files with 85 additions and 30 deletions
|
|
@ -28,7 +28,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
|
|||
private boolean withSecondTarget;
|
||||
private boolean destroyAttachedAuras;
|
||||
private Map<UUID, Integer> zoneChangeCounter = new HashMap<>();
|
||||
private Map<UUID, UUID> lockedControllers = new HashMap<>();
|
||||
private Map<UUID, UUID> lockedControllers = new HashMap<>(); // Controllers for each permanent that is enforced by this effect
|
||||
|
||||
public ExchangeControlTargetEffect(Duration duration, String rule) {
|
||||
this(duration, rule, false);
|
||||
|
|
@ -102,9 +102,11 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
|
|||
discard();
|
||||
return;
|
||||
}
|
||||
// Meant to be swapped since this enforced the
|
||||
this.lockedControllers.put(permanent1.getId(), permanent2.getControllerId());
|
||||
this.zoneChangeCounter.put(permanent1.getId(), permanent1.getZoneChangeCounter(game));
|
||||
this.lockedControllers.put(permanent2.getId(), permanent1.getControllerId());
|
||||
|
||||
this.zoneChangeCounter.put(permanent1.getId(), permanent1.getZoneChangeCounter(game));
|
||||
this.zoneChangeCounter.put(permanent2.getId(), permanent2.getZoneChangeCounter(game));
|
||||
} else {
|
||||
// discard if there are less than 2 permanents
|
||||
|
|
@ -118,7 +120,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
|
|||
for (Map.Entry<UUID, Integer> entry : zoneChangeCounter.entrySet()) {
|
||||
Permanent permanent = game.getPermanent(entry.getKey());
|
||||
if (permanent == null || permanent.getZoneChangeCounter(game) != entry.getValue()) {
|
||||
// controll effect cease if the same permanent is no longer on the battlefield
|
||||
// Control effect cease if the same permanent is no longer on the battlefield
|
||||
toDelete.add(entry.getKey());
|
||||
continue;
|
||||
}
|
||||
|
|
@ -138,6 +140,7 @@ public class ExchangeControlTargetEffect extends ContinuousEffectImpl {
|
|||
if (!toDelete.isEmpty()) {
|
||||
for (UUID uuid : toDelete) {
|
||||
zoneChangeCounter.remove(uuid);
|
||||
lockedControllers.remove(uuid);
|
||||
}
|
||||
if (zoneChangeCounter.isEmpty()) {
|
||||
discard();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue