2024-05-25 23:51:28 -04:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
@onready var backdrop: ColorRect = $ColorRect
|
|
|
|
@onready var result: RichTextLabel = $Result
|
2024-05-27 13:05:36 -04:00
|
|
|
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
|
2024-05-25 23:51:28 -04:00
|
|
|
@onready var data: Data = $/root/Root/Data
|
2024-05-27 13:05:36 -04:00
|
|
|
@onready var icon = $NewSpell/Icon
|
|
|
|
@onready var nam = $NewSpell/Name
|
|
|
|
@onready var rarity = $NewSpell/Rarity
|
|
|
|
@onready var description = $NewSpell/Description
|
|
|
|
|
2024-05-25 23:51:28 -04:00
|
|
|
var timer: float = 0
|
2024-05-27 13:05:36 -04:00
|
|
|
var won: bool
|
2024-05-25 23:51:28 -04:00
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
|
|
|
data.player.connect("died", displayResult)
|
|
|
|
data.opponent.connect("died", displayResult)
|
|
|
|
|
|
|
|
func displayResult(victory: bool):
|
2024-05-27 13:05:36 -04:00
|
|
|
won = victory
|
|
|
|
if (victory):
|
|
|
|
result.text = "[center]Victory[/center]"
|
|
|
|
else:
|
|
|
|
result.text = "[center]Defeat[/center]"
|
|
|
|
animationPlayer.play("show")
|
|
|
|
|
|
|
|
func animFinished(s: String):
|
|
|
|
if (won):
|
|
|
|
won = false
|
|
|
|
var spell: Spell = data.getNewSpell()
|
|
|
|
if (spell != null):
|
|
|
|
icon.texture = spell.icon
|
|
|
|
nam.text = "[center]%s[/center]" % spell.name
|
|
|
|
rarity.text = "[center]%s[/center]" % data.Rarity.find_key(spell.rarity)
|
|
|
|
description.text = "[center]%s[/center]" % spell.description
|
|
|
|
animationPlayer.play("newSpell")
|
|
|
|
else:
|
|
|
|
animationPlayer.play("continue")
|
|
|
|
elif (s != "continue" && s != "RESET"):
|
|
|
|
animationPlayer.play("continue")
|
|
|
|
|
2024-05-27 19:54:22 -04:00
|
|
|
func _on_continue_pressed():
|
2024-05-30 22:55:48 -04:00
|
|
|
await data.transitioner.hideScreen()
|
2024-05-27 19:54:22 -04:00
|
|
|
var t: Tavern = load(data.locations[data.Location.TAVERN]).instantiate()
|
|
|
|
$/root/Root.add_child(t)
|
|
|
|
data.musicPlayer.setLoc(Data.Location.TAVERN)
|
|
|
|
data.loc = data.Location.TAVERN
|
|
|
|
$/root/Root/Arena.queue_free()
|