38 lines
1013 B
GDScript3
38 lines
1013 B
GDScript3
|
class_name NPC
|
||
|
extends Character
|
||
|
|
||
|
|
||
|
enum npcDifficulties { MINION, NORMAL, MINIBOSS, BOSS, ELITEBOSS, BBEG }
|
||
|
|
||
|
@export var npcDifficulty: npcDifficulties
|
||
|
@export var tier: int
|
||
|
|
||
|
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
|
||
|
# tier factor
|
||
|
self.maxHealth *= exp(self.tier)
|
||
|
|
||
|
# fun factor (just additional factor to tweak)
|
||
|
self.maxHealth *= 10
|
||
|
|
||
|
|
||
|
func _init(npcDifficulty: npcDifficulties = npcDifficulties.NORMAL, tier: int = 0) -> void:
|
||
|
self.npcDifficulty = npcDifficulty
|
||
|
self.tier = tier
|
||
|
_random_mod_health()
|