示例#1
0
文件: Deck.py 项目: raminsaf/hokm
 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()
示例#3
0
 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
示例#11
0
文件: Deck.py 项目: raminsaf/hokm
 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())
示例#17
0
 def getAllSuitValues(self):
     suitmap = {}
     for suit in Suit.getSuits():
         suitmap[suit] = self.getSuitValue(suit)
     return suitmap
示例#18
0
 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)
示例#20
0
文件: Deck.py 项目: raminsaf/hokm
 def toString(self):
   ret = ""
   for suit in Suit.getSuits():
     for card in suit:
       ret = ret + card.toString()
   return ret
示例#21
0
文件: Deck.py 项目: raminsaf/hokm
 def getAllSuitValues(self):
   suitmap = {}
   for suit in Suit.getSuits():
     suitmap[suit] = self.getSuitValue(suit)
   return suitmap
示例#22
0
 def getHokmDeck():
     cards = [
         Card(suit, value) for suit in Suit.getSuits()
         for value in range(2, 15)
     ]
     return Deck(cards)
示例#23
0
文件: Card.py 项目: raminsaf/hokm
 def toString(self):
     return Suit.getSuitSymbol(self._suit) + self.getName()
示例#24
0
文件: Card.py 项目: raminsaf/hokm
 def toString(self):
   return Suit.getSuitSymbol(self._suit) + self.getName()