oldschool-toontown/toontown/safezone/DistributedSZTreasureAI.py

24 lines
945 B
Python
Raw Normal View History

from . import DistributedTreasureAI
2019-11-02 17:27:54 -05:00
from toontown.toonbase import ToontownGlobals
class DistributedSZTreasureAI(DistributedTreasureAI.DistributedTreasureAI):
def __init__(self, air, treasurePlanner, x, y, z):
DistributedTreasureAI.DistributedTreasureAI.__init__(self, air, treasurePlanner, x, y, z)
self.healAmount = treasurePlanner.healAmount
def validAvatar(self, av):
return av.hp >= -1 and av.hp < av.maxHp
def d_setGrab(self, avId):
DistributedTreasureAI.DistributedTreasureAI.d_setGrab(self, avId)
if avId in self.air.doId2do:
2019-11-02 17:27:54 -05:00
av = self.air.doId2do[avId]
if self.validAvatar(av):
if av.hp == -1:
av.hp = 0
if ToontownGlobals.VALENTINES_DAY in simbase.air.holidayManager.currentHolidays:
2019-11-02 17:27:54 -05:00
av.toonUp(self.healAmount * 2)
else:
av.toonUp(self.healAmount)