Class Fourmi

All Implemented Interfaces:
Serializable

public class Fourmi extends Creature implements Serializable
The ant class.
Ant is the creature used by player.
Ant aren't different by extends of this class but by Espece & Individu.
Author:
Hydrolien
See Also:
  • Field Details

    • typeF

      protected byte typeF
      It can be 0: ♀, 1: ♂, 2: Minor, 3: Medium (☿), 4:Major, 5:soldier 6+:other type.
    • mode

      protected byte mode
    • fere

      protected Fourmiliere fere
    • hardnessMax

      protected byte hardnessMax
    • uneSeuleAction

      private static byte uneSeuleAction
    • bActionHaveChange

      private static boolean bActionHaveChange
    • cutWings

      protected boolean cutWings
  • Constructor Details

    • Fourmi

      public Fourmi(Fourmiliere fere, Espece e, byte ty)
      Main constructor.
      By default the ant is an egg of 0 years old & 100/100 of cleaning Pheromone are set depending of the queen of the anthill.
      Parameters:
      fere - The anthill of this.
      e - The specie of this.
      ty - The typeF of this. It can be 0: ♀, 1: ♂, 2: Minor, 3: Medium (☿), 4:Major, 5:soldier 6+:other type.
    • Fourmi

      public Fourmi(Fourmiliere fere, Espece e, int ty)
      Secondary constructor.
      Parameters:
      fere - The anthill of this.
      e - The specie of this.
      ty - The typeF of this. It can be 0: ♀, 1: ♂, 2: Minor, 3: Medium, 4:Major, 5:soldier 6+:other type.
    • Fourmi

      public Fourmi(Fourmiliere fere, Espece e, byte ty, byte stade)
      Secondary constructor.
      Parameters:
      fere - The anthill of this.
      e - The specie of this.
      ty - The typeF of this. It can be 0: ♀, 1: ♂, 2: Minor, 3: Medium, 4:Major, 5:soldier 6+:other type.
      stade - The stade of the ant. It will call evoluer() to be sur that everything it update as if the ant have grow.
    • Fourmi

      public Fourmi(Fourmiliere fere, Espece e, byte typeF, byte stade, Pheromone ph)
      Secondary constructor.
      Parameters:
      fere - The anthill of this.
      e - The specie of this.
      typeF - The typeF of this. It can be 0: ♀, 1: ♂, 2: Minor, 3: Medium, 4:Major, 5:soldier 6+:other type.
      stade - The stade of the ant. It will call evoluer() to be sur that everything it update as if the ant have grow up.
      ph - The Pheromone of the ant.
    • Fourmi

      public Fourmi()
      Null constructor.
      Use only for test.
  • Method Details

    • getTypeF

      public byte getTypeF()
    • setTypeF

      public void setTypeF(byte s)
    • setTypeF

      public void setTypeF(int x)
    • getSex

      public String getSex()
      Specified by:
      getSex in class Creature
    • getMode

      public byte getMode()
    • isAutoMode

      public boolean isAutoMode()
    • setMode

      public void setMode(byte x)
    • setMode

      public void setMode(int x)
    • setFourmiliere

      public void setFourmiliere(Fourmiliere gf)
    • setFere

      public void setFere(Fourmiliere fere)
    • getFourmiliere

      public Fourmiliere getFourmiliere()
    • getFere

      public Fourmiliere getFere()
    • getJoueur

      public Joueur getJoueur()
    • getHardnessMax

      public byte getHardnessMax()
    • setHardnessMax

      public void setHardnessMax(byte x)
    • getX

      public int getX()
    • getY

      public int getY()
    • setFoodMoinsConsomFood

      public void setFoodMoinsConsomFood()
    • getIndividu

      public Individu getIndividu()
    • getTropDeFood

      public boolean getTropDeFood()
    • getFemelle

      public boolean getFemelle()
      Specified by:
      getFemelle in class Creature
    • setFemelle

      public void setFemelle(boolean b)
      Specified by:
      setFemelle in class Creature
    • getType

      public byte getType()
      Specified by:
      getType in class Creature
    • getHaveWings

      public boolean getHaveWings()
      return true if Ant still have wings.
      Specified by:
      getHaveWings in class Creature
    • getCutWings

      public boolean getCutWings()
    • setCutWings

      public void setCutWings(boolean b)
    • getUneSeuleAction

      public static byte getUneSeuleAction()
    • setUneSeuleAction

      public static void setUneSeuleAction(int x)
    • setUneSeuleAction

      public static void setUneSeuleAction()
    • getBActionHaveChange

      public static boolean getBActionHaveChange()
    • setBActionHaveChange

      public static void setBActionHaveChange(boolean b)
      Setter that notify playing ant in case it was waiting for an action to be choose.
    • getName

      public String getName()
      Overrides:
      getName in class Creature
    • isImago

      public boolean isImago()
    • getReine

      public Fourmi getReine()
    • getHealthLost

      public byte getHealthLost()
    • getFoodConso

      public int getFoodConso()
    • isAI

      public boolean isAI()
      Return true if is own by an AI.
      If it have an anthill that have a player it will return getIa() value of the player.
      Overrides:
      isAI in class Creature
    • setAction

      public void setAction(int x)
      Update action & update view.
      Overrides:
      setAction in class Creature
    • getStateHealth

      public int getStateHealth()
      Return the state of the Fourmi concerning health.
      Overrides:
      getStateHealth in class Creature
      Returns:
      an int from 0 to 3 (0=OK, 1=medium, 2=bad, 3=critical)
    • getMovingCost

      public int getMovingCost()
      Overrides:
      getMovingCost in class Creature
    • toString

      public String toString()
      Description copied from class: Creature
      Return a description of the creature.
      Overrides:
      toString in class Creature
    • afficheToi

      public void afficheToi()
    • estReine

      public boolean estReine()
    • description

      public String description()
    • getMaxAgeIndividu

      public int getMaxAgeIndividu(int especeTempId, int stadeTemp)
      return the max age for an Individu depending of Espece & stade.
      Parameters:
      especeTempId - Temporary Espece id.
      stadeTemp - Temporary stade.
    • getMaxAgeIndividu

      public int getMaxAgeIndividu()
      return the max age for an Individu with stade=0 (imago) & individu already define.
    • getMultiplicateurDeDiff

      public double getMultiplicateurDeDiff()
      return the difficulty multiplier.
      Difficulty multiplier is in [0.2;3]
    • getSeuilDeRisqueDInfection

      public int getSeuilDeRisqueDInfection()
    • estALaFere

      public boolean estALaFere()
      True if the ant is at its anthill.
    • descriptionTableau

      public String[] descriptionTableau()
    • toStringShort

      public String toStringShort()
      Return a short string that describe this.
      Overrides:
      toStringShort in class Creature
    • descriptionGString

      public fr.formiko.usual.structures.listes.GString descriptionGString()
    • salir

      public void salir()
      un-clean this. It also let this died if it is under the seuilDeRisqueDInfection & that this have bad luck.
    • wantFood

      public boolean wantFood()
      return true if this whant some food. This ask for food if it is hungry at 5% or if food is < at what we need for 2 days.
      Specified by:
      wantFood in class Creature
    • wantClean

      public boolean wantClean()
      return true if this whant to be clean. This want to le clean if in 2 turns it will be under the seuilDeRisqueDInfection.
      Specified by:
      wantClean in class Creature
    • iniTour

      public void iniTour()
      initialize tour value for an ant.
      If that's a non-ai player it will have TourFourmiNonIa else it will have TourReine or TourFourmi depending of getReine().
    • iniPheromone

      public void iniPheromone()
      Initialize ph value for an ant.
      It take similar pheromone to the 1 of the queen. If the queen is death it take ph from the 1a an of the anthill. If there is not more and it take a random pheromone.