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 classUse 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 classEnemy.Factory<T extends Enemy> -
Field Summary
FieldsModifier and TypeFieldDescriptionfloatstatic final Stringfloatfloat0-100%.floatfloat0-100%.boolean[]Will be null if no buffs were applied to this enemy everintbooleanfloatfloatfloatbooleanstatic final ColorbooleanfloatintintfloatbooleanbooleanbooleanWon't search for a new path (set manually)intfloatintNumber of enemies in range of 1 tilefloatintintstatic final floatSpawn tile it appeared fromfloatNumber of passed tiles all time, not reset when new path is assigned to the enemyintstatic final intbooleanbooleanWave it has been spawned onFields inherited from class com.prineside.tdi2.Registrable
S -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyDrawInterpolation(float interpolatedTime) booleancanBeAttackedBy(Tower tower) Additional check - main check happens in tower.canAttackEnemy()final booleancanBeBuffed(BuffType buff) booleanvoidvoiddrawBatchAdditive(Batch batch, float deltaTime) Highlights and auras.voiddrawHealth(Batch batch) booleanfloatgetAbilityVulnerability(AbilityType abilityType) floatfloatgetBuffedDamageMultiplier(TowerType towerType, DamageType damageType) floatgetBuffsByTypeOrNull(BuffType buffType) floatgetBuffVulnerability(BuffType buff) getColor()floatfloatintfinal floatgetPassedTilesDelta(float deltaTime) Get the distance which will be travelled by the enemy in the specified time from the current position.floatgetSize()Enemy's radius in pxfloatgetSpeed()floatfloatgetTowerDamageMultiplier(TowerType towerType) getUserData(String key) floatgiveDamage(Tower tower, float damage, DamageType damageType) Do not call directly, use EnemySystem method insteadfloatgiveDamageRaw(float damage, DamageType damageType) booleanhasBuffsByType(BuffType buffType) abstract booleanvoidbooleanisAir()booleanbooleanbooleanisVulnerableTo(DamageType damageType) booleanisVulnerableToSpecial(SpecialDamageType damageType) voidCalled when position is set by the system according to path and passedTiles.voidonPreDie()voidvoidvoidsetHealth(float newHealth) voidsetKillExp(float exp) voidsetMaxHealth(float health) voidsetPosition(float x, float y) final voidsetPosition(Vector2 position) voidvoidsetSpeed(float newSpeed) voidsetUserData(String idx, Object data) voidupdate(float deltaTime) voidMethods 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:
writein interfaceKryoSerializable- Overrides:
writein classRegistrable
-
read
- Specified by:
readin interfaceKryoSerializable- Overrides:
readin 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
-