#!/usr/bin/env python3 """AVA2 talisman (docs/FEATURE-AVA2-UNLOCK.md P7): ARMOR_PENDANT worn in WEAR_PENDANT, element enchant applies, its own attribute pool changed only by 71301/71302/53996/53997, which are no switchbot scrolls.""" from pathlib import Path ROOT=Path(__file__).resolve().parents[2] SRC=ROOT/'src/server' def source(name):return (SRC/name).read_bytes().decode('latin1') il=source('common/item_length.h');assert il.index('ARMOR_EAR,')GetPendantScrollKind() || item2->IsTalisman())\n\t\t\t\t\t\t\t\treturn PendantScrollUse(item, item2);')GetPendantScrollKind()' in source('game/src/port_switchbot.h') assert 'port_pendant.cpp' in source('game/src/Makefile') port=source('game/src/port_pendant.cpp') pool=port[port.index('s_aPendantAttr[] ='):];pool=pool[:pool.index('};')] assert pool.count('{ APPLY_')==20 and 'APPLY_ATTBONUS' not in pool and 'APPLY_ENCHANT' not in pool for text in ('PENDANT_MAX_ATTR = 5','{ 0, 10, 40, 35, 15 }','{ 40, 50, 10, 0, 0 }','case 71302:\n\t\tcase 53996:','case 71301:\n\t\tcase 53997:', 'if (item->HasAttr(r.bApply))','item->SetCount(item->GetCount() - 1);'): assert text in port,text codes=('target','equipped','empty','changed','full','added') for code in codes:assert '"MTPENDANT %s"'%code in port,code assert port.index('"MTPENDANT equipped"')ClearAttribute()') assert port.index('"MTPENDANT full"')