Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 24th, 2012  |  syntax: None  |  size: 2.59 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class GuardScorpionAI(AIController):
  2.    
  3.     def setup(self):
  4.         self.entity.set_stat("mdf", 256)
  5.         self.stage = 0
  6.         self.count = 0
  7.         self.warning = 0
  8.         self.s_def = self.entity.get_stat("def")
  9.         self.s_mdf = self.entity.get_stat("mdf")
  10.        
  11.     def main(self):
  12.         if self.count == 0 or self.count == 2:
  13.             target = self.entity.get_random_opponent()
  14.             attack = self.search_scope
  15.             self.count += 1
  16.            
  17.         elif self.count == 1 or self.count == 3:
  18.             target = self.target
  19.             if (self._chance(1, 3)):
  20.                 attack = self.scorpion_tail
  21.             else:
  22.                 if self.entity.get_cur("hp") < (self.entity.get_max("hp") * 0.5):
  23.                     attack = self.scorpion_tail
  24.                 else:
  25.                     attack = self.rifle
  26.             self.count += 1
  27.            
  28.         elif self.count == 4:
  29.             self.entity.set_stat("def", 255)
  30.             self.entity.set_stat("mdf", 384)
  31.             self.stage = 1
  32.             if (self.warning == 0):
  33.                 # TODO: PRINT MESSAGES TO BATTLESCREEN
  34.                 self.warning = 1
  35.             self.count += 1
  36.            
  37.         elif self.count == 5 or self.count == 6:
  38.             self.count += 1
  39.            
  40.         elif self.count == 7:
  41.             target = self.entity
  42.             attack = self.empty_attack
  43.             self.entity.set_stat("def", self.s_def)
  44.             self.entity.set_stat("mdf", self.s_mdf)
  45.             self.stage = 0
  46.             self.count = 0
  47.            
  48.         attack(target)
  49.    
  50.     def counter(self, target):
  51.         if (self.stage == 1):
  52.             target = self.entity.get_all_opponents
  53.             attack = self.tail_laser
  54.         else:
  55.             target = None
  56.             attack = self.empty_attack(target)        
  57.         attack(target)    
  58.    
  59.     def rifle(self, target):
  60.         formula = PHYSICAL
  61.         power = self.entity.get_base(formula)
  62.         hit = 100
  63.         target = SINGLE_OPPONENT
  64.         element = "shoot"
  65.    
  66.     def scorpion_tail(self, target):
  67.         formula = PHYSICAL
  68.         power = self.entity.get_base(formula) * 1.75
  69.         hit = 95
  70.         target = SINGLE_OPPONENT
  71.         element = "shoot"
  72.    
  73.     def search_scope(self, target):
  74.         self.target = target
  75.    
  76.     def tail_laser(self, target):
  77.         formula = PHYSICAL
  78.         power = self.entity.get_base(formula) * 3
  79.         hit = 120
  80.         target = ALL_OPPONENTS
  81.         element = "shoot"
  82.    
  83.     attacks = [rifle, search_scope, scorpion_tail]