def __makeDoobers(self): # Generate a handful of suits that we can see the Boss Cog # promoting as we come in. These shouldn't really need to be # true DistributedSuits, but I tried to make just a Suit by # itself and it just doesn't work. It doesn't do any real # harm to make DistributedSuits, anyway. self.__resetDoobers() # 8 suits, 4 on each side. for i in range(8): suit = DistributedSuitAI.DistributedSuitAI(self.air, None) # Choose a random level for each new suit. level = random.randrange(len(SuitDNA.suitsPerLevel)) # And a random type to match the level. suit.dna = SuitDNA.SuitDNA() suit.dna.newSuitRandom(level = level, dept = self.dna.dept) suit.setLevel(level) suit.generateWithRequired(self.zoneId) self.doobers.append(suit) self.__sendDooberIds()
def setupSuitDNA(self, level, type, track): dna = SuitDNA.SuitDNA() dna.newSuitRandom(type, track) self.dna = dna self.track = track self.setLevel(level) return None
def __init__(self, air): DistributedSuitBaseAI.__init__(self, air, None) suitDNA = SuitDNA.SuitDNA() suitDNA.newSuit('f') self.dna = suitDNA self.setLevel(1) return
def __init__(self, air, dept): DistributedAvatarAI.DistributedAvatarAI.__init__(self, air) self.dept = dept self.dna = SuitDNA.SuitDNA() self.dna.newBossCog(self.dept) self.deptIndex = SuitDNA.suitDepts.index(self.dept) self.resetBattleCounters() self.looseToons = [] self.involvedToons = [] self.toonsA = [] self.toonsB = [] self.nearToons = [] self.suitsA = [] self.activeSuitsA = [] self.suitsB = [] self.activeSuitsB = [] self.reserveSuits = [] self.barrier = None self.keyStates = ['BattleOne', 'BattleTwo', 'BattleThree', 'Victory'] self.bossDamage = 0 self.battleThreeStart = 0 self.battleThreeDuration = 1800 self.attackCode = None self.attackAvId = 0 self.hitCount = 0 AllBossCogs.append(self) return
def attachSuitHead(node, suitName): """ gets a suit head whose scale and vertical pos has been normalized to all the suit heads NOTE: calling class is responsible for cleaning this up! (eg. self.head = None) """ suitIndex = SuitDNA.suitHeadTypes.index(suitName) suitDNA = SuitDNA.SuitDNA() suitDNA.newSuit(suitName) suit = Suit() suit.setDNA(suitDNA) headParts = suit.getHeadParts() head = node.attachNewNode('head') for part in headParts: copyPart = part.copyTo(head) # turn on depth write and test. copyPart.setDepthTest(1) copyPart.setDepthWrite(1) suit.delete() suit = None p1 = Point3() p2 = Point3() head.calcTightBounds(p1, p2) d = p2 - p1 biggest = max(d[0], d[2]) # make them ramp up slightly in size as we go down the row column = (suitIndex % SuitDNA.suitsPerDept) s = (0.2 + (column / 100.0)) / biggest # also make them move down slightly as we go across pos = -0.14 + ((SuitDNA.suitsPerDept - column - 1) / 135.0) head.setPosHprScale(0, 0, pos, 180, 0, 0, s, s, s) return head
def _RoguesGallery__makeSuit(self, dept, type, name=None): dna = SuitDNA.SuitDNA() if name != None: dna.newSuit(name) else: dna.newSuitRandom(type + 1, dept) suit = Suit.Suit() suit.setStyle(dna) suit.generateSuit() suit.pose('neutral', 30) ll = Point3() ur = Point3() suit.update() suit.calcTightBounds(ll, ur) suitWidth = ur[0] - ll[0] suitDepth = ur[1] - ll[1] suitHeight = ur[2] - ll[2] self.rowWidth += suitWidth + suitDepth self.rowHeight = max(self.rowHeight, suitHeight) suit.reparentTo(self.gallery) suit.setHpr(180.0, 0.0, 0.0) profile = Suit.Suit() profile.setStyle(dna) profile.generateSuit() profile.pose('neutral', 30) profile.reparentTo(self.gallery) profile.setHpr(90.0, 0.0, 0.0) self.suitRow.append((type, suitWidth, suit, suitDepth, profile)) self.actors.append(suit) self.actors.append(profile)
def attachSuitHead(node, suitName): suitIndex = SuitDNA.suitHeadTypes.index(suitName) suitDNA = SuitDNA.SuitDNA() suitDNA.newSuit(suitName) suit = Suit() suit.setDNA(suitDNA) headParts = suit.getHeadParts() head = node.attachNewNode('head') for part in headParts: copyPart = part.copyTo(head) copyPart.setDepthTest(1) copyPart.setDepthWrite(1) suit.delete() suit = None p1 = Point3() p2 = Point3() head.calcTightBounds(p1, p2) d = p2 - p1 biggest = max(d[0], d[2]) column = suitIndex % SuitDNA.suitsPerDept s = (0.2 + column / 100.0) / biggest pos = -0.14 + (SuitDNA.suitsPerDept - column - 1) / 135.0 head.setPosHprScale(0, 0, pos, 180, 0, 0, s, s, s) return head
def initGoon(self, dnaName): dna = SuitDNA.SuitDNA() dna.newGoon(dnaName) self.setDNA(dna) self.type = dnaName self.createHead() self.find('**/actorGeom').setH(180)
def switchBoss(self, bossIndex): dna = SuitDNA.SuitDNA() dna.newBossCog(SuitDNA.suitDepts[bossIndex]) self.style = dna self.getGeomNode().getChildren().getPath(0).removeNode() self.generateBossCog() self.initializeDropShadow() if base.wantNametags: self.initializeNametag3d()
def initGoon(self, dnaName): dna = SuitDNA.SuitDNA() dna.newGoon(dnaName) self.setDNA(dna) self.type = dnaName self.createHead() # HACK: rotate the goon to match Panda coordinates self.find("**/actorGeom").setH(180)
def initGoon(self, dnaName): dna = SuitDNA.SuitDNA() dna.newGoon(dnaName) self.setDNA(dna) self.type = dnaName self.createHead() self.find('**/actorGeom').setH(180) self.setBlend(frameBlend=base.settings.getBool( 'game', 'smooth-animations', False))
def setupSuitDNA(self, level, type, track, extraSuit=None): dna = SuitDNA.SuitDNA() if not extraSuit: dna.newSuitRandom(type, track) else: dna.newSuit(extraSuit) self.dna = dna self.track = track self.setLevel(level) return None
def _DistributedSellbotBossAI__makeDoobers(self): self._DistributedSellbotBossAI__resetDoobers() for i in range(8): suit = DistributedSuitAI.DistributedSuitAI(self.air, None) level = random.randrange(len(SuitDNA.suitsPerLevel)) suit.dna = SuitDNA.SuitDNA() suit.dna.newSuitRandom(level=level, dept=self.dna.dept) suit.setLevel(level) suit.generateWithRequired(self.zoneId) self.doobers.append(suit) self._DistributedSellbotBossAI__sendDooberIds()
def __makeSuit(self, dept, type, name = None): """__makeSuit(self, string dept, int type) Creates a single suit of the indicated department and type. Parents the new suit to self.gallery and adds it to self.rowSuits, in both face-on and profile views, and accumulates its width. """ dna = SuitDNA.SuitDNA() if(name!=None): dna.newSuit(name) else: dna.newSuitRandom(type + 1, dept) suit = Suit.Suit() suit.setStyle(dna) suit.generateSuit() suit.pose("neutral", 30) # Compute the maximum extents of the suit. We'll use to # scale all the suits to fit their boxes after we're done. ll = Point3() ur = Point3() suit.update() suit.calcTightBounds(ll, ur) suitWidth = ur[0] - ll[0] suitDepth = ur[1] - ll[1] suitHeight = ur[2] - ll[2] #print "height of %s (%s) is %0.2f" % (dna.name, suit.name, suitHeight) self.rowWidth += suitWidth + suitDepth self.rowHeight = max(self.rowHeight, suitHeight) # Now put the suit in the gallery, once as a head-on, and once # as a profile. suit.reparentTo(self.gallery) suit.setHpr(180.0, 0.0, 0.0) profile = Suit.Suit() profile.setStyle(dna) profile.generateSuit() profile.pose("neutral", 30) profile.reparentTo(self.gallery) profile.setHpr(90.0, 0.0, 0.0) self.suitRow.append((type, suitWidth, suit, suitDepth, profile)) self.actors.append(suit) self.actors.append(profile)
def setupSuitDNA(self, level, type, track): """ setupSuitDNA(self, int level, int type, char track) Creates the suit DNA, according to the indicated level (1..9), type (1..8), and track ("c", "l", "m", "s"). """ dna = SuitDNA.SuitDNA() dna.newSuitRandom(type, track) self.dna = dna self.track = track self.setLevel(level) return None
def __init__(self, air, dept): DistributedAvatarAI.DistributedAvatarAI.__init__(self, air) self.dept = dept self.dna = SuitDNA.SuitDNA() self.dna.newBossCog(self.dept) self.deptIndex = SuitDNA.suitDepts.index(self.dept) self.resetBattleCounters() # These are the toons who will be participating in our # battles. self.looseToons = [] self.involvedToons = [] self.toonsA = [] self.toonsB = [] self.nearToons = [] # These are the suits. self.suitsA = [] self.activeSuitsA = [] self.suitsB = [] self.activeSuitsB = [] self.reserveSuits = [] self.barrier = None # This is the list of state transitions that will be logged in # the event manager. self.keyStates = [ 'BattleOne', 'BattleTwo', 'BattleThree', 'Victory', ] # Accumulated hits on the boss during the climactic final # battle (battle three) self.bossDamage = 0 self.battleThreeStart = 0 self.battleThreeDuration = 1800 # Expected battle 3 time in seconds # What attack code the boss has currently selected. self.attackCode = None self.attackAvId = 0 # The number of times we are hit during one dizzy spell. self.hitCount = 0 AllBossCogs.append(self)
def __init__(self, air, suitPlanner): DistributedAvatarAI.DistributedAvatarAI.__init__(self, air) SuitBase.SuitBase.__init__(self) self.sp = suitPlanner self.maxHP = 10 self.currHP = 10 self.zoneId = 0 self.dna = SuitDNA.SuitDNA() self.virtual = 0 self.skeleRevives = 0 self.maxSkeleRevives = 0 self.reviveFlag = 0 self.buildingHeight = None return
def _DistributedLawbotBossAI__makeLawyers(self): self._DistributedLawbotBossAI__resetLawyers() lawCogChoices = ['b', 'dt', 'ac', 'bs', 'sd', 'le', 'bw'] for i in range(self.numLawyers): suit = DistributedLawbotBossSuitAI.DistributedLawbotBossSuitAI( self.air, None) suit.dna = SuitDNA.SuitDNA() lawCog = random.choice(lawCogChoices) suit.dna.newSuit(lawCog) suit.setPosHpr(*ToontownGlobals.LawbotBossLawyerPosHprs[i]) suit.setBoss(self) suit.generateWithRequired(self.zoneId) self.lawyers.append(suit) self._DistributedLawbotBossAI__sendLawyerIds()
def __makeLawyers(self): self.__resetLawyers() lawCogChoices = ['le', 'bw'] for i in xrange(self.numLawyers): suit = DistributedLawbotBossSuitAI.DistributedLawbotBossSuitAI( self.air, None) suit.dna = SuitDNA.SuitDNA() lawCog = random.choice(lawCogChoices) #if (i == 0): lawCog = 'bw' #Cog 8 #elif (i == 1): lawCog = 'le' #Cog 7 #elif (i == 2): lawCog = 'le' #Cog 6 #elif (i == 3): lawCog = 'le' #Cog 5 #elif (i == 4): lawCog = 'bw' #Cog 4 #elif (i == 5): lawCog = 'bw' #Cog 3 #elif (i == 6): lawCog = 'le' #Cog 2 #elif (i == 7): lawCog = 'b' #Cog 1 #elif (i == 8): lawCog = 'bw' #Cog 9 #elif (i == 9): lawCog = 'bw' #Cog 10 #elif (i == 10): lawCog = 'le' #Cog 8m #elif (i == 11): lawCog = 'bw' #Cog 7m #elif (i == 12): lawCog = 'bw' #Cog 6m #elif (i == 13): lawCog = 'le' #Cog 5m #elif (i == 14): lawCog = 'le' #Cog 4m #elif (i == 15): lawCog = 'le' #Cog 3m #elif (i == 16): lawCog = 'bw' #Cog 2m #elif (i == 17): lawCog = 'bw' #Cog 1m #lif (i == 18): lawCog = 'le' #Cog 9m #elif (i == 19): lawCog = 'le' #Cog 10m #elif (i == 20): lawCog = 'le' #Cog 21 #elif (i == 21): lawCog = 'le' #Cog 22 suit.dna.newSuit(lawCog) suit.setPosHpr(*ToontownGlobals.LawbotBossLawyerPosHprs[i]) suit.setBoss(self) suit.generateWithRequired(self.zoneId) self.lawyers.append(suit) self.__sendLawyerIds() return
def setDNAString(self, dnaString): self.dna = SuitDNA.SuitDNA() self.dna.makeFromNetString(dnaString) self.setDNA(self.dna)
def setDNAString(self, dnaString): self.dna = SuitDNA.SuitDNA() self.dna.makeFromNetString(dnaString) self.setDNA(self.dna) self.setBlend(frameBlend=True)