Package com.prineside.tdi2
Class Enemy
java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.Enemy
- All Implemented Interfaces:
KryoSerializable
- Direct Known Subclasses:
ArmoredEnemy
,BossEnemy
,BrootEnemy
,ConstructorBossEnemy
,FastEnemy
,FighterEnemy
,GenericEnemy
,HealerEnemy
,HeliEnemy
,IcyEnemy
,JetEnemy
,LightEnemy
,MetaphorBossCreepEnemy
,MetaphorBossEnemy
,MobchainBossBodyEnemy
,MobchainBossCreepEnemy
,MobchainBossHeadEnemy
,RegularEnemy
,SnakeBossBodyEnemy
,SnakeBossHeadEnemy
,SnakeBossTailEnemy
,StrongEnemy
,ToxicEnemy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Use this wrapper to store a reference to an enemy (always if there's a chance the enemy will become unregistered between the moment it is stored & stored reference is used in the code) No need to use as method argument / as local variable (if there's no chance for the enemy to become unregistered while it is being used locally)static class
Enemy.Factory<T extends Enemy>
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloat
static final String
float
float
0-100%.float
float
0-100%.boolean[]
Will be null if no buffs were applied to this enemy everint
boolean
float
float
float
boolean
static final Color
boolean
float
int
int
float
boolean
boolean
boolean
Won't search for a new path (set manually)int
float
int
Number of enemies in range of 1 tilefloat
int
int
static final float
Spawn tile it appeared fromfloat
Number of passed tiles all time, not reset when new path is assigned to the enemyint
static final int
boolean
boolean
Wave it has been spawned onFields inherited from class com.prineside.tdi2.Registrable
S
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyDrawInterpolation
(float interpolatedTime) boolean
canBeAttackedBy
(Tower tower) Additional check - main check happens in tower.canAttackEnemy()final boolean
canBeBuffed
(BuffType buff) boolean
void
void
drawBatchAdditive
(Batch batch, float deltaTime) Highlights and auras.void
drawHealth
(Batch batch) boolean
float
getAbilityVulnerability
(AbilityType abilityType) float
float
getBuffedDamageMultiplier
(TowerType towerType, DamageType damageType) float
getBuffsByTypeOrNull
(BuffType buffType) float
getBuffVulnerability
(BuffType buff) getColor()
float
float
int
final float
getPassedTilesDelta
(float deltaTime) Get the distance which will be travelled by the enemy in the specified time from the current position.float
getSize()
Enemy's radius in pxfloat
getSpeed()
float
float
getTowerDamageMultiplier
(TowerType towerType) getUserData
(String key) float
giveDamage
(Tower tower, float damage, DamageType damageType) Do not call directly, use EnemySystem method insteadfloat
giveDamageRaw
(float damage, DamageType damageType) boolean
hasBuffsByType
(BuffType buffType) abstract boolean
void
boolean
isAir()
boolean
boolean
boolean
isVulnerableTo
(DamageType damageType) boolean
isVulnerableToSpecial
(SpecialDamageType damageType) void
Called when position is set by the system according to path and passedTiles.void
onPreDie()
void
void
void
setHealth
(float newHealth) void
setKillExp
(float exp) void
setMaxHealth
(float health) void
setPosition
(float x, float y) final void
setPosition
(Vector2 position) void
void
setSpeed
(float newSpeed) void
setUserData
(String idx, Object data) void
update
(float deltaTime) void
Methods inherited from class com.prineside.tdi2.Registrable
isRegistered, setRegistered, setUnregistered
-
Field Details
-
ATTACHED_PARTICLE_REGENERATION_BUFF
- See Also:
-
UNREGISTERED_ID
public static final int UNREGISTERED_ID- See Also:
-
HEALTH_BAR_BACKGROUND_COLOR
-
SIZE
public static final float SIZE- See Also:
-
killScore
public int killScore -
angle
public float angle -
drawAngle
public float drawAngle -
drawScale
public float drawScale -
healthBarInvisible
public boolean healthBarInvisible -
drawPosition
-
invisible
-
disabled
-
chasedByCrusher
public boolean chasedByCrusher -
gaveMiningSpeedForGauss
public boolean gaveMiningSpeedForGauss -
loot
-
thrownBackBy
-
ignitionProgress
public float ignitionProgress -
ignitionIncreasedLastFrame
public int ignitionIncreasedLastFrame -
notAffectsWaveKillCounter
-
lowAimPriority
-
caughtByCrushersSet
-
totalCatchesByCrushers
public int totalCatchesByCrushers -
stunDebuffStats
-
attachedParticles
-
type
-
maxHealth
public float maxHealth -
bounty
public float bounty -
otherEnemiesNearby
public int otherEnemiesNearbyNumber of enemies in range of 1 tile -
healthBarScale
public float healthBarScale -
id
public int id -
graphPath
-
pathSearches
public int pathSearches -
ignorePathfinding
public boolean ignorePathfindingWon't search for a new path (set manually) -
sideShiftIndex
public int sideShiftIndex -
passedTiles
public float passedTiles -
sumPassedTiles
public float sumPassedTilesNumber of passed tiles all time, not reset when new path is assigned to the enemy -
existsTime
public float existsTime -
buffsByType
-
buffsAppliedByType
Will be null if no buffs were applied to this enemy ever -
spawnTile
Spawn tile it appeared from -
ignoredOnGameOverNoEnemies
public boolean ignoredOnGameOverNoEnemies -
wave
Wave it has been spawned on -
ignoredByAutoWaveCall
public boolean ignoredByAutoWaveCall -
buffFreezingPercent
public float buffFreezingPercent -
buffFreezingLightningLengthBonus
public float buffFreezingLightningLengthBonus0-100%. If value is set to 100%, chain length won't be reduced if it jumps on this enemy (zero resistance, a perfect superconductor yay) -
buffFreezingPoisonDurationBonus
public float buffFreezingPoisonDurationBonus0-100%. If value is set to 100%, poisoning duration won't be reduced as time goes by -
buffSnowballHits
public int buffSnowballHits -
multishotTowerHits
-
wasAimedAtWithChainReactionBuff
public boolean wasAimedAtWithChainReactionBuff -
wasStunnedByGauss
public boolean wasStunnedByGauss
-
-
Method Details
-
write
- Specified by:
write
in interfaceKryoSerializable
- Overrides:
write
in classRegistrable
-
read
- Specified by:
read
in interfaceKryoSerializable
- Overrides:
read
in classRegistrable
-
getUserData
-
setUserData
-
getCurrentTile
-
getColor
-
initBuffsByTypeArray
public void initBuffsByTypeArray() -
hasBuffsByType
- Returns:
- false if there are no buffs applied of the selected type. Buff arrays may not be allocated yet
-
getBuffsByTypeOrNull
-
update
public void update(float deltaTime) -
canHaveRandomSideShift
public boolean canHaveRandomSideShift() -
giveDamage
Do not call directly, use EnemySystem method instead -
giveDamageRaw
-
getSize
public float getSize()Enemy's radius in px -
getSquaredSize
public float getSquaredSize() -
drawBatch
-
drawBatchAdditive
Highlights and auras. Not called if particles are disabled. -
setPositionToPath
public void setPositionToPath() -
getPosition
-
setPosition
-
setPosition
public void setPosition(float x, float y) -
applyDrawInterpolation
public void applyDrawInterpolation(float interpolatedTime) -
addLoot
- Returns:
- stack the item has been added into
-
getTexture
-
getHighlightTexture
-
getEmojiTexture
-
drawHealth
-
setHealth
public void setHealth(float newHealth) -
setKillExp
public void setKillExp(float exp) -
getKillExp
public float getKillExp() -
getKillScore
public int getKillScore() -
getHealth
public float getHealth() -
setMaxHealth
public void setMaxHealth(float health) -
setSpeed
public void setSpeed(float newSpeed) -
getSpeed
public float getSpeed() -
getPassedTilesDelta
public final float getPassedTilesDelta(float deltaTime) Get the distance which will be travelled by the enemy in the specified time from the current position. Takes buffedSpeed and path node's speed multipliers into account. Usually used by the EnemySystem to update enemy's position, also used for position interpolation.- Returns:
- distance in px which the enemy will travel in deltaTime
-
getBuffedSpeed
public float getBuffedSpeed() -
getTowerDamageMultiplier
-
getBuffedDamageMultiplier
- Parameters:
towerType
- may be null
-
hasDrawPriority
public abstract boolean hasDrawPriority() -
getBaseDamage
public float getBaseDamage() -
onSpawned
public void onSpawned() -
onPreDie
public void onPreDie() -
onPositionSetToPath
public void onPositionSetToPath()Called when position is set by the system according to path and passedTiles. Position can be corrected here. -
canBeBuffed
-
getBuffVulnerability
-
isVulnerableTo
-
isBossRelated
public boolean isBossRelated() -
isBossMainBodyPart
public boolean isBossMainBodyPart() -
isVulnerableToSpecial
-
getAbilityVulnerability
-
canBeAttackedBy
Additional check - main check happens in tower.canAttackEnemy() -
isAir
public boolean isAir() -
dynamicPathfindingAllowed
public boolean dynamicPathfindingAllowed() -
getBreakParticle
-
getHitParticle
-