AVA2 unlock P7: talismans (ARMOR_PENDANT / WEAR_PENDANT, element enchants)
- ARMOR_PENDANT subtype, WEAR_PENDANT=27, APPLY_ENCHANT_ELEC..DARK (123-128) and POINT_ENCHANT_* (242-247); battle.cpp adds the enchant % vs element mobs - port_pendant.cpp: talisman attribute pool (AVA2 item_attr pendant column), 71302/53996 reroll and 71301/53997 add (max 5), MTPENDANT client messages - switchbot skips talisman scrolls; tests for pendant + applies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6199b2cbff
commit
f09ffd8a35
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/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,')<il.index('ARMOR_PENDANT,')<il.index('ARMOR_NUM_TYPES')
|
||||
length=source('common/length.h')
|
||||
assert length.index('WEAR_COSTUME_MOUNT_SKIN,\t// 26')<length.index('WEAR_PENDANT,\t\t// 27')
|
||||
reader=source('db/src/ProtoReader.cpp')
|
||||
assert '"ARMOR_NECK", "ARMOR_EAR", "ARMOR_PENDANT", "ARMOR_NUM_TYPES"' in reader
|
||||
item=source('game/src/item.cpp')
|
||||
fec=item[item.index('int CItem::FindEquipCell('):]
|
||||
assert fec.index('if (IsTalisman())\n\t\treturn WEAR_PENDANT;')<fec.index('0 == GetWearFlag()'),'talisman has no wear flag'
|
||||
items=source('game/src/char_item.cpp')
|
||||
case=items[items.index('case USE_CHANGE_ATTRIBUTE2 :'):]
|
||||
assert case.index('return CostumeEnchantUse(item, item2);')<case.index('if (item->GetPendantScrollKind() || item2->IsTalisman())\n\t\t\t\t\t\t\t\treturn PendantScrollUse(item, item2);')<case.index('BuffOnAttr_RemoveBuffsFromItem(item2)')
|
||||
assert '!scroll->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"')<port.index('item2->ClearAttribute()')
|
||||
assert port.index('"MTPENDANT full"')<port.index('PendantPutAttribute(item2, s_aiAddLevel)')
|
||||
script=ROOT.parent/'metin2-client/src/platform/ScriptLib/PendantScript.inc'
|
||||
if script.is_file():
|
||||
s=script.read_text()
|
||||
for code in codes:assert "'%s':"%code in s,code
|
||||
print('PASS: talisman slot/equip, enchant switch routing before the switcher path, 20-row pool, max 5, switchbot excluded, MTPENDANT codes')
|
||||
Reference in New Issue
Block a user