Package org.jpokemon.pokemon

Examples of org.jpokemon.pokemon.Pokemon


  }

  public void testRemoveNotInPartyException() {
    PokemonStorageUnit unit1 = new PokemonStorageUnit(6);

    Pokemon p1 = new Pokemon(1);
    Pokemon p2 = new Pokemon(2);

    unit1.add(p1);
    unit.add(p2);

    try {
View Full Code Here


    add(pokemonSelectorPanel, BorderLayout.EAST);
    callParentRefresh();
  }

  public void addPokemon(PokemonInfo pi) {
    Pokemon pokemon = new Pokemon(pi.getNumber(), defaultlevel);
    parent.getPlayer().add(pokemon);
    callParentRefresh();
  }
View Full Code Here

    battle().log(slot().trainer().id() + " used " + item.name());
  }

  @Override
  public void execute() {
    Pokemon target = target().party().get(_targetIndex);

    if (_item.type() == ItemType.MACHINE)
      battle().log("Machines aren't allowed in battle!");
    else if (_item.type() == ItemType.STONE)
      battle().log("Stones aren't allowed in battle!");
    else if (_item.type() == ItemType.POTION)
      _item.effect(target);
    else if (_item.type() == ItemType.BALL) {
      if (!(target().trainer() instanceof WildTrainer))
        battle().log("Cannot use a ball against " + target.name() + "!");
      else if (_item.effect(target)) {
        if (!slot().trainer().add(target))
          battle().log("No room for " + target.name());
        else {
          target().party().remove(target);
          battle().log(target.name() + " was caught!");
        }
      }
      else
        battle().log(target.name() + "broke free!");
    }
  }
View Full Code Here

    assertEquals(cash, player.getCash());
  }

  public void testAddUsesStorage() {
    int i = 1;
    while (player.party().add(new Pokemon(i)))
      i++;

    assertEquals(PokemonStorageUnit.partysize, player.party().size());
    assertFalse(player.party().add(new Pokemon(i)));
    assertTrue(player.add(new Pokemon(i)));
  }
View Full Code Here

    assertTrue(player.add(new Pokemon(i)));
  }

  public void testAddPokemonUpdatesPokedex() {
    int number = (int) (Math.random() * range) + 1;
    Pokemon p = new Pokemon(number);

    assertEquals(PokedexStatus.NONE, player.pokedex().status(number));

    player.add(p);

View Full Code Here

    _executions = 0;
  }

  @Override
  public void execute() {
    Pokemon leader = slot().leader();

    _executions++;

    if (_executions == 1) {
      for (ConditionEffect conditionEffect : leader.getConditionEffects()) {
        if (conditionEffect.blocksAttack()) {
          battle().log(leader.name() + conditionEffect.getPersistanceMessage());
          return;
        }
      }

      if (!_move.enabled()) {
        battle().log(leader.name() + " cannot use " + _move.name() + ". It's not enabled");
        return;
      }
      else if (!_move.use()) {
        battle().log(leader.name() + " tried to use " + _move.name() + ", but it missed");

        if (_move.hurtUserOnMiss()) {
          int d = Battle.computeDamage(leader, _move, target().leader()) / 8;
          slot().takeDamage(d);
          battle().log(leader.name() + " took " + d + " recoil damage");
        }

        return;
      }
    }

    battle().log(slot().trainer().id() + "'s " + slot().leader().name() + " used " + _move.name());

    if (_move.style() == MoveStyle.DELAYNEXT && _executions != 1) {
      battle().log(slot().trainer().id() + "'s " + slot().leader().name() + " is resting this turn");
      return;
    }
    if (_move.style() == MoveStyle.DELAYBEFORE && _executions != _move.turns()) {
      battle().log(slot().trainer().id() + "'s " + slot().leader().name() + " is resting this turn");
      return;
    }
    if (_move.style() == MoveStyle.OHKO) {
      int levelDiff = leader.level() - target().leader().level();

      if (levelDiff < 0 || (levelDiff + 30.0) / 100.0 <= Math.random()) {
        battle().log(leader.name() + " tried to use " + _move.name() + ", but it missed");
        return;
      }
    }
    if (_move.style() == MoveStyle.MISC) { // TODO MoveStyle.MISC execution
      battle().log(_move.name() + " doesn't work yet. Sorry about that!");
View Full Code Here

  private int number, levelmin, levelmax, flex;

  public Pokemon instantiate() {
    int level = (int) ((levelmax - levelmin + 1) * Math.random()) + levelmin;

    return new Pokemon(number, level);
  }
View Full Code Here

      return; // didn't hit

    MoveEffectType type = MoveEffectType.valueOf(this.type);
    Target target = Target.valueOf(this.target);

    Pokemon pokemon = target == Target.SELF ? user.leader() : enemy.leader();

    if (type.isStatModifier())
      pokemon.getStat(StatType.valueOf(type.toString())).effect(power);
    else if (type.isConditionModifier())
      pokemon.addConditionEffect(ConditionEffect.valueOf(type.toString()));
    else if (type.isFieldModifier())
      user.addSlotEffect(new SlotEffect(SlotEffectType.valueOf(type.toString()), user, enemy));
    else if (type == MoveEffectType.HEALTH_MOD)
      pokemon.healDamage((int) (pokemon.maxHealth() * power / 1000.0));
  }
View Full Code Here

TOP

Related Classes of org.jpokemon.pokemon.Pokemon

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.