New magic word: ~secondVP - skips to second battle

This commit is contained in:
John 2015-08-08 13:32:48 +03:00
parent ce8d856ebe
commit 80b5e4c548
2 changed files with 22 additions and 13 deletions

View file

@ -38,7 +38,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM):
def __init__(self, cr): def __init__(self, cr):
DistributedBossCog.DistributedBossCog.__init__(self, cr) DistributedBossCog.DistributedBossCog.__init__(self, cr)
FSM.FSM.__init__(self, 'DistributedSellbotBoss') FSM.FSM.__init__(self, 'DistributedCashbotBoss')
self.resistanceToon = None self.resistanceToon = None
self.resistanceToonOnstage = 0 self.resistanceToonOnstage = 0
self.cranes = {} self.cranes = {}

View file

@ -403,18 +403,32 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS
def enterReward(self): def enterReward(self):
DistributedBossCogAI.DistributedBossCogAI.enterReward(self) DistributedBossCogAI.DistributedBossCogAI.enterReward(self)
def getVP(invoker):
for do in simbase.air.doId2do.values():
if isinstance(do, DistributedSellbotBossAI):
if invoker.doId in do.involvedToons:
return do
@magicWord(category=CATEGORY_ADMINISTRATOR)
def secondVP():
"""
Skips to the second round of the VP.
"""
invoker = spellbook.getInvoker()
boss = getVP(invoker)
if not boss:
return "You aren't in a VP!"
boss.exitIntroduction()
boss.b_setState('RollToBattleTwo')
return 'Skipping to the second round...'
@magicWord(category=CATEGORY_ADMINISTRATOR) @magicWord(category=CATEGORY_ADMINISTRATOR)
def skipVP(): def skipVP():
""" """
Skips to the final round of the VP. Skips to the final round of the VP.
""" """
invoker = spellbook.getInvoker() invoker = spellbook.getInvoker()
boss = None boss = getVP(invoker)
for do in simbase.air.doId2do.values():
if isinstance(do, DistributedSellbotBossAI):
if invoker.doId in do.involvedToons:
boss = do
break
if not boss: if not boss:
return "You aren't in a VP!" return "You aren't in a VP!"
if boss.state in ('PrepareBattleThree', 'BattleThree'): if boss.state in ('PrepareBattleThree', 'BattleThree'):
@ -429,12 +443,7 @@ def killVP():
Kills the VP. Kills the VP.
""" """
invoker = spellbook.getInvoker() invoker = spellbook.getInvoker()
boss = None boss = getVP(invoker)
for do in simbase.air.doId2do.values():
if isinstance(do, DistributedSellbotBossAI):
if invoker.doId in do.involvedToons:
boss = do
break
if not boss: if not boss:
return "You aren't in a VP!" return "You aren't in a VP!"
boss.b_setState('Victory') boss.b_setState('Victory')