mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[DSC] Implement Zimone, Mystery Unraveler.
This commit is contained in:
parent
5e1dace946
commit
43b28334e6
3 changed files with 102 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue