diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-17 19:41:46 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-17 19:41:46 +0100 |
commit | f75ee64e21f67b4f27404147aedaa63750058d5a (patch) | |
tree | 8e35f5b0ca986169e46ef1f90c3fdd951a9af113 /scripts/load_shapes.gd | |
parent | a7bda4264b45c0c64fd81ac91b4f1fbbc539e314 (diff) |
wave
Diffstat (limited to 'scripts/load_shapes.gd')
-rw-r--r-- | scripts/load_shapes.gd | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/load_shapes.gd b/scripts/load_shapes.gd index 32e9104..9ac9f3c 100644 --- a/scripts/load_shapes.gd +++ b/scripts/load_shapes.gd @@ -13,6 +13,7 @@ func _ready(): get_saveload() load_models() load_info() + calc_cost() emit_signal("done_loading") loaded = true @@ -41,3 +42,22 @@ func load_info(): if parsed != null: for tin in parsed: info[tin.name] = tin + + +func calc_cost (): + for i in info: info[i].cost = get_lives(i) + +func get_lives (name): + var i = info[name] + var hp = i.lives + for n in i.get("spawn_num", 0): + hp += get_lives(i.spawn_on_death) + return hp + +func get_damage (hp, name): + var i = info[name] + var dam = hp * i.damage + for n in i.get("spawn_num", 0): + var spawn_info = info[i.spawn_on_death] + dam += get_damage(spawn_info.lives, i.spawn_on_death) + return dam |