Stardust-Labs-MC / wiki

Project/Planning board for the official wiki on Miraheze
https://stardustlabs.miraheze.org/
0 stars 0 forks source link

Make a calculator for movement speed #26

Open Tera458 opened 1 year ago

naomieow commented 1 year ago

Take $M_a$ as our starting movement speed attribute and $M_f$ as our final product, I believe the following equation will give the final speed attribute. Conversion to $\text{ms}^{-1}$ is still beyond me as of right now.

$$ M{f}=\left(M{a}+\sum{a{\text{add}}}\right)\times\left(1+\sum{b{\text{multiplyBase}}}\right)\times\left(\prod({c_{\text{multiply}}+1})\right) $$

naomieow commented 1 year ago

A lua implementation of the equation in my previous comment:

function calc_movement(base, add, multiplyBase, multiply)
    total = base
    for i = 1, #add do
        total = total + add[i]
    end

    mbTotal = 1
    for i = 1, #multiplyBase do
        mbTotal = mbTotal + multiplyBase[i]
    end
    total = total * mbTotal

    mTotal = 1
    for i = 1, #multiply do
        mTotal = mTotal * (multiply[i] + 1)
    end

    total = total * mTotal

    return total
end