예제 #1
0
 def __init__(self, radius=3):
     self.tree = Root(
         Selection(
             Sequence(
                 WithinPlayerFov(),
                 WithinRadius(radius=radius),
                 SeekTowardsLInfinityRadius(radius=radius)
             ),
             Sequence(
                 Negate(NumberOfEntities(radius=2, species=Species.UNDEAD, number_of_entities=4)),
                 CoinFlip(p=0.3),
                 SpawnEntity(bestiary.generate_random_zombie, min_time=0, max_time=0),
             ),
             Sequence(
                 InNamespace(name="target"),
                 IsAdjacent(),
                 Attack()
             ),
             Sequence(
                 InNamespace(name="target"),
                 WithinPlayerFov(),
                 CastSpell(spell=tome.magic_missile)
             ),
             DoNothing()
         )
     )
예제 #2
0
 def __init__(self):
     self.tree = Root(
         Selection(
             Sequence(
                 Negate(InNamespace(name="summoned_goblins")),
                 CheckHealthStatus(HealthStates.INJURED),
                 SpawnEntity(bestiary.goblin, min_time=0, max_time=0),
                 SpawnEntity(bestiary.goblin, min_time=0, max_time=0),
                 SetNamespace(name="summoned_goblins")
             ),
             Sequence(
                 Negate(InNamespace(name="summoned_orcs")),
                 CheckHealthStatus(HealthStates.BADLY_INJURED),
                 SpawnEntity(bestiary.orc, min_time=0, max_time=0),
                 SpawnEntity(bestiary.orc, min_time=0, max_time=0),
                 SetNamespace(name="summoned_orcs")
             ),
             Sequence(
                 Negate(InNamespace(name="summoned_trolls")),
                 CheckHealthStatus(HealthStates.NEAR_DEATH),
                 SpawnEntity(bestiary.troll, min_time=0, max_time=0),
                 SpawnEntity(bestiary.troll, min_time=0, max_time=0),
                 SetNamespace(name="summoned_trolls")
             ),
             Sequence(
                 InNamespace(name="target"),
                 IsAdjacent(),
                 Attack()
             ),
             Sequence(
                 WithinPlayerFov(),
                 MoveTowardsTargetEntity()
             )
         )
     )
예제 #3
0
 def __init__(self, skittering_range=3):
     self.skittering_range = skittering_range
     self.tree = Root(
         Selection(
             Sequence(
                 IsAdjacent(),
                 Attack()),
             Sequence(
                 WithinL2Radius(radius=skittering_range),
                 MoveTowardsTargetEntity()),
             Skitter()))
예제 #4
0
 def __init__(self, sensing_range=12):
     self.sensing_range = sensing_range
     self.tree = Root(
         Selection(
             Sequence(
                 IsAdjacent(),
                 Attack()),
             Sequence(
                 WithinL2Radius(radius=sensing_range),
                 MoveTowardsTargetEntity()),
             TravelToRandomPosition()))
예제 #5
0
 def __init__(self, previous_ai, number_of_turns=10):
     self.number_of_turns = number_of_turns
     self.tree = Root(
         Selection(
             Sequence(
                 IsFinished(number_of_turns),
                 ChangeAI(previous_ai)
             ),
             Sequence(
                 IsAdjacent(),
                 Attack()),
             Skitter()))
예제 #6
0
 def __init__(self):
     self.tree = Root(
         Selection(
             Sequence(
                 InNamespace(name="target"),
                 IsAdjacent(),
                 Attack()
             ),
             Sequence(
                 InNamespace(name="target"),
                 TargetWithinRange(),
                 Attack()
             ),
             Sequence(
                 WithinPlayerFov(),
                 MoveTowardsTargetEntity()),
             Sequence(
                 InNamespace(name="target_point"),
                 MoveTowardsPointInNamespace(name="target_point")),
             TravelToRandomPosition()
         )
     )
예제 #7
0
 def __init__(self):
     self.tree = Root(
         Selection(
             Sequence( #Do something to entity in spot
                 OtherEntityInSameSpot(),
                 Selection(
                     Sequence(
                         IsItemInSpot(),
                         PickUp()
                     ),
                     Sequence(
                         IsCorpseInSpot(),
                         Disolve()
                     ),
                     Sequence(
                         IsNPCInSpot(),
                         Attack()
                     ),
                 ),
             ),
             Sequence( #Do something to entity adject
                 IsNPCAdjacent(),
                 Selection(
                     Sequence(
                         IsNPCParalyzed(),
                         Envelop()
                     ),
                     Sequence(
                         InNamespace(name="target"),
                         IsAdjacent(),
                         Attack()
                     ),
                 )
             ),
             Sequence( #Shuffle along
                 Skitter()
             )
         ))
예제 #8
0
 def __init__(self, move_towards_radius=6, species=Species.NONDESCRIPT):
     self.tree = Root(
         Selection(
             Sequence(
                 IsAdjacent(),
                 Attack()),
             Sequence(
                 WithinL2Radius(radius=move_towards_radius),
                 MoveTowardsTargetEntity()),
             Sequence(
                 FindNearestTargetEntity(species=species, radius=move_towards_radius),
                 MoveTowardsTargetEntity(),
             ),
             Swarm(species=Species.ZOMBIE),
             Skitter()))
예제 #9
0
    def __init__(self, species=Species.NONDESCRIPT):

        self.target_species= species

        self.tree = Root(
            Selection(
                Sequence(
                    InNamespace(name="target"),
                    IsAdjacent(),
                    Attack()),
                Sequence(
                    InNamespace(name="target"),
                    MoveTowardsTargetEntity()),
                Sequence(
                    FindNearestTargetEntity(species=self.target_species),
                    MoveTowardsTargetEntity(),
                ),
                TravelToRandomPosition()))
예제 #10
0
    def __init__(self, radius=4, guard_point=None):
        self.radius = radius

        self.tree = Root(
            Selection(
                Sequence(
                    InNamespace(name="target"),
                    IsAdjacent(),
                    Attack()),
                Sequence(
                    WithinPlayerFov(),
                    MoveTowardsTargetEntity()),
                Sequence(
                    PointToTarget(guard_point, "radius_point"),
                    OutsideL2Radius(self.radius),
                    MoveTowardsPointInNamespace(name="radius_point")
                ),
                Skitter()))
예제 #11
0
 def __init__(self, spawn, min_time=5, max_time=10):
     number_of_turns = randint(min_time, max_time)
     self.tree = Root(
         Selection(
             Sequence(
                 SpawnEntity(spawn, min_time=min_time, max_time=max_time)
             ),
             Sequence(
                 InNamespace(name="target"),
                 IsAdjacent(),
                 Attack()
             ),
             Sequence(
                 WithinPlayerFov(),
                 MoveTowardsTargetEntity()
             ),
         )
     )
예제 #12
0
 def __init__(self, species=None, radius=3):
     self.tree = Root(
         Selection(
             Sequence(
                 FindEntities(species=species, radius=radius),
                 InNamespace(name="entities"),
                 Heal()
             ),
             Sequence(
                 WithinPlayerFov(),
                 WithinRadius(radius=radius),
                 SeekTowardsLInfinityRadius(radius=radius)
             ),
             Sequence(
                 InNamespace(name="target"),
                 IsAdjacent(),
                 Attack()
             ),
             Swarm(species=species),
             Skitter()
         )
     )
예제 #13
0
 def __init__(self, radius=3):
     self.tree = Root(
         Selection(
             Sequence(
                 InNamespace(name="target"),
                 WithinRadius(radius=radius),
                 SeekTowardsLInfinityRadius(radius=radius)
             ),
             Sequence(
                 InNamespace(name="target"),
                 TargetWithinRange(),
                 Attack()
             ),
             Sequence(
                 InNamespace(name="target"),
                 MoveTowardsTargetEntity()
             ),
             Sequence(
                 InNamespace(name="target_point"),
                 MoveTowardsPointInNamespace(name="target_point")),
             TravelToRandomPosition()
         )
     )