two fighters, one winner.
Last updated
Was this helpful?
Last updated
Was this helpful?
find first attacker and set as 'a'
find second attacker and set as 'b'
calculate (b.health / a.deamaePerAttack) as 'aCount' calculate (a.health / b.deamaePerAttack) as 'bCount'
if aCount is less than bCount which means 'a' win. return 'a'.name, otherwise 'b' win. return 'b'.name