Skip to content

Instantly share code, notes, and snippets.

@SciresM
Created May 30, 2018 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SciresM/5662114f22927c5a6bb50bb5cab853df to your computer and use it in GitHub Desktop.
Save SciresM/5662114f22927c5a6bb50bb5cab853df to your computer and use it in GitHub Desktop.
Encounter Set printer for Pokemon Quest
def print_set(p):
ind_lvl = 0
def printf(s, lvl = ind_lvl):
s = '%s%s' % (' ' * ind_lvl, s)
print s
try:
outf.write('%s\n' % s)
except:
pass
printf('Pack: %s' % p)
p = paks[p]
for set_type, suf in [('Normal', 'Sets'), ('Boss', 'Set')]:
ind_lvl += 1
printf('%s:' % set_type)
for set_prio in ['Primary', 'Secondary', 'Tertiary', 'Quarternary']:
ind_lvl += 1
printf('%s:' % set_prio)
regis_arr = p['m_%s%sEnemy%s' % (set_type.lower(), set_prio, suf)]
if set_type == 'Normal':
regis_arr = regis_arr['Array']
else:
regis_arr = [regis_arr['m_registDatas']]
for set_i, set in enumerate(regis_arr):
set_arr = set['Array']
if len(set_arr) == 0 or (len(set_arr) == 1 and (set_arr[0]['m_lotteryRate'] == 0 or set_arr[0]['m_enemyData']['m_PathID'] == 0)):
continue
ind_lvl += 1
total_lot = sum(map(lambda ptr: ptr['m_lotteryRate'], set_arr))
if set_type == 'Normal':
printf('Set %d:' % (set_i))
ind_lvl += 1
for enemy_ptr in set_arr:
enemy_lottery = enemy_ptr['m_lotteryRate']
enemy_path = str((0x10000000000000000 + enemy_ptr['m_enemyData']['m_PathID']) % 0x10000000000000000)
lot = (float(enemy_lottery) / float(total_lot)) * 100.0
enemy = dats[enemy_path]
printf('%s (Form %d) (%0.02f%%):' % (names[enemy['m_monsterNo']], enemy['m_formNo'], lot))
ind_lvl += 1
printf('Base HP: %d' % enemy['m_hpBasis'])
printf('Base ATK: %d' % enemy['m_attackBasis'])
printf('Nature: %s' % ('Default' if enemy['m_seikaku'] == 65535 else str(enemy['m_seikaku'])))
printf('Ability: %d' % enemy['m_tokusei'])
printf('Drop Type: %d' % enemy['m_dropType'])
printf('AI Type: %d' % enemy['m_AIType'])
ind_lvl -= 1
if set_type == 'Normal':
ind_lvl -= 1
ind_lvl -= 1
ind_lvl -= 1
ind_lvl -= 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment