Skip to content

Commit

Permalink
p3 norm attack elem
Browse files Browse the repository at this point in the history
  • Loading branch information
aqiu384 committed Jul 16, 2024
1 parent 47f049b commit 84b7b64
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/p345/configs/p3-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/p345/configs/p3a-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "-",
Expand Down
1 change: 1 addition & 0 deletions src/p345/configs/p3f-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "-",
Expand Down
1 change: 1 addition & 0 deletions src/p345/configs/p3p-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "-",
Expand Down
3 changes: 2 additions & 1 deletion src/p345/configs/p4-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/p345/configs/p4g-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/p345/configs/p5-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "-",
Expand Down
2 changes: 2 additions & 0 deletions src/p345/configs/p5r-comp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "-",
Expand Down
32 changes: 21 additions & 11 deletions src/p345/enemy-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand All @@ -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])

Expand Down Expand Up @@ -51,25 +52,24 @@
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)
printif_notequal(dname, 'stats', demon['stats'], list(stats))
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'])
Expand All @@ -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:
Expand Down

0 comments on commit 84b7b64

Please sign in to comment.