mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
rewrite watchers to GameState.getWatcher(), rather than getWatchers().get(). This hides away the implementation of the watchers. Accepts the class rather than the name. Always returns the specific subclass, so there is no more casting needed. Only 1 line in the common library remains, that is still using the old 'deprecated' method. Needs a new version release to do that.
This commit is contained in:
parent
f01b3d3ca3
commit
9a310732d8
324 changed files with 573 additions and 586 deletions
|
|
@ -40,7 +40,7 @@ public class SpectacleAbility extends SpellAbility {
|
|||
|
||||
@Override
|
||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
|
||||
if (watcher != null && watcher.getAllOppLifeLost(playerId, game) > 0) {
|
||||
return super.canActivate(playerId, game);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue