From 6a70b36e04af3bba2d159d5bdff283033b556fd5 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 10 Sep 2020 10:46:49 +0200 Subject: [PATCH] Spell points are off now, as I think trainers will work better for this game. Made the spell book window handle it properly. --- game/project.godot | 1 - game/ui/windows/SpellBookWindow.gd | 6 ++- game/ui/windows/SpellContainer.gd | 61 +++++++++++++++++++----------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/game/project.godot b/game/project.godot index e311da78..bbdeccdf 100644 --- a/game/project.godot +++ b/game/project.godot @@ -195,7 +195,6 @@ window/size/ui_scale_touch=1.0 [ess] -spells/use_spell_points=true level/auto_learn_spells=false data/ess_resource_db_path="res://data/resource_db.tres" data/ess_entity_spawner_path="res://player/bs_entity_spawner.tres" diff --git a/game/ui/windows/SpellBookWindow.gd b/game/ui/windows/SpellBookWindow.gd index a7f64a51..06929106 100644 --- a/game/ui/windows/SpellBookWindow.gd +++ b/game/ui/windows/SpellBookWindow.gd @@ -64,6 +64,9 @@ func _ready() -> void: _prev_button.connect("pressed", self, "dec_page") _next_button.connect("pressed", self, "inc_page") + + if ESS.use_spell_points: + _spell_points_label.text = "" connect("visibility_changed", self, "_visibility_changed") @@ -135,7 +138,8 @@ func refresh_all() -> void: if _page > _max_pages: _page = _max_pages - _spell_points_label.text = "Free spell points: " + str(_player.getc_free_spell_points()) + if ESS.use_spell_points: + _spell_points_label.text = "Free spell points: " + str(_player.getc_free_spell_points()) refresh_entries() diff --git a/game/ui/windows/SpellContainer.gd b/game/ui/windows/SpellContainer.gd index 6eebac21..5f6dfec7 100644 --- a/game/ui/windows/SpellContainer.gd +++ b/game/ui/windows/SpellContainer.gd @@ -106,28 +106,45 @@ func spell_button_pressed() -> void: _popup.popup(Rect2(pos, _popup.rect_size)) func update_spell_indicators(): - if _spell_known && ESS.use_spell_points: - get_node(known_label_path).show() - get_node(learn_button_path).hide() - - modulate = known_color + if ESS.use_spell_points: + if _spell_known: + get_node(known_label_path).show() + get_node(learn_button_path).hide() + + modulate = known_color + else: + if _spell != null: + if _spell.training_required_spell: + if not _player.spell_hasc(_spell.training_required_spell): + + if ESS.use_spell_points: + get_node(known_label_path).hide() + get_node(learn_button_path).show() + + modulate = unlearnable_color + + return + + if ESS.use_spell_points: + get_node(known_label_path).hide() + get_node(learn_button_path).show() + + modulate = not_known_color else: - if _spell != null: - if _spell.training_required_spell: - if not _player.spell_hasc(_spell.training_required_spell): - - if ESS.use_spell_points: - get_node(known_label_path).hide() - get_node(learn_button_path).show() - - modulate = unlearnable_color - - return - - if ESS.use_spell_points: - get_node(known_label_path).hide() - get_node(learn_button_path).show() - - modulate = not_known_color + get_node(known_label_path).hide() + get_node(learn_button_path).hide() + + if _spell_known: + modulate = known_color + else: + if _spell != null: + if _spell.training_required_spell: + if not _player.spell_hasc(_spell.training_required_spell): + + modulate = unlearnable_color + + return + + modulate = not_known_color