@Override public DamageAssignment.Batch match(Event context, DamageAssignment.Batch damageAssignments) { DamageAssignment.Batch batch = new DamageAssignment.Batch(); GameObject source = (GameObject) this.getStaticSourceObject(context.game.actualState); int enchantedPlayer = source.getAttachedTo(); for (DamageAssignment assignment : damageAssignments) if (context.state.<Identified>get(assignment.takerID).ID == enchantedPlayer) batch.add(assignment); return batch; }
@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; }