Package org.pokenet.server.battle

Examples of org.pokenet.server.battle.Pokemon


   * @param a
   * @param b
   */
  public void swapPokemon(int a, int b) {
    if(a >= 0 && a < 6 && b >= 0 && b < 6) {
      Pokemon temp = m_pokemon[a];
      m_pokemon[a] = m_pokemon[b];
      m_pokemon[b] = temp;
      m_tcpSession.write("s" + a + "," + b);
    }
  }
View Full Code Here


   * Fishes for a pokemon.
   */
  public void fish(int rod) {
    if(this.lastFishingTime + 1000 < System.currentTimeMillis()) {
      if(this.getMap().caughtFish(this, this.getFacing(), rod)) {
        Pokemon p = this.getMap().getWildPokemon(this);
        //If we have both the required level to fish this thing up and the rod to do it
        if(this.getFishingLevel() >= DataService.getFishDatabase().getFish(p.getSpeciesName()).getReqLevel() && rod >= DataService.getFishDatabase().getFish(p.getSpeciesName()).getReqRod()) {
          this.addFishingExp(DataService.getFishDatabase().getFish(p.getSpeciesName()).getExperience());
          this.ensureHealthyPokemon();
          m_battleField = new WildBattleField(DataService.getBattleMechanics(),this,p);
        }
        //If you either have too low a fishing level or too weak a rod
        else {
View Full Code Here

     * Whether the weather should have effects.
     */
    protected boolean hasEffects(BattleField field) {
        Pokemon[] pokemon = field.getActivePokemon();
        for (int i = 0; i < pokemon.length; ++i) {
            Pokemon p = pokemon[i];
            if (p.hasAbility("Air Lock") || p.hasAbility("Cloud Nine"))
                return false;
        }
        return true;
    }
View Full Code Here

            double chance = m_chances[i];
            if (serene) {
                chance *= 2.0;
            }
            if (random.nextDouble() <= chance) {
                Pokemon affected = (m_attacker[i] ? user : target);
                if ((user != affected) && hasSubstitute && !m_statuses[i].hitsThroughSubstitute()) {
                    if (m_power == 0) {
                        user.getField().showMessage("But it failed!");
                    }
                    continue;
                }
                if (affected.addStatus(user, m_statuses[i]) == null) {
                    if (m_power == 0) {
                        // Only show the message if it is a primary effect.
                        m_statuses[i].informDuplicateEffect(affected);
                    }
                }
View Full Code Here

       field.showMessage(field.getActivePokemon()[m_party].getName() + m_message);
       return true;
     }
     public boolean tickField(BattleField field) {
       if (--m_turns == 0) {
         Pokemon poke = field.getActivePokemon()[m_party];
         poke.addStatus(poke.getOpponent(), m_effect);
         field.removeEffect(this);
         return true;
       }
       return false;
     }
View Full Code Here

         if (m_damage <= 0) {
           field.showMessage("But it failed!");
           field.removeEffect(this);
           return true;
         }
         Pokemon poke = field.getActivePokemon()[m_party];
         field.showMessage(poke.getName() + " took the attack!");
         poke.changeHealth(-m_damage);
         field.removeEffect(this);
         return true;
       }
       return false;
     }
View Full Code Here

       if (!(o2 instanceof StatCutEffect)) return false;
       StatCutEffect eff = (StatCutEffect)o2;
       return ((m_stat == eff.m_stat) && (m_party == eff.m_party));
     }
     public boolean applyToField(BattleField field) {
       Pokemon user = field.getActivePokemon()[m_party];
       m_turns = user.hasItem("Light Clay") ? 8 : 5;
       field.showMessage("A barrier was formed!");
       return true;
     }
View Full Code Here

     }
     public String getDescription() {
       return " was seeded!";
     }
     public boolean tick(Pokemon p) {
       final Pokemon opponent = p.getOpponent();
       if (p.isFainted() || opponent.isFainted()) return false;
       int damage = p.getStat(Pokemon.S_HP) / 8;
       if (damage == 0) {
         damage = 1;
       }
       if (!p.hasAbility("Magic Guard")) {
         p.getField().showMessage(p.getName() + "'s health was sapped by leech seed!");
         p.changeHealth(-damage, true);

         if (p.hasAbility("Liquid Ooze")) {
           p.getField().showMessage(opponent.getName() + " sucked up liquid ooze!");
           opponent.changeHealth(-damage);
         } else {
           p.getField().showMessage(opponent.getName() + " regained health!");
           opponent.changeHealth(damage);
         }
       }
       return false;
     }
View Full Code Here

TOP

Related Classes of org.pokenet.server.battle.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.