mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Fix SOS selection of the same type in a row
This commit is contained in:
parent
fbf84238a8
commit
aee605bb19
2 changed files with 9 additions and 34 deletions
|
@ -993,6 +993,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
||||||
self.notify.warning('requestAttack() - no toon: %d' % toonId)
|
self.notify.warning('requestAttack() - no toon: %d' % toonId)
|
||||||
return
|
return
|
||||||
validResponse = 1
|
validResponse = 1
|
||||||
|
self.npcAttacks = {k:v for k, v in self.npcAttacks.iteritems() if v != toonId}
|
||||||
if track == SOS:
|
if track == SOS:
|
||||||
self.notify.debug('toon: %d calls for help' % toonId)
|
self.notify.debug('toon: %d calls for help' % toonId)
|
||||||
self.air.writeServerEvent('friendSOS', toonId, '%s' % av)
|
self.air.writeServerEvent('friendSOS', toonId, '%s' % av)
|
||||||
|
@ -1007,7 +1008,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas
|
||||||
npcCollision = 0
|
npcCollision = 0
|
||||||
if av in self.npcAttacks:
|
if av in self.npcAttacks:
|
||||||
callingToon = self.npcAttacks[av]
|
callingToon = self.npcAttacks[av]
|
||||||
if self.activeToons.count(callingToon) == 1:
|
if callingToon != toonId and self.activeToons.count(callingToon) == 1:
|
||||||
self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS)
|
self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS)
|
||||||
npcCollision = 1
|
npcCollision = 1
|
||||||
if npcCollision == 0:
|
if npcCollision == 0:
|
||||||
|
|
|
@ -328,20 +328,14 @@ class TownBattle(StateData.StateData):
|
||||||
|
|
||||||
def enterOff(self):
|
def enterOff(self):
|
||||||
if self.isLoaded:
|
if self.isLoaded:
|
||||||
for toonPanel in self.toonPanels:
|
for panel in self.toonPanels + self.cogPanels:
|
||||||
toonPanel.hide()
|
panel.hide()
|
||||||
|
|
||||||
for cogPanel in self.cogPanels:
|
self.toonAttacks = [(-1, 0, 0)] * 4
|
||||||
cogPanel.hide()
|
|
||||||
|
|
||||||
self.toonAttacks = [(-1, 0, 0),
|
|
||||||
(-1, 0, 0),
|
|
||||||
(-1, 0, 0),
|
|
||||||
(-1, 0, 0)]
|
|
||||||
self.target = 0
|
self.target = 0
|
||||||
|
|
||||||
if hasattr(self, 'timer'):
|
if hasattr(self, 'timer'):
|
||||||
self.timer.hide()
|
self.timer.hide()
|
||||||
return None
|
|
||||||
|
|
||||||
def exitOff(self):
|
def exitOff(self):
|
||||||
if self.isLoaded:
|
if self.isLoaded:
|
||||||
|
@ -352,17 +346,14 @@ class TownBattle(StateData.StateData):
|
||||||
self.track = -1
|
self.track = -1
|
||||||
self.level = -1
|
self.level = -1
|
||||||
self.target = 0
|
self.target = 0
|
||||||
return None
|
|
||||||
|
|
||||||
def enterAttack(self):
|
def enterAttack(self):
|
||||||
self.attackPanel.enter()
|
self.attackPanel.enter()
|
||||||
self.accept(self.attackPanelDoneEvent, self.__handleAttackPanelDone)
|
self.accept(self.attackPanelDoneEvent, self.__handleAttackPanelDone)
|
||||||
return None
|
|
||||||
|
|
||||||
def exitAttack(self):
|
def exitAttack(self):
|
||||||
self.ignore(self.attackPanelDoneEvent)
|
self.ignore(self.attackPanelDoneEvent)
|
||||||
self.attackPanel.exit()
|
self.attackPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleAttackPanelDone(self, doneStatus):
|
def __handleAttackPanelDone(self, doneStatus):
|
||||||
self.notify.debug('doneStatus: %s' % doneStatus)
|
self.notify.debug('doneStatus: %s' % doneStatus)
|
||||||
|
@ -495,12 +486,10 @@ class TownBattle(StateData.StateData):
|
||||||
self.cog = 0
|
self.cog = 0
|
||||||
self.chooseCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track)
|
self.chooseCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track)
|
||||||
self.accept(self.chooseCogPanelDoneEvent, self.__handleChooseCogPanelDone)
|
self.accept(self.chooseCogPanelDoneEvent, self.__handleChooseCogPanelDone)
|
||||||
return None
|
|
||||||
|
|
||||||
def exitChooseCog(self):
|
def exitChooseCog(self):
|
||||||
self.ignore(self.chooseCogPanelDoneEvent)
|
self.ignore(self.chooseCogPanelDoneEvent)
|
||||||
self.chooseCogPanel.exit()
|
self.chooseCogPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleChooseCogPanelDone(self, doneStatus):
|
def __handleChooseCogPanelDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
|
@ -548,12 +537,10 @@ class TownBattle(StateData.StateData):
|
||||||
self.toon = 0
|
self.toon = 0
|
||||||
self.chooseToonPanel.enter(self.numToons, localNum=self.localNum)
|
self.chooseToonPanel.enter(self.numToons, localNum=self.localNum)
|
||||||
self.accept(self.chooseToonPanelDoneEvent, self.__handleChooseToonPanelDone)
|
self.accept(self.chooseToonPanelDoneEvent, self.__handleChooseToonPanelDone)
|
||||||
return None
|
|
||||||
|
|
||||||
def exitChooseToon(self):
|
def exitChooseToon(self):
|
||||||
self.ignore(self.chooseToonPanelDoneEvent)
|
self.ignore(self.chooseToonPanelDoneEvent)
|
||||||
self.chooseToonPanel.exit()
|
self.chooseToonPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleChooseToonPanelDone(self, doneStatus):
|
def __handleChooseToonPanelDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
|
@ -590,12 +577,10 @@ class TownBattle(StateData.StateData):
|
||||||
canHeal, canTrap, canLure = self.checkHealTrapLure()
|
canHeal, canTrap, canLure = self.checkHealTrapLure()
|
||||||
self.FireCogPanel.enter(self.numCogs, luredIndices=self.luredIndices, trappedIndices=self.trappedIndices, track=self.track)
|
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
|
|
||||||
|
|
||||||
def exitFire(self):
|
def exitFire(self):
|
||||||
self.ignore(self.fireCogPanelDoneEvent)
|
self.ignore(self.fireCogPanelDoneEvent)
|
||||||
self.FireCogPanel.exit()
|
self.FireCogPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleCogFireDone(self, doneStatus):
|
def __handleCogFireDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
|
@ -616,12 +601,10 @@ class TownBattle(StateData.StateData):
|
||||||
canHeal, canTrap, canLure = self.checkHealTrapLure()
|
canHeal, canTrap, canLure = self.checkHealTrapLure()
|
||||||
self.SOSPanel.enter(canLure, canTrap)
|
self.SOSPanel.enter(canLure, canTrap)
|
||||||
self.accept(self.SOSPanelDoneEvent, self.__handleSOSPanelDone)
|
self.accept(self.SOSPanelDoneEvent, self.__handleSOSPanelDone)
|
||||||
return None
|
|
||||||
|
|
||||||
def exitSOS(self):
|
def exitSOS(self):
|
||||||
self.ignore(self.SOSPanelDoneEvent)
|
self.ignore(self.SOSPanelDoneEvent)
|
||||||
self.SOSPanel.exit()
|
self.SOSPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleSOSPanelDone(self, doneStatus):
|
def __handleSOSPanelDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
|
@ -655,13 +638,11 @@ class TownBattle(StateData.StateData):
|
||||||
self.accept(self.proxyGenerateMessage, self.__handleProxyGenerated)
|
self.accept(self.proxyGenerateMessage, self.__handleProxyGenerated)
|
||||||
self.accept(self.SOSPetSearchPanelDoneEvent, self.__handleSOSPetSearchPanelDone)
|
self.accept(self.SOSPetSearchPanelDoneEvent, self.__handleSOSPetSearchPanelDone)
|
||||||
messenger.send(self.battleEvent, [response])
|
messenger.send(self.battleEvent, [response])
|
||||||
return None
|
|
||||||
|
|
||||||
def exitSOSPetSearch(self):
|
def exitSOSPetSearch(self):
|
||||||
self.ignore(self.proxyGenerateMessage)
|
self.ignore(self.proxyGenerateMessage)
|
||||||
self.ignore(self.SOSPetSearchPanelDoneEvent)
|
self.ignore(self.SOSPetSearchPanelDoneEvent)
|
||||||
self.SOSPetSearchPanel.exit()
|
self.SOSPetSearchPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleSOSPetSearchPanelDone(self, doneStatus):
|
def __handleSOSPetSearchPanelDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
|
@ -676,12 +657,10 @@ class TownBattle(StateData.StateData):
|
||||||
def enterSOSPetInfo(self):
|
def enterSOSPetInfo(self):
|
||||||
self.SOSPetInfoPanel.enter(self.petId)
|
self.SOSPetInfoPanel.enter(self.petId)
|
||||||
self.accept(self.SOSPetInfoPanelDoneEvent, self.__handleSOSPetInfoPanelDone)
|
self.accept(self.SOSPetInfoPanelDoneEvent, self.__handleSOSPetInfoPanelDone)
|
||||||
return None
|
|
||||||
|
|
||||||
def exitSOSPetInfo(self):
|
def exitSOSPetInfo(self):
|
||||||
self.ignore(self.SOSPetInfoPanelDoneEvent)
|
self.ignore(self.SOSPetInfoPanelDoneEvent)
|
||||||
self.SOSPetInfoPanel.exit()
|
self.SOSPetInfoPanel.exit()
|
||||||
return None
|
|
||||||
|
|
||||||
def __handleSOSPetInfoPanelDone(self, doneStatus):
|
def __handleSOSPetInfoPanelDone(self, doneStatus):
|
||||||
mode = doneStatus['mode']
|
mode = doneStatus['mode']
|
||||||
|
@ -697,15 +676,10 @@ class TownBattle(StateData.StateData):
|
||||||
self.fsm.request('SOS')
|
self.fsm.request('SOS')
|
||||||
|
|
||||||
def __isCogChoiceNecessary(self):
|
def __isCogChoiceNecessary(self):
|
||||||
if self.numCogs > 1 and not self.__isGroupAttack(self.track, self.level):
|
return self.numCogs > 1 and not self.__isGroupAttack(self.track, self.level)
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def __isGroupAttack(self, trackNum, levelNum):
|
def __isGroupAttack(self, trackNum, levelNum):
|
||||||
retval = BattleBase.attackAffectsGroup(trackNum, levelNum)
|
return BattleBase.attackAffectsGroup(trackNum, levelNum)
|
||||||
return retval
|
|
||||||
|
|
||||||
def __isGroupHeal(self, levelNum):
|
def __isGroupHeal(self, levelNum):
|
||||||
retval = BattleBase.attackAffectsGroup(HEAL_TRACK, levelNum)
|
return self.__isGroupAttack(HEAL_TRACK, levelNum)
|
||||||
return retval
|
|
||||||
|
|
Loading…
Reference in a new issue