Genshin equivalent

Having a healer that can revive characters at c0 would be nice. Barbara and Qiqi are constellation locked for this resurrection skill.

Other than that, the unique thing about Bailu's kit is her E healing. It bounces between characters. It heals the selected character and then 2 random characters (can be the same character). After each bounce, healing is reduced 15% (attenuation). This is not 'smart' healing, but more like random healing.

Having a 'smart' healer in Genshin could also be helpful. They heal the whole party, but those with less hp get healed more. For example, say the healer E will heal a total amount of X. The X gets distributed between the 4 party members in proportion to those that need the healing the most.

Algorithm / Formula (max cap): Let X be the total healing amount and \(h_i \) be the hp of the party members. Take the character with the highest current hp (not max hp). Call this highest current hp \(M = \max h_i \). The idea is to bring the rest of the party members as close to M hp as possible. And once everyone is at M, then heal all equally with whatever healing is remaining.

Let there be n total party members (in HSR we usually have n=4). Let \( j = \text{argmax}_i(h_i) \) be the member with the highest current hp. Suppose member i gets healing amount \(x_i \ge 0 \) where \( \sum x_i = X \). Perhaps one can formulate an optimization problem on how to allocate the \(x_i \) while optimizing a certain objective function.

Note that \(h_j-h_i = r_i\) is the difference between member i's hp and the max current hp. If $$X \le \sum_i (h_j - h_i) = R$$ then heal each member except j for an amount $$x_i = (X + \sum_{k \neq j} h_k)/(n-1) - h_i $$ If $$X > R$$ then all party members can be healed to \(M = h_j\) and there is excess healing \(X-R\) left. Distribute this excess healing evenly (or based on proportion of max hp). Then the formula becomes $$x_i = (R + \sum_{k \neq j} h_k)/(n-1) - h_i + (X-R)/n$$ The general formula is $$x_i = (\min(X, R) + \sum_{k \neq j} h_k)/(n-1) - h_i + \max(X-R, 0)/n$$ Note this generalizes to any number of party members.

Above we ignored overflow healing or healing over the max hp. But if there is overflow, then add that to the excess healing remaining. Let \(z_i \) be the max hp of member i. If \(h_i + x_i > z_i \) then we have overflow healing. We then redistribute this excess healing to others.

So we have an iterative algorithm. Compute the \(x_i\) as above and heal the party members using that. For each party member, take the sum of any excess healing $$X' = \sum \max(h_i + x_i - z_i, 0)$$ Then update the \(h_i \to h_i' = h_i + x_i \). Recompute the \(x_i \) using \(X' \) and the new \(h_i' \) variables, excluding any members at full hp. Then repeat the process until X' is reduced to 0 or all party members are at full hp.

The worst case complexity of this algorithm is \(O(n^2) \), corresponding to the case where each step heals exactly one ally to full hp, giving a geometric series \(n+(n-1)+\ldots + 1 \sim O(n^2) \). However, in HSR \(n\ge 4\) so the computation is constant time.

The above we call 'need-based healing', 'egalitarianism', or even 'socialism'. We are essentially constructing a function mapping \(f(X, h_i) \to x_i \). Perhaps one can create a neural network that learns from many examples so that when it sees the input it can output the \(h_i\). The above function is nonlinear and involves several relu units.

We do not look at percentage hp lost. One party member could have 20k out of 80k hp (25%), but the other members have 10k out of 20k hp (50%). In this case the healing would go to the party members with 10k hp as they have smaller absolute value of hp.