Setup signals to give information from running cards
This commit is contained in:
parent
08a265a14b
commit
b4f33f30b6
@ -9,20 +9,6 @@ enum TYPE {
|
||||
MOVEMENT
|
||||
}
|
||||
|
||||
enum EFFECT {
|
||||
POISON
|
||||
BURN
|
||||
CONFUSION
|
||||
WEAKNESS
|
||||
|
||||
SPLIT
|
||||
DOUBLE
|
||||
HALF
|
||||
FLIP
|
||||
DUPLICATE
|
||||
REROLL
|
||||
}
|
||||
|
||||
enum ACCEPTED_DICE {
|
||||
DICE_1
|
||||
DICE_2
|
||||
@ -44,7 +30,7 @@ export (int) var move_dice_multiplyer
|
||||
export (int) var damage_amount_addition
|
||||
export (int) var damage_dice_multiplyer
|
||||
|
||||
export (Array, EFFECT) var effects
|
||||
export (Array, Global.EFFECT) var effects
|
||||
|
||||
export (Array, ACCEPTED_DICE) var accepted_dice
|
||||
|
||||
|
15
Global.gd
Normal file
15
Global.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends Node
|
||||
|
||||
enum EFFECT {
|
||||
POISON
|
||||
BURN
|
||||
CONFUSION
|
||||
WEAKNESS
|
||||
|
||||
SPLIT
|
||||
DOUBLE
|
||||
HALF
|
||||
FLIP
|
||||
DUPLICATE
|
||||
REROLL
|
||||
}
|
@ -22,6 +22,12 @@ func _ready():
|
||||
$UI/DiceView.roll_dice()
|
||||
|
||||
|
||||
func do_damage_around_player(damage, damage_range):
|
||||
pass
|
||||
|
||||
func do_effect_around_player(effect, effect_range):
|
||||
pass
|
||||
|
||||
func set_player_to_move(movement_range : int = 0):
|
||||
player_to_move = true
|
||||
player_movement_range = movement_range
|
||||
|
@ -76,5 +76,8 @@ margin_left = 1.52588e-05
|
||||
margin_top = -7.62939e-06
|
||||
grow_horizontal = 0
|
||||
|
||||
[connection signal="do_damage" from="UI/CardView" to="." method="do_damage_around_player"]
|
||||
[connection signal="do_effect" from="UI/CardView" to="." method="do_effect_around_player"]
|
||||
[connection signal="do_movement" from="UI/CardView" to="." method="set_player_to_move"]
|
||||
[connection signal="return_dice" from="UI/CardView" to="UI/DiceView" method="roll_dice"]
|
||||
[connection signal="dice_selected" from="UI/DiceView" to="UI/CardView" method="set_currently_holding_dice"]
|
||||
|
21
UI/Card.gd
21
UI/Card.gd
@ -2,6 +2,9 @@ tool
|
||||
extends Control
|
||||
|
||||
signal return_dice(dice_number)
|
||||
signal do_movement(movement_range)
|
||||
signal do_damage(damage, damage_range)
|
||||
signal do_effect(effect, effect_range)
|
||||
|
||||
const TYPE_COLORS = [
|
||||
Color("#db4758"), # DAMAGE
|
||||
@ -121,11 +124,12 @@ func run_card():
|
||||
var damage = card_info.damage_amount_addition
|
||||
for dice_number in input_dice:
|
||||
damage += card_info.damage_dice_multiplyer * dice_number
|
||||
emit_signal("do_damage", damage, card_info.effect_damage_range)
|
||||
|
||||
# do any utility dice returns
|
||||
for dice_number in input_dice:
|
||||
|
||||
if card_info.EFFECT.SPLIT in card_info.effects:
|
||||
if Global.EFFECT.SPLIT in card_info.effects:
|
||||
var halfed_dice = float(dice_number)/2.0
|
||||
|
||||
var new_dice1 = halfed_dice
|
||||
@ -139,7 +143,7 @@ func run_card():
|
||||
emit_signal("return_dice", new_dice1)
|
||||
emit_signal("return_dice", new_dice2)
|
||||
|
||||
if card_info.EFFECT.DOUBLE in card_info.effects:
|
||||
if Global.EFFECT.DOUBLE in card_info.effects:
|
||||
var new_dice1 = dice_number * 2
|
||||
var new_dice2 = 0
|
||||
|
||||
@ -151,7 +155,7 @@ func run_card():
|
||||
emit_signal("return_dice", new_dice1)
|
||||
if new_dice2 != 0: emit_signal("return_dice", new_dice1)
|
||||
|
||||
if card_info.EFFECT.HALF in card_info.effects:
|
||||
if Global.EFFECT.HALF in card_info.effects:
|
||||
var new_dice = float(dice_number)/2.0
|
||||
|
||||
#if decimal valued, add 0.5 or - 0.5 at random
|
||||
@ -160,14 +164,19 @@ func run_card():
|
||||
|
||||
emit_signal("return_dice", new_dice)
|
||||
|
||||
if card_info.EFFECT.FLIP in card_info.effects:
|
||||
if Global.EFFECT.FLIP in card_info.effects:
|
||||
# all opposite sides of a dice add up to 7
|
||||
emit_signal("return_dice", 7 - dice_number)
|
||||
|
||||
if card_info.EFFECT.DUPLICATE in card_info.effects:
|
||||
if Global.EFFECT.DUPLICATE in card_info.effects:
|
||||
emit_signal("return_dice", dice_number)
|
||||
emit_signal("return_dice", dice_number)
|
||||
|
||||
|
||||
# for each effect, emit do effect with the range
|
||||
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 = []
|
||||
|
@ -1,6 +1,9 @@
|
||||
extends Control
|
||||
|
||||
signal return_dice(dice_number)
|
||||
signal do_movement(movement_range)
|
||||
signal do_damage(damage, damage_range)
|
||||
signal do_effect(effect, effect_range)
|
||||
|
||||
const card = preload("res://UI/Card.tscn")
|
||||
const card_db_string = "res://Assets/CardDB/%s.tres"
|
||||
@ -16,6 +19,12 @@ var currently_holding_dice = null
|
||||
|
||||
func emit_return_dice(dice_number):
|
||||
emit_signal("return_dice", dice_number)
|
||||
func emit_do_movement(movement_range):
|
||||
emit_signal("do_movement", movement_range)
|
||||
func emit_do_damage(damage, damage_range):
|
||||
emit_signal("do_damage", damage, damage_range)
|
||||
func emit_do_effect(effect, effect_range):
|
||||
emit_signal("do_effect", effect, effect_range)
|
||||
|
||||
|
||||
func set_currently_holding_dice(dice_number : int):
|
||||
@ -80,6 +89,9 @@ func draw_card(specific_card : String = ""):
|
||||
|
||||
# connect new_card.return_dice signal to self.emit_return_dice
|
||||
new_card.connect("return_dice", self, "emit_return_dice")
|
||||
new_card.connect("do_movement", self, "emit_do_movement")
|
||||
new_card.connect("do_damage", self, "emit_do_damage")
|
||||
new_card.connect("do_effect", self, "emit_do_effect")
|
||||
|
||||
# add the current card to the list of card
|
||||
current_cards.append(new_card)
|
||||
|
@ -24,6 +24,10 @@ config/name="Quit Rolling Around"
|
||||
run/main_scene="res://Scenes/BattleScene.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
Global="*res://Global.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1280
|
||||
|
Loading…
Reference in New Issue
Block a user