def order(self): suitmap = { suit:[] for suit in Suit.getSuits() } for card in self._cards: suitmap[card.getSuit()].append(card) self._cards = [] for suit in Suit.getSuits(): self._cards += sorted(suitmap[suit], key = lambda x: x.getValue(), reverse = True)
def __init__(self, cr): Suit.__init__(self) DistributedAvatar.__init__(self, cr) DistributedSmoothNode.__init__(self, cr) self.anim = None self._state = SuitState.ALIVE self.dept = None self.variant = None self.suitPlan = None self.level = None self.moveIval = None self.hpFlash = None # For PythonCTMusicManager: # Are we in range of the localAvatar? self.isInRange = False self.chaseTarget = 0 self.suitFSM = ClassicFSM('DistributedSuit', [ State('off', self.enterSuitOff, self.exitSuitOff), State('walking', self.enterWalking, self.exitWalking), State('flyingDown', self.enterFlyingDown, self.exitFlyingDown), State('flyingUp', self.enterFlyingUp, self.exitFlyingUp), State('lured', self.enterLured, self.exitLured) ], 'off', 'off') self.stateIndex2suitState = {} self.suitFSM.enterInitialState() self.makeStateDict()
def order(self): suitmap = {suit: [] for suit in Suit.getSuits()} for card in self._cards: suitmap[card.getSuit()].append(card) self._cards = [] for suit in Suit.getSuits(): self._cards += sorted(suitmap[suit], key=lambda x: x.getValue(), reverse=True)
def delete(self): Suit.delete(self) del self.anim del self._state del self.dept del self.variant del self.suitPlan del self.moveIval DistributedAvatar.delete(self)
def __init__(self, cr): Suit.__init__(self) DistributedAvatar.__init__(self, cr) self.anim = None self.dept = None self.variant = None self.suitPlan = None self.level = None self.moveIval = None self.hpFlash = None self.chaseTarget = 0
def setSuit(self, arg, variant=0): if isinstance(arg, SuitPlan): plan = arg else: plan = SuitBank.getSuitById(arg) voice = Voice.NORMAL if variant: if isinstance(variant, (int, long, float, complex)): variant = Variant.getVariantById(variant) if plan.getForcedVoice(): voice = plan.getForcedVoice() Suit.generate(self, plan, variant, voice=voice) self.suitPlan = plan self.variant = Variant.getVariantById(variant)
def disable(self): base.taskMgr.remove(self.uniqueName('monitorLocalAvDistance')) self.anim = None self._state = None self.dept = None self.variant = None self.suitPlan = None if self.hpFlash: self.hpFlash.finish() self.hpFlash = None if self.moveIval: self.moveIval.pause() self.moveIval = None Suit.disable(self) DistributedAvatar.disable(self)
def disable(self): self.anim = None self.state = None self.dept = None self.variant = None self.suitPlan = None if self.hpFlash: self.hpFlash.finish() self.hpFlash = None if self.moveIval: self.moveIval.pause() self.moveIval = None Suit.disable(self) DistributedAvatar.disable(self) return
def disable(self): self.stopSmooth() # Picked up by DistributedBattleZone: messenger.send('suitDelete', [self]) self.anim = None self._state = None self.dept = None self.variant = None self.suitPlan = None if self.hpFlash: self.hpFlash.finish() self.hpFlash = None if self.moveIval: self.moveIval.pause() self.moveIval = None Suit.disable(self) DistributedAvatar.disable(self)
def __init__(self, cr): Suit.__init__(self) DistributedAvatar.__init__(self, cr) DistributedSmoothNode.__init__(self, cr) self.anim = None self.state = SuitState.ALIVE self.dept = None self.variant = None self.suitPlan = None self.level = None self.moveIval = None self.hpFlash = None self.suitFSM = ClassicFSM('DistributedSuit', [ State('off', self.enterSuitOff, self.exitSuitOff), State('walking', self.enterWalking, self.exitWalking), State('flyingDown', self.enterFlyingDown, self.exitFlyingDown), State('flyingUp', self.enterFlyingUp, self.exitFlyingUp), State('lured', self.enterLured, self.exitLured)], 'off', 'off') self.stateIndex2suitState = {} self.suitFSM.enterInitialState() self.makeStateDict() return
def getHokmDeck(): cards = [Card(suit, value) for suit in Suit.getSuits() for value in range(2,15)] return Deck(cards)
def startRay(self): Suit.initializeRay(self, self.avatarType, 2)
def d_enableMovement(self): self.sendUpdate('enableMovement', []) Suit.initializeRay(self, self.avatarType, 2)
def d_disableMovement(self, wantRay=False): self.sendUpdate('disableMovement', []) self.interruptAttack() self.stopMoving() if not wantRay: Suit.disableRay(self)
def toggleRay(self, ray=1): if ray: Suit.initializeRay(self, self.avatarType, 2) else: Suit.disableRay(self)
def setName(self, name): Suit.setName(self, name, self.suitPlan.getName())
def getAllSuitValues(self): suitmap = {} for suit in Suit.getSuits(): suitmap[suit] = self.getSuitValue(suit) return suitmap
def toString(self): ret = "" for suit in Suit.getSuits(): for card in suit: ret = ret + card.toString() return ret
def throwObject(self): self.acceptOnce('enter' + self.wsnp.node().getName(), self.__handleWeaponCollision) Suit.throwObject(self)
def getHokmDeck(): cards = [ Card(suit, value) for suit in Suit.getSuits() for value in range(2, 15) ] return Deck(cards)
def toString(self): return Suit.getSuitSymbol(self._suit) + self.getName()