Ejemplo n.º 1
0
  @Override
  public Set evaluate(GameState state, Identified thisObject) {
    Set ret = new Set();

    for (GameObject object : state.getAllObjects())
      for (Class<? extends Keyword> c : this.abilities) if (object.hasAbility(c)) ret.add(object);

    for (Player player : state.players)
      for (Class<? extends Keyword> c : this.abilities) if (player.hasAbility(c)) ret.add(player);

    return ret;
  }
Ejemplo n.º 2
0
  @Override
  public MagicSet evaluate(GameState state, Identified thisObject) {
    MagicSet ret = new MagicSet();
    MagicSet what = this.what.evaluate(state, thisObject);
    auras:
    for (GameObject aura : state.getAllObjects()) {
      if (!aura.getSubTypes().contains(SubType.AURA)) continue;

      for (Keyword ability : aura.getKeywordAbilities())
        if (ability.isEnchant()) {
          Enchant e = (Enchant) ability;
          MagicSet intermediate = new MagicSet(what);
          intermediate.retainAll(e.filter.evaluate(state, aura));
          for (GameObject o : intermediate.getAll(GameObject.class))
            if (!o.cantBeAttachedBy().match(state, thisObject, new MagicSet(aura))) {
              ret.add(aura);
              continue auras;
            }
        }
    }
    return ret;
  }