예제 #1
0
def findToonAttack(toons, attacks, track):
    foundAttacks = []
    for t in toons:
        if t in attacks:
            attack = attacks[t]
            local_track = attack[TOON_TRACK_COL]
            if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:
                local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])
            if local_track == track:
                if local_track == FIRE:
                    canFire = 1
                    for attackCheck in foundAttacks:
                        if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
                            canFire = 0

                    if canFire:
                        foundAttacks.append(attack)
                else:
                    foundAttacks.append(attack)

    def compFunc(a, b):
        if a[TOON_LVL_COL] > b[TOON_LVL_COL]:
            return 1
        elif a[TOON_LVL_COL] < b[TOON_LVL_COL]:
            return -1
        return 0

    foundAttacks.sort(compFunc)
    return foundAttacks
def findToonAttack(toons, attacks, track):
    foundAttacks = []
    for t in toons:
        if t in attacks:
            attack = attacks[t]
            local_track = attack[TOON_TRACK_COL]
            if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS:
                local_track = NPCToons.getNPCTrack(attack[TOON_TGT_COL])
            if local_track == track:
                if local_track == FIRE:
                    canFire = 1
                    for attackCheck in foundAttacks:
                        if attackCheck[TOON_TGT_COL] == attack[TOON_TGT_COL]:
                            canFire = 0

                    if canFire:
                        foundAttacks.append(attack)
                else:
                    foundAttacks.append(attack)

    def compFunc(a, b):
        if a[TOON_LVL_COL] > b[TOON_LVL_COL]:
            return 1
        elif a[TOON_LVL_COL] < b[TOON_LVL_COL]:
            return -1
        return 0

    foundAttacks.sort(compFunc)
    return foundAttacks
예제 #3
0
    def __updateNPCFriendsPanel(self):
        self.NPCFriends = {}
        for friend, count in base.localAvatar.NPCFriendsDict.items():
            track = NPCToons.getNPCTrack(friend)
            if track == ToontownBattleGlobals.LURE_TRACK and self.canLure == 0 or track == ToontownBattleGlobals.TRAP_TRACK and self.canTrap == 0:
                self.NPCFriends[friend] = 0
            else:
                self.NPCFriends[friend] = count

        self.NPCFriendPanel.setFriends(self.NPCFriends)
        self.NPCFriendPanel.update()
    def __updateNPCFriendsPanel(self):
        self.NPCFriends = {}
        for friend, count in base.localAvatar.NPCFriendsDict.items():
            track = NPCToons.getNPCTrack(friend)
            if (
                track == ToontownBattleGlobals.LURE_TRACK
                and self.canLure == 0
                or track == ToontownBattleGlobals.TRAP_TRACK
                and self.canTrap == 0
            ):
                self.NPCFriends[friend] = 0
            else:
                self.NPCFriends[friend] = count

        self.NPCFriendPanel.setFriends(self.NPCFriends)
        self.NPCFriendPanel.update()