Package net.sf.colossus.variant
Class CreatureType
- java.lang.Object
-
- net.sf.colossus.variant.CreatureType
-
- All Implemented Interfaces:
java.lang.Comparable<CreatureType>
- Direct Known Subclasses:
CreatureTypeTitan
public class CreatureType extends java.lang.Object implements java.lang.Comparable<CreatureType>
A type of creature in a variant. This class models a generic creature type, i.e. all features that are common through all creatures of a specific type. Default equality and sorting order is class (in case of subclasses) then name.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
baseColor
private boolean
demilord
private boolean
flies
private boolean
isSummonable
private static java.util.logging.Logger
LOGGER
private boolean
lord
private boolean
magicMissile
private int
maxCount
private java.lang.String
name
static java.util.Comparator<CreatureType>
NAME_ORDER
A comparator sorting creature types by name.private boolean
nativeDune
private boolean
nativeRiver
private boolean
nativeSlope
private java.util.Set<HazardTerrain>
nativeTerrains
private static boolean
noBaseColor
private java.lang.String
pluralName
private int
poison
private int
power
private boolean
rangestrikes
private int
skill
private int
slows
private boolean
waterDwelling
-
Constructor Summary
Constructors Constructor Description CreatureType(java.lang.String name, int power, int skill, boolean rangestrikes, boolean flies, java.util.Set<HazardTerrain> nativeTerrains, boolean nativeSlope, boolean nativeRiver, boolean nativeDune, boolean waterDwelling, boolean magicMissile, boolean summonable, boolean lord, boolean demilord, int maxCount, java.lang.String pluralName, java.lang.String baseColor, int poison, int slows)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canChangeValue()
true if any if the values can change during the game returned by: - getPower, getSkill, (and therefore getPointValue) - isRangestriker, isFlier, useMagicMissile - isNativeTerraion(t), for all t - isNativeHexSide(h) for all h In Standard game only the titans change their attributesint
compareTo(CreatureType o)
boolean
equals(java.lang.Object object)
Compare by name.java.lang.String
getBaseColor()
protected java.lang.String
getImageName()
java.lang.String[]
getImageNames()
int
getKillValue()
Get the non-terrainified part of the kill-value.int
getMaxCount()
java.lang.String
getName()
The name used for creatures of this type.java.lang.String
getPluralName()
The name used for multiple creatures of this type.int
getPointValue()
int
getPoison()
int
getPower()
int
getSkill()
int
getSlows()
int
hashCode()
boolean
isDemiLord()
boolean
isFlier()
boolean
isImmortal()
boolean
isLord()
boolean
isLordOrDemiLord()
boolean
isNativeAt(char h)
boolean
isNativeAt(HazardHexside hazard)
boolean
isNativeDune()
boolean
isNativeIn(HazardTerrain terrain)
Checks if the type of creature is native in a terrain type.boolean
isNativeRiver()
boolean
isNativeSlope()
boolean
isPoison()
boolean
isRangestriker()
boolean
isSummonable()
boolean
isTitan()
Returns true if this is a Titan.boolean
isWaterDwelling()
void
setMaxCount(int maxCount)
Only called on Titans after numPlayers is known.static void
setNoBaseColor(boolean b)
boolean
slows()
java.lang.String
toString()
boolean
useMagicMissile()
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
NAME_ORDER
public static final java.util.Comparator<CreatureType> NAME_ORDER
A comparator sorting creature types by name.
-
noBaseColor
private static boolean noBaseColor
-
name
private final java.lang.String name
-
pluralName
private final java.lang.String pluralName
-
power
private final int power
-
skill
private final int skill
-
rangestrikes
private final boolean rangestrikes
-
flies
private final boolean flies
-
nativeSlope
private final boolean nativeSlope
-
nativeRiver
private final boolean nativeRiver
-
nativeDune
private final boolean nativeDune
-
waterDwelling
private final boolean waterDwelling
-
magicMissile
private final boolean magicMissile
-
lord
private final boolean lord
-
demilord
private final boolean demilord
-
maxCount
private int maxCount
-
poison
private final int poison
-
slows
private final int slows
-
baseColor
private final java.lang.String baseColor
-
nativeTerrains
private final java.util.Set<HazardTerrain> nativeTerrains
-
isSummonable
private final boolean isSummonable
-
-
Constructor Detail
-
CreatureType
public CreatureType(java.lang.String name, int power, int skill, boolean rangestrikes, boolean flies, java.util.Set<HazardTerrain> nativeTerrains, boolean nativeSlope, boolean nativeRiver, boolean nativeDune, boolean waterDwelling, boolean magicMissile, boolean summonable, boolean lord, boolean demilord, int maxCount, java.lang.String pluralName, java.lang.String baseColor, int poison, int slows)
-
-
Method Detail
-
setNoBaseColor
public static void setNoBaseColor(boolean b)
-
getName
public java.lang.String getName()
The name used for creatures of this type.
-
getPluralName
public java.lang.String getPluralName()
The name used for multiple creatures of this type.
-
isNativeIn
public boolean isNativeIn(HazardTerrain terrain)
Checks if the type of creature is native in a terrain type.- Parameters:
terrain
- The terrain to check. Not null.- Returns:
- true iff creatures of this type are native in the terrain.
-
isSummonable
public boolean isSummonable()
-
isTitan
public boolean isTitan()
Returns true if this is a Titan. The default implementation is a constant false, to be overridden in classes representing Titans.- Returns:
- true iff this creature type is a Titan.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object object)
Compare by name.- Overrides:
equals
in classjava.lang.Object
-
getMaxCount
public int getMaxCount()
-
setMaxCount
public void setMaxCount(int maxCount)
Only called on Titans after numPlayers is known. 08/2009 Clemens: And on Balrogs when players scores raise.
-
isLord
public boolean isLord()
-
isDemiLord
public boolean isDemiLord()
-
isLordOrDemiLord
public boolean isLordOrDemiLord()
-
isImmortal
public boolean isImmortal()
-
canChangeValue
public boolean canChangeValue()
true if any if the values can change during the game returned by: - getPower, getSkill, (and therefore getPointValue) - isRangestriker, isFlier, useMagicMissile - isNativeTerraion(t), for all t - isNativeHexSide(h) for all h In Standard game only the titans change their attributes
-
getImageName
protected java.lang.String getImageName()
-
getImageNames
public java.lang.String[] getImageNames()
-
getPower
public int getPower()
-
getSkill
public int getSkill()
-
getPointValue
public int getPointValue()
-
isRangestriker
public boolean isRangestriker()
-
isFlier
public boolean isFlier()
-
isPoison
public boolean isPoison()
-
slows
public boolean slows()
-
isNativeAt
public boolean isNativeAt(HazardHexside hazard)
-
isNativeAt
public boolean isNativeAt(char h)
-
isNativeSlope
public boolean isNativeSlope()
-
isNativeRiver
public boolean isNativeRiver()
-
isNativeDune
public boolean isNativeDune()
-
isWaterDwelling
public boolean isWaterDwelling()
-
useMagicMissile
public boolean useMagicMissile()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getBaseColor
public java.lang.String getBaseColor()
-
getPoison
public int getPoison()
-
getSlows
public int getSlows()
-
getKillValue
public int getKillValue()
Get the non-terrainified part of the kill-value. TODO this is not model, but AI related (but also used in client for sorting creatures -- the client uses the AI for recruit hints, too)
-
compareTo
public int compareTo(CreatureType o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<CreatureType>
-
-