sorry, i posted the wrong one! you needed to make it damage the enemies by making them take 0-wand upgradex10 instead of wand upgradex10!
You were healing the enemies!
Well for starters it should definitely be using “length of array - 1”, but other than that I don’t see anything weird. If that doesn’t fix it, please share your code!