[DSC] Implement Zimone, Mystery Unraveler.

This commit is contained in:
Grath 2024-09-28 16:11:33 -04:00
parent 5e1dace946
commit 43b28334e6
3 changed files with 102 additions and 1 deletions

View file

@ -18,21 +18,28 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
private final int resolutionNumber;
private final Effects effects;
private final boolean orMore;
public IfAbilityHasResolvedXTimesEffect(int resolutionNumber, Effect effect) {
this(effect.getOutcome(), resolutionNumber, effect);
}
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect... effects) {
this(outcome, resolutionNumber, false, effects);
}
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, boolean orMore, Effect... effects) {
super(outcome);
this.resolutionNumber = resolutionNumber;
this.effects = new Effects(effects);
this.orMore = orMore;
}
private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) {
super(effect);
this.resolutionNumber = effect.resolutionNumber;
this.effects = effect.effects.copy();
this.orMore = effect.orMore;
}
@Override
@ -42,7 +49,8 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
if (AbilityResolvedWatcher.getResolutionCount(game, source) != resolutionNumber) {
int resolutionCount = AbilityResolvedWatcher.getResolutionCount(game, source);
if (resolutionCount < resolutionNumber || (!orMore && resolutionCount > resolutionNumber)) {
return false;
}
boolean result = false;
@ -62,6 +70,9 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
if (orMore) {
return "otherwise, " + effects.getText(mode);
}
return "if this is the " + CardUtil.numberToOrdinalText(resolutionNumber) +
" time this ability has resolved this turn, " + effects.getText(mode);
}