Package org.pokenet.server.network.message.battle

Examples of org.pokenet.server.network.message.battle.BattleEndMessage


    m_finished = true;
    if (winner == 0) {
      calculateExp();
      m_player.removeTempStatusEffects();
      TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
          new BattleEndMessage(BattleEnd.WON));
    } else {
      TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
          new BattleEndMessage(BattleEnd.LOST));
      m_player.lostBattle();
    }
    m_player.setBattling(false);
    dispose();
    m_wildPoke = null;
View Full Code Here


          m_wildPoke.getRareness(), 1.0, 1)) {
        m_wildPoke.calculateStats(false);
        m_player.catchPokemon(m_wildPoke);
        showMessage("You successfuly caught " + m_wildPoke.getSpeciesName());
        TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
            new BattleEndMessage(BattleEnd.POKEBALL));
        m_player.setBattling(false);
        dispose();
        return true;
      } else
        showMessage("...but it failed!");
      break;
    case GREATBALL:
      showMessage(m_player.getName() + " threw a Great Ball!");
      if (getMechanics().isCaught(
          m_wildPoke,
          m_wildPoke.getRareness(), 1.5, 1)) {
        m_wildPoke.calculateStats(false);
        m_player.catchPokemon(m_wildPoke);
        showMessage("You successfuly caught " + m_wildPoke.getSpeciesName());
        TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
            new BattleEndMessage(BattleEnd.POKEBALL));
        m_player.setBattling(false);
        dispose();
        return true;
      } else
        showMessage("...but it failed!");
      break;
    case ULTRABALL:
      showMessage(m_player.getName() + " threw an Ultra Ball!");
      if (getMechanics().isCaught(
          m_wildPoke,
          m_wildPoke.getRareness(), 2.0, 1)) {
        m_wildPoke.calculateStats(false);
        m_player.catchPokemon(m_wildPoke);
        showMessage("You successfuly caught " + m_wildPoke.getSpeciesName());
        TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
            new BattleEndMessage(BattleEnd.POKEBALL));
        m_player.setBattling(false);
        dispose();
        return true;
      } else
        showMessage("...but it failed!");
      break;
    case MASTERBALL:
      showMessage(m_player.getName() + " threw a Master Ball!");
      if (getMechanics().isCaught(
          m_wildPoke,
          m_wildPoke.getRareness(), 255.0, 1)) {
        m_wildPoke.calculateStats(false);
        m_player.catchPokemon(m_wildPoke);
        showMessage("You successfuly caught " + m_wildPoke.getSpeciesName());
        TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
            new BattleEndMessage(BattleEnd.POKEBALL));
        m_player.setBattling(false);
        dispose();
        return true;
      } else
        showMessage("...but it failed!");
View Full Code Here

    m_finished = true;
    m_players[0].removeTempStatusEffects();
    m_players[1].removeTempStatusEffects();
    if (winner == 0) {
      TcpProtocolHandler.writeMessage(m_players[0].getTcpSession(),
          new BattleEndMessage(BattleEnd.WON));
      TcpProtocolHandler.writeMessage(m_players[1].getTcpSession(),
          new BattleEndMessage(BattleEnd.LOST));
      m_players[1].lostBattle();
    } else {
      TcpProtocolHandler.writeMessage(m_players[0].getTcpSession(),
          new BattleEndMessage(BattleEnd.LOST));
      TcpProtocolHandler.writeMessage(m_players[1].getTcpSession(),
          new BattleEndMessage(BattleEnd.WON));
      m_players[0].lostBattle();
    }
    m_players[0].setBattling(false);
    m_players[1].setBattling(false);
    dispose();
View Full Code Here

          m_players[1].setMoney(m_players[1].getMoney() + m_players[0].getMoney());
          m_players[0].setMoney(0);
        }
        m_players[1].updateClientMoney();
*/        TcpProtocolHandler.writeMessage(m_players[1].getTcpSession(),
            new BattleEndMessage(BattleEnd.WON));
        m_players[1].setBattling(false);
      } else {
/*        if(m_players[1].getMoney() >= 100) {
          m_players[1].setMoney(m_players[0].getMoney() - 100);
          m_players[0].setMoney(m_players[1].getMoney() + 100);
        } else {
          m_players[0].setMoney(m_players[1].getMoney() + m_players[0].getMoney());
          m_players[1].setMoney(0);
        }
        m_players[0].updateClientMoney();
*/        TcpProtocolHandler.writeMessage(m_players[0].getTcpSession(),
            new BattleEndMessage(BattleEnd.WON));
        m_players[0].setBattling(false);
      }
    }
  }
View Full Code Here

          money));
      m_player.setMoney(m_player.getMoney() + money);
      /* End the battle */
      m_player.removeTempStatusEffects();
      TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
          new BattleEndMessage(BattleEnd.WON));
      /* Now add Trainer EXP */
      int trainerExp = 0;
      for(int i = 0; i < getParty(1).length; i++) {
        if(getParty(1)[i] != null)
          trainerExp += getParty(1)[i].getLevel() / 2;
      }
      /* If the player got a badge, triple the EXP gained */
      if(m_npc.isGymLeader() && !m_player.hasBadge(m_npc.getBadge()))
        trainerExp *= 2;
      if(trainerExp > 0)
        m_player.addTrainingExp(trainerExp);
      /* Give the player the badge if it's a gym leader */
      if(m_npc.isGymLeader()) {
        m_player.addBadge(m_npc.getBadge());
      }
    } else {
      if(m_player.getMoney() - money >= 0) {
        m_player.setMoney(m_player.getMoney() - money);
      } else {
        m_player.setMoney(0);
      }
      TcpProtocolHandler.writeMessage(m_player.getTcpSession(),
          new BattleEndMessage(BattleEnd.LOST));
      m_player.lostBattle();
    }
    m_player.updateClientMoney();
    m_player.setBattling(false);
    m_player.setTalking(false);
View Full Code Here

TOP

Related Classes of org.pokenet.server.network.message.battle.BattleEndMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.