40 lines
1.1 KiB
GDScript
40 lines
1.1 KiB
GDScript
class_name NPC
|
|
extends Character
|
|
|
|
|
|
enum npcDifficulties { MINION, NORMAL, MINIBOSS, BOSS, ELITEBOSS, BBEG }
|
|
enum npcTiers { I, II, III, IV, V, VI, VII, VIII, IX, X }
|
|
|
|
@export var npcDifficulty: npcDifficulties
|
|
@export var npcTier: npcTiers
|
|
|
|
func _random_mod_health() -> void:
|
|
randomize()
|
|
# noise factor
|
|
var noise_factor = randf_range(7, 10)
|
|
self.maxHealth *= noise_factor
|
|
# difficulty factor
|
|
match self.npcDifficulty:
|
|
npcDifficulties.MINION:
|
|
self.maxHealth /= 2
|
|
npcDifficulties.MINIBOSS:
|
|
self.maxHealth *= 2
|
|
npcDifficulties.BOSS:
|
|
self.maxHealth *= 4
|
|
npcDifficulties.ELITEBOSS:
|
|
self.maxHealth *= 8
|
|
npcDifficulties.BBEG:
|
|
self.maxHealth *= 16
|
|
# npcTier factor
|
|
self.maxHealth *= exp(self.npcTier)
|
|
|
|
# fun factor (just additional factor to tweak)
|
|
self.maxHealth *= 10
|
|
|
|
|
|
func _init(npcDifficulty: npcDifficulties = npcDifficulties.NORMAL,
|
|
npcTier: npcTiers = npcTiers.I) -> void:
|
|
self.npcDifficulty = npcDifficulty
|
|
self.npcTier = npcTier
|
|
_random_mod_health()
|