mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
[NEO] Implemented Bronze Cudgels
This commit is contained in:
parent
dece8da0ad
commit
b92128dd41
5 changed files with 96 additions and 15 deletions
|
|
@ -15,11 +15,7 @@ public enum AbilityResolutionCount implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
AbilityResolvedWatcher watcher = game.getState().getWatcher(AbilityResolvedWatcher.class);
|
||||
if (watcher != null) {
|
||||
return watcher.getResolutionCount(game, sourceAbility);
|
||||
}
|
||||
return 0;
|
||||
return AbilityResolvedWatcher.getResolutionCount(game, sourceAbility);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -38,15 +38,13 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AbilityResolvedWatcher watcher = game.getState().getWatcher(AbilityResolvedWatcher.class);
|
||||
if (watcher != null && watcher.getResolutionCount(game, source) == resolutionNumber) {
|
||||
if (effect instanceof OneShotEffect) {
|
||||
return effect.apply(game, source);
|
||||
} else {
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
return true;
|
||||
}
|
||||
if (AbilityResolvedWatcher.getResolutionCount(game, source) != resolutionNumber) {
|
||||
return true;
|
||||
}
|
||||
if (effect instanceof OneShotEffect) {
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,11 @@ public class AbilityResolvedWatcher extends Watcher {
|
|||
resolutionMap.clear();
|
||||
}
|
||||
|
||||
public int getResolutionCount(Game game, Ability source) {
|
||||
return resolutionMap.getOrDefault(source.getOriginalId().toString() + game.getState().getZoneChangeCounter(source.getSourceId()), 0);
|
||||
public static int getResolutionCount(Game game, Ability source) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(AbilityResolvedWatcher.class)
|
||||
.resolutionMap
|
||||
.getOrDefault(source.getOriginalId().toString() + game.getState().getZoneChangeCounter(source.getSourceId()), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue