Package org.jpokemon.battle

Examples of org.jpokemon.battle.Battle


    super(b, user, user);
  }

  @Override
  public void execute() {
    Battle battle = (Battle) PlayerManager.getActivity((Player) slot().trainer());
    double chance = 100;

    for (Slot s : battle) {
      if (slot().leader().level() < s.leader().level())
        chance -= 10 * (s.leader().level() - slot().leader().level());
      else if (slot().leader().level() > s.leader().level()) chance += 7 * (slot().leader().level() - s.leader().level());
    }

    if ((chance / 250.0) > Math.random()) {
      // Message message = new Message("SPEECH", "Got away safely!", Message.Level.MESSAGE);
      // PlayerManager.pushMessage((Player) slot().trainer(), message);
      battle.remove(slot().trainer());
    }
    else
      battle().log("Didn't get away!");
  }
View Full Code Here


      }
    }
  }

  private void startBattle(Lobby lobby) {
    Battle battle = new Battle();
    Map<String, String> responses = lobby.getResponses();
    List<Player> playersInBattle = new ArrayList<Player>();

    int teamNumber = 0;
    for (List<String> teamMembers : lobby.getTeams()) {
      for (String teamMember : teamMembers) {
        if ("yes".equals(responses.get(teamMember))) {
          Player player = PlayerManager.getPlayer(teamMember);
          battle.addTrainer(player, teamNumber);
          playersInBattle.add(player);
        }
      }

      teamNumber++;
View Full Code Here

    Trainer trainer = new Trainer(getData());
    trainer.loadXml(trainerData);

    if (!player.record().getTrainer(trainer.id())) {
      PlayerManager.addActivity(player, new Battle(player, trainer));
    }
  }
View Full Code Here

TOP

Related Classes of org.jpokemon.battle.Battle

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.