コード例 #1
0
    def Tick(self):
        # check to see if anyone has been "eliminated" by falling off the tabletop
        for each in self.players:
            if plus.getLocation(each)[1] < -6:
                plus.eliminatePlayer(each)

        return Arenas.SuperArena.Tick(self)
コード例 #2
0
    def Tick(self):
        # do our stuff here
        if self.bHazardsOn:
            self.spikes1.Tick()
            self.spikes2.Tick()
            self.grate.Tick()

        # check to see if anyone has been "eliminated" by falling off the tabletop
        for each in self.players:
            if plus.getLocation(each)[1] < -2:
                plus.eliminatePlayer(each)

        return Arenas.SuperArena.Tick(self)
コード例 #3
0
    def Tick(self):
        # check to see if anyone has been "eliminated" by falling off the tabletop
        for each in self.players:
            if plus.getLocation(each)[1] < -4:
                plus.eliminatePlayer(each)

        if self.bHazardsOn:
            self.flame1a.Tick()
            self.flame1b.Tick()
            self.flame2a.Tick()
            self.flame2b.Tick()
            self.flame3a.Tick()
            self.flame3b.Tick()
            self.flame4a.Tick()
            self.flame4b.Tick()

        return Arenas.SuperArena.Tick(self)
コード例 #4
0
    def Tick(self):
        # check to see if anyone has been "eliminated" by falling into a pit
        for each in self.players:
            if plus.getLocation(each)[1] < -1.5 and not plus.isEliminated(
                    each):
                plus.eliminatePlayer(each)

        if self.bHazardsOn:
            self.Hell1.Tick()
            self.Hell2.Tick()
            self.Hammer1.Tick()
            self.Hammer2.Tick()
            self.Pit1.Tick()
            self.Pit2.Tick()
            self.Pit3.Tick()
            self.Pit4.Tick()

        return Arenas.SuperArena.Tick(self)
コード例 #5
0
ファイル: bbeans.py プロジェクト: egold555/RobotArenaMod
    def Tick(self):
        self.wallmaster += 1

        for each in self.players:
            if plus.getLocation(each)[1] < -0.6 and (
                    abs(plus.getLocation(each)[0]) > 11.3
                    or abs(plus.getLocation(each)[2]) > 11.3):
                plus.eliminatePlayer(each)
            if abs(plus.getLocation(each)[0]) < 1.8 and abs(
                    plus.getLocation(each)[2]) < 1.8 and plus.getLocation(
                        each)[1] < -0.5 and self.wallmaster < 370:
                self.wallmaster = 370

        if self.wallmaster == 370:
            self.retractsound = plus.createSound("Sounds/liftmotor.wav", False,
                                                 (0, 0, 0))
            plus.playSound(self.retractsound)
        if self.wallmaster > 370 and self.wallmaster < 390:
            self.SetPinned("bladewall", False)
            self.prism.Lock(False)
            self.prism.ApplyForce(50)

        return Arenas.SuperArena.Tick(self)
コード例 #6
0
ファイル: MultiBotAttacker.py プロジェクト: apanx/RA2_AI
    def Tick(self):
#        self.DebugString(4, "self.Timer_A: "+  str(self.Timer_A))
#        self.DebugString(5, "self.Timer_B: "+ str(self.Timer_B))
#        self.DebugString(6, "self.Enemy_1: "+ str(self.Enemy_1))
#        self.DebugString(7, "self.ALLY: "+ str(self.ALLY))


        ####--- Find out who's who: (Friend or Foe) -------------------------------------
        if self.ALLY > 3:  # If our ALLY is NOT FOUND yet.
            enemy, e_range = self.GetNearestEnemy()

            if self.Bot_ID_Locker_A == False:  # Find Enemy_1
                self.Enemy_1 = enemy
                self.Bot_ID_Locker_A = True

            if enemy  is not  self.Enemy_1:      # Find Enemy_2
                if self.Bot_ID_Locker_B == False:
                    self.Enemy_2 = enemy
                    self.Bot_ID_Locker_B = True

                    self.List_Of_Bots = list(plus.getPlayers())  # Find out who your friend is.
                    self.List_Of_Bots.remove(self.Enemy_1)
                    self.List_Of_Bots.remove(self.Enemy_2)
                    self.List_Of_Bots.remove(self.GetID())
                    for lastbot in self.List_Of_Bots:
                        self.ALLY = lastbot




       ############--- MAIN BOT CONTROL -------#############---
        if self.Timer_A <= self.Delay_Till_Engage:
            self.Timer_A += 1
            enemy, range = self.GetNearestEnemy()


         # If enemy is still too close, then 'Engage' now.
        if self.Timer_A == 10:
            if range < 3:
                self.RemoveTactic("DeBaiter")
                self.tactics.append(Tactics.Engage(self))
                self.Timer_A = self.Delay_Till_Engage + 1  # By-Pass the 2 coding sections below.

        # If enemy is NOT too close.... take a break.
        if self.Timer_A == 11:
             if range > 3:
                plus.disable(self.GetID(), 1) # Disable.
                plus.playSound(self.LiftTing)

        if self.Timer_A >= self.Delay_Till_Engage    or  range < 4:  # Engage in batttle.
                self.RemoveTactic("DeBaiter")
                self.tactics.append(Tactics.Engage(self))
                plus.disable(self.GetID(), 0) # Enable.






        ####--- AVOIDING FRIENDLY FIRE  -------------------------------------
        if self.Timer_A > 12:
            if self.ALLY < 4: # If our ALLY is FOUND, then AVOID him.
                if self.GetDistanceToID(self.ALLY) < 3:  # Try to avoid your Friend.
                    self.RemoveTactic("Engage")
                    self.tactics.append(MadTactics.DeBaiter(self))
                    self.Timer_A = 0  # Reset Timer.




            # Evade-----
            #if self.Scram_Mode == True   or plus.getHealth(self.GetID(), 0) < .1:
            if plus.getHealth(self.GetID(), 0) < .1:
                self.RemoveTactic("Engage")
                self.tactics.append(MadTactics.Evade(self))
                plus.playSound(self.LiftTing)







 #       if plus.getHealth(self.GetID(), 0) < .01:  # Temporary...
 #           plus.disable(self.GetID(), 1) # Disable this bot.
 #           plus.eliminatePlayer(self.GetID())

        if plus.isEliminated(self.GetID()): # If this AI is eliminated, then:
            plus.disable(self.GetID(), 1) # Disable this bot.
            plus.eliminatePlayer(self.GetID())

        if plus.isDefeated(self.GetID()): # If this AI  is defeated, then:
            plus.disable(self.GetID(), 1) # Disable this bot.
            plus.eliminatePlayer(self.GetID())




        #tactic = [x for x in self.tactics if x.name == "DeBaiter"]
        #if len(tactic) =="DeBaiter":
        #if tactic =="DeBaiter":
#        if self.tactics =="DeBaiter":
#            plus.playSound(self.LiftTing)







#        if plus.getGameType() == "TEAM MATCH":
#            plus.playSound(self.LiftTing)

#            plus.getLocation(self.GetID()) #  Get this AI's location.
#            plus.getLocation(self.ALLY) #  Get ALLY's location.

#        if plus.getGameType() == "TABLETOP":
#           self.tactics.append(Tactics.AvoidEdges(self))
 #            self.king_of_hill = (plus.getGameType() == "TEAM MATCH")

#            plus.getLocation(self.GetID()) #  Get this AI's location.
#            self.ThisAI = self.GetID()
#
#            #e_range = self.GetDistanceToID(enemy)
#            if enemy  e_range < 3





        ####--- WEAPONS -------------------------------------
        if self.GetDistanceToID(self.ALLY) > 2:  # Do NOT attack your Friend.
            if self.weapons:

                # spin up depending on enemy's range
                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)

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

                # slight delay between firing
                if self.reloadTime > 0: self.reloadTime -= 1

                if len(targets) > 0 and self.reloadTime <= 0:
                    try:
                        trigger = self.triggerIterator.next()
                    except StopIteration:
                        self.triggerIterator = iter(self.triggers)
                        trigger = self.triggerIterator.next()

                    self.Input(trigger, 0, 1)
                    self.reloadTime = self.reloadDelay

        return AI.SuperAI.Tick(self)