From 6b2007ee1ac3e367a904b0201d3f5794b6b7d7f2 Mon Sep 17 00:00:00 2001 From: CactiChameleon9 Date: Sun, 17 Jul 2022 17:01:38 +0100 Subject: [PATCH] Fix the movement amount calculation --- Scenes/BattleScene.gd | 7 +++++++ UI/Card.gd | 7 ++++++- UI/CardView.gd | 3 +-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Scenes/BattleScene.gd b/Scenes/BattleScene.gd index 8a0dc55..3be5c0c 100644 --- a/Scenes/BattleScene.gd +++ b/Scenes/BattleScene.gd @@ -53,6 +53,13 @@ func _physics_process(delta): yield(get_tree().create_timer(0.1), "timeout") #TODO BAD WORKAROUND $UI/DiceView.selected = false $UI/CardView.selected = true + + # if all 3 parts are done, select the DiceView again + if ($UI/DiceView.selected == false and + $UI/CardView.selected == false and + self.player_to_move == false): + + $UI/DiceView.selected = true func player_movement_input(): diff --git a/UI/Card.gd b/UI/Card.gd index 7a51f0c..7a33126 100644 --- a/UI/Card.gd +++ b/UI/Card.gd @@ -126,6 +126,12 @@ func run_card(): damage += card_info.damage_dice_multiplyer * dice_number emit_signal("do_damage", damage, card_info.effect_damage_range) + # calculate the damage amount + var movement = card_info.move_amount_addition + for dice_number in input_dice: + movement += card_info.move_dice_multiplyer * dice_number + emit_signal("do_movement", movement) + # do any utility dice returns for dice_number in input_dice: @@ -176,7 +182,6 @@ func run_card(): for effect in card_info.effects: emit_signal("do_effect", effect, card_info.effect_damage_range) - emit_signal("do_movement", card_info.movement) #clear the input dice input_dice = [] diff --git a/UI/CardView.gd b/UI/CardView.gd index 5ba87f3..d9130a1 100644 --- a/UI/CardView.gd +++ b/UI/CardView.gd @@ -69,8 +69,7 @@ func _physics_process(delta): current_cards[hovering_card].dice_inputted(currently_holding_dice) current_cards[hovering_card].hovering_dice = null selected = false - - + func draw_card(specific_card : String = ""): # make a new card instance and add it to the grid container