/** {@inheritDoc} */
  @Override
  public final boolean performTest(final java.util.Map<String, Object> runParams2) {

    // Check for tapping
    if (!mapParams.containsKey("NoTapCheck")) {
      final SpellAbility manaAbility = (SpellAbility) runParams2.get("AbilityMana");
      if (manaAbility == null
          || manaAbility.getPayCosts() == null
          || !manaAbility.getPayCosts().hasTapCost()) {
        return false;
      }
    }

    if (this.mapParams.containsKey("ValidCard")) {
      final Card tapper = (Card) runParams2.get("Card");
      if (!tapper.isValid(
          this.mapParams.get("ValidCard").split(","),
          this.getHostCard().getController(),
          this.getHostCard())) {
        return false;
      }
    }

    if (this.mapParams.containsKey("Player")) {
      final Player player = (Player) runParams2.get("Player");
      if (!player.isValid(
          this.mapParams.get("Player").split(","),
          this.getHostCard().getController(),
          this.getHostCard())) {
        return false;
      }
    }

    if (this.mapParams.containsKey("Activator")) {
      final SpellAbility sa = (SpellAbility) runParams2.get("AbilityMana");
      if (sa == null) return false;
      final Player activator = sa.getActivatingPlayer();
      if (!activator.isValid(
          this.mapParams.get("Activator").split(","),
          this.getHostCard().getController(),
          this.getHostCard())) {
        return false;
      }
    }

    if (this.mapParams.containsKey("Produced")) {
      Object prod = runParams2.get("Produced");
      if (prod == null || !(prod instanceof String)) {
        return false;
      }
      String produced = (String) prod;
      if ("ChosenColor".equals(mapParams.get("Produced"))) {
        if (!this.getHostCard().hasChosenColor()
            || !produced.contains(MagicColor.toShortString(this.getHostCard().getChosenColor()))) {
          return false;
        }
      }
    }

    return true;
  }