Class 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

public abstract class Enemy extends Registrable
  • Field Details

    • ATTACHED_PARTICLE_REGENERATION_BUFF

      public static final String ATTACHED_PARTICLE_REGENERATION_BUFF
      See Also:
    • UNREGISTERED_ID

      public static final int UNREGISTERED_ID
      See Also:
    • HEALTH_BAR_BACKGROUND_COLOR

      public static final Color 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

      public Vector2 drawPosition
    • invisible

      public MultiReasonBool invisible
    • disabled

      public MultiReasonBool disabled
    • chasedByCrusher

      public boolean chasedByCrusher
    • gaveMiningSpeedForGauss

      public boolean gaveMiningSpeedForGauss
    • loot

      public Array<ItemStack> loot
    • thrownBackBy

      public IntSet thrownBackBy
    • ignitionProgress

      public float ignitionProgress
    • ignitionIncreasedLastFrame

      public int ignitionIncreasedLastFrame
    • notAffectsWaveKillCounter

      public MultiReasonBool notAffectsWaveKillCounter
    • lowAimPriority

      public MultiReasonBool lowAimPriority
    • caughtByCrushersSet

      public IntSet caughtByCrushersSet
    • totalCatchesByCrushers

      public int totalCatchesByCrushers
    • stunDebuffStats

      public StunDebuffStats stunDebuffStats
    • attachedParticles

    • type

      public EnemyType type
    • maxHealth

      public float maxHealth
    • bounty

      public float bounty
    • otherEnemiesNearby

      public int otherEnemiesNearby
      Number of enemies in range of 1 tile
    • healthBarScale

      public float healthBarScale
    • id

      public int id
    • graphPath

      public Path graphPath
    • pathSearches

      public int pathSearches
    • ignorePathfinding

      public boolean ignorePathfinding
      Won't search for a new path (set manually)
    • sideShiftIndex

      public int sideShiftIndex
    • passedTiles

      public float passedTiles
    • sumPassedTiles

      public float sumPassedTiles
      Number of passed tiles all time, not reset when new path is assigned to the enemy
    • existsTime

      public float existsTime
    • buffsByType

      public DelayedRemovalArray[] buffsByType
    • buffsAppliedByType

      @Null public boolean[] buffsAppliedByType
      Will be null if no buffs were applied to this enemy ever
    • spawnTile

      @Null public SpawnTile spawnTile
      Spawn tile it appeared from
    • ignoredOnGameOverNoEnemies

      public boolean ignoredOnGameOverNoEnemies
    • wave

      @Null public Wave wave
      Wave it has been spawned on
    • ignoredByAutoWaveCall

      public boolean ignoredByAutoWaveCall
    • buffFreezingPercent

      public float buffFreezingPercent
    • buffFreezingLightningLengthBonus

      public float buffFreezingLightningLengthBonus
      0-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 buffFreezingPoisonDurationBonus
      0-100%. If value is set to 100%, poisoning duration won't be reduced as time goes by
    • buffSnowballHits

      public int buffSnowballHits
    • multishotTowerHits

      public IntIntMap multishotTowerHits
    • wasAimedAtWithChainReactionBuff

      public boolean wasAimedAtWithChainReactionBuff
    • wasStunnedByGauss

      public boolean wasStunnedByGauss
  • Method Details

    • write

      public void write(Kryo kryo, Output output)
      Specified by:
      write in interface KryoSerializable
      Overrides:
      write in class Registrable
    • read

      public void read(Kryo kryo, Input input)
      Specified by:
      read in interface KryoSerializable
      Overrides:
      read in class Registrable
    • getUserData

      @Null public Object getUserData(String key)
    • setUserData

      public void setUserData(String idx, @Null Object data)
    • getCurrentTile

      @Null public Tile getCurrentTile()
    • getColor

      public Color getColor()
    • initBuffsByTypeArray

      public void initBuffsByTypeArray()
    • hasBuffsByType

      public boolean hasBuffsByType(BuffType buffType)
      Returns:
      false if there are no buffs applied of the selected type. Buff arrays may not be allocated yet
    • getBuffsByTypeOrNull

      public DelayedRemovalArray getBuffsByTypeOrNull(BuffType buffType)
    • update

      public void update(float deltaTime)
    • canHaveRandomSideShift

      public boolean canHaveRandomSideShift()
    • giveDamage

      public float giveDamage(Tower tower, float damage, DamageType damageType)
      Do not call directly, use EnemySystem method instead
    • getSize

      public float getSize()
      Enemy's radius in px
    • getSquaredSize

      public float getSquaredSize()
    • drawBatch

      public void drawBatch(Batch batch, float deltaTime)
    • drawBatchAdditive

      public void drawBatchAdditive(Batch batch, float deltaTime)
      Highlights and auras. Not called if particles are disabled.
    • setPositionToPath

      public void setPositionToPath()
    • getPosition

      public Vector2 getPosition()
    • setPosition

      public final void setPosition(Vector2 position)
    • setPosition

      public void setPosition(float x, float y)
    • applyDrawInterpolation

      public void applyDrawInterpolation(float interpolatedTime)
    • addLoot

      public ItemStack addLoot(Item item, int count)
      Returns:
      stack the item has been added into
    • getTexture

      public TextureRegion getTexture()
    • getHighlightTexture

      public TextureRegion getHighlightTexture()
    • getEmojiTexture

      public TextureRegion getEmojiTexture()
    • drawHealth

      public void drawHealth(Batch batch)
    • 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

      public float getTowerDamageMultiplier(TowerType towerType)
    • getBuffedDamageMultiplier

      public float getBuffedDamageMultiplier(TowerType towerType, DamageType damageType)
      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

      public final boolean canBeBuffed(BuffType buff)
    • getBuffVulnerability

      public float getBuffVulnerability(BuffType buff)
    • isVulnerableTo

      public boolean isVulnerableTo(DamageType damageType)
    • isBossRelated

      public boolean isBossRelated()
    • isBossMainBodyPart

      public boolean isBossMainBodyPart()
    • isVulnerableToSpecial

      public boolean isVulnerableToSpecial(SpecialDamageType damageType)
    • getAbilityVulnerability

      public float getAbilityVulnerability(AbilityType abilityType)
    • canBeAttackedBy

      public boolean canBeAttackedBy(Tower tower)
      Additional check - main check happens in tower.canAttackEnemy()
    • isAir

      public boolean isAir()
    • dynamicPathfindingAllowed

      public boolean dynamicPathfindingAllowed()
    • getBreakParticle

      public ParticleEffectPool.PooledEffect getBreakParticle()
    • getHitParticle

      public ParticleEffectPool.PooledEffect getHitParticle()