mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
Fix #10655 (getPermanentEntering for COUNTERS_ADDED trigger/watcher)
This commit is contained in:
parent
3886075dac
commit
34c805c4b8
5 changed files with 24 additions and 8 deletions
|
|
@ -29,8 +29,13 @@ public class BoostCountersAddedFirstTimeWatcher extends Watcher {
|
|||
return;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
int offset = 0;
|
||||
if (permanent == null) {
|
||||
permanent = game.getPermanentEntering(event.getTargetId());
|
||||
offset++;
|
||||
}
|
||||
if (permanent != null && event.getData().equals(CounterType.P1P1.getName())) {
|
||||
map.putIfAbsent(new MageObjectReference(permanent, game), event.getId());
|
||||
map.putIfAbsent(new MageObjectReference(permanent, game, offset), event.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -40,13 +45,13 @@ public class BoostCountersAddedFirstTimeWatcher extends Watcher {
|
|||
map.clear();
|
||||
}
|
||||
|
||||
public static boolean checkEvent(GameEvent event, Permanent permanent, Game game) {
|
||||
public static boolean checkEvent(GameEvent event, Permanent permanent, Game game, int offset) {
|
||||
return event
|
||||
.getId()
|
||||
.equals(game
|
||||
.getState()
|
||||
.getWatcher(BoostCountersAddedFirstTimeWatcher.class)
|
||||
.map
|
||||
.getOrDefault(new MageObjectReference(permanent, game), null));
|
||||
.getOrDefault(new MageObjectReference(permanent, game, offset), null));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue