fixed Time of Ice not keeping things tapped.

This commit is contained in:
Evan Kranzler 2018-05-29 19:46:02 -04:00
parent dd833c8b27
commit 84c1423990
2 changed files with 15 additions and 46 deletions

View file

@ -28,7 +28,6 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
@ -45,7 +44,7 @@ import mage.constants.PhaseStep;
import mage.constants.SagaChapter;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import static mage.filter.StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
@ -81,7 +80,7 @@ public final class TimeOfIce extends CardImpl {
effects.add(new TimeOfIceEffect());
sagaAbility.addChapterEffect(
this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_II, effects,
new TargetCreaturePermanent(FILTER_OPPONENTS_PERMANENT_CREATURE)
new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)
);
// III Return all tapped creatures to their owners' hands.
@ -125,8 +124,8 @@ class TimeOfIceEffect extends ContinuousRuleModifyingEffectImpl {
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter
// the battlefield triggered ability the source dies (or will be exiled), then the ZONE_CHANGE or LOST_CONTROL
// event will happen before this effect is applied ever)
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (!(sourceObject instanceof Permanent) || !((Permanent) sourceObject).getControllerId().equals(source.getControllerId())) {
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject == null || sourceObject.getZoneChangeCounter(game) > source.getSourceObjectZoneChangeCounter() + 1) {
discard();
return false;
}

View file

@ -93,10 +93,14 @@ public class SagaAbility extends SimpleStaticAbility {
for (int i = fromChapter.getNumber(); i <= toChapter.getNumber(); i++) {
ability = new ChapterTriggeredAbility(null, SagaChapter.getChapter(i), toChapter);
for (Effect effect : effects) {
ability.addEffect(effect);
if (effect != null) {
ability.addEffect(effect.copy());
}
}
for (Target target : targets) {
ability.addTarget(target);
if (target != null) {
ability.addTarget(target.copy());
}
}
if (i > fromChapter.getNumber()) {
ability.setRuleVisible(false);
@ -136,7 +140,7 @@ public class SagaAbility extends SimpleStaticAbility {
class ChapterTriggeredAbility extends TriggeredAbilityImpl {
SagaChapter chapterFrom, chapterTo;
private SagaChapter chapterFrom, chapterTo;
public ChapterTriggeredAbility(Effect effect, SagaChapter chapterFrom, SagaChapter chapterTo) {
super(Zone.ALL, effect, false);
@ -161,7 +165,10 @@ class ChapterTriggeredAbility extends TriggeredAbilityImpl {
int amountAdded = event.getAmount();
int loreCounters = amountAdded;
Permanent sourceSaga = game.getPermanentOrLKIBattlefield(getSourceId());
if (sourceSaga != null) { // If it's entering the battlefield, it won't be found so we assume it had no counters
if (sourceSaga == null) {
sourceSaga = game.getPermanentEntering(getSourceId());
}
if (sourceSaga != null) {
loreCounters = sourceSaga.getCounters(game).getCount(CounterType.LORE);
}
return loreCounters - amountAdded < chapterFrom.getNumber()
@ -204,40 +211,3 @@ class ChapterTriggeredAbility extends TriggeredAbilityImpl {
return sb.toString();
}
}
//class SagaAddCounterAbility extends TriggeredAbilityImpl {
//
// SagaChapter maxChapter;
//
// SagaAddCounterAbility(SagaChapter maxChapter) {
// super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.LORE.createInstance()), false);
// this.usesStack = false;
// this.maxChapter = maxChapter;
// }
//
// SagaAddCounterAbility(final SagaAddCounterAbility ability) {
// super(ability);
// this.maxChapter = ability.maxChapter;
// }
//
// @Override
// public SagaAddCounterAbility copy() {
// return new SagaAddCounterAbility(this);
// }
//
// @Override
// public boolean checkEventType(GameEvent event, Game game) {
// return event.getType() == EventType.PRECOMBAT_MAIN_PHASE_PRE;
// }
//
// @Override
// public boolean checkTrigger(GameEvent event, Game game) {
// return event.getPlayerId().equals(this.controllerId);
// }
//
// @Override
// public String getRule() {
// return "<i>(As this Saga enters and after your draw step, add a lore counter. Sacrifice after " + maxChapter.toString() + ".)</i> ";
// }
//
//}