code does not set previous.ai = current.ai at any place
Opened this issue · 1 comments
kd8qdz commented
causing a crash when the confuse spell expires.
mgedmin commented
That is no longer a problem: http://rogueliketutorials.com/tutorials/tcod/part-9/ sets previous_ai in the ConfusedMonster.__init__
:
class ConfusedMonster:
def __init__(self, previous_ai, number_of_turns=10):
self.previous_ai = previous_ai
self.number_of_turns = number_of_turns
and then when the component is created, the old entity.ai is passed as the argument
confused_ai = ConfusedMonster(entity.ai, 10)
confused_ai.owner = entity
entity.ai = confused_ai