Example #1
0
    def Tick(self):
        if AI.SuperAI.debugging:
            speed = self.GetSpeed()
            self.DebugString(4, "Speed = " + str(speed))

            turning_speed = self.GetTurning()
            self.DebugString(5, "TSpeed = " + str(turning_speed))

            self.DebugString(6, str(self.GetLocation()))

        Me = self.GetID()
        plus.force(Me, 0, 500 * plus.getWeight(Me), 0)

        return AI.SuperAI.Tick(self)
Example #2
0
    def Tick(self):
        #self.announcetimer -= .25
        if self.chargetimer == 0.0 and self.NumBotsInRange() == 1:
            self.Zap()

        if self.zaptimer > 0.0:
            self.zaptimer -= .25
            if self.zaptimer <= 0.0:
                self.zaptimer = 0.0
                self.zapping = []
                plus.stopSound(self.zapsound)
            elif self.zaptimer > 0.0:
                for bot in self.zapping:
                    if not plus.isMatchPaused() and not plus.isMatchOver():
                        plus.damage(bot, 0, 25, plus.getLocation(bot))
                        if self.sensors[bot]:
                            plus.force(bot, 0, 115 * plus.getWeight(bot), 0)

        if self.chargetimer > 0.0:
            self.chargetimer -= .25
        elif self.chargetimer < 0.0:
            self.chargetimer = 0.0
Example #3
0
    def Secret(self, bTarget):
        #This is definitely NOT a secret super death AI for Spinner from the west!!!  You don't need to scroll down any further!!!
        # Tauntauns
        if self.numComps > 0:
            if plus.getTimeElapsed() < 3:
                self.tauntbox.get("taunt1").setText("I have been waiting a long time for this.")
            if 3 < plus.getTimeElapsed() < 5:
                self.tauntbox.get("taunt1").setText("Go on, squirm!")
            if 5 < plus.getTimeElapsed() < 8:
                self.tauntbox.get("taunt1").setText("Just try and budge that useless hood ornament you call a weapon!")
            if 8 < plus.getTimeElapsed() < 10:
                self.tauntbox.get("taunt1").setText("Squirm like the worm you are!")
            if 10 < plus.getTimeElapsed() < 12:
                self.tauntbox.get("taunt1").setText("Your struggles will not avail you...")
            if 12 < plus.getTimeElapsed() < 16:
                self.tauntbox.get("taunt1").setText("...against the power of the EYE OF THE WEST!")
            if 16 < plus.getTimeElapsed() < 18:
                self.tauntbox.get("taunt1").setText("Long have I tolerated your abuse, but NO LONGER!")
            if 18 < plus.getTimeElapsed() < 22:
                self.tauntbox.get("taunt1").setText("With the power of the Western Eye at my command, I AM INVINCIBLE!")
            if 22 < plus.getTimeElapsed() < 24:
                self.tauntbox.get("taunt1").setText("Now... suffer.")
            if 24 < plus.getTimeElapsed() < 27:
                self.tauntbox.get("taunt1").setText("Know the black depths of pain you have inflicted upon me!")
            if 27 < plus.getTimeElapsed() < 29:
                self.tauntbox.get("taunt1").setText("FEEL THE WRATH OF THE WEST!")
            if 29 < plus.getTimeElapsed() < 32:
                self.tauntbox.get("taunt1").setText("HA HA HA HA HA HA HA HA HA HA HA HA HA...")

        #stay put unless we're being counted out
        if not self.bImmobile:
            self.Throttle(0)

        for bot in self.bids:
            #cool psychic lightning effects
            self.arena.SetLightningStartEnd(bot, self.GetLocation(), plus.getLocation(bot))
            self.zaptimer += 1
            if self.zaptimer > 4:
                plus.zap(bot, 20, 1)
                self.zaptimer = 0

            #apply more force as bots get further from center
            self.xforce = -1 * plus.getLocation(bot)[0] * plus.getWeight(bot)
            self.yforce = -30 * (plus.getLocation(bot)[1] - self.yCenter) * plus.getWeight(bot)
            self.zforce = -1 * plus.getLocation(bot)[2] * plus.getWeight(bot)

            plus.force(bot, self.xforce, self.yforce, self.zforce)

            #summon THE EYE OF THE WEST
            if abs(plus.getLocation(bot)[0]) < 2 and abs(plus.getLocation(bot)[2]) < 2 and self.eyetimer == 0:
                self.summon = 1
                plus.removeSound(self.psygrab)

        if self.summon == 1 and self.eyetimer < 17:
            self.eyetimer += 0.25
        if 0 < self.eyetimer <= 8 and self.eyetimer%1 == 0:
            plus.AddParticleEmitter((4*math.cos((math.pi/8)*self.eyetimer), (self.yCenter - 6), 4*math.sin((math.pi/8)*self.eyetimer)), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((4*math.cos((math.pi/8)*self.eyetimer + math.pi), (self.yCenter - 6), 4*math.sin((math.pi/8)*self.eyetimer + math.pi)), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 9:
            plus.AddParticleEmitter((1, (self.yCenter - 6), 3), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-1, (self.yCenter - 6), -3), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 10:
            plus.AddParticleEmitter((1.6, (self.yCenter - 6), 2), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-1.6, (self.yCenter - 6), -2), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 11:
            plus.AddParticleEmitter((1.9, (self.yCenter - 6), 1), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-1.9, (self.yCenter - 6), -1), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 12:
            plus.AddParticleEmitter((2, (self.yCenter - 6), 0), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-2, (self.yCenter - 6), 0), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 13:
            plus.AddParticleEmitter((1.9, (self.yCenter - 6), -1), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-1.9, (self.yCenter - 6), 1), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 14:
            plus.AddParticleEmitter((1.6, (self.yCenter - 6), -2), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-1.6, (self.yCenter - 6), 2), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 15:
            plus.AddParticleEmitter((1, (self.yCenter - 6), -3), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.AddParticleEmitter((-1, (self.yCenter - 6), 3), (0, 3, 0), (1, 5, 1)).SetEmitting(True)
            plus.playSound(self.flamepuff)
        if self.eyetimer == 16:
            plus.AddParticleEmitter((0, (self.yCenter - 6), 0), (0, 16, 0), (1, 16, 1)).SetEmitting(True)
            plus.playSound(self.eye)
            plus.removeSound(self.flamepuff)
            self.timetodie = 1

        #remove enemy components one by one
        if self.timetodie == 1:
            if self.numComps > 0:
                self.numComps -= 0.25
                if self.numComps%1 == 0:
                    plus.addPoints(self.GetID(), 1337)
                    for bot in self.bids:
                        if self.numComps > 0:
                            plus.emitSmoke(30, (plus.getLocation(bot)), (0, 0, 0), (5, 5, 5))
                            plus.damage(bot, self.numComps, 100000, plus.getLocation(bot))
                            plus.damage(bot, self.numComps, 100000, plus.getLocation(bot))
                            plus.addPoints(bot, -1000)

        #finishing blow
        if self.numComps == 0:
            if self.smoker == 32:
                plus.removeSound(self.eye)
                plus.fadeInToLoop(self.finale, -100, 3200)
                self.tauntbox.get("taunt1").setText("Do you hear that sound? Know what it is?")
            if self.smoker > 1:
                self.smoker -= 0.5
            self.smoketimer += 0.1
            self.smokeh = (self.yCenter - 6) + (6 * ((1 / self.smoker) ** 2))

            #SMOKE TORNADO
            plus.emitSmoke(30, ((self.smoker * (math.cos((math.pi/4) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((math.pi/4) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((math.pi/2) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((math.pi/2) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((3*math.pi/4) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((3*math.pi/4) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((math.pi) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((math.pi) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((5*math.pi/4) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((5*math.pi/4) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((3*math.pi/2) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((3*math.pi/2) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((7*math.pi/4) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((7*math.pi/4) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))
            plus.emitSmoke(30, ((self.smoker * (math.cos((2*math.pi) + self.smoketimer))), self.smokeh, (self.smoker * (math.sin((2*math.pi) + self.smoketimer)))), (0, 0, 0), (5, 8, 5))

            if self.smoker == 24:
                self.tauntbox.get("taunt1").setText("That is the sound of your death approaching.")
            if self.smoker == 16:
                self.tauntbox.get("taunt1").setText("At last... vengeance shall be mine.")
            if self.smoker == 8:
                self.tauntbox.get("taunt1").setText("HA HA HA HA HA HA HA HA HA HA HA HA HA...")
            if self.smoker == 2:
                plus.stopAllSounds()
                plus.playSound(self.charge)
            if self.smoker == 1:
                plus.removeSound(self.charge)
                plus.playSound(self.bang)
                self.smoker = 0.9
                plus.fadeFromBlack(6)
                for bot in self.bids:
                    #must un-disable bots in order to kill them
                    plus.disable(bot, 0)
                    self.arena.SetLightningVisible(bot, False)
                    plus.damage(bot, 0, 100000, plus.getLocation(bot))
                    plus.damage(bot, 0, 100000, plus.getLocation(bot))
                    plus.damage(bot, 0, 100000, plus.getLocation(bot))
                    plus.damage(bot, 0, 100000, plus.getLocation(bot))
                    #reset numLosses
                    file("adaptiveAI_2.txt", "w").write("0")
Example #4
0
    def Tick(self):
        #@@@@@@@@@@@@@@@@@@@@@@
        for trigger in self.triggers:
            self.Input(trigger, 0, 0)
        Target, range = self.GetNearestEnemy()
        if Target != None:
            Winkel = (self.GetHeadingToID(Target, False) +
                      self.GetMotorAngle(self.Motor))
            self.DebugString(6, str(self.GetHeadingToID(Target, False)))
            self.DebugString(7, str(-self.GetMotorAngle(self.Motor)))
            self.DebugString(8, str(Winkel))
            if self.AimTowards(Winkel):
                for trigger in self.triggers:
                    self.Input(trigger, 0, 1)
        #@@@@@@@@@@@@@@@@@@@@@@

        #WWWWWWWWWWW
        # 3 looping timers for sequential weapon activation (with Bindings input)
        self.weptimerA += self.ACounter3thru4
        if self.weptimerA == self.AParameter3thru4:
            self.weptimerA = 0

        self.weptimerB += self.BCounter5thru8
        if self.weptimerB == self.BParameter5thru8:
            self.weptimerB = 0

        self.weptimerC += self.CCounter1thru7
        if self.weptimerC == self.CParameter1thru7:
            self.weptimerC = 0
        #WWWWWWWWWWW

        #AAAAAAAAAAAAAAAAA
        if self.altitude > 0:  # If there's an 'altitude' entry in Bindings...
            self.ongoingtimerAA += 1

            if self.ongoingtimerAA < 2:
                self.floor = self.GetLocation()[1]

            if self.GetLocation(
            )[1] < self.floor + self.altitude:  # "self.altitude" added for Bindings input #
                plus.force(0, 0, 100 * plus.getWeight(0), 0)
        #AAAAAAAAAAAAAAAAA

        # fire weapon
        targets = []
        if self.weapons:
            targets = [x for x in self.sensors.itervalues() if x.contacts > 0 \
                and not plus.isDefeated(x.robot)]

        bReturn = AI.SuperAI.Tick(self)

        # call this now so it takes place after other driving commands
        if self.whipFunction: self.whipFunction(len(targets) > 0)

        enemy, range = self.GetNearestEnemy()

        if enemy is not None and range < self.spin_range:
            self.Input("Spin", 0, 1)
        elif self.GetInputStatus("Spin", 0) != 0:
            self.Input("Spin", 0, 0)

        return bReturn
Example #5
0
 def Tick(self):
     Me = self.GetID()
     plus.force(Me, 0, 85 * plus.getWeight(Me), 0)
     self.DebugString(6, str(self.GetLocation()))
     return AI.SuperAI.Tick(self)