class_name CreationCopy extends RefCounted ## Display strings for the creation screen, DERIVED from the rules tables. ## ## Prose lives in content (blurbs, fragments). NUMBERS LIVE IN CODE. The card reads ## both and repeats neither. A hit die written into a JSON — or typed into a string ## literal here — is a second source of truth, and it will eventually disagree with ## the table. Every number below is read from Callings/Races/Skills at call time, so ## retuning a calling retunes its card. ## ## §7: nothing here may mention Luck, in any form. §2: presentation only. const ARMOR_WORD := { "none": "no armour", "light": "light armour", "medium": "medium armour", "heavy": "heavy armour", } static func calling_detail(id: String) -> String: ## e.g. "d8 · light armour · MP (FTH) · saves DEX + MAG · picks 4 skills · talent backstab" if not Callings.exists(id): return "" var saves: Array = [] for s in Callings.saves(id): saves.append(s.to_upper()) return "d%d · %s · %s · saves %s · picks %d skills · talent %s" % [ Callings.hit_die(id), armor_word(id), resource_word(id), " + ".join(saves), Callings.skill_count(id), Callings.talent(id), ] static func armor_word(id: String) -> String: ## The card says "no armour", not "none". Public so the test can assert against ## the DERIVED word rather than the raw table value — "none" is not a substring ## of "no armour", and asserting on the raw value only ever passed by accident. return ARMOR_WORD.get(Callings.armor(id), Callings.armor(id)) static func resource_word(id: String) -> String: ## Martials live on cooldowns; casters on a pool off their casting stat. if not Callings.is_caster(id): return "cooldowns" return "MP (%s)" % Callings.casting_stat(id).to_upper() static func race_trait(id: String) -> String: ## e.g. "+1 to every save · +1 skill of choice" / "Poison resist · Nightsight" if not Races.exists(id): return "" var parts: Array = [] if Races.save_bonus(id) > 0: parts.append("+%d to every save" % Races.save_bonus(id)) for s in Races.granted_skills(id): parts.append(skill_label(s).capitalize()) if Races.poison_save_bonus(id) > 0: parts.append("Poison resist") if Races.flag(id, "nightsight"): parts.append("Nightsight") if Races.flag(id, "claws"): parts.append("Claws") if Races.flag(id, "keen_scent"): parts.append("Keen scent") if Races.wants_bonus_skill(id): parts.append("+1 skill of choice") return " · ".join(parts) static func skill_label(skill: String) -> String: ## sleight_of_hand -> "sleight of hand". Ids are snake_case; humans are not. return skill.replace("_", " ")