public void run() {
    int n =
        IOptionPane.showConfirmDialog(
            SkinManager.instance.getFrame("main_frame"),
            SkinManager.instance.getDialogMessageText("remove_song_tags_prompt"),
            SkinManager.instance.getDialogMessageTitle("remove_song_tags_prompt"),
            IOptionPane.YES_NO_OPTION);
    if (n != 0) return;
    int successes = 0;
    try {
      for (int i = 0; i < songs.length; ++i) {
        if (TagManager.removeTags(songs[i])) {
          successes++;
        }
      }
    } catch (Exception e) {
    }

    String dialog_text = SkinManager.instance.getDialogMessageText("remove_batch_tags");
    dialog_text = dialog_text.replaceAll("%num_successful%", String.valueOf(successes));
    dialog_text = dialog_text.replaceAll("%total%", String.valueOf(songs.length));
    String dialog_title = SkinManager.instance.getDialogMessageTitle("remove_batch_tags");
    IOptionPane.showMessageDialog(
        SkinManager.instance.getFrame("main_frame"),
        dialog_text,
        dialog_title,
        IOptionPane.PLAIN_MESSAGE);
  }
Example #2
0
 public void handleRocketCourier(Card consToBuy) {
   int handleRocketCourierChoice =
       optionPane.showConfirmDialog(
           game,
           String.format(game.descriptions.getString("WouldAllThings"), consToBuy.getName()),
           "",
           JOptionPane.YES_NO_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (handleRocketCourierChoice == JOptionPane.YES_OPTION) {
     this.player.playerDeck.hand.add(new Card(consToBuy));
     this.RocketCourierState--;
   } else {
     HeroTopOfDeckState =
         this.player.playerDeck.addNewCardToDiscard(new Card(consToBuy), HeroTopOfDeckState);
   }
   this.player.playerDeck.resetHandLocation();
 }
Example #3
0
  public synchronized boolean executeAction(Action a) {
    if (a.onUnite && !this.united) {
      this.actionOnUnite = a;
      this.united = true;
    }
    switch (a.action) {
      case HonorBoost:
        this.player.incrementHonor(a.magnitude);
        this.game.decrementHonor(a.magnitude);
        return true;
      case PowerBoost:
        this.power += a.magnitude;
        return true;
      case RuneBoost:
        this.rune += a.magnitude;
        return true;
      case DrawCard:
        player.playerDeck.drawNCards(a.magnitude);
        return true;
      case Discard:
        optionPane.showMessageDialog(
            game,
            String.format(game.descriptions.getString("SelectDeckDiscard"), a.magnitude),
            "",
            JOptionPane.PLAIN_MESSAGE);
        this.turnState = TurnState.Discard;
        this.turnStateMagnitude = a.magnitude;
        chill();
        return true;
      case OptionalDiscard:
        int za =
            optionPane.showConfirmDialog(
                game,
                String.format(game.descriptions.getString("OptionalHandDiscard"), a.magnitude),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (za == JOptionPane.YES_OPTION) {
          this.turnState = TurnState.Discard;
          this.turnStateMagnitude = a.magnitude;
          chill();
          return true;
        }
        return false;
      case ForcedDeckBanish:
        optionPane.showMessageDialog(
            game,
            String.format(game.descriptions.getString("ForcedBanish"), a.magnitude),
            "",
            JOptionPane.PLAIN_MESSAGE);
        this.turnState = TurnState.DeckBanish;
        this.turnStateMagnitude = a.magnitude;
        chill();
        return true;
      case CenterBanish:
        int m =
            optionPane.showConfirmDialog(
                game,
                String.format(game.descriptions.getString("OptionalCenterBanish"), a.magnitude),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (m == JOptionPane.YES_OPTION) {
          this.turnState = TurnState.CenterBanish;
          this.turnStateMagnitude = a.magnitude;
          chill();
          return true;
        }
        return false;
      case HandBanish:
        int z =
            optionPane.showConfirmDialog(
                game,
                String.format(game.descriptions.getString("OptionalHandBanish"), a.magnitude),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (z == JOptionPane.YES_OPTION) {
          this.turnState = TurnState.HandBanish;
          this.turnStateMagnitude = a.magnitude;
          chill();
          return true;
        }
        return false;
      case OptionalDeckBanish:
        if (player.playerDeck.hand.size() == 0) return false;
        int n =
            optionPane.showConfirmDialog(
                game,
                String.format(game.descriptions.getString("OptionalDeckBanish"), a.magnitude),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (n == JOptionPane.YES_OPTION) {
          this.turnState = TurnState.DeckBanish;
          this.turnStateMagnitude = a.magnitude;
          chill();
          return true;
        }
        return false;
      case HonorAndRuneBoost:
        this.rune += a.magnitude;
        this.player.incrementHonor(a.magnitude);
        this.game.decrementHonor(a.magnitude);
        return true;
      case ConstructRuneBoost:
        this.constructRune += a.magnitude;
        return true;
      case MechanaConstructRuneBoost:
        this.mechanaConstructRune += a.magnitude;
        return true;
      case EnterAiyanaState:
        this.AiyanaState = true;
        return true;
      case HeroRuneBoost:
        this.heroRune += a.magnitude;
        return true;
      case MonsterPowerBoost:
        this.monsterPower += a.magnitude;
        return true;
      case DefeatMonster:
        if (!this.game.gameDeck.canAMonsterBeDefeated(a.magnitude)) {
          this.player.incrementHonor(1);
          this.game.decrementHonor(1);
        } else {
          this.turnState = TurnState.DefeatMonster;
          this.turnStateMagnitude = a.magnitude;
        }
        return true;
      case EnterVoidMesmer:
        this.VoidMesmerState = true;
        return true;
      case FreeCard:
        optionPane.showMessageDialog(
            game, game.descriptions.getString("FreeCard"), "", JOptionPane.PLAIN_MESSAGE);
        this.turnState = TurnState.FreeCard;
        this.turnStateMagnitude = a.magnitude;
      case HeavyOrMystic:
        Object objects[] = {"Mystic", "Heavy Infantry"};
        int heavyOrMysticChoice =
            optionPane.showOptionDialog(
                game,
                game.descriptions.getString("HeavyOrMystic"),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                objects);
        if (heavyOrMysticChoice == JOptionPane.YES_OPTION) {
          this.player.playerDeck.hand.add(new Card(Main.getMystic()));
          this.player.playerDeck.deckRend.resetHandLocation();
        } else {
          this.player.playerDeck.hand.add(new Card(Main.getHeavyInfantry()));
          this.player.playerDeck.deckRend.resetHandLocation();
        }
        return true;
      case LunarStag:
        Object objects2[] = {
          game.descriptions.getString("2Rune"), game.descriptions.getString("2Honor")
        };
        int lunarStagChoice =
            optionPane.showOptionDialog(
                game,
                game.descriptions.getString("LunarStag"),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                objects2);
        if (lunarStagChoice == JOptionPane.YES_OPTION) {
          this.rune += 2;
        } else {
          this.player.incrementHonor(2);
          this.game.decrementHonor(2);
        }
        return true;
      case AskaraOfFate:
        this.player.playerDeck.drawCard();
        for (Player p : this.game.players) {
          p.playerDeck.drawCard();
        }
        return true;
      case AskaraCenterBanish:
        int num1 =
            optionPane.showConfirmDialog(
                game,
                String.format(game.descriptions.getString("OptionalCenterBanish"), 1),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (num1 == JOptionPane.YES_OPTION) {
          this.turnState = TurnState.AskaraCenterBanish;
          this.turnStateMagnitude = 1;
          chill();
          return true;
        }
        return false;
      case NookHound:
        this.player.playerDeck.drawCard();
        Card nookHoundCard =
            this.player.playerDeck.hand.get(this.player.playerDeck.hand.size() - 1);
        int nookHoundNumber =
            optionPane.showConfirmDialog(
                game,
                String.format(
                    game.descriptions.getString("OptionalDiscardDeShiz"), nookHoundCard.getName()),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (nookHoundNumber == JOptionPane.YES_OPTION) {
          this.player.playerDeck.hand.remove(this.player.playerDeck.hand.size() - 1);
          this.player.playerDeck.discard.add(nookHoundCard);
          this.player.playerDeck.drawCard();
        }
        return true;
      case AskaraDiscard:
        optionPane.showMessageDialog(
            game, game.descriptions.getString("DiscardDerpDeDerp"), "", JOptionPane.PLAIN_MESSAGE);
        this.turnState = TurnState.AskaraDiscard;
        this.turnStateMagnitude = 2;
        chill();
        return true;

      case TwofoldAskaraPlayed:
        if (this.player.playerDeck.checkForHeroInPlayedforTwoFold()) {
          optionPane.showMessageDialog(
              game, game.descriptions.getString("PickAndShit"), "", JOptionPane.PLAIN_MESSAGE);
          this.turnState = TurnState.TwofoldAskara;
          chill();

        } else {
          optionPane.showMessageDialog(
              game, game.descriptions.getString("NoHero"), "", JOptionPane.PLAIN_MESSAGE);
        }

        return true;
      case RajAction:
        optionPane.showMessageDialog(
            game, game.descriptions.getString("FryRy"), "", JOptionPane.PLAIN_MESSAGE);
        this.turnState = TurnState.RajTurnState;
        this.turnStateMagnitude = 1;
        chill();

        return true;
      case SeaTyrantAction:
        this.player.incrementHonor(5);
        this.game.decrementHonor(5);
        for (Player p : this.game.players) {
          if (!(p.equals(this.player))) {
            p.flipTyrantConstructsBool();
          }
        }
        return true;
      case CetraAction:
        if (this.game.gameDeck.checkForHeroInCenter()) {
          optionPane.showMessageDialog(
              game, game.descriptions.getString("CenterRowsShiz"), "", JOptionPane.PLAIN_MESSAGE);
          this.turnState = TurnState.FreeCardHero;
          chill();
        } else {
          optionPane.showMessageDialog(
              game, game.descriptions.getString("NoHeroToBuy"), "", JOptionPane.PLAIN_MESSAGE);
        }
        return true;

      case CorrosiveWidowAction:
        this.player.incrementHonor(3);
        this.game.decrementHonor(3);
        for (Player p : this.game.players) {
          if (!p.equals(this.player)) {
            p.flipWidowConstructsBool();
          }
        }
        return true;

      case TabletOfTimesDawn:
        int tabletOptionChoice =
            optionPane.showConfirmDialog(
                game,
                game.descriptions.getString("ZaBannishtheThings"),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (tabletOptionChoice == JOptionPane.YES_OPTION) {
          this.game.extraTurn = true;
          for (int i = 0; i < this.player.playerDeck.constructs.size(); i++) {
            if (this.player.playerDeck.constructs.get(i).getName().equals("Tablet_of_Times_Dawn")) {
              this.player.playerDeck.constructs.remove(i);
            }
          }
          return true;
        }
        return false;

      case YggdrasilStaff:
        this.power += 1;
        if (this.rune >= 4) {
          int yggdrasilStaffChoice =
              optionPane.showConfirmDialog(
                  game,
                  game.descriptions.getString("WouldZaThings"),
                  "",
                  JOptionPane.YES_NO_OPTION,
                  JOptionPane.QUESTION_MESSAGE);
          if (yggdrasilStaffChoice == JOptionPane.YES_OPTION) {
            this.rune -= 4;
            this.player.incrementHonor(3);
            this.game.decrementHonor(3);
            return true;
          }
        }
        return true;

      case AvatarGolem:
        this.power += 2;
        boolean mechanaConstructHonor = false;
        boolean lifeboundConstructHonor = false;
        boolean voidConstructHonor = false;
        boolean enlightenedConstructHonor = false;
        for (Card c : this.player.playerDeck.constructs) {
          if (this.testForMechana(c) && !mechanaConstructHonor) {
            this.player.incrementHonor(1);
            this.game.decrementHonor(1);
            mechanaConstructHonor = true;
          } else if (c.getFaction() == Card.Faction.Lifebound && !lifeboundConstructHonor) {
            this.player.incrementHonor(1);
            this.game.decrementHonor(1);
            lifeboundConstructHonor = true;
          } else if (c.getFaction() == Card.Faction.Void && !voidConstructHonor) {
            this.player.incrementHonor(1);
            this.game.decrementHonor(1);
            voidConstructHonor = true;
          } else if (c.getFaction() == Card.Faction.Enlightened && !enlightenedConstructHonor) {
            this.player.incrementHonor(1);
            this.game.decrementHonor(1);
            enlightenedConstructHonor = true;
          }
        }
        return true;

      case KorAction:
        this.power += 2;
        if (this.player.playerDeck.constructs.size() >= 2) {
          player.playerDeck.drawNCards(1);
        }
        return true;

      case MechanaInitiate:
        Object mechanaInitiateOptions[] = {"1 Rune", "1 Power"};
        int mechanaInitiateChoice =
            optionPane.showOptionDialog(
                game,
                game.descriptions.getString("GainAllTheThings"),
                "",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                mechanaInitiateOptions);
        if (mechanaInitiateChoice == JOptionPane.YES_OPTION) {
          this.rune += 1;
        } else {
          this.power += 1;
        }
        return true;

      case HedronCannon:
        for (Card c : this.player.playerDeck.constructs) {
          if (this.testForMechana(c)) {
            this.power += 1;
          }
        }
        return true;

      case Voidthirster:
        this.power += 1;
        this.VoidthirsterState = true;
        return true;

      case XeronAction:
        this.player.incrementHonor(3);
        this.game.decrementHonor(3);
        for (int i = 0; i < this.game.players.size(); i++) {
          if (!this.game.players.get(i).equals(this.player)) {
            Card xeronTemp = this.game.players.get(i).playerDeck.stealCard();
            if (xeronTemp != null) {
              this.player.playerDeck.hand.add(xeronTemp);
              this.player.playerDeck.resetHandLocation();
            }
          }
        }
        return true;

      case RocketCourier:
        this.RocketCourierState++;
        return true;

      case HedronLinkDevice:
        this.HedronLinkDeviceState = true;
        return true;
      case HeroTopOfDeck:
        this.HeroTopOfDeckState = true;
        return true;
    }
    return false;
  }