public Glass(GameState state) { super( state, "Whenever this creature becomes the target of a spell or ability for the first time in a turn, counter that spell or ability."); SimpleEventPattern pattern = new SimpleEventPattern(EventType.BECOMES_TARGET); pattern.put( EventType.Parameter.TARGET, RelativeComplement.instance(ABILITY_SOURCE_OF_THIS, TargetedThisTurn.instance())); state.ensureTracker(new TargetedThisTurn.Tracker()); SetGenerator thatSpell = EventParameter.instance( TriggerEvent.instance(This.instance()), EventType.Parameter.OBJECT); this.addEffect(counter(thatSpell, "Counter that spell or ability.")); }
@Override public org.rnd.jmagic.engine.Set evaluate(GameState state, Identified thisObject) { Set ret = new Set(); for (int ID : state.getTracker(Tracker.class).getValue(state)) ret.add(state.get(ID)); return ret; }