class_name NpcContent extends RefCounted ## Computes available_moves — the single home of move legality (§6). Reads the ## NPC's non-spoiler capability block and filters by live game state so the model ## is shown exactly what it may legally do this turn. persona/knowledge on the ## same file are server-only and ignored here. const UNIVERSAL := ["adjust_disposition", "refuse", "end_conversation", "become_hostile"] static func available_moves(npc_dict: Dictionary, game_state, canon_log) -> Array: var moves: Array = [] var caps: Dictionary = npc_dict.get("capabilities", {}) for q in caps.get("offerable_quests", []): if not canon_log.has_quest(q): moves.append("offer_quest(%s)" % q) for t in caps.get("revealable_topics", []): if not game_state.is_revealed(t): moves.append("reveal(%s)" % t) for i in caps.get("giveable_items", []): # Currency is exempt from the one-shot gift gate — an NPC can pay you twice. if Currency.is_currency(i) or not game_state.is_gift_given(i): moves.append("give_item(%s)" % i) for item_id in game_state.inventory.keys(): if int(game_state.inventory[item_id]) > 0: moves.append("accept_item(%s)" % item_id) # Money is not in the inventory dict, so it needs its own offer. Only the # denominations the purse can actually pay: an NPC cannot ask a party holding # 47c for a gold coin. for denom in Currency.VALUES: if game_state.purse_copper >= Currency.value(denom): moves.append("accept_item(%s)" % denom) moves.append_array(UNIVERSAL) return moves