[Touch of Death] Making Drain-Life work!


#1

My character will not cast “drain-life”. I’m not sure what I’m doing wrong.


#2

The same issue as most the posts in the forums. You are not checking if enemy exists before trying to us it.

wrap a

if enemy:

around your code that uses the enemy object


#3

It looks like he does actually have an enemy check on line 5, he’s just redefining enemy on line 10, which is harmless.

I need to work on this, but try casting spells like this:

self.cast("drain-life", enemy)

I’ve opened a GitHub issue here to make the docs show the right values: https://github.com/codecombat/codecombat/issues/1961


#4

Oh … right. i missed that if enemy at the top. :smile:

yeah. seems to be safer to always use self.cast instead of the helper methods.