@Override protected void update(GameState state, Event event) { MagicSet movements = event.getResult(state); for (ZoneChange zc : movements.getAll(ZoneChange.class)) { int ownerID = state.<GameObject>get(zc.oldObjectID).ownerID; if (this.counts.containsKey(ownerID)) this.counts.put(ownerID, this.counts.get(ownerID) + 1); else this.counts.put(ownerID, 1); } }
@Override public boolean checkSpecialRestrictions(GameState state, List<Target> choices) { if (choices.isEmpty()) return true; List<Integer> controllers = new LinkedList<Integer>(); for (Target choice : choices) { int controller = state.<GameObject>get(choice.targetID).controllerID; if (controllers.contains(controller)) return false; controllers.add(controller); } return true; }
@Override protected boolean match(GameState state, Event event) { if (event.type != EventType.MOVE_BATCH) return false; for (ZoneChange change : event .parametersNow .get(EventType.Parameter.TARGET) .evaluate(state, null) .getAll(ZoneChange.class)) { if (state.battlefield().ID != change.destinationZoneID) continue; GameObject object = state.get(change.newObjectID); if (!object.getColors().contains(Color.GREEN) || !object.getTypes().contains(Type.CREATURE)) continue; return true; } return false; }
@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; }