wynnbuilder-forked-for-changes/testing/1.20_manasteal/ms_sslow.py
hppeng-wynn d9e5d6da95
Updating to wynn 2.0.2.3 (except item database...)
* Fix enraged blow typo; allow "or" and "and" in adv search

...forgot to update json

* Lacerate is blocked by Echo, not Mirror Image

* Misc bugfix

Fix bug with skillpoints and negative set bonus
Add final multiplier for echo

* Clean up testing folder

and add script for quick plotting pairs of ids/item values

* Fix typo in better lightweaver

add to the correct dps

* Partial update to 2.0.2.3 (festival of heroes)

patch:
- ing changes (manual)
- two endgame items (the ones that I got customs for)

bugfix:
- Fix bug in reverse mapping that mapped item "type" to "accessoryType"

* Forgot to commit all the 2.0.2.3 data files...

* Fix epilogue displayName

* Fix minor incorrectness with fromIntV invocation

don't think this was a bug? but its not the correct number of arguments lol

* Move powder ingreds to ing load sequence

not used anywhere else
also, remove extra prints in crafter

* Refactor powder special display

fix quake/chain/courage not displaying some powder special information 💀

* Finally fix satsujin to work with powder specials

thanks to powder special display refactor

* Fix mask of the awakened giving outdated stats

e

* Add prologue and gleeman's tale

wynn api when
...fix epilgoue

---------

Co-authored-by: hppeng <hppeng>
2023-04-14 17:18:52 -07:00

65 lines
2.2 KiB
Python

import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
# Super slow attack speed. (Idealized to 1 hit/2s, 2/3 chance of proc
mana_consumption = 6
mana_steal = 14 # /3s
mana_regen = 6 # /5s
#mana_steal = 5 # /3s
#mana_regen = 5 # /5s
natural_regen = 1
ms_period = 2
ms_chance = ms_period / 3
no_ms_chance = 1 - ms_chance
MAX_MANA = 20
TIME_CYCLE = 10
transition_matrix = np.zeros((MAX_MANA * TIME_CYCLE, MAX_MANA * TIME_CYCLE))
for j in range(TIME_CYCLE):
for i in range(MAX_MANA):
natural_state = max(0, i - mana_consumption + natural_regen)
if j % 5 == 0: # mr activation
natural_state = min(19, natural_state + mana_regen)
next_ind = ((j+1) % TIME_CYCLE) * MAX_MANA
if j % ms_period == 0: # ms activation
ms_state = min(19, natural_state + mana_steal)
transition_matrix[next_ind + natural_state, i+j*MAX_MANA] = no_ms_chance
transition_matrix[next_ind + ms_state, i+j*MAX_MANA] += ms_chance
else:
transition_matrix[next_ind + natural_state, i+j*MAX_MANA] = 1
eigval, eigvec = la.eig(transition_matrix)
print(eigval)
eps = 0.00001
ind = np.argwhere(abs(eigval - 1) < eps)
steady_state = np.sum(abs(eigvec[:, ind]).reshape((TIME_CYCLE, MAX_MANA)), axis=0)
steady_state /= np.sum(steady_state)
cumulative = np.cumsum(steady_state)
print("mana\tcumulative probability")
for i in range(MAX_MANA):
print(f"{i+1}\t{cumulative[i]}")
mana_limit = 6+mana_consumption
x_ticks = list(range(len(steady_state)))
plt.figure()
plt.scatter(x_ticks, steady_state, label="mana values")
plt.xlim(0, 19)
plt.ylim(0, 0.3)
plt.axvline(x=mana_limit, color="red")
plt.xlabel("Mana Value")
plt.xticks(x_ticks)
plt.ylabel("Probability at t=infty")
plt.legend()
ax2 = plt.gca().twinx()
ax2.plot(x_ticks, cumulative, label="cumulative probability", color="pink")
plt.text(mana_limit - 0.2, cumulative[mana_limit] + 0.03, f"time with sprint loss: {cumulative[mana_limit]*100:.2f}%", horizontalalignment='right')
plt.scatter((mana_limit,), (cumulative[mana_limit],), color="red")
ax2.set_ylim(0, 1)
ax2.set_ylabel("Cumulative probability at t=infty")
plt.title(f"Super Slow Speed: Build={mana_regen}mr,{mana_steal}ms,{mana_consumption}mana/sec")
plt.legend()
plt.show()