home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Scripts / Combat.py < prev    next >
Encoding:
Text File  |  2000-10-27  |  33.7 KB  |  820 lines

  1.  # General Combat Logic for enemies
  2. import Bladex
  3. import Actions
  4. import pdb
  5. import Reference
  6. import CharStats
  7. import pocimac
  8.  
  9. """
  10. bow attack? --- return
  11. |no
  12. --- WUEA? --- return
  13.     |no
  14.     --- in pause? --- return
  15.         |no
  16.         --- start pause? --- return
  17.             |no
  18.             --- CheckFullAttack? -- dodge
  19. """
  20. # Combat Moves
  21. ATTACK=0     # Melee attack
  22. BLOCK=1      # Block
  23. DODGE=2      # Dodge
  24. MOVE=3       # Positional Move
  25. RANGE=4      # Range Attack
  26. ATTACKDOWN=5 # Melee attack for stairs
  27.  
  28. """
  29. Predefined moves &  sequences
  30. =============================
  31.  
  32. Blocks and Moves
  33. ================
  34. "tr" -- Turn (Strafe) Right
  35. "tl" -- Turn (Strafe) Left
  36. "tb" -- Turn (Strafe) to move behind
  37. "tf" -- Turn (Strafe) to face in front
  38.  
  39. Dodges
  40. ======
  41. "d_r" -- Dodge Right
  42. "d_l" -- Dodge Left
  43. "d_b" -- Dodge Back
  44.  
  45. Attack Sequences
  46. ================
  47. Use () to desgnate a combo sequence, with a comma seperated set of strings inside 
  48. referring to atttack sets / meta-attacks.
  49.  
  50. Special Attack "RespectDistance"
  51.  
  52. Python Functions
  53. ================
  54. If a python function is given, it will expect 1 argument, the entity name, and
  55. should return a boolean specifying whether the action it describes has been 
  56. succesfully performed. If no return value is given, it defaults to true.
  57.  
  58.  
  59. """
  60.  
  61. # return to the default range, for use as a reset function after a temporary move in...
  62. def MoveBackProc (EntityName):
  63.     me=Bladex.GetEntity(EntityName)
  64.     if me and me.Life>0 and me.CombatGroup:                
  65.         if len(me.GetGroupMembers()) > 1 and not me.Data.group_fighter:
  66.             me.CombatDistFlag= 1
  67.         else:
  68.             me.CombatDistFlag= 0
  69.  
  70.  
  71. # If an opening can be seen, move in for a temporary attack.
  72. def TempMoveInProc (EntityName):
  73.     # temporarily move in for close range attacks
  74.     me=Bladex.GetEntity(EntityName)
  75.     MoveInTime= 6.0 # seconds
  76.     if me and me.Life>0 and me.CombatDistFlag==1 and me.ActiveEnemy:
  77.         enemy= Bladex.GetEntity(me.ActiveEnemy)        
  78.         time= Bladex.GetTime()                            
  79.         if Actions.StatR(me.ActiveEnemy) <> Actions.RA_1H_WEAPON or Actions.IsBehindEntity (EntityName, me.ActiveEnemy) or ((time-enemy.LastAttackTime)>me.Data.ImpatientAttackTime):
  80.             me.CombatDistFlag= 0
  81.             Bladex.AddScheduledFunc(Bladex.GetTime() + MoveInTime, MoveBackProc,(EntityName,))
  82.             return 1
  83.     return 0
  84.  
  85. def FearFire (EntityName):
  86.     me=Bladex.GetEntity(EntityName)
  87.     FearTime= 3.0 # seconds
  88.     if me and me.Life>0 and me.CombatDistFlag==0 and me.ActiveEnemy and Actions.has_torch(me.ActiveEnemy) and not Actions.IsBehindEntity(EntityName, me.ActiveEnemy):    
  89.         me.CombatDistFlag= 1
  90.         Bladex.AddScheduledFunc(Bladex.GetTime() + FearTime, MoveBackProc,(EntityName,))
  91.         return 1
  92.     return 0
  93.         
  94.  
  95. def TempMoveOutProc (EntityName):
  96.     # temporarily move away from close range attacks
  97.     me=Bladex.GetEntity(EntityName)
  98.     MoveOutTime= 12.0 # seconds
  99.     if me and me.Life>0 and me.CombatDistFlag==0 and me.ActiveEnemy:
  100.         me.CombatDistFlag= 1
  101.         Bladex.AddScheduledFunc(Bladex.GetTime() + MoveOutTime, MoveBackProc,(EntityName,))
  102.         return 1
  103.     return 0
  104.  
  105.  
  106. # Launch laugh animation if we have one, but don't all laugh at the same time
  107. def Laugh (EntityName):
  108.     me=Bladex.GetEntity(EntityName)
  109.     if me and me.Life>0 and me.CombatGroup:
  110.         memberlist = me.GetGroupMembers()
  111.         for member_name in memberlist:
  112.             member = Bladex.GetEntity(member_name)
  113.             if member and member.Life > 0:
  114.                 if member.AnimName == "laugh":
  115.                     return 0
  116.     me.Wuea=Reference.WUEA_ENDED
  117.     me.LaunchAnmType("laugh")
  118.     return me.AnimName=="laugh"
  119.  
  120. # Launch insult animation if we have one, but don't all insult at the same time    
  121. def Insult (EntityName):
  122.     me=Bladex.GetEntity(EntityName)
  123.     if me and me.Life>0 and me.CombatGroup:
  124.         memberlist = me.GetGroupMembers()
  125.         for member_name in memberlist:
  126.             member = Bladex.GetEntity(member_name)
  127.             if member and member.Life > 0:
  128.                 if member.AnimName == "insult":
  129.                     return 0
  130.     me.Wuea=Reference.WUEA_ENDED
  131.     me.LaunchAnmType("insult")
  132.     if me.AnimName=="insult":
  133.         Actions.UnGraspString(EntityName,"InsultUngrasp")
  134.         return 1
  135.  
  136.     return 0
  137.  
  138. # Launch relax animation if we have one, but don't all relax at the same time    
  139. def Relax (EntityName):
  140.     me=Bladex.GetEntity(EntityName)
  141.     if me and me.Life>0 and me.CombatGroup:
  142.         memberlist = me.GetGroupMembers()
  143.         for member_name in memberlist:
  144.             member = Bladex.GetEntity(member_name)
  145.             if member and member.Life > 0:
  146.                 if member.AnimName == "rlx_f":
  147.                     return 0
  148.     me.Wuea=Reference.WUEA_ENDED
  149.     me.LaunchAnmType("rlx_f")    
  150.     if me.AnimName=="rlx_f":
  151.         Actions.UnGraspString(EntityName,"InsultUngrasp")
  152.         me.Gof=0
  153.         me.Gob=0
  154.         return 1
  155.         
  156.     return 0
  157.  
  158. # for stripping away certain moves when angry, add checks here
  159. def DoneInAnger (move):
  160.     if move[2] == Laugh:
  161.         return 0
  162.     if move[2] == Insult:
  163.         return 0
  164.     return 1
  165.  
  166. # for stripping away certain moves when furious, add checks here, extra to above
  167. def DoneInFury (move):
  168.     if not DoneInAnger (move):
  169.         return 0
  170.     if move[0] == BLOCK:
  171.         return 0
  172.     if move[0] == DODGE:
  173.         return 0
  174.     if move[0] == ATTACK:
  175.         return 0
  176.     return 1
  177.  
  178. def GetAngry (EntityName):
  179.     me=Bladex.GetEntity(EntityName)
  180.     me.BlockingPropensity = 0
  181.     me.AttackList=filter(DoneInAnger,me.AttackList)
  182.     me.Data.Angry = 1
  183.     return 1
  184.  
  185. def GetFurious (EntityName):
  186.     me=Bladex.GetEntity(EntityName)
  187.     if me.Data.Furious == 0:
  188.         me.Data.GetFurious (EntityName)
  189.         return 1
  190.     return 0
  191.  
  192. def GiveOrders (EntityName):
  193.     me=Bladex.GetEntity(EntityName)
  194.     if me and me.Life>0 and me.Data.group_leader and me.CombatDistFlag == 1 and me.CombatGroup:                
  195.         if len(me.GetGroupMembers()) > 1:
  196.             me.LaunchAnmType("order")
  197.             # Kinds of orders
  198.             # Go berserk / Fury
  199.             #me.Data.CallGroupMemberFunc(EntityName, GetFurious, 0)
  200.             # Move In
  201.             me.Data.CallGroupMemberFunc(EntityName, TempMoveInProc, 0)
  202.             return 1
  203.     return 0
  204.  
  205.  
  206. # Use a potion in combat if we have one, and our life is low
  207. def UsePotion (EntityName):
  208.     me=Bladex.GetEntity(EntityName)    
  209.     if me and me.Life >0:
  210.         
  211.         inv = me.GetInventory()
  212.         for x in range (inv.nObjects):
  213.             item_name = inv.GetObject(x)
  214.             item = Bladex.GetEntity(item_name)
  215.             if item.Data and item.Data.__class__==pocimac.Pocima:
  216.                 max_life= CharStats.GetCharMaxLife(me.Kind, me.Level)
  217.                 if (me.Life <= max_life/4.0) or (item.Data.Increment and me.Life+item.Data.Increment<=max_life):
  218.                     # we have found a potion, I hope its the life giving one...
  219.                     me.Data.obj_used=item
  220.                     item.Data.UsedBy = EntityName
  221.                     item.UseFunc(item_name, Actions.USE_FROM_INV)
  222.                     return 1
  223.                     
  224.         
  225.             
  226.     return 0
  227.     
  228. def SetCombatMoveProbability(MoveType, Probability, List):
  229.     if List:
  230.         tot=0.0
  231.         for move in List:
  232.             if move[0]==MoveType:
  233.                 tot= tot+move[1]        
  234.         if tot != Probability:
  235.             for move in List:
  236.                 if move[0]==MoveType:
  237.                     move[1]= (move[1]/tot) * Probability
  238.  
  239. def GetMoveMinDist (MoveType, DesMove, List):
  240.     if List:
  241.         for move in List:
  242.             if move[0]==MoveType and move[2]==DesMove:
  243.                 return move[3]
  244.     raise TypeError, 'Move not found'
  245.  
  246. def GetMoveAveDist (MoveType, DesMove, List):
  247.     if List:
  248.         for move in List:
  249.             if move[0]==MoveType and move[2]==DesMove:
  250.                 return move[4]
  251.     raise TypeError, 'Move not found'
  252.  
  253. def GetMoveMaxDist (MoveType, DesMove, List):
  254.     if List:
  255.         for move in List:
  256.             if move[0]==MoveType and move[2]==DesMove:
  257.                 return move[5]
  258.     raise TypeError, 'Move not found'
  259.  
  260.         
  261. def MagicShield (EntityName):
  262.     #pdb.set_trace()
  263.     me= Bladex.GetEntity(EntityName)
  264.     if me and me.Life>0:
  265.         me.Data.MagicShield (EntityName)
  266.         return 1
  267.     return 0
  268.  
  269. def Disappear (EntityName):
  270.     me= Bladex.GetEntity(EntityName)
  271.     if me and me.Life>0:
  272.         return me.Data.Disappear (EntityName)
  273.     return 0
  274.  
  275. def LaunchFireBall (EntityName):
  276.     me= Bladex.GetEntity(EntityName)
  277.     if me and me.Life>0:
  278.         return me.Data.LaunchFireBall (EntityName)
  279.     return 0
  280.  
  281. def LaunchMissile (EntityName):
  282.     me= Bladex.GetEntity(EntityName)
  283.     if me and me.Life>0:
  284.         return me.Data.LaunchMissile (EntityName)
  285.     return 0
  286.  
  287. def LaunchWeapon (EntityName):
  288.     me= Bladex.GetEntity(EntityName)
  289.     if me and me.Life>0:
  290.         return me.Data.LaunchWeapon (EntityName)
  291.     return 0
  292.  
  293. def KeepDistance (EntityName):
  294.     me= Bladex.GetEntity(EntityName)
  295.     return me.AnimName!="rlx"
  296.     
  297.  
  298. #           Type    Weight  Move                  MinD  BestD  MaxD     Time (s)
  299. ################################################################################
  300. TraitorKnightAttackData = [
  301.            # inner zone blocks:
  302.             [BLOCK,  0.08, (),                   500.0, 1000.0, 3000.0, 0.35],
  303.             [BLOCK,  0.05, "tr",                 750.0, 1500.0, 3500.0, 0.50],
  304.             [BLOCK,  0.05, "tl",                 750.0, 1500.0, 3500.0, 0.50],
  305.             [BLOCK,  0.05, "tb",                 750.0, 1500.0, 3500.0, 0.50],
  306.             [BLOCK,  0.20, "tf",                 750.0, 1500.0, 3500.0, 0.50],
  307.  
  308.            # outer zone blocks:
  309.             [BLOCK,  0.05, "tr",                3500.0, 7000.0, 9000.0, 0.50],
  310.             [BLOCK,  0.05, "tl",                3500.0, 7000.0, 9000.0, 0.50],
  311.             [BLOCK,  0.35, "tb",                3500.0, 7000.0, 9000.0, 0.50],
  312.             [BLOCK,  0.10, "tf",                3500.0, 7000.0, 9000.0, 0.50],
  313.  
  314.            # dodges:
  315.             [DODGE,  0.25, "d_r",                500.0, 1200.0, 2800.0, 0.35],
  316.             [DODGE,  0.25, "d_l",                500.0, 1200.0, 2800.0, 0.35],
  317.             [DODGE,  0.00, "d_b",                500.0, 1200.0, 2800.0, 0.35],
  318.  
  319.            # attacks:
  320.         [ATTACKDOWN, 0.90, ("STAIRS",),         1200.0, 1400.0, 2500.0, 0.35],
  321.  
  322.             [ATTACK, 0.00, ("GA","GA","GA","GM1",), 1200.0, 1400.0, 2500.0, 0.35],
  323.             [ATTACK, 0.50, ("GA",),             1200.0, 1400.0, 2500.0, 0.35],
  324.             [ATTACK, 0.40, ("GM2",),               0.0, 1600.0, 2500.0, 0.35],
  325.             [ATTACK, 0.40, ("GA", "GA"),        1200.0, 1600.0, 2500.0, 0.35],
  326.             [ATTACK, 0.10, ("GA", "GA", "GM1"),    0.0, 1600.0, 2500.0, 0.35],
  327.             [ATTACK, 0.25, ("GM2",),            1200.0, 1800.0, 2500.0, 0.35],
  328.             [ATTACK, 1.00, "RespectDistance",      0.0,  500.0, 2000.0, 1.00],
  329.  
  330.            # inner zone moves:
  331.             [MOVE,   0.05, "tr",                   0.0, 2000.0, 5000.0, 0.50],
  332.             [MOVE,   0.05, "tl",                   0.0, 2000.0, 5000.0, 0.50],
  333.             [MOVE,   0.10, "tb",                   0.0, 2000.0, 5000.0, 0.50],
  334.             [MOVE,   0.25, "tf",                   0.0, 2000.0, 5000.0, 0.50],
  335.  
  336.            # outer zone moves:
  337.             [MOVE,   0.06, "tr",                5001.0, 7000.0, 9000.0, 0.50],
  338.             [MOVE,   0.06, "tl",                5002.0, 7000.0, 9000.0, 0.50],
  339.             [MOVE,   0.15, "tb",                5003.0, 7000.0, 9000.0, 0.50],
  340.             [MOVE,   0.05, "tf",                5004.0, 7000.0, 9000.0, 0.50],
  341.             [MOVE,   0.15, TempMoveInProc,      3000.0, 7000.0, 9000.0, 0.35],
  342.             [MOVE,   0.005, Laugh,              5000.0, 7000.0, 9000.0, 5.00],
  343.             [MOVE,   0.005, Insult,             5000.0, 7000.0, 9000.0, 5.00],
  344.             [MOVE,   0.02, GiveOrders,          5000.0, 7000.0, 9000.0, 1.00],
  345.             [MOVE,   0.05, UsePotion,           3000.0, 7000.0, 9000.0, 1.00],
  346. ]
  347.  
  348. SkeletonAttackData = [
  349.            # inner zone blocks:
  350.             [BLOCK,  0.30, (),                   500.0, 1000.0, 3000.0, 0.35],
  351.             [BLOCK,  0.08, "tr",                 750.0, 1500.0, 3500.0, 0.50],
  352.             [BLOCK,  0.08, "tl",                 750.0, 1500.0, 3500.0, 0.50],
  353.             [BLOCK,  0.08, "tb",                 750.0, 1500.0, 3500.0, 0.50],
  354.             [BLOCK,  0.20, "tf",                 750.0, 1500.0, 3500.0, 0.50],
  355.  
  356.            # outer zone blocks:
  357.             [BLOCK,  0.05, "tr",                3500.0, 7000.0, 9000.0, 0.50],
  358.             [BLOCK,  0.05, "tl",                3500.0, 7000.0, 9000.0, 0.50],
  359.             [BLOCK,  0.10, "tb",                3500.0, 7000.0, 9000.0, 0.50],
  360.             [BLOCK,  0.05, "tf",                3500.0, 7000.0, 9000.0, 0.50],
  361.             
  362.            # attacks:
  363.         [ATTACKDOWN, 1.00, ("STAIRS",),         1200.0, 1600.0, 2500.0, 0.35],
  364.             
  365.             [ATTACK, 0.00, ("GA","GA","GA","GM1",), 1200.0, 1400.0, 2500.0, 0.35],
  366.             [ATTACK, 0.50, ("GA",),             1200.0, 1400.0, 2500.0, 0.35],
  367.             [ATTACK, 0.40, ("GM2",),               0.0, 1600.0, 2500.0, 0.35],
  368.             [ATTACK, 0.40, ("GA", "GA"),        1200.0, 1600.0, 2500.0, 0.35],
  369.             [ATTACK, 0.10, ("GA", "GA", "GM1"),    0.0, 1600.0, 3000.0, 0.35],
  370.             [ATTACK, 0.25, ("GM2",),            1200.0, 1800.0, 2500.0, 0.35],
  371.             [ATTACK, 0.25, ("G22",),            2014.0, 3000.0, 5327.0, 0.35],
  372.             [ATTACK, 1.00, "RespectDistance",      0.0,  500.0, 2000.0, 1.00],
  373.  
  374.            # inner zone moves:
  375.             [MOVE,   0.05, "tr",                   0.0, 2000.0, 5000.0, 0.50],
  376.             [MOVE,   0.05, "tl",                   0.0, 2000.0, 5000.0, 0.50],
  377.             [MOVE,   0.10, "tb",                   0.0, 2000.0, 5000.0, 0.50],
  378.             [MOVE,   0.25, "tf",                   0.0, 2000.0, 5000.0, 0.50],
  379.  
  380.            # outer zone moves:
  381.             [MOVE,   0.01, "tr",                5000.0, 7000.0, 9000.0, 0.50],
  382.             [MOVE,   0.01, "tl",                5000.0, 7000.0, 9000.0, 0.50],
  383.             [MOVE,   0.05, "tb",                5000.0, 7000.0, 9000.0, 0.50],
  384.             [MOVE,   0.02, "tf",                5000.0, 7000.0, 9000.0, 0.50],
  385.             [MOVE,   0.06, TempMoveInProc,      3000.0, 7000.0, 9000.0, 0.35],
  386. ]
  387.  
  388. OrkAttackData =    [ 
  389.            # inner zone blocks:
  390.             [BLOCK,  0.25, (),                   500.0, 1000.0, 3000.0, 0.50],
  391.             [BLOCK,  0.05, "tr",                 750.0, 1500.0, 3500.0, 0.50],
  392.             [BLOCK,  0.05, "tl",                 750.0, 1500.0, 3500.0, 0.50],
  393.             [BLOCK,  0.05, "tb",                 750.0, 1500.0, 3500.0, 0.50],
  394.             [BLOCK,  0.05, "tf",                 750.0, 1500.0, 3500.0, 0.50],
  395.            # total inner zone 0.45
  396.            
  397.            # outer zone blocks:
  398.             [BLOCK,  0.07, (),                  3000.0, 4000.0, 5000.0, 0.50],
  399.             [BLOCK,  0.035,"tr",                3500.0, 7000.0, 9000.0, 0.50],
  400.             [BLOCK,  0.035,"tl",                3500.0, 7000.0, 9000.0, 0.50],
  401.             [BLOCK,  0.245,"tb",                3500.0, 7000.0, 9000.0, 0.50],
  402.             [BLOCK,  0.07, "tf",                3500.0, 7000.0, 9000.0, 0.50],
  403.            # total outer zone 0.455
  404.            
  405.            # dodges:
  406.             [DODGE,  0.30, "d_r",                500.0, 1200.0, 2800.0, 0.35],
  407.             [DODGE,  0.30, "d_l",                500.0, 1200.0, 2800.0, 0.35],
  408.             [DODGE,  0.30, "d_b",                500.0, 1200.0, 2800.0, 0.35],
  409.  
  410.            # attacks:
  411.         [ATTACKDOWN, 1.00, ("STAIRS",),         1200.0, 1800.0, 2500.0, 0.35],
  412.  
  413.             [ATTACK, 0.50, ("GA",),             1200.0, 1400.0, 2500.0, 0.35],
  414.             [ATTACK, 0.40, ("GA", "GA"),           0.0, 1600.0, 2500.0, 0.35],
  415.             [ATTACK, 0.40, ("GA", "GA", "GA"),  1000.0, 1600.0, 2500.0, 0.35],
  416.             [ATTACK, 0.40, ("GA", "GA"),        1200.0, 1600.0, 2500.0, 0.35],
  417.             [ATTACK, 0.10, ("GA", "GA", "GM1"),    0.0, 1600.0, 3000.0, 0.35],
  418.             [ATTACK, 0.25, ("GM2",),            1200.0, 1800.0, 2500.0, 0.35],
  419.             [ATTACK, 1.00, "RespectDistance",      0.0,  500.0, 2000.0, 1.00],
  420.  
  421.            # inner zone moves:
  422.             [MOVE,   0.03, "tr",                   0.0, 2000.0, 5000.0, 0.50],
  423.             [MOVE,   0.03, "tl",                   0.0, 2000.0, 5000.0, 0.50],
  424.             [MOVE,   0.05, "tb",                   0.0, 2000.0, 5000.0, 0.50],
  425.             [MOVE,   0.10, "tf",                   0.0, 2000.0, 5000.0, 0.50],
  426.  
  427.            # outer zone moves:
  428.             [MOVE,   0.03, "tr",                5000.0, 7000.0, 9000.0, 0.50],
  429.             [MOVE,   0.03, "tl",                5000.0, 7000.0, 9000.0, 0.50],
  430.             [MOVE,   0.05, "tb",                5000.0, 7000.0, 9000.0, 0.50],
  431.             [MOVE,   0.03, "tf",                5000.0, 7000.0, 9000.0, 0.50],
  432.             [MOVE,   0.15, TempMoveInProc,      5000.0, 7000.0, 9000.0, 0.35],
  433.             [MOVE,   0.05, UsePotion,           3000.0, 7000.0, 9000.0, 1.00],
  434. ]
  435.  
  436. ChaosKnightAttackData =    [ 
  437.            # inner zone blocks:
  438.             [BLOCK,  0.85, (),                   500.0, 1000.0, 3000.0, 0.35],
  439.                      
  440.            # attacks:
  441.             [ATTACK, 0.02, ("SP1",),            7000.0, 9000.0,50000.0, 0.35],
  442.             [ATTACK, 0.20, ("G01",),            1490.0, 2195.0, 2900.0, 0.35],
  443.             [ATTACK, 0.15, ("G02",),            1410.0, 2105.0, 2800.0, 0.35],
  444.             [ATTACK, 0.10, ("G07",),            1550.0, 2225.0, 2900.0, 0.35],
  445.             [ATTACK, 0.10, ("G08",),            1700.0, 2375.0, 3050.0, 0.35],
  446.             [ATTACK, 0.07, ("G12",),            1850.0, 2525.0, 3200.0, 0.35],
  447.             [ATTACK, 0.07, ("G18",),            3050.0, 3600.0, 3850.0, 0.35],
  448.             [ATTACK, 0.05, ("G31",),            2450.0, 3600.0, 3850.0, 0.35],
  449. ]
  450.  
  451. RagnarAttackData = [ 
  452.            # blocks:
  453.             [BLOCK,  0.25, (),                   500.0, 1000.0, 9000.0, 0.35],
  454.             [BLOCK,  0.10, "tr",                 750.0, 1500.0, 9000.0, 0.35],
  455.             [BLOCK,  0.10, "tl",                 750.0, 1500.0, 9000.0, 0.35],
  456.             [BLOCK,  0.25, "tb",                 750.0, 1500.0, 9000.0, 0.35],
  457.             [BLOCK,  0.15, "tf",                 750.0, 1500.0, 9000.0, 0.35],
  458.  
  459.            # dodges:
  460.             [DODGE,  0.40, ("GDR",),             500.0, 1200.0, 2800.0, 0.35],
  461.             [DODGE,  0.40, ("GDL",),             500.0, 1200.0, 2800.0, 0.35],
  462.             [DODGE,  0.20, ("GDB",),             500.0, 1200.0, 2800.0, 0.35],
  463.  
  464.            # attacks:
  465.             [ATTACK, 0.30, ("G01",),             500.0, 1800.0, 2500.0, 0.35],
  466.             [ATTACK, 0.10, ("G02",),             500.0, 1800.0, 2500.0, 0.35],
  467.             [ATTACK, 0.05, ("G03",),             500.0, 1800.0, 2500.0, 0.35],
  468.             [ATTACK, 0.25, ("G07",),             500.0, 1800.0, 2500.0, 0.35],
  469.             [ATTACK, 0.25, ("G17",),             500.0, 1800.0, 2500.0, 0.35],
  470.             [ATTACK, 0.25, ("G21",),             500.0, 1800.0, 2500.0, 0.35],
  471.  
  472.            # inner zone moves:
  473.             [MOVE,  0.35, ("GDR",),              500.0, 1200.0, 2800.0, 0.35],
  474.             [MOVE,  0.35, ("GDL",),              500.0, 1200.0, 2800.0, 0.35],
  475.             [MOVE,  0.30, ("GDB",),              500.0, 1200.0, 2800.0, 0.35],
  476.             
  477.            # all zone moves:
  478.             [MOVE,   0.05, "tr",                   0.0, 2000.0, 9000.0, 0.35],
  479.             [MOVE,   0.05, "tl",                   0.0, 2000.0, 9000.0, 0.35],
  480.             [MOVE,   0.25, "tb",                   0.0, 2000.0, 9000.0, 0.35],
  481.             [MOVE,   0.05, "tf",                   0.0, 2000.0, 9000.0, 0.35],
  482.  
  483.            # outer zone moves:
  484.             [MOVE,   0.02, Laugh,               5000.0, 7000.0, 9000.0, 5.00],
  485.             [MOVE,   0.02, Insult,              5000.0, 7000.0, 9000.0, 5.00],
  486.             [MOVE,   0.05, UsePotion,           3500.0, 6000.0, 9000.0, 1.00],
  487.  
  488. ]
  489.  
  490. TrollAttackData =    [ 
  491.            # inner zone blocks:
  492.             [BLOCK,  0.80, (),                   500.0, 1750.0, 3000.0, 0.65],
  493.  
  494.            # attacks:                     
  495.             [ATTACKDOWN, 0.90, ("G04",),         650.0, 1225.0, 2150.0, 0.35],
  496.             [ATTACKDOWN, 0.60, ("G18",),        2050.0, 3025.0, 3900.0, 0.35],
  497.  
  498.             [ATTACK, 0.25, ("G01",),            1250.0, 1625.0, 1800.0, 0.35],
  499.             [ATTACK, 0.20, ("G02",),            1000.0, 1500.0, 2000.0, 0.35],
  500.             [ATTACK, 0.15, ("G04",),             650.0, 1225.0, 2050.0, 0.35],
  501.             [ATTACK, 0.15, ("G06",),             950.0, 1405.0, 1860.0, 0.35],
  502.             [ATTACK, 0.10, ("G12",),            2150.0, 2505.0, 2850.0, 0.35],
  503.             [ATTACK, 0.10, ("G18",),            2150.0, 3025.0, 3900.0, 0.35],
  504.             [ATTACK, 0.10, ("G19",),             250.0, 2500.0, 3900.0, 0.35],
  505.             [ATTACK, 0.05, ("G31",),            2220.0, 3060.0, 3900.0, 0.35]
  506.  
  507. ]
  508.  
  509. CosAttackData = [
  510.            # attacks:
  511.             [ATTACK, 0.15, ("GA",),              1500.0, 1500.0, 2200.0, 0.35],
  512.  
  513.             # inner zone moves:
  514.             [MOVE,   0.05, "tr",                1400.0, 1700.0, 2200.0, 0.25],
  515.             [MOVE,   0.05, "tl",                1400.0, 1700.0, 2200.0, 0.25],
  516.             [MOVE,   0.10, "tb",                1400.0, 1700.0, 2200.0, 0.25],
  517.             [MOVE,   0.10, "tf",                1400.0, 1700.0, 2200.0, 0.25],
  518.             [MOVE,   0.25, FearFire,               0.0, 1700.0, 2200.0, 0.05],            
  519.  
  520.            # outer zone moves:
  521.             [MOVE,   0.06, "tr",                2200.0, 3000.0, 4000.0, 0.25],
  522.             [MOVE,   0.06, "tl",                2200.0, 3000.0, 4000.0, 0.25],
  523.             [MOVE,   0.15, "tb",                2200.0, 3000.0, 4000.0, 0.25],
  524.             [MOVE,   0.05, "tf",                2200.0, 7000.0, 4000.0, 0.25],          
  525. ]
  526.  
  527. SpiderSmallAttackData = [
  528.            # attacks:
  529.             [ATTACK, 0.25, ("GA",),              500.0, 1000.0, 1400.0, 0.35],
  530.             [ATTACK, 0.03, ("SP",),             2800.0, 3000.0, 3500.0, 0.20],
  531.  
  532.            # inner zone moves:
  533.             [MOVE,   0.25, FearFire,               0.0, 1700.0, 2500.0, 0.05],
  534. ]
  535.  
  536. VampireAttackData =    [ 
  537.            # inner zone blocks:
  538.             [BLOCK,  0.30, (),                   500.0, 1000.0, 3000.0, 0.35],
  539.             [BLOCK,  0.08, "tr",                 750.0, 1500.0, 3500.0, 0.50],
  540.             [BLOCK,  0.12, "tl",                 750.0, 1500.0, 3500.0, 0.50],
  541.             [BLOCK,  0.17, "tb",                 750.0, 1500.0, 3500.0, 0.50],
  542.             [BLOCK,  0.08, "tf",                 750.0, 1500.0, 3500.0, 0.50],
  543.  
  544.            # dodges:
  545.             [DODGE,  0.90, ("g_26",),            500.0, 1800.0, 2930.0, 0.35],
  546.             [DODGE,  0.90, Disappear,           1500.0, 1800.0, 4930.0, 0.35],
  547.                      
  548.            # attacks:
  549.             [ATTACK, 0.15, ("disappear",),       500.0, 1000.0, 1200.0, 0.35],
  550.             [ATTACK, 0.15, Disappear,           2000.0, 3000.0, 9000.0, 0.35],
  551.             [ATTACK, 0.10, ("disappear",),      9000.0,10000.0,20000.0, 0.35],            
  552.             #[ATTACK, 0.10, ("g_01",),           1490.0, 2195.0, 2900.0, 0.35],
  553.             #[ATTACK, 0.10, ("g_06",),           1410.0, 2105.0, 2800.0, 0.35],
  554.             [ATTACK, 0.10, ("g_01",),           1200.0, 2421.0, 3178.0, 0.35],
  555.             [ATTACK, 0.10, ("g_06",),           1410.0, 2320.0, 3000.0, 0.35],
  556.             [ATTACK, 0.05, ("g_07",),           1500.0, 2400.0, 3020.0, 0.35],
  557.             #[ATTACK, 0.05, ("g_26",),           1000.0, 2200.0, 2930.0, 0.35],
  558.             
  559.            # outer zone moves:
  560.             [MOVE,   0.002, Insult,             5000.0, 7000.0, 9000.0, 0.50],
  561.             [MOVE,   0.002, Insult,             6000.0, 6250.0, 6500.0, 0.50],
  562.             [MOVE,   0.002, Insult,             7000.0, 7250.0, 7500.0, 0.50],
  563.             [MOVE,   0.002, Insult,             8000.0, 8250.0, 8500.0, 0.50],
  564.             [MOVE,   0.002, Insult,             9000.0, 9250.0, 9500.0, 0.50],            
  565.             [MOVE,   0.025,  "tr",                750.0, 1500.0, 4500.0, 0.35],
  566.             [MOVE,   0.025,  "tl",                750.0, 1500.0, 4500.0, 0.35],            
  567.             [MOVE,   0.0625,"tb",                750.0, 1500.0, 4500.0, 0.35],            
  568.             [MOVE,   0.0375,"tf",                750.0, 1500.0, 4500.0, 0.35],            
  569.             [MOVE,   0.80,  KeepDistance,       2800.0, 6250.0, 9500.0, 0.35],
  570. ]
  571.  
  572.  
  573. LittleDemonAttackData =    [ 
  574.            # inner zone blocks:
  575.             #[DODGE,  0.30, MagicShield,        500.0, 1000.0, 3000.0, 2.00],
  576.                      
  577.            # attacks:
  578.             [ATTACK, 0.40, ("SP1",),               0.0, 1500.0, 3000.0, 0.35],
  579.             [ATTACK, 0.40, ("SP1",),            5000.0, 7000.0, 9000.0, 0.35],
  580.             [ATTACK, 0.20, ("G03",),            2085.0, 2500.0, 2829.0, 0.35],
  581.             [ATTACK, 0.20, ("G06",),            3217.0, 3700.0, 3997.0, 0.35],
  582.             [ATTACK, 0.90, ("G07",),            2400.0, 2500.0, 2600.0, 0.35],
  583.             [ATTACK, 0.10, ("G22",),            3097.0, 3700.0, 3855.0, 0.35],
  584.             [ATTACK, 0.10, ("G27",),            2274.0, 2600.0, 2700.0, 0.35],
  585.             [ATTACK, 0.20, ("ZIG",),            5000.0, 9000.0,12000.0, 0.53],
  586.             [ATTACK, 0.20, ("ZAG",),            5000.0, 9000.0,12000.0, 0.57],
  587. ]
  588.  
  589.  
  590. LichAttackData =    [  
  591.            # outer zone moves:
  592. #            [MOVE,   0.02, Insult,              5000.0, 7000.0, 9000.0, 5.00],
  593. ]
  594.  
  595. MinotaurAttackData =    [            
  596.             [ATTACK, 0.18, ("G01",),            1500.0, 3000.0, 3500.0, 0.35],
  597.             [ATTACK, 0.18, ("G07",),            1500.0, 3000.0, 3500.0, 0.35],
  598.             [ATTACK, 0.18, ("G08",),            1500.0, 3000.0, 3500.0, 0.35],
  599.             [ATTACK, 0.06, ("G12",),            2800.0, 3300.0, 3750.0, 0.35],
  600.             [ATTACK, 0.06, ("G31",),            2800.0, 3300.0, 3750.0, 0.35],
  601. ]
  602.  
  603. SalamanderAttackData =    [  
  604.            # attacks:
  605.             [ATTACK, 0.30, ("g_bite",),            3400.0, 3700.0, 4200.0, 0.35],
  606.             [ATTACK, 0.10, ("g_r",),               2500.0, 2800.0, 3500.0, 0.35],            
  607.             [ATTACK, 0.01, ("spit",),               0.0, 1500.0, 3950.0, 0.35],
  608.             [ATTACK, 0.02, ("spit",),               0.0, 1500.0, 2274.0, 0.35],
  609.             [ATTACK, 0.04, ("spit",),             6000.0,9000.0,10000.0, 0.35],
  610.  
  611. ]
  612.  
  613. DalGurakPhase1 = [ 
  614.  
  615.            # attacks:
  616.             [ATTACK,  0.02, LaunchFireBall,     7000.0,21000.0,32000.0, 0.35],
  617.             [ATTACK,  0.02, LaunchMissile,      7000.0,21000.0,32000.0, 0.35],
  618.  
  619.            # all zone moves:
  620.             [MOVE,    0.80, Disappear,          1000.0, 5000.0, 7000.0, 0.35],
  621.             [MOVE,    0.003,Disappear,          1000.0, 5000.0,32000.0, 0.35]
  622.             
  623.  
  624. #            [MOVE,   0.02, "tr",                   0.0, 2000.0, 9000.0, 0.35],
  625. #            [MOVE,   0.02, "tl",                   0.0, 2000.0, 9000.0, 0.35],
  626. #            [MOVE,   0.04, "tb",                   0.0, 2000.0, 9000.0, 0.35],
  627. #            [MOVE,   0.02, "tf",                   0.0, 2000.0, 9000.0, 0.35],
  628. ]
  629.  
  630. DalGurakPhase2 = [ 
  631.            # blocks:
  632.             [BLOCK,  0.10, (),                   500.0, 1000.0, 9000.0, 0.50],
  633.             [BLOCK,  0.05, "tr",                 750.0, 1500.0, 4500.0, 0.50],
  634.             [BLOCK,  0.05, "tl",                 750.0, 1500.0, 4500.0, 0.50],
  635.             [BLOCK,  0.05, "tb",                 750.0, 1500.0, 4500.0, 0.50],
  636.             [BLOCK,  0.20, "tf",                 750.0, 1500.0, 4500.0, 0.50],
  637.             
  638.            # dodges:
  639.             [DODGE,  0.50, ("g_d_l",),          2400.0, 3000.0, 3550.0, 0.35],
  640.             [DODGE,  0.50, ("g_d_r",),          2200.0, 2700.0, 3150.0, 0.35],
  641.  
  642.            # attacks on stairs:          
  643.         [ATTACKDOWN,  0.20, LaunchWeapon,       4000.0, 6900.0,20000.0, 4.00],
  644.         [ATTACKDOWN,  0.10, ("GMG1",),          8000.0, 9000.0,30000.0, 4.00],
  645.         [ATTACKDOWN,  0.10, ("GMG2",),          8000.0, 9000.0,30000.0, 4.00],
  646.         [ATTACKDOWN,  0.05, ("g_08_new",),      1386.0, 2000.0, 2061.0, 0.35],
  647.         [ATTACKDOWN,  0.05, ("g_21_6_s8new",),  1228.0, 2500.0, 2635.0, 0.35],
  648.         [ATTACKDOWN,  0.05, ("g_19_bs1_new",),  1306.0, 3700.0, 3864.0, 0.35],
  649.  
  650.            # attacks:
  651.            # launch weapon attacks:
  652.             [ATTACK,  0.10, LaunchWeapon,       4000.0, 6900.0, 9000.0, 4.00],
  653.            # accumulated attack total 0.1
  654.            
  655.            # launch trail attacks:
  656.             [ATTACK,  0.05, ("GMG1",),          8000.0, 9000.0,30000.0, 4.00],
  657.             [ATTACK,  0.05, ("GMG2",),          8000.0, 9000.0,30000.0, 4.00],
  658.            # accumulated attack total 0.2
  659.            
  660.            # melee simples:
  661.             [ATTACK,  0.15, ("g_07_new",),       500.0, 1700.0, 1778.0, 0.35],
  662.             [ATTACK,  0.10, ("g_08_new",),      1386.0, 2000.0, 2061.0, 0.35],
  663.             [ATTACK,  0.10, ("g_02_new",),      1304.0, 2000.0, 2100.0, 0.35],
  664.             [ATTACK,  0.10, ("g_01_7_new",),    1068.0, 2000.0, 2130.0, 0.35],
  665.             [ATTACK,  0.10, ("g_22lowkata_new",),1128.0,2800.0, 2871.0, 0.35],
  666.            # accumulated attack total 0.75
  667.            
  668.            # melee specials
  669.             [ATTACK,  0.05, ("g_21_6_s8new",),  1228.0, 2000.0, 2135.0, 0.35],
  670.             [ATTACK,  0.05, ("g_19_bs1_new",),  1306.0, 3700.0, 3864.0, 0.35],
  671.             [ATTACK,  0.05, ("g_b32kata_new",), 1082.0, 3000.0, 3127.0, 0.35],
  672.             [ATTACK,  0.05, ("g_29_3new",),     1130.0, 2800.0, 2964.0, 0.35],
  673. #           [ATTACK,  0.00, ("g_back",),        1173.0, 1400.0, 1490.0, 0.35],
  674.            # accumulated attack total 0.95
  675.                        
  676.            # all zone moves:
  677.             [MOVE,   0.02, "tr",                   0.0, 2000.0, 9000.0, 0.35],
  678.             [MOVE,   0.02, "tl",                   0.0, 2000.0, 9000.0, 0.35],
  679.             [MOVE,   0.04, "tb",                   0.0, 2000.0, 9000.0, 0.35],
  680.             [MOVE,   0.02, "tf",                   0.0, 2000.0, 9000.0, 0.35],
  681. ]
  682.  
  683. GreatDemonAttackData = [                        
  684.            # Close attacks
  685.             [ATTACK,  0.50, ("g_magic",),          0.0, 2000.0, 3000.0, 0.50],
  686.             [ATTACK,  0.20, ("g_claw",),        1000.0, 2000.0, 4500.0, 0.50],
  687.             [ATTACK,  0.10, ("g_01",),          3000.0, 3700.0, 4300.0, 0.50],
  688.             [ATTACK,  0.10, ("g_12",),          3800.0, 5000.0, 7000.0, 0.50],
  689.             
  690.            # Long range spit attacks
  691.             [ATTACK,  0.012, ("g_spit_around",), 3000.0, 6000.0, 12000.0, 0.50],
  692.             [ATTACK,  0.015,("g_spit_f",),      3000.0, 7500.0,12000.0, 0.50],
  693.             [ATTACK,  0.030,("g_spitball",),    8000.0, 9500.0,12000.0, 0.50],
  694.                         
  695.            # All range attack should be activated later...
  696.             [ATTACK,  0.25, "RespectDistance",  1000.0, 2000.0, 3000.0, 0.35],
  697.             [ATTACK,  0.25, KeepDistance,       7000.0,12000.0,30000.0, 0.50],
  698.             
  699.             # Reserved for later in life
  700.             #[ATTACK,  0.03, ("g_quake",),       1000.0, 7000.0, 9000.0, 0.50],
  701.             
  702.             # Not implimented back attacks...
  703.             #[ATTACK,  0.03, ("g_back",),        6000.0, 6500.0, 7000.0, 0.50],
  704. ]
  705.  
  706.  
  707. AnAhkardAttackData = [
  708.             [ATTACK,  0.25, ("g_01",),          1500.0, 3000.0, 3400.0, 0.50],
  709.             [ATTACK,  0.25, ("g_02",),          2500.0, 3200.0, 4700.0, 0.50],
  710.             [ATTACK,  0.25, ("g_07",),          2500.0, 3200.0, 4500.0, 0.50],
  711.             [ATTACK,  0.007, ("g_mgc03",),       4000.0, 6000.0,10000.0, 0.50],  #AimLaser
  712. ]
  713.  
  714. StoneGolemAttackData = [
  715.             [ATTACK,  0.05, ("g_01",),          1500.0, 2000.0, 2500.0, 0.50],
  716.             [ATTACK,  0.05, ("g_114",),         1500.0, 2000.0, 2700.0, 0.50],
  717.             [ATTACK,  0.05, ("g_12",),          1500.0, 2000.0, 2500.0, 0.50],
  718.             [ATTACK,  0.05, ("g_21",),          1500.0, 2000.0, 2500.0, 0.50],
  719.             [ATTACK,  0.10, ("g_21_27",),       3000.0, 3500.0, 4000.0, 0.50],
  720.             [ATTACK,  0.05, ("g_31",),          1500.0, 2000.0, 2500.0, 0.50],
  721.             [ATTACK,  0.016,("g_1tw",),         5500.0, 7500.0,10000.0, 0.50],
  722. ]
  723.  
  724. """
  725. Notes
  726. =====
  727. If the total weights of a category are less than 1.00, then 
  728. the remainder is used as the chance that nothing is selected 
  729. out of this category.
  730.  
  731. ToDo
  732. ====
  733. Anticipation of enemy moves, if they just perform 
  734. the same attack repeatedly....
  735.  
  736.  
  737. Extra information: 
  738. ?* best angle
  739. ?* max angle
  740. * distance
  741. * max distance
  742. * overall time to execute
  743. * (possibly additional for dodge & block.  Special counters vs.)
  744. * (for attack, damage)
  745.  
  746.  
  747.  
  748. Questions and bugs 
  749. Com moves don't seem to be launched (e.g sr and sl)?
  750. Currenly waiting for a fixed paused before continuing from setting a com mode, can we vary this?
  751. Why is it moving forwards when very close?
  752. Still bug in LastAnmPos, when PossibleXZPos returns false for Kgt_r_f animation
  753. Slow Attacks...
  754.  
  755.  
  756. ##########################################################
  757. Consider Blocks first.
  758.  
  759.     if block found don't comsider dodge
  760.  
  761. ##########################################################
  762. Consider Dodges next (and Positional Moves)
  763.     Remove dodges from list if:
  764.         * angle > max angle
  765.         * distance > max distance 
  766.         * action takes us out of action area max or collides with scenery
  767.  
  768.     Evaluate each dodge based on:
  769.         ?* length of time to execute the dodge (-)
  770.         * Dodge Effectiveness
  771.             ?* distance from the dodge's ideal angle (-)
  772.             * distance from the dodge's ideal distance (-)
  773.             ?* whether countering Jump, or Long Range (+)        
  774.         * Other factors
  775.             * how often we have used the dodge before (-)            
  776.             ?* angle to enemy improvement for us (+)
  777.             ?* angle to us improvement for enemy (-)
  778.             * how much we like the dodge (pregiven) (*)
  779.     
  780.     Roulette method to choose a dodge
  781.     
  782.     if dodge found then return
  783.  
  784. ##########################################################
  785. Consider Attacks Next
  786.     Remove attacks from list if:
  787.         ?* angle > max angle
  788.         * distance > max distance 
  789.         * action takes us out of action area max or collides with scenery
  790.  
  791.     Evaluate each attacks based on:
  792.         ?* length of time to execute the attack (-)
  793.         * Attack Effectiveness            
  794.             * distance from the attack's ideal angle (-)
  795.             * distance from the attack's ideal distance (-)
  796.             
  797.         * Other factors
  798.             * how often we have used the dodge before (-)            
  799.             * angle to enemy improvement for us (+)
  800.             * angle to us improvement for enemy (-)
  801.             * how much we like the attack (pregiven) based on (*)
  802.                 * likely damage done by the attack if it connects
  803.                 * length of time to execute the attack
  804.     
  805.     Roulette method to choose an attack
  806.     
  807.     if attack found then return
  808.  
  809. Consider Positional Moves Last
  810.     eg Strafing, GoF, and GoB, and combinations of above
  811.  
  812.  
  813. """
  814.                     
  815.                     
  816.                     
  817.                     
  818.                     
  819.                     
  820.