def chooseSOSCard(self, difficulty): if difficulty < 0 or difficulty > 5: return None if difficulty <= 1: card = random.choice(NPCToons.npcFriendsMinMaxStars(0, 1)) elif difficulty <= 3: card = random.choice(NPCToons.npcFriendsMinMaxStars(1, 1)) else: card = random.choice(NPCToons.npcFriendsMinMaxStars(2, 2)) return card
def __setCagedToonNpcId(self): def npcFriendsMaxStars(stars): return [ id for id in NPCToons.npcFriends.keys() if NPCToons.getNPCTrackLevelHpRarity(id)[3] <= stars ] if self.numRentalDiguises >= 4: self.cagedToonNpcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 3)) elif 1 <= self.numRentalDiguises <= 3: self.cagedToonNpcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 4)) else: self.cagedToonNpcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 5))
def setVictors(self, victorIds): DistributedFactoryAI.DistributedFactoryAI.setVictors(self, victorIds) activeVictors = [] for victorId in victorIds: toon = self.air.doId2do.get(victorId) if toon is not None: activeVictors.append(toon) npcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 3)) for toon in activeVictors: toon.attemptAddNPCFriend(npcId) toon.d_setSystemMessage(0, 'You got a %s SOS card.' % (NPCToons.getNPCName(npcId)))
def setVictors(self, victorIds): DistributedFactoryAI.DistributedFactoryAI.setVictors(self, victorIds) activeVictors = [] for victorId in victorIds: toon = self.air.doId2do.get(victorId) if toon is not None: activeVictors.append(toon) npcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 3)) for toon in activeVictors: toon.attemptAddNPCFriend(npcId) toon.d_setSystemMessage(0, 'You got a %s SOS card.' % (NPCToons.getNPCName(npcId)))
class DistributedImpossibleFactoryAI(DistributedFactoryAI): notify = directNotify.newCategory('DistributedImpossibleFactoryAI') POSSIBLE_SOS = NPCToons.npcFriendsMinMaxStars(3, 4) def setVictors(self, victorIds): DistributedFactoryAI.setVictors(self, victorIds) activeVictors = [self.air.doId2do.get(victorId) for victorId in victorIds if self.air.doId2do.get(victorId) is not None] npcId = random.choice(self.POSSIBLE_SOS) npcName = NPCToons.getNPCName(npcId) for victor in activeVictors: victor.attemptAddNPCFriend(npcId) victor.attemptAddNPCFriend(npcId) victor.attemptAddNPCFriend(npcId) victor.d_setSystemMessage(0, 'You got 3 %s SOS Cards!' % npcName)