we calc the cost of manyfold in its effect(), which doesn't get run until after we check if we can afford the abl in runEnemy state. On the first turn he checks, the cost is an empty object literal so there's nothing he can't afford and in the last case, where he tries to use it and can't because he's dead already from the player turn, is presumably operating off the calculated cost from the previous usage of manyfold -- we reuse the manyfold_embrace object instance without resetting it, so...
Essentially, the only reason the cost check on that ability is a happy-ish accident that could lead to WEIRD bugs and is definitely causing unintended behavior (deciding about cost affordability based on stale data, different from the actual current damage dealt data).
we calc the cost of manyfold in its effect(), which doesn't get run until after we check if we can afford the abl in runEnemy state. On the first turn he checks, the cost is an empty object literal so there's nothing he can't afford and in the last case, where he tries to use it and can't because he's dead already from the player turn, is presumably operating off the calculated cost from the previous usage of manyfold -- we reuse the manyfold_embrace object instance without resetting it, so...
Essentially, the only reason the cost check on that ability is a happy-ish accident that could lead to WEIRD bugs and is definitely causing unintended behavior (deciding about cost affordability based on stale data, different from the actual current damage dealt data).