extends Control @onready var MultiplierLB = $MainMC/VBoxContainer/EnumMC/EnumHB/VBoxContainer/MPLB/MultiplierLB @onready var DieTypeLB = $MainMC/VBoxContainer/EnumMC/EnumHB/VBoxContainer2/DTTP/DieTypeLB @onready var DieLB = $MainMC/VBoxContainer/Die/DiceCR/DieLB @onready var topBG = $MainMC/VBoxContainer/Die/DiceCR var Multiplier : int = 1 var ChosenDie : int = 20 var topBGdef = Color8(22, 22, 32, 255) var topBGnat = Color8(0, 112, 57, 255) var topBGcrit = Color8(136, 16, 0, 255) func _ready(): topBG.color = topBGdef pass func _process(_delta): MultiplierLB.text = str(Multiplier) DieTypeLB.text = str(ChosenDie) func Die(): var result = ChosenDie * Multiplier var randomNumber = randi() % result + 1 if randomNumber != 20 and randf_range(0, 1) < 0.05: randomNumber = 20 return randomNumber var dice_values = [4, 6, 8, 10, 12, 20] func _on_updt_gui_input(event): if event is InputEventScreenTouch and event.is_pressed(): if ChosenDie < 20: ChosenDie = dice_values[dice_values.find(ChosenDie)+1] func _on_dwdt_gui_input(event): if event is InputEventScreenTouch and event.is_pressed(): if ChosenDie > 4: ChosenDie = dice_values[dice_values.find(ChosenDie)-1] func _on_mpup_gui_input(event): if event is InputEventScreenTouch and event.is_pressed(): if Multiplier < 10: Multiplier += 1 func _on_mpdw_gui_input(event): if event is InputEventScreenTouch and event.is_pressed(): if Multiplier > 1: Multiplier -= 1 func _on_roll_rect_gui_input(event:InputEvent): if event is InputEventScreenTouch and event.is_pressed(): var roll = Die(); DieLB.text = str(roll); if roll == 20: topBG.set_color(topBGnat) if roll == 1: topBG.set_color(topBGcrit) if roll != 20 and roll != 1: topBG.set_color(topBGdef)