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

View file

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

View file

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