2024-09-19 19:03:06 -06:00
|
|
|
class_name NPC
|
|
|
|
extends Character
|
|
|
|
|
|
|
|
|
2024-10-03 06:45:13 -06:00
|
|
|
enum npcDifficulties { MINION, NORMAL, ELITE, BOSS, ELITEBOSS, BBEG }
|
2024-10-01 14:13:54 -06:00
|
|
|
enum npcTiers { I, II, III, IV, V, VI, VII, VIII, IX, X }
|
2024-09-19 19:03:06 -06:00
|
|
|
|
|
|
|
@export var npcDifficulty: npcDifficulties
|
2024-10-01 14:13:54 -06:00
|
|
|
@export var npcTier: npcTiers
|
2024-09-19 19:03:06 -06:00
|
|
|
|
|
|
|
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
|
2024-10-03 06:45:13 -06:00
|
|
|
npcDifficulties.ELITE:
|
2024-09-19 19:03:06 -06:00
|
|
|
self.maxHealth *= 2
|
|
|
|
npcDifficulties.BOSS:
|
|
|
|
self.maxHealth *= 4
|
|
|
|
npcDifficulties.ELITEBOSS:
|
|
|
|
self.maxHealth *= 8
|
|
|
|
npcDifficulties.BBEG:
|
|
|
|
self.maxHealth *= 16
|
2024-10-01 14:13:54 -06:00
|
|
|
# npcTier factor
|
|
|
|
self.maxHealth *= exp(self.npcTier)
|
2024-09-19 19:03:06 -06:00
|
|
|
|
|
|
|
# fun factor (just additional factor to tweak)
|
|
|
|
self.maxHealth *= 10
|
|
|
|
|
|
|
|
|
2024-10-01 14:13:54 -06:00
|
|
|
func _init(npcDifficulty: npcDifficulties = npcDifficulties.NORMAL,
|
|
|
|
npcTier: npcTiers = npcTiers.I) -> void:
|
2024-09-19 19:03:06 -06:00
|
|
|
self.npcDifficulty = npcDifficulty
|
2024-10-01 14:13:54 -06:00
|
|
|
self.npcTier = npcTier
|
2024-09-19 19:03:06 -06:00
|
|
|
_random_mod_health()
|