2023-11-08 14:28:55 +11:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
|
|
|
func calculate_spawn_power(wave_number : int, number_of_players : int) -> int:
|
|
|
|
return 20 + (50 * number_of_players) + (30 * wave_number)
|
|
|
|
|
|
|
|
|
|
|
|
func generate_wave(spawn_power : int, spawn_pool : Array[Enemy]) -> Dictionary:
|
|
|
|
var wave = {}
|
2023-11-16 00:07:41 +11:00
|
|
|
#var sp_used = 0
|
2023-11-08 14:28:55 +11:00
|
|
|
var enemy_types = randi_range(1, 5)
|
|
|
|
var enemy_choices = spawn_pool.duplicate()
|
2023-11-15 15:19:40 +11:00
|
|
|
var sp_allotment = floori(spawn_power / enemy_types)
|
2023-11-08 14:28:55 +11:00
|
|
|
for x in enemy_types:
|
|
|
|
var choice = enemy_choices.pick_random()
|
|
|
|
enemy_choices.erase(choice)
|
|
|
|
if sp_allotment / choice.spawn_power > 0:
|
2023-11-13 19:36:35 +11:00
|
|
|
wave[Data.enemies.find(choice)] = sp_allotment / choice.spawn_power
|
2023-11-16 00:07:41 +11:00
|
|
|
#sp_used += wave[Data.enemies.find(choice)] * choice.spawn_power
|
|
|
|
#print("Generated wave with spawn power: " + str(sp_used) + "/" + str(spawn_power))
|
2023-11-08 14:28:55 +11:00
|
|
|
return wave
|