From 84b7b649823643fe35c41e2211d10e8ef43bb99b Mon Sep 17 00:00:00 2001 From: aqiu384 Date: Tue, 16 Jul 2024 12:49:41 -0700 Subject: [PATCH] p3 norm attack elem --- src/p345/configs/p3-comp-config.json | 1 + src/p345/configs/p3a-comp-config.json | 1 + src/p345/configs/p3f-comp-config.json | 1 + src/p345/configs/p3p-comp-config.json | 1 + src/p345/configs/p4-comp-config.json | 3 ++- src/p345/configs/p4g-comp-config.json | 3 ++- src/p345/configs/p5-comp-config.json | 2 ++ src/p345/configs/p5r-comp-config.json | 2 ++ src/p345/enemy-data.py | 32 ++++++++++++++++++--------- 9 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/p345/configs/p3-comp-config.json b/src/p345/configs/p3-comp-config.json index 1428e5f..71b0432 100644 --- a/src/p345/configs/p3-comp-config.json +++ b/src/p345/configs/p3-comp-config.json @@ -27,6 +27,7 @@ "enemyIds": "p3-enemy-ids.tsv", "skillIds": "skill-ids.tsv", "skillEffects": "skill-effects.tsv", + "itemEffects": "item-effects.tsv", "weaponsBegin": "0", "armorBegin": "1000", "bootsbegin": "2000", diff --git a/src/p345/configs/p3a-comp-config.json b/src/p345/configs/p3a-comp-config.json index afb8ec6..9b2f6a8 100644 --- a/src/p345/configs/p3a-comp-config.json +++ b/src/p345/configs/p3a-comp-config.json @@ -19,6 +19,7 @@ "demonIds": "p3a-demon-ids.tsv", "enemyIds": "p3a-enemy-ids.tsv", "skillEffects": "skill-effects.tsv", + "itemEffects": "item-effects.tsv", "itemsBegin": "0xFA0", "resistLvls": { "0": "-", diff --git a/src/p345/configs/p3f-comp-config.json b/src/p345/configs/p3f-comp-config.json index f958b44..6f3669e 100644 --- a/src/p345/configs/p3f-comp-config.json +++ b/src/p345/configs/p3f-comp-config.json @@ -27,6 +27,7 @@ "enemyIds": "p3-enemy-ids.tsv", "skillIds": "skill-ids.tsv", "skillEffects": "skill-effects.tsv", + "itemEffects": "item-effects.tsv", "itemsBegin": "0xFA0", "resistLvls": { "0": "-", diff --git a/src/p345/configs/p3p-comp-config.json b/src/p345/configs/p3p-comp-config.json index e48f2b8..907db61 100644 --- a/src/p345/configs/p3p-comp-config.json +++ b/src/p345/configs/p3p-comp-config.json @@ -27,6 +27,7 @@ "enemyIds": "p3-enemy-ids.tsv", "skillIds": "skill-ids.tsv", "skillEffects": "skill-effects.tsv", + "itemEffects": "item-effects.tsv", "itemsBegin": "0x500", "resistLvls": { "0": "-", diff --git a/src/p345/configs/p4-comp-config.json b/src/p345/configs/p4-comp-config.json index 3ea35e0..da7d773 100644 --- a/src/p345/configs/p4-comp-config.json +++ b/src/p345/configs/p4-comp-config.json @@ -27,7 +27,8 @@ "enemyIds": "p4-enemy-ids.tsv", "skillIds": "p4-skill-ids.tsv", "skillEffects": "p4-skill-ids.tsv", - "itemsBegin": "0x300", + "itemEffects": "../p4-item-effects.tsv", + "itemsBegin": "-1", "resistLvls": { "0": "-", "1": "n", diff --git a/src/p345/configs/p4g-comp-config.json b/src/p345/configs/p4g-comp-config.json index beda3f9..6ec281e 100644 --- a/src/p345/configs/p4g-comp-config.json +++ b/src/p345/configs/p4g-comp-config.json @@ -27,7 +27,8 @@ "enemyIds": "p4g-enemy-ids.tsv", "skillIds": "p4g-skill-ids.tsv", "skillEffects": "p4g-skill-ids.tsv", - "itemsBegin": "0x300", + "itemEffects": "../p4-item-effects.tsv", + "itemsBegin": "-1", "resistLvls": { "0": "-", "1": "n", diff --git a/src/p345/configs/p5-comp-config.json b/src/p345/configs/p5-comp-config.json index d498c5e..3c67f1c 100644 --- a/src/p345/configs/p5-comp-config.json +++ b/src/p345/configs/p5-comp-config.json @@ -26,6 +26,8 @@ "demonIds": "p5-demon-ids.tsv", "enemyIds": "p5-enemy-ids.tsv", "skillIds": "skill-effects.tsv", + "skillEffects": "skill-effects.tsv", + "itemEffects": "item-effects.tsv", "itemsBegin": "0x0", "resistLvls": { "0": "-", diff --git a/src/p345/configs/p5r-comp-config.json b/src/p345/configs/p5r-comp-config.json index e69a2aa..038b368 100644 --- a/src/p345/configs/p5r-comp-config.json +++ b/src/p345/configs/p5r-comp-config.json @@ -24,6 +24,8 @@ "demonIds": "p5r-demon-ids.tsv", "enemyIds": "p5r-enemy-ids.tsv", "skillIds": "skill-effects.tsv", + "skillEffects": "skill-effects.tsv", + "itemEffects": "item-effects.tsv", "itemsBegin": "0x0", "resistLvls": { "0": "-", diff --git a/src/p345/enemy-data.py b/src/p345/enemy-data.py index 46d0fb1..1dce8e0 100755 --- a/src/p345/enemy-data.py +++ b/src/p345/enemy-data.py @@ -3,10 +3,11 @@ import json from shared import printif_notequal, save_ordered_demons, load_comp_config, check_resists -GAME_PREFIX = 'p4g' +GAME_PREFIX = 'p3p' GAME_TYPE = GAME_PREFIX[:2] COMP_CONFIG = load_comp_config(f"configs/{GAME_PREFIX}-comp-config.json") DATA_DIR = '../../../megaten-fusion-tool/src/app/{}' +NORM_ATKS = { 0: 'Slash Attack', 350: 'Pierce Attack', 351: 'Strike Attack' } TOOL_DEMONS = {} for fname in COMP_CONFIG['enemyData']: @@ -19,7 +20,7 @@ with open(f"{GAME_TYPE}-data/{COMP_CONFIG['enemyIds']}") as tsvfile: DEMON_IDS = ['BLANK\t0'] + [x.strip() for x in tsvfile] -for fname in [COMP_CONFIG['skillEffects'], 'race-ids.tsv', 'item-effects.tsv']: +for fname in [COMP_CONFIG['skillEffects'], 'race-ids.tsv', COMP_CONFIG['itemEffects']]: with open(f"{GAME_TYPE}-data/{fname}") as tsvfile: datasets.append(['BLANK'] + [x.strip().split('\t')[0] for x in tsvfile]) @@ -51,11 +52,17 @@ innate = struct.unpack('<8H', line[0x0E:0x1E]) exp, yen = struct.unpack('<2H', line[0x1E:0x22]) drops = struct.unpack('<8H', line[0x22:0x32]) + quest_drop = struct.unpack('<3H', line[0x32:0x38]) + norm_hit, norm_pwr = struct.unpack('<2H', line[0x38:0x3C]) if GAME_TYPE == 'p3': temp = exp exp = yen yen = temp + norm_elem = struct.unpack('<1H', line[0x3C:0x3E])[0] + norm_atk = NORM_ATKS[norm_elem] + if norm_atk not in demon['skills']: + print(dname, 'norm_atk', norm_atk) printif_notequal(dname, 'race', demon['race'].replace(' P', ''), RACE_IDS[race_id]) printif_notequal(dname, 'lvl', demon['lvl'], dlvl) @@ -63,13 +70,6 @@ printif_notequal(dname, 'exp', demon['exp'], exp) printif_notequal(dname, 'yen', demon.get('price', 0), yen) - if ' P' in demon['race']: - continue - - innate = [SKILL_IDS[s_id] for s_id in innate if s_id != 0] - old_skills = demon['skills'][1 if GAME_TYPE == 'p3' else 0:] - printif_notequal(dname, 'skills', old_skills, innate) - old_drops = demon.get('gem', '-').split(', ') if 'material' in demon: old_drops.append(demon['material']) @@ -81,10 +81,20 @@ i_id -= COMP_CONFIG['itemsBegin'] i_chance *= 0.5 - iname = ITEM_IDS[i_id] + if i_id < 0 or len(ITEM_IDS) < i_id: + print(dname, 'unk_drop', i_id, i_chance) + continue + iname = ITEM_IDS[i_id] if iname not in old_drops: - print(dname, 'drop', iname, old_drops) + print(dname, 'drop', iname, i_chance, old_drops) + + if ' P' in demon['race']: + continue + + innate = [SKILL_IDS[s_id] for s_id in innate if s_id != 0] + old_skills = demon['skills'][1 if GAME_TYPE == 'p3' else 0:] + printif_notequal(dname, 'skills', old_skills, innate) if GAME_PREFIX == 'p5r': with open(f"dumps/{GAME_PREFIX}-enemy-resists.bin", 'rb') as binfile: