Holocaust fire cost

This commit is contained in:
John 2015-08-09 13:41:30 +03:00
parent 80b5e4c548
commit a2d5b004c9
3 changed files with 10 additions and 16 deletions

View file

@ -47,7 +47,7 @@ class FireCogPanel(StateData.StateData):
del self.backButton
self.loaded = 0
def enter(self, numAvatars, localNum = None, luredIndices = None, trappedIndices = None, track = None, fireCosts = None):
def enter(self, numAvatars, localNum = None, luredIndices = None, trappedIndices = None, track = None):
if not self.loaded:
self.load()
self.frame.show()
@ -59,7 +59,7 @@ class FireCogPanel(StateData.StateData):
if len(trappedIndices) > 0:
if track == BattleBase.TRAP:
invalidTargets += trappedIndices
self.__placeButtons(numAvatars, invalidTargets, localNum, fireCosts)
self.__placeButtons(numAvatars, invalidTargets, localNum)
def exit(self):
self.frame.hide()
@ -87,23 +87,24 @@ class FireCogPanel(StateData.StateData):
def adjustToons(self, numToons, localNum):
self.__placeButtons(numToons, [], localNum)
def __placeButtons(self, numAvatars, invalidTargets, localNum, fireCosts):
canfire = 0
def __placeButtons(self, numAvatars, invalidTargets, localNum):
canFire = 0
for i in xrange(4):
if numAvatars > i and i not in invalidTargets and i != localNum:
self.avatarButtons[i].show()
self.avatarButtons[i]['text'] = ''
if fireCosts[i] <= localAvatar.getPinkSlips():
if localAvatar.getPinkSlips():
self.avatarButtons[i]['state'] = DGG.NORMAL
self.avatarButtons[i]['text_fg'] = (0, 0, 0, 1)
canfire = 1
canFire = 1
else:
self.avatarButtons[i]['state'] = DGG.DISABLED
self.avatarButtons[i]['text_fg'] = (1.0, 0, 0, 1)
else:
self.avatarButtons[i].hide()
if canfire:
if canFire:
self.textFrame['text'] = TTLocalizer.FireCogTitle % localAvatar.getPinkSlips()
else:
self.textFrame['text'] = TTLocalizer.FireCogLowTitle % localAvatar.getPinkSlips()

View file

@ -773,7 +773,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame):
self.sosButton.show()
self.passButton.show()
self.fireButton.show()
if localAvatar.getPinkSlips() > 0:
if localAvatar.getPinkSlips():
self.fireButton['state'] = DGG.NORMAL
self.fireButton['image_color'] = Vec4(0, 0.6, 1, 1)
else:

View file

@ -122,10 +122,6 @@ class TownBattle(StateData.StateData):
self.SOSPetInfoPanel = TownBattleSOSPetInfoPanel.TownBattleSOSPetInfoPanel(self.SOSPetInfoPanelDoneEvent)
self.fireCogPanelDoneEvent = 'fire-cog-panel-done'
self.FireCogPanel = FireCogPanel.FireCogPanel(self.fireCogPanelDoneEvent)
self.cogFireCosts = [None,
None,
None,
None]
self.toonPanels = (TownBattleToonPanel.TownBattleToonPanel(0),
TownBattleToonPanel.TownBattleToonPanel(1),
TownBattleToonPanel.TownBattleToonPanel(2),
@ -460,11 +456,8 @@ class TownBattle(StateData.StateData):
toonIds = map(lambda toon: toon.doId, toons)
self.notify.debug('adjustCogsAndToons() toonIds: %s self.toons: %s' % (toonIds, self.toons))
maxSuitLevel = 0
cogFireCostIndex = 0
for cog in cogs:
maxSuitLevel = max(maxSuitLevel, cog.getActualLevel())
self.cogFireCosts[cogFireCostIndex] = 1
cogFireCostIndex += 1
creditLevel = maxSuitLevel
resetActivateMode = 0
@ -603,7 +596,7 @@ class TownBattle(StateData.StateData):
def enterFire(self):
canHeal, canTrap, canLure = self.checkHealTrapLure()
self.FireCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track, fireCosts=self.cogFireCosts)
self.FireCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track)
self.accept(self.fireCogPanelDoneEvent, self.__handleCogFireDone)
return None