wynnbuilder-idk/testing/1.20_manasteal/ms_linalg.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

49 lines
1.5 KiB
Python

import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
# Attack speed independent. Fast speed losses not accounted for
mana_consumption = 3
mana_steal = 10 # /3s
mana_regen = 0 # /5s
#mana_steal = 5 # /3s
#mana_regen = 5 # /5s
natural_regen = 1
weight_natural = 8/15 # 4/5 * 2/3
weight_mr = 2/15 # 1/5 * 2/3
weight_ms = 4/15 # 4/5 * 1/3
weight_mr_ms = 1/15 # 1/5 * 1/3
MAX_MANA = 20
transition_matrix = np.zeros((MAX_MANA, MAX_MANA))
for i in range(MAX_MANA):
natural_state = max(0, i - mana_consumption + natural_regen)
mr_state = min(19, natural_state + mana_regen)
ms_state = min(19, natural_state + mana_steal)
mr_ms_state = min(19, natural_state + mana_regen + mana_steal)
transition_matrix[natural_state, i] = weight_natural
transition_matrix[mr_state, i] += weight_mr
transition_matrix[ms_state, i] += weight_ms
transition_matrix[mr_ms_state, i] += weight_mr_ms
eigval, eigvec = la.eig(transition_matrix)
print(eigval)
eps = 0.00001
ind = np.argwhere(abs(eigval - 1) < eps)
steady_state = abs(eigvec[:, ind])
steady_state /= np.sum(steady_state)
cumulative = np.cumsum(steady_state)
print("mana\tprob cumsum")
for i in range(MAX_MANA):
print(f"{i+1}\t{cumulative[i]}")
plt.figure()
plt.scatter(range(len(steady_state)), steady_state)
plt.xlim(0, 19)
plt.ylim(0, 0.2)
plt.xlabel("Mana Value")
plt.ylabel("Probability at t=infty")
plt.title(f"Build={mana_regen}mr,{mana_steal}ms,{mana_consumption}mana/sec")
plt.show()