Enemy hero id
can be "Hero Placeholder"
or "Hero Placeholder 1
".
Examples for finding enemy hero (best to just add these to the top of the code, outside the main loop, and forget):
# Python
enemyHero = [e for e in self.findEnemies() if e.id in ["Hero Placeholder", "Hero Placeholder 1"]][0]
// JavaScript
var enemyHero = this.findEnemies().filter(function (e) {
return e.id === 'Hero Placeholder' || e.id === 'Hero Placeholder 1';
})[0];
In mirror matches (Zero Sum, Ace of Coders) it’s easier to just do
# Python
enemyHero = self.findByType(self.type)[0] or self.findByType('knight')[0]
// JavaScript
var enemyHero = this.findByType(this.type)[0] || this.findByType('knight')[0];
as both players have the same hero type (or Tharin if their game session is bugged out).