feat: add achievements titles and rewards
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
extends GutTest
|
||||
|
||||
const TitleEngineType = preload("res://scripts/domain/meta/title_engine.gd")
|
||||
|
||||
func test_refresh_selects_highest_rank_title_when_level_flags_and_reputation_conditions_match() -> void:
|
||||
var engine := TitleEngineType.new([
|
||||
{"id": "greenhorn", "name": "Bleu", "rank": 0, "conditions": []},
|
||||
{"id": "survivor", "name": "Survivant", "rank": 1, "conditions": [{"type": "level", "min": 3}]},
|
||||
{"id": "goblin_bane", "name": "Fléau", "rank": 2, "conditions": [{"type": "flag", "flag": "achv_kill", "equals": true}]},
|
||||
{"id": "bodyguard", "name": "Garde", "rank": 3, "conditions": [{"type": "reputation", "faction": "survivors", "min": 15}]},
|
||||
])
|
||||
|
||||
assert_eq(engine.refresh({"level": 1}).id, "greenhorn")
|
||||
assert_eq(engine.refresh({"level": 3}).id, "survivor")
|
||||
assert_eq(engine.refresh({"level": 3, "flags": {"achv_kill": true}}).id, "goblin_bane")
|
||||
assert_eq(engine.refresh({"level": 3, "flags": {"achv_kill": true}, "reputation": {"survivors": 15}}).id, "bodyguard")
|
||||
|
||||
func test_refresh_keeps_current_title_when_no_definition_matches() -> void:
|
||||
var engine := TitleEngineType.new([{"id": "survivor", "name": "Survivant", "rank": 1, "conditions": [{"type": "level", "min": 3}]}])
|
||||
|
||||
assert_eq(engine.refresh({"level": 1}), {})
|
||||
assert_eq(engine.refresh({"level": 3}).id, "survivor")
|
||||
Reference in New Issue
Block a user