Files
AIGame/Tools/validate_skill_runtime.py

24 lines
2.0 KiB
Python

"""Validate the formal skill table and its authored client bank without enabling proposal files."""
import copy
import json
import hashlib
from pathlib import Path
from validate_skill_design import validate,load,require
ROOT=Path(__file__).resolve().parents[1]
def main():
path=ROOT/'Config/Combat/skill_runtime_v1.json';runtime=load(path)
require(runtime['status']=='runtime' and runtime['runtimeEnabled'] is True and runtime['protocol']==1 and runtime['logicVersion']==1,'Unsupported formal runtime version')
design=copy.deepcopy(runtime);design['status']='design_only';design['runtimeEnabled']=False
result=validate(design,load(ROOT/'Config/Combat/skill_presentations_v1.proposal.json'),load(ROOT/'Doc/Design/Sound/BattleSkills/manifest.json'),load(ROOT/'Config/Gameplay/greenfield.json'))
require((ROOT/'AIClient/Assets/Bundles/Combat/BattleSkillPresentation.prefab').is_file(),'Missing authored battle skill bank')
# Runtime only accepts the finite, typed parameter vocabulary implemented by the C++ adapter.
for template in runtime['templates']:
for action in template['actions']:
require(action['trigger']=='delivery_hit','Unsupported formal action phase')
if action['type']=='apply_status':require(action['statusId'] in ('shield_main','slow_main'),'Unsupported formal status')
result.update(formalPartnerProfiles=10,formalEffectKinds=15,formalAudioClips=9,status='formal_runtime_contract_validated',runtimeIntegrated=True,protocol=1,logicVersion=1,rulesVersion=3,runtimeSource=str(path.relative_to(ROOT)).replace('\\','/'),runtimeSourceSha256=hashlib.sha256(path.read_bytes()).hexdigest(),note='Formal runtime table is separate from disabled proposals; nine audio clips generated; ten formal partner presentation profiles validated by verify_partner_skills.py')
target=ROOT/'Doc/Design/Combat/Runtime/config_validation.json';target.parent.mkdir(parents=True,exist_ok=True);target.write_text(json.dumps(result,indent=2),encoding='utf-8');print(json.dumps(result))
if __name__=='__main__':main()