I’m playing sarven-brawl and I’m running into a code error.
loop:
enemies = self.findEnemies()
enemy = self.findNearest(enemies)
if is_soldier(enemy):
# Assess the threat and take appropriate action
The if line is giving the error Cannot read property 'formals' of null when is_soldier(enemy) is evaluated and enemy is None (or null to be precise).
I’m performing the null check inside is_soldier() but it’s never reached because the program crashes before reaching the check.
FWIW, here is my definition of is_soldier(). It shouldn’t matter how it’s defined since I believe passing null as an argument is causing the error.
def is_soldier(enemy):
if enemy and not is_sandyak(enemy):
return True
return False