Files
TheTree_mock/tests/mvp/test_amelia_donations.gd
Takeshi 5dde0c5ec2 Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
2026-09-30 23:52:24 +09:00

53 lines
4.6 KiB
GDScript

extends "res://tests/ui/test_chapel_gameplay.gd"
## Original effect fixture only: recruitment values remain unconfigured.
func cleric_id() -> StringName: return &"heroine_amelia"
func donation_price() -> int: return 60
func recruit_cleric(_main: Control, runtime: Variant) -> void:
expect(runtime.submit_command(&"register_staff", {&"staff_id":cleric_id(), &"role_id":&"cleric", &"options":{&"employment_kind":&"UNIQUE", &"current_cell":Vector3i(-8,0,0)}}).is_success(), "register unique Amelia test fixture")
func verify_effect(runtime: Variant, chapel: FacilityInstance) -> void:
expect(runtime.get_facility_business_price(chapel)==60, "assigned Amelia triples chapel donation")
var saved: Dictionary=runtime.create_snapshot()
expect(runtime.restore_snapshot(saved), "placement passive restores")
chapel=runtime.facility_service.get_instance(chapel.instance_id)
expect(runtime.get_facility_business_price(chapel)==60, "restoring never stacks donation multiplier")
var worker: StaffRuntime=runtime.staff_service.get_staff(cleric_id())
worker.employment_kind=StaffRuntime.EmploymentKind.FREE_HIRE
expect(runtime.get_facility_business_price(chapel)==20, "same ID with ordinary employment has no unique effect")
worker.employment_kind=StaffRuntime.EmploymentKind.UNIQUE
worker.role_id=&"porter"
expect(runtime.get_facility_business_price(chapel)==20, "unrelated role has no donation effect")
worker.role_id=&"cleric"
var other:=FacilityInstance.new()
other.instance_id=&"other_chapel";other.definition_id=&"chapel"
expect(runtime.get_donation_multiplier(other)==1, "other chapel does not inherit placement effect")
other.instance_id=chapel.instance_id;other.definition_id=&"standard_room"
expect(runtime.get_donation_multiplier(other)==1, "lodging is not a donation")
expect(runtime.submit_command(&"hire_staff_candidate",{&"candidate_id":&"heroine_anri"}).is_success(), "normal Anri recruitment for combined effect")
expect(runtime.submit_command(&"set_staff_work_assignment",{&"staff_id":&"heroine_anri", &"facility_id":chapel.instance_id, &"template_id":&"DAY"}).is_success(), "assign manager alongside chapel cleric")
expect(runtime.get_facility_business_price(chapel)==72, "triple donation combines once with approved floor20percent")
expect(runtime.submit_command(&"set_staff_work_assignment",{&"staff_id":&"heroine_anri", &"facility_id":&"", &"template_id":&"DAY"}).is_success(), "remove manager without changing cleric")
expect(runtime.get_facility_business_price(chapel)==60, "removing manager keeps exactly one donation passive")
var business: BusinessManagementPanel=root.get_node("Main").find_child("BusinessManagementPanel",true,false)
business.select_facility(chapel.instance_id)
expect(business.quote_label.text.contains("60G") and business.effect_label.text.contains("寄付金3倍"), "normal business UI explains actual donation")
func verify_after_start(runtime: Variant, chapel: FacilityInstance) -> void:
var guest: GuestRuntime=runtime.guest_service.get_guest(&"worship_walker")
var service: ServiceInstance=runtime.facility_service.get_service(guest.current_service_id)
expect(service.price_snapshot==60, "autonomous visitor freezes triple donation before worship")
expect(runtime.submit_command(&"set_facility_policy", {&"facility_id":chapel.instance_id, &"patch":{&"price_mode":&"expensive"}}).is_success(), "change donation policy during worship")
expect(runtime.get_facility_business_price(runtime.facility_service.get_instance(chapel.instance_id))==90 and service.price_snapshot==60, "new90G quote never rewrites accepted60G donation")
var saved: Dictionary=runtime.create_snapshot()
expect(runtime.restore_snapshot(saved), "save active fixed quote with changed current policy")
expect(runtime.facility_service.get_service(service.service_id).price_snapshot==60, "restore preserves original donation")
expect(runtime.submit_command(&"set_facility_policy", {&"facility_id":chapel.instance_id, &"patch":{&"price_mode":&"standard"}}).is_success(), "return policy through ordinary command")
func verify_completion(runtime: Variant, chapel: FacilityInstance, service_id: StringName) -> void:
var sales := 0
var donor_paid := 0
for entry: LedgerEntry in runtime.economy_service.get_entries():
if entry.source_entity_id==chapel.instance_id and entry.category==&"SERVICE_SALE":
sales+=entry.amount
if entry.credit_account==&"GUEST_WALLET:worship_walker": donor_paid+=entry.amount
expect(donor_paid==60 and sales>=donor_paid and runtime.economy_service.validate_ledger()[&"ok"], "visitor60G payment is recorded exactly once as chapel revenue")
expect(runtime.facility_service.get_service(service_id).price_snapshot==60, "completion retains original quote")