Esempio n. 1
0
  /**
   * Test fight stage.
   *
   * <p>Use debugStat on units to mess with fights, is also useful for testing animations.
   * Intentionally crashes at the end for lack of session info, so don't worry about it.
   *
   * <p>range can be set by messing with map.addUnit(), and you can change all the other
   * unit-related things to test them out. I can see us using this to use this bit for speed testing
   * in the future, if I ever make a gui or something for it.
   *
   * <p>TODO: gui for speed balancing
   */
  public void testFightStage() {
    Player p1 = localPlayer;
    testSession =
        new Session(new Seize(), "test", 8, new java.util.HashSet<>(), new net.fe.pick.Draft());
    Player p2 = new Player("p2", (byte) 1);
    p2.getParty().setColor(Party.TEAM_RED);
    p1.getParty().setColor(Party.TEAM_BLUE);
    p2.setTeam(2);
    p1.setTeam(1);

    testSession.addPlayer(p1);
    testSession.addPlayer(p2);

    final ClientOverworldStage map = new ClientOverworldStage(testSession);
    Unit u1 = UnitFactory.getUnit("Eirika");
    u1.getInventory().add(WeaponFactory.getWeapon("Silver Sword"));
    u1.equip(0);
    map.addUnit(u1, 0, 0);
    u1.setLevel(20);
    u1.loadMapSprites();
    p1.getParty().addUnit(u1);

    Unit u2 = UnitFactory.getUnit("Dart");
    u2.getInventory().add(WeaponFactory.getWeapon("Tomahawk"));
    map.addUnit(u2, 1, 0);
    u2.equip(0);
    u2.setLevel(1);
    u2.loadMapSprites();
    p2.getParty().addUnit(u2);

    map.processAddStack();
    int u2Uses = u2.getWeapon().getMaxUses();

    // u1.debugStat("Skl");
    // u1.debugStat("Str");

    // ^------- put all pre-calc stuff here

    CombatCalculator calc =
        new CombatCalculator(
            new UnitIdentifier(u1), new UnitIdentifier(u2), FEMultiplayer::getUnit);
    System.out.println(calc.getAttackQueue());

    u2.getWeapon().setUsesDEBUGGING(u2Uses);
    u1.fillHp();
    u2.fillHp();

    setCurrentStage(
        new FightStage(
            new UnitIdentifier(u1),
            new UnitIdentifier(u2),
            calc.getAttackQueue(),
            map,
            new EmptyRunnable()));
  }
Esempio n. 2
0
  /** Test overworld stage. */
  public void testOverworldStage() {
    testSession =
        new Session(new Seize(), "test", 8, new java.util.HashSet<>(), new net.fe.pick.Draft());
    testSession.addPlayer(localPlayer);

    Player p2 = new Player("P2", (byte) 1);
    p2.getParty().setColor(Party.TEAM_RED);
    testSession.addPlayer(p2);
    localPlayer.getParty().setColor(Party.TEAM_BLUE);
    p2.setTeam(2);
    localPlayer.setTeam(1);

    Unit u1 = UnitFactory.getUnit("Natasha");
    u1.addToInventory(WeaponFactory.getWeapon("Physic"));
    u1.setHp(1);
    localPlayer.getParty().addUnit(u1);

    Unit u3 = UnitFactory.getUnit("Oswin");
    u3.addToInventory(WeaponFactory.getWeapon("Silver Axe"));
    u3.equip(0);
    u3.setHp(1);
    p2.getParty().addUnit(u3);

    Unit u4 = UnitFactory.getUnit("Eirika");
    u4.addToInventory(WeaponFactory.getWeapon("Silver Sword"));
    u4.equip(0);
    u4.setHp(1);
    p2.getParty().addUnit(u4);

    Unit u2 = UnitFactory.getUnit("Lute");
    u2.addToInventory(WeaponFactory.getWeapon("Physic"));
    u2.setHp(1);
    localPlayer.getParty().addUnit(u2);

    currentStage = new ClientOverworldStage(testSession);

    this.client =
        new Client("nope", 12345) {
          @Override
          public void sendMessage(Message message) {
            if (message instanceof CommandMessage) {
              ((ClientOverworldStage) currentStage).processCommands((CommandMessage) message);
            }
          }
        };
  }