31 lines
664 B
GDScript
31 lines
664 B
GDScript
extends "res://addons/gut/test.gd"
|
|
|
|
const GameState = preload("res://scripts/state/game_state.gd")
|
|
|
|
|
|
func test_add_item_accumulates():
|
|
var s = GameState.new()
|
|
s.add_item("coin", 3)
|
|
s.add_item("coin", 2)
|
|
assert_eq(s.inventory["coin"], 5)
|
|
|
|
|
|
func test_npc_disposition_clamps():
|
|
var s = GameState.new()
|
|
s.set_npc_disposition("oda_fenn", 250)
|
|
assert_eq(s.npc_dispositions["oda_fenn"], 100)
|
|
|
|
|
|
func test_drift_luck_respects_base():
|
|
var s = GameState.new()
|
|
s.luck_base = 10
|
|
s.luck = 10
|
|
s.drift_luck(100)
|
|
assert_eq(s.luck, 13)
|
|
|
|
|
|
func test_luck_descriptor_delegates():
|
|
var s = GameState.new()
|
|
s.luck = 4
|
|
assert_eq(s.luck_descriptor(), "Fortune spits on you")
|