Is the following check necessary so that the killer receives bounty if either they are enemies with killed or vice versa?
If I'm not mistaken, a player may be an enemy towards another without the reverse being true, and hence this check. Just wanted to confirm whether I'm doing a useless check or not, thanks.
Usage example:
If I'm not mistaken, a player may be an enemy towards another without the reverse being true, and hence this check. Just wanted to confirm whether I'm doing a useless check or not, thanks.
Wurst:
function unit.checkBountyValidFor(player killer) returns bool
let killed = this.getOwner()
return (killed != killer) and
(killed.isEnemyOf(killer) or killer.isEnemyOf(killed))
Wurst:
public function unit.bountyOnHeroFor (player killer)
if this.checkBountyValidFor(killer)
let lvl = GetHeroLevel(this) * 2 + 20
killer.earnGoldFrom(this, GetRandomInt(0, 200) + lvl * lvl )
Last edited: