This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2025-07-16 10:20:45 +02:00
|
|
|
class_name BetResult
|
|
|
|
|
extends Resource
|
|
|
|
|
|
|
|
|
|
@export var expected: int = 0
|
|
|
|
|
@export var actual: int = 0
|
|
|
|
|
|
|
|
|
|
func _init(
|
|
|
|
|
expected: int = 0,
|
|
|
|
|
actual: int = 0,
|
|
|
|
|
) -> void:
|
|
|
|
|
self.expected = expected
|
|
|
|
|
self.actual = actual
|
|
|
|
|
|
|
|
|
|
func set_expected(value: int) -> void:
|
|
|
|
|
self.expected = value
|
|
|
|
|
|
|
|
|
|
func add_win() -> void:
|
|
|
|
|
self.actual += 1
|
|
|
|
|
|
|
|
|
|
func _to_string() -> String:
|
|
|
|
|
return "BetResult(expected: {e}, actual: {a})".format({
|
|
|
|
|
"e": expected,
|
|
|
|
|
"a": actual,
|
|
|
|
|
})
|
2025-07-16 11:15:05 +02:00
|
|
|
|
|
|
|
|
func get_score() -> int:
|
|
|
|
|
if expected == actual:
|
|
|
|
|
return 20 + (actual * 10)
|
|
|
|
|
else:
|
|
|
|
|
return (abs(max(expected, actual)) - abs(min(expected, actual))) * -10
|