2019-12-30 00:07:56 -06:00
|
|
|
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)
|
2019-12-30 00:07:56 -06:00
|
|
|
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
|
2019-12-30 00:07:56 -06:00
|
|
|
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)
|