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:
shenlei
2026-10-16 14:28:35 +09:00
co-authored by Claude Opus 5.5
parent 6199b2cbff
commit f09ffd8a35
17 changed files with 326 additions and 14 deletions
+23 -1
View File
@@ -10,6 +10,7 @@ The 478 AVA2 drop items come from metin2-client `tools/server/ava2-items` (see F
| P4 sash | 85004 领主 / 85008 大师 / 85014 王朝 / 85018 皇家 披风 (`COSTUME_SASH`, grade 4) | done, not deployed |
| P5 mounts | 71502 / 71505 / 71508 / 71511 坐骑时装 (`COSTUME_MOUNT`), 71234 / 71254 坐骑外观 (`COSTUME_MOUNT_SKIN`) + mobs 32012 / 32028 | done, not deployed |
| P6 costume enchants | 54001–54078 时装 / 发型强化石, 54124–54174 坐骑外观强化石 (`USE_CHANGE_ATTRIBUTE`); weapon / sash-skin / effect ranges and 53996 stay locked | done, not deployed |
| P7 talismans | 护符 chains 9600–10950 (`ARMOR_PENDANT`, +0..+200 per element), 71301 / 71302 / 53996 / 53997 talisman attribute items | done, not deployed |
## P1: boxes and keys
@@ -83,7 +84,7 @@ AVA2's `ENABLE_SPECIAL_COSTUME_ATTR`, in `game/src/port_costume_attr.cpp`. The i
- 54001–54027 时装 (mask 2, body);
- 54028–54078 发型 (4, hair);
- 54124–54174 坐骑外观 (16, mount skin).
- Still locked, since the target systems don't exist here: 54079– weapon costume (8), 54175– sash skin (32), 54220– effect (64). 53996 (talisman) waits for P7.
- Still locked, since the target systems don't exist here: 54079– weapon costume (8), 54175– sash skin (32), 54220– effect (64). 53996 became a talisman item in P7.
- `CItem::IsCostumeEnchant` (vnum 54001–54267 with a nonzero value2) is checked first in the change/add-attribute case of `UseItemEx`, before the 40250 costume refusal. So an enchant never reaches the reroll code, and dragged onto gear it is refused (`MTCATTR target`).
- `CostumeEnchantUse` follows AVA2's checks:
- target kind and mask (`target`);
@@ -99,3 +100,24 @@ AVA2's `ENABLE_SPECIAL_COSTUME_ATTR`, in `game/src/port_costume_attr.cpp`. The i
- renders `MTCATTR`.
Test: `tests/features/test_costume_attr.py`.
## P7: talismans
AVA2's `ITEM_TALISMAN_EQUIPMENT` + `ELEMENT_NEW_BONUSES`, in `game/src/port_pendant.cpp`.
- Item: `ITEM_ARMOR` / `ARMOR_PENDANT = 7` (ProtoReader `arSub2`, so **the db binary changes again**), worn in `WEAR_PENDANT = 27`. The AVA2 wear flag `WEAR_PENDANT` does not exist here: `FindEquipCell` sends every talisman to the slot before the wear-flag check.
- Six chains of 201 items (+0..+200), fire 9600, ice 9830, earth 10060, dark 10290, wind 10520, elect 10750. Each carries `APPLY_ENCHANT_<element>` = its step; the level limit rises from 20 to 60 along the chain.
- Refine sets 440–499 (fragment 96001–96006 + 30031 + 33031 ×10, 50000 yang, 100 %) are SQL rows: metin2-client `tools/server/pendant` (`install.sh`, then restart the db).
- Applies `APPLY_ENCHANT_ELEC..DARK = 123..128` (AVA2 numbers; the db names are AVA2's, `APPLY_ENCHANT_ELECT` first) → `POINT_ENCHANT_* = 242..247`.
- Damage (battle.cpp `CalcAttBonus`): against a monster with `RACE_FLAG_ATT_<element>`, attack +point %, so a +200 talisman triples the attack on those monsters (×(1+200/100)), which is AVA2's own balance. Each flag is its own `if`, as on AVA2. AVA2 leaves out ICE; we include it, since 203 has 83 ice monsters and an ice talisman chain.
- Attributes:
- The pool is AVA2's item_attr pendant column (20 rows, levels 1–5), kept in a table in `port_pendant.cpp` instead of a new item_attr column (that would change the db boot packet).
- `GetAttributeSetIndex` stays −1. So talismans drop without attributes, and the 40250 switchers, the switchbot and the attribute lock refuse them.
- 71302 rerolls all attributes (needs at least one; levels 0/10/40/35/15 %). 71301 adds one up to 5, always succeeding (levels 40/50/10 %). No duplicates.
- **Deviation:** AVA2's 53996 / 53997 are generic switcher / adder items, a free 40250 gear reroll. Here they work like 71302 / 71301, as their zh names (护符附魔道具 / 护符加持道具) say.
- Not while worn (`equipped`), like the 40250 switcher. Any other attribute item dropped on a talisman, or a talisman item dropped on anything else, gets `target`.
- Messages: `MTPENDANT target|equipped|empty|changed|full|added` (client `mt_pendant`). `ItemLog PENDANT_CHANGE` / `PENDANT_ADD`.
- Not ported: AVA2's element target packet (`ELEMENT_TARGET`, the element icon over the target HP bar).
- Client: `ItemData.h` / `PythonItemModule` constants, `c_Equipment_Pendant`, apply texts, and `mt_pendant` (`PendantScript.inc`: the equipment slot under the earring, item drop targets, messages).
Test: `tests/features/test_pendant.py`; `test_applies.py` covers the 123–128 numbering.