KeiroD

Kaiorga - AI

Aug 4th, 2010
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 7.75 KB | None | 0 0
  1.  elseif ($gdata(NPC;Data,$letrem($remext(%tperson)))) {
  2.         var %raw = $letrem($remext(%tperson))
  3.         if ($data(%tperson,Stats,Friendly)) { var %gambits = $data(NPC;Data,%raw,Summon;Gambits) }
  4.         else { var %gambits = $data(NPC;Data,%raw,Gambits) }
  5.         :repeat;gambits
  6.         var %w = 0
  7.         ;This loop loops through the available attacks which have specific gambits: Gambits=<Attack1> <Attack2>
  8.         while ($numtok(%gambits,32) != %w) {
  9.           dll WhileFix.dll WhileFix
  10.           inc %w
  11.           var %ability = $gettok($gettok(%gambits,%w,32),1,47)
  12.           var %gambit = $data(NPC;Data,%raw,%ability)
  13.           var %self. [ $+ [ %gambit ] ] $gettok($gettok(%gambits,%w,32),2,47)
  14.           if (%self. [ $+ [ %gambit ] ]) { var %target = %tperson }
  15.           else {
  16.             if ($data(%tperson,Stats,Friendly)) { var %target = $randtarget(friendly,$1) }
  17.             else { var %target = $randtarget(Normal,$1) }
  18.           }
  19.           ;bmsg %chan %tperson %target %gambit %ability
  20.           ;----------------------------------------------------
  21.           if ($gambitchk(%tperson,%target,%gambit,%ability,$1)) {
  22.             var %data = $v1
  23.             var %target = $gettok(%data,1,32)
  24.             var %ability = $gettok(%data,2,32)
  25.             var %ATB = $data(Abilities,%ability,ATB)
  26.             var %CUR;ATB = $data(%tperson,Stats,ATB;Gauge)
  27.             ;bmsg %chan ya %ability %CUR;ATB >= %ATB
  28.             var %priority = 1
  29.             ;This statement checks to see if %tpersons still has ATB segments available to use for an attack
  30.             if (%CUR;ATB >= %ATB) {
  31.               ;Unsets %priority if the target has more than 1 ATB gauge so the leftovers can be used to fill regular actions
  32.               ;because if in fact %tperson only has 1 ATB gauge, it wont goto normal period.
  33.               unset %priority
  34.               action %target %tperson %ability - $1
  35.               decini %tperson Stats ATB;Gauge %ATB
  36.               goto repeat;gambits
  37.             }
  38.             elseif (%CUR;ATB < %ATB) { var %priority = 1 | break }
  39.             elseif (%CUR;ATB == 0) { var %priority = 1 }
  40.             ;Not done
  41.           }
  42.           ;----------------------------------------------------
  43.           elseif (%w == $numtok(%gambits,32)) {
  44.             ;The !%priority applies to npcs whose gambits did not succeed in possible scenario succession <- O_O
  45.             if ($data(%tperson,Stats,ATB;Gauge) >= 1) || (!%priority) { goto normal }
  46.           }
  47.         }
  48.         ;end of gambit loop
  49.         if (!%priority) {
  50.           :normal
  51.           var %CUR;ATB = $data(%tperson,Stats,ATB;Gauge)
  52.           var %m = 0
  53.           var %success = 200
  54.           :once;again
  55.           if ($data(%tperson,Stats,Friendly)) { var %target = $randtarget(friendly,$1) }
  56.           else { var %target = $randtarget(Normal,$1) }
  57.           if ($data(%battle,Data,Guardian) && $data(%battle,Status,$+(Guardian:,$v1)) == 1) { var %target = $data(%battle,Data,Guardian) }
  58.           var %abilities = $data(NPC;Data,%raw,Abilities)
  59.           var %x = 0
  60.           while ($numtok(%abilities,32) != %x) {
  61.             dll WhileFix.dll WhileFix
  62.             inc %x
  63.             var %chance = $rand(1,100)
  64.  
  65.             ;Format: Haste/self:30 or Haste:30, just gettok,s the first so it can check for ossible self targetting down there v
  66.             var %ability = $gettok($gettok($gettok(%abilities,%x,32),1,58),1,47)
  67.  
  68.             var %self = $gettok($gettok($gettok(%abilities,%x,32),1,58),2,47)
  69.             if (%self) { var %target = %tperson | unset %self }
  70.  
  71.             var %ATB = $data(Abilities,%ability,ATB)
  72.             var %percent = $gettok($gettok(%abilities,%x,32),2,58)
  73.             if (!%percent) { var %percent = 100 }
  74.             bmsg %chan %chance %percent for %ability %self
  75.             if (%chance <= %percent) {
  76.  
  77.               if ($data(NPC;Data,%raw,%ability)) {
  78.                 var %gambit = $v1
  79.                 if (!$gambitchk(%tperson,%target,%gambit,%ability,$1)) { goto once;again }
  80.               }
  81.  
  82.               ;Different action for more than 1 ATB gauge
  83.               if ($data(%tperson,Readying,Eidolon)) {
  84.                 uini %tperson Readying Eidolon
  85.                 .timeraction. [ $+ [ %battle ] ] -m 1 500 %msg $name(%tperson) readies to strike!
  86.                 .timeraction2. [ $+ [ %battle ] ] -m 1 600 turn $1
  87.                 goto cease
  88.               }
  89.               if ($data(%tperson,Stats,Max;ATB;Gauge) > 1) {
  90.                 if (%CUR;ATB >= %ATB) && (%target) {
  91.                   if (%tperson == Brynhildr) {
  92.                     if ($istok($data(%tperson,Stats,Status),Enfrost,32) == $true) { var %ability = $replace(%ability,Pyro,Cryo) }
  93.                     if ($istok($data(%tperson,Stats,Status),Enthunder,32) == $true) { var %ability = $replace(%ability,Pyro,Electro) }
  94.                     if ($istok($data(%tperson,Stats,Status),Enwater,32) == $true) { var %ability = $replace(%ability,Pyro,Hydro) }
  95.                   }
  96.                   ;.timeraction. [ $+ [ %battle ] $+ ] . [ $+ [ %success ] ] -m 1 %success action %target %tperson %ability - $1
  97.                   action %target %tperson %ability - $1
  98.                   inc %success 150
  99.                   decini %tperson Stats ATB;Gauge %ATB
  100.                   var %CUR;ATB = $data(%tperson,Stats,ATB;Gauge)
  101.                   if (%CUR;ATB > 0) { goto once;again }
  102.                   else { goto finished }
  103.                 }
  104.                 else {
  105.                   inc %m
  106.                   if (%m >= 5) {
  107.                     :finished
  108.                     .timeraction2. [ $+ [ %battle ] ] -m 1 1000 eventchk $1 $iif(%gestalt. [ $+ [ %battle ] ],$data(%battle,Eidolon,Summoner),$null)
  109.                     .timeraction3. [ $+ [ %battle ] ] -m 1 1000 swini %tperson Stats ATB;Gauge $data(%tperson,Stats,Max;ATB;Gauge)
  110.                     if ($istok(Odin Stiria Nix Brynhildr Bahamut Alexander Hecatoncheir,$remext(%tperson),32) == $true) { swini %tperson Readying Eidolon 1 }
  111.                     goto cease
  112.                   }
  113.                   goto once;again
  114.                 }
  115.               }
  116.  
  117.               ;Generic map for max ATB Gauge of 1
  118.               else { break }
  119.  
  120.             }
  121.  
  122.           }
  123.         }
  124.         if ($data(%tperson,Readying,Wait)) {
  125.           var %data = $data(%tperson,Readying,Data)
  126.           var %target = $gettok(%data,2,32)
  127.           var %ability = $gettok(%data,1,32)
  128.           decini %tperson Readying Wait 1
  129.           if ($data(%tperson,Readying,Wait) <= 0) { goto execute }
  130.           else {
  131.             .timeraction3. [ $+ [ %battle ] ] -m 1 500 %msg $name(%tperson) readies $acol(%ability) $+ !
  132.             .timeraction4. [ $+ [ %battle ] ] -m 1 650 turn $1
  133.             swini %tperson Stats ATB;Gauge $data(%tperson,Stats,Max;ATB;Gauge)
  134.             halt
  135.           }
  136.         }
  137.         elseif (%ATB > $data(%tperson,Stats,Max;ATB;Gauge)) {
  138.           swini %tperson Readying Data %ability %target
  139.           swini %tperson Readying Wait $calc(%ATB - 1)
  140.           if ($istok($alive(All,$1),%target,32) != $true) { var %target = $randtarget(Normal,$1) }
  141.           .timeraction3. [ $+ [ %battle ] ] -m 1 500 %msg $name(%tperson) readies $acol(%ability) $+ !
  142.           .timeraction4. [ $+ [ %battle ] ] -m 1 550 swini %tperson Stats ATB;Gauge $data(%tperson,Stats,Max;ATB;Gauge)
  143.           .timeraction5. [ $+ [ %battle ] ] -m 1 600 turn $1
  144.           halt
  145.         }
  146.         else {
  147.           :execute
  148.           .timeraction. [ $+ [ %battle ] ] -m 1 500 action %target %tperson %ability - $1
  149.           .timeraction2. [ $+ [ %battle ] ] -m 1 650 eventchk $1 $iif(%gestalt. [ $+ [ %battle ] ],$data(%battle,Eidolon,Summoner),$null)
  150.           swini %tperson Stats ATB;Gauge $data(%tperson,Stats,Max;ATB;Gauge)
  151.         }
  152.       }
  153.       ;end of npc attacking phase
  154.     }
Add Comment
Please, Sign In to add comment