fixed the LastTimeCounterRemovedCondition, moved the Chronozoa test to fit the package convention, added a test case

This commit is contained in:
glerman 2015-06-24 12:20:38 +03:00 committed by Gal Lerman
parent 15e3101bf4
commit 9b44c9a087
4 changed files with 91 additions and 20 deletions

View file

@ -2,6 +2,7 @@ package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -20,8 +21,15 @@ public class LastTimeCounterRemovedCondition implements Condition{
@Override
public boolean apply(Game game, Ability source) {
final Permanent p = game.getPermanent(source.getSourceId());
final int timeCounters = p.getCounters().getCount(CounterType.TIME);
return timeCounters == 0;
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
}
if (permanent != null) {
final int timeCounters = permanent.getCounters().getCount(CounterType.TIME);
return timeCounters == 0;
} else {
return false;
}
}
}