Package fr.formiko.formiko
Class Creature
java.lang.Object
fr.formiko.formiko.ObjetAId
fr.formiko.formiko.ObjetSurCarteAId
fr.formiko.formiko.Creature
- All Implemented Interfaces:
Serializable
The class that extends every living thing on the game.
Most of the common var between Fourmi and Insecte can be found here.
Creature have a lot of interfaces. They can be used to do every action that a creature can do. If a creature can not do an action as lay (pondre) and try to do it, an error message will appear. This actions can all be call by a short cut here (to be able to do creature.action() and not ActionFourmi.action(creature)).
Most of the common var between Fourmi and Insecte can be found here.
Creature have a lot of interfaces. They can be used to do every action that a creature can do. If a creature can not do an action as lay (pondre) and try to do it, an error message will appear. This actions can all be call by a short cut here (to be able to do creature.action() and not ActionFourmi.action(creature)).
- Author:
- Hydrolien
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected byte
protected int
protected Espece
protected int
protected int
protected byte
protected boolean
private int
protected byte
protected int
protected int
protected Pheromone
protected byte
protected byte
-3=egg, -2=larva, -1=nymph, 0=imagoprotected ObjetSurCarteAId
Fields inherited from class fr.formiko.formiko.ObjetSurCarteAId
ccase, direction
-
Constructor Summary
ConstructorDescriptionCreature()
constructor for Creature.constructor for Creature.Main constructor for Creature. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFood
(int x) void
ajouteAge
(int x) void
ajouteFood
(int x) boolean
canLay()
void
ceDeplacer
(boolean bIa) void
ceDeplacer
(int direction) void
ceDeplacer
(Case ca) void
ceDeplacer
(CCase ccase) void
void
boolean
chasse()
boolean
chasser
(int direction) void
void
Drop the transported item.void
eat
(int percentageOfHungryness) Eat with the interface Chasse.void
endTurn()
boolean
void
evoluer()
int
Return a friendly level. Higer is more frienly.int
int
getAge()
find all allied Creature on the same Case.find all allied Creature on the same Case and remove this form the GCreature.boolean
Is this consider as an ally of c ?boolean
Is this consider as an enemy of c ?abstract boolean
int
getFood()
int
abstract boolean
return true if Creature have wings.byte
boolean
getIa()
boolean
boolean
Is this consider as neutral for c ?int
byte
int
int
byte
int
getName()
getPh()
byte
abstract String
getSex()
int
getSize()
byte
getStade()
int
Return the state of the Creature concerning action.int
Return the state of the Creature concerning age.int
Return the state of the Creature concerning food.int
Return the state of the Creature concerning health.return stade as a string in the good language.abstract byte
getType()
boolean
isAI()
Return true if is own by an AI.boolean
isDead()
boolean
isFlying()
boolean
isHungry
(int percentageOfHungryness) check if this is hungry.void
mourir()
void
mourir
(int r) void
mourirOuPas
(int x) check if this should died of reason x.void
netoyer()
void
boolean
void
pondre()
void
preTurn()
Actualise Creature c before the turn.void
runAway()
Run away if a predator is next to you.private void
setAction
(byte x) void
setAction
(int x) void
setActionMoins
(int x) void
void
setAge
(int x) void
void
Move the Creature from a case to an other.void
setEspece
(int e) void
abstract void
setFemelle
(boolean b) void
setFood
(int x) void
void
setGivenFood
(int x) void
setHealth
(byte x) void
setHealth
(int x) void
setIsDead
(boolean b) void
setLastTurnEnd
(int x) void
setMaxAction
(byte x) void
setMaxAge
(int x) void
setMaxFood
(int x) void
void
setPheromone
(byte a, byte b, byte c) void
setPheromone
(int a, int b, int c) void
void
setPheromoneTolerence
(byte x) void
setStade
(byte s) void
setStade
(int x) void
Set as transported item o.void
toString()
Return a description of the creature.Return a short string that describe this.void
tour()
void
void
trophallaxie
(int id, int foodDonnée) void
trophallaxie
(Creature c, int foodDonnée) abstract boolean
abstract boolean
wantFood()
Methods inherited from class fr.formiko.formiko.ObjetSurCarteAId
getCase, getCCase, getDirAllea, getDirection, setCc, setCCase, setDirection
-
Field Details
-
déplacement
-
chasse
-
pondre
-
trophallaxie
-
evoluer
-
mourir
-
netoyer
-
tour
-
food
protected int food -
maxFood
protected int maxFood -
givenFood
protected int givenFood -
age
protected int age -
maxAge
protected int maxAge -
isDead
protected boolean isDead -
action
protected byte action -
maxAction
protected byte maxAction -
ph
-
health
protected byte health -
pheromoneTolerence
protected byte pheromoneTolerence -
stade
protected byte stade-3=egg, -2=larva, -1=nymph, 0=imago -
e
-
transported
-
lastTurnEnd
private int lastTurnEnd
-
-
Constructor Details
-
Creature
public Creature(CCase ccase, int age, int maxAge, byte maxAction, Pheromone ph, int food, int maxFood) Main constructor for Creature.
All args are Creature var. -
Creature
constructor for Creature.
Here we only know some var, but the main constructor will take care of them. -
Creature
-
Creature
constructor for Creature.
Here we only know some var, but the main constructor will take care of them. -
Creature
-
Creature
-
Creature
public Creature()
-
-
Method Details
-
getFood
public int getFood() -
getMaxFood
public int getMaxFood() -
setFoodMoins1
public void setFoodMoins1() -
setFood
public void setFood(int x) -
setMaxFood
public void setMaxFood(int x) -
ajouteFood
public void ajouteFood(int x) -
addFood
public void addFood(int x) -
diminuerOuPasFood
public void diminuerOuPasFood() -
getGivenFood
public int getGivenFood() -
setGivenFood
public void setGivenFood(int x) -
getAge
public int getAge() -
getMaxAge
public int getMaxAge() -
setMaxAge
public void setMaxAge(int x) -
setAgePlus1
public void setAgePlus1() -
setAge
public void setAge(int x) -
ajouteAge
public void ajouteAge(int x) -
getAction
public int getAction() -
setAction
private void setAction(byte x) -
setAction
public void setAction(int x) -
setActionMoins
public void setActionMoins(int x) -
setActionTo0
public void setActionTo0() -
getMaxAction
public byte getMaxAction() -
setMaxAction
public void setMaxAction(byte x) -
setCCase
Move the Creature from a case to an other.
It is used by Deplacement interfaces.
It wil try to remove from old CCase and add to new CCase.- Overrides:
setCCase
in classObjetSurCarteAId
-
getPheromone
-
getPh
-
setPheromone
-
setPh
-
setPheromone
public void setPheromone(byte a, byte b, byte c) -
setPheromone
public void setPheromone(int a, int b, int c) -
getIsDead
public boolean getIsDead() -
isDead
public boolean isDead() -
setIsDead
public void setIsDead(boolean b) -
getHealth
public byte getHealth() -
getMaxHealth
public byte getMaxHealth() -
setHealth
public void setHealth(int x) -
setHealth
public void setHealth(byte x) -
getFemelle
public abstract boolean getFemelle() -
setFemelle
public abstract void setFemelle(boolean b) -
getSex
-
getStade
public byte getStade() -
setStade
public void setStade(byte s) -
setStade
public void setStade(int x) -
estFourmi
public boolean estFourmi() -
getType
public abstract byte getType() -
getPheromoneTolerence
public byte getPheromoneTolerence() -
setPheromoneTolerence
public void setPheromoneTolerence(byte x) -
getHaveWings
public abstract boolean getHaveWings()return true if Creature have wings. -
isFlying
public boolean isFlying() -
wantFood
public abstract boolean wantFood() -
wantClean
public abstract boolean wantClean() -
getEspece
-
setEspece
-
setEspece
public void setEspece(int e) -
getName
-
getLastTurnEnd
public int getLastTurnEnd() -
setLastTurnEnd
public void setLastTurnEnd(int x) -
isAI
public boolean isAI()Return true if is own by an AI. -
getIa
public boolean getIa() -
getTransported
-
setTransported
Set as transported item o.
If item is no null it will be remove from the CCase.
If item is not null & it already have an item it will throw an exception. -
dropTransported
public void dropTransported()Drop the transported item.
Transported item is now on the CCase of the Creature & not anymore transported by Creature. -
getSize
public int getSize() -
ceDeplacer
public void ceDeplacer(boolean bIa) -
ceDeplacer
-
ceDeplacer
-
ceDeplacer
public void ceDeplacer(int direction) -
ceDeplacerPlusieurCase
-
pondre
public void pondre() -
canLay
public boolean canLay() -
chasse
public boolean chasse() -
chasser
public boolean chasser(int direction) -
trophallaxie
public void trophallaxie(int id, int foodDonnée) -
trophallaxie
-
trophallaxer
public void trophallaxer() -
evoluer
public void evoluer() -
mourir
public void mourir() -
mourir
public void mourir(int r) -
supprimerDeLaCarte
public void supprimerDeLaCarte() -
netoyer
public void netoyer() -
netoyer
-
ceNetoyer
public void ceNetoyer() -
netoyerIa
public boolean netoyerIa() -
tour
public void tour() -
endTurn
public void endTurn() -
getStateFood
public int getStateFood()Return the state of the Creature concerning food.- Returns:
- an int from 0 to 3 (0=OK, 1=medium, 2=bad, 3=critical)
-
getStateAction
public int getStateAction()Return the state of the Creature concerning action.- Returns:
- an int from 0 to 3 (0=OK, 1=medium, 2=bad, 3=critical)
-
getStateAge
public int getStateAge()Return the state of the Creature concerning age.- Returns:
- an int from 0 to 3 (0=OK, 1=medium, 2=bad, 3=critical)
-
getStateHealth
public int getStateHealth()Return the state of the Creature concerning health. Creature that don't Override getStateHealth() will always be at 0.- Returns:
- an int from 0 to 3 (0=OK, 1=medium, 2=bad, 3=critical)
-
getMovingCost
public int getMovingCost() -
toString
Return a description of the creature. -
toStringShort
Return a short string that describe this.- Overrides:
toStringShort
in classObjetAId
-
getStringStade
return stade as a string in the good language. -
getEstAllié
Is this consider as an ally of c ?- Parameters:
c
- A Creature that whant to know if we are ally.
-
getEstEnnemi
Is this consider as an enemy of c ?- Parameters:
c
- A Creature that whant to know if we are enemy.
-
getIsNeutral
Is this consider as neutral for c ?- Parameters:
c
- A Creature that whant to know if we are neutral.
-
friendlyLevel
Return a friendly level. Higer is more frienly.- Parameters:
c
- A Creature to test friendly level.
-
getAlliéSurLaCase
find all allied Creature on the same Case. -
getAlliéSurLaCaseSansThis
find all allied Creature on the same Case and remove this form the GCreature. -
mourirOuPas
public void mourirOuPas(int x) check if this should died of reason x.- Parameters:
x
- Reason to died or not.
-
isHungry
public boolean isHungry(int percentageOfHungryness) check if this is hungry.- Parameters:
percentageOfHungryness
- 0=are you starving to death, 40=are you hungry, 90=can you eat something more.
return true if actual %age of food is < than percentageOfHungryness.
-
eat
public void eat(int percentageOfHungryness) Eat with the interface Chasse.
It will stop eating only if action <= 0 or is not hungry or it transport something or chasse have returned false (creature haven't eat the last time he try).
If transported thing can be eat, it will be done. Else transported thing will be drop at anthill. -
runAway
public void runAway()Run away if a predator is next to you. -
preTurn
public void preTurn()Actualise Creature c before the turn.
-