Andrio_Celos

battlecontrol.mrc

Feb 3rd, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 80.46 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;; BATTLE CONTROL
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4.  
  5. on 1:TEXT:!battle stats*:*: {
  6.   var %total.battles $bytes($readini(battlestats.dat, Battle, TotalBattles),b)
  7.   var %total.wins $bytes($readini(battlestats.dat, Battle, TotalWins),b)
  8.   var %total.losses $bytes($readini(battlestats.dat, Battle, TotalLoss),b)
  9.   var %winning.record $bytes($readini(battlestats.dat, Battle, WinningStreakRecord),b)
  10.   var %total.gauntlet.wins $bytes($readini(battlestats.dat, Battle, GauntletRecord),b)
  11.  
  12.   if (%winning.record = $null) { unset %winning.record) }
  13.   if (%winning.record != $null) { var %winning.record (Highest record is: %winning.record $+ ) }
  14.  
  15.   query %battlechan $readini(translation.dat, system, BattleStatsData)
  16.   if ($readini(battlestats.dat, Battle, WinningStreak) != 0) { query %battlechan $readini(translation.dat, system, BattleStatsWinningStreak) }
  17.   if ($readini(battlestats.dat, Battle, LosingStreak) != 0) { query %battlechan $readini(translation.dat, system, BattleStatsLosingStreak) }
  18.   if (%total.gauntlet.wins > 0) { query %battlechan $readini(translation.dat, system, BattleStatsGauntletRecord) }
  19. }
  20.  
  21. ; Bot Admins can toggle the automated battle system to be on/off
  22. on 50:TEXT:!toggle automated battle system*:*:{  
  23.   if ($readini(system.dat, system, automatedbattlesystem) = off) {
  24.     writeini system.dat system automatedbattlesystem on
  25.     query %battlechan $readini(translation.dat, system, AutomatedBattleOn)
  26.     if (%battleis = off) { $clear_battle }
  27.   }
  28.   else {
  29.     writeini system.dat system automatedbattlesystem off
  30.     query %battlechan $readini(translation.dat, system, AutomatedBattleOff)
  31.   }
  32. }
  33.  
  34. ; Bot Admins can toggle which battle formulas are used.
  35. on 50:TEXT:!toggle battle formula*:*:{  
  36.   if ($readini(system.dat, system, EnableOldDmgFormulas) = true) {
  37.     writeini system.dat system EnableOldDmgFormulas false
  38.     query %battlechan $readini(translation.dat, system, NewDmgFormulaIsOn)
  39.   }
  40.   else {
  41.     writeini system.dat system EnableOldDmgFormulas true
  42.     query %battlechan $readini(translation.dat, system, NewDmgFormulaIsOff)
  43.   }
  44. }
  45.  
  46. ; Bot admins can toggle the AI system on/off.
  47.  
  48. on 50:TEXT:!toggle ai system*:*:{  
  49.   if ($readini(system.dat, system, aisystem) = off) {
  50.     writeini system.dat system aisystem on
  51.     query %battlechan $readini(translation.dat, system, AiSystemOn)
  52.   }
  53.   else {
  54.     writeini system.dat system aisystem off
  55.     query %battlechan $readini(translation.dat, system, AiSystemOff)
  56.   }
  57. }
  58.  
  59. ; Bot admins can adjust the "level adjust"
  60. on 50:TEXT:!leveladjust*:*:{  
  61.   if ($2 = $null) { $view.leveladjust }
  62.   if ($2 != $null) {  
  63.  
  64.     if ($2 !isnum) { query %battlechan $readini(translation.dat, errors, DifficultyMustBeNumber) | halt }
  65.     if (. isin $2) { query %battlechan $readini(translation.dat, errors, DifficultyMustBeNumber) | halt }
  66.     if ($2 < 0) { query %battlechan $readini(translation.dat, errors, DifficultyCan'tBeNegative) | halt }
  67.  
  68.     writeini battlestats.dat battle leveladjust $2
  69.     query %battlechan $readini(translation.dat, system, SaveLevelAdjust)
  70.   }
  71. }
  72.  
  73. on 2:TEXT:!leveladjust*:*:{ $view.leveladjust }
  74.  
  75. alias view.leveladjust {
  76.   var %leveladjust $readini(battlestats.dat, battle, LevelAdjust)
  77.   if (%leveladjust = $null) { var %leveladjust 0 }
  78.   query %battlechan $readini(translation.dat, system, ViewLevelAdjust)
  79. }
  80.  
  81. ; Everyone can save and view a battle streak.
  82.  
  83. on 2:TEXT:!view battle save*:*:{   $set_chr_name($nick) | $checkchar($nick)
  84.   var %saved.streak $readini($char($nick), info, savedstreak)
  85.   if (%saved.streak = $null) { var %saved.streak 0 }
  86.   query %battlechan $readini(translation.dat, system, ViewBattleStreak)
  87. }
  88. on 2:TEXT:!save battle streak*:*:{   $set_chr_name($nick) | $checkchar($nick)
  89.   if (%battleis = on) { query %battlechan $readini(translation.dat, errors, Can'tDoThisInBattle) | halt }
  90.   var %current.streak $readini(battlestats.dat, Battle, WinningStreak)
  91.   if (%current.streak <= 0) { query %battlechan $readini(translation.dat, errors, Can'tSaveALosingStreak) | halt }
  92.  
  93.   else {
  94.     var %last.saved $readini($char($nick), info, savedstreak.time)
  95.     var %current.time $ctime
  96.     var %time.difference $calc(%current.time - %last.saved)
  97.  
  98.     if ((%time.difference = $null) || (%time.difference > 7200)) {
  99.       var %saved.streak $readini($char($nick), info, savedstreak)
  100.       if (%saved.streak = $null) { var %saved.streak 0 }
  101.       if (%current.streak < %saved.streak) { query %battlechan $readini(translation.dat, errors, Can'tSaveALowerStreak) | halt }
  102.       writeini $char($nick) Info SavedStreak %current.streak
  103.       writeini $char($nick) Info SavedStreak.time $ctime
  104.       query %battlechan $readini(translation.dat, system, SaveBattleStreak)
  105.     }
  106.     else { query %battlechan $readini(translation.dat, errors, NotEnoughTimeToSave) | halt }
  107.   }
  108. }
  109.  
  110. on 2:TEXT:!reload battle streak*:*:{   $set_chr_name($nick) | $checkchar($nick)
  111.   if (%battleis = on) { query %battlechan $readini(translation.dat, errors, Can'tDoThisInBattle) | halt }
  112.   var %current.streak $readini(battlestats.dat, Battle, WinningStreak)
  113.   if (%current.streak >= 1) { query %battlechan $readini(translation.dat, errors, Can'tReloadOnAWinningStreak) | halt }
  114.   else {
  115.     var %saved.streak $readini($char($nick), info, savedstreak)
  116.     if (%saved.streak = $null) { query %battlechan $readini(translation.dat, errors, NoWinningStreakSaved) | halt }
  117.     if (%saved.streak = 0) { query %battlechan $readini(translation.dat, errors, NoWinningStreakSaved) | halt }
  118.     writeini battlestats.dat Battle WinningStreak %saved.streak
  119.     writeini battlestats.dat Battle LosingStreak 0
  120.     query %battlechan $readini(translation.dat, system, ReloadBattleStreak)
  121.     writeini $char($nick) info savedstreak 0
  122.   }
  123. }
  124.  
  125. ; Bot Owners can have some control over battles
  126. on 50:TEXT:!startbat*:*:{   /.timerBattleStart off | $startnormal($2) }
  127. on 50:TEXT:!start bat*:*:{   /.timerBattleStart off | $startnormal($3) }
  128. on 50:TEXT:!new bat*:*:{   /.timerBattleStart off | $startnormal($3) }
  129. on 50:TEXT:!end bat*:*:{   $endbattle($3) }
  130. on 50:TEXT:!endbat*:*:{   $endbattle($2) }
  131.  
  132. ; Bot owners can force the next turn
  133. ON 50:TEXT:!next*:* {
  134.   if (%battleis = on)  { $check_for_double_turn($1) }
  135.   else { query %battlechan $readini(translation.dat, Errors, NoCurrentBattle) | halt }
  136. }
  137.  
  138. ; Bot owners can reset the battle stats.
  139. on 50:TEXT:!clear battle stats*:*:{
  140.   writeini battlestats.dat Battle TotalBattles 0
  141.   writeini battlestats.dat Battle TotalWins 0
  142.   writeini battlestats.dat Battle TotalLoss 0
  143.   writeini battlestats.dat Battle LosingStreak 0
  144.   writeini battlestats.dat Battle WinningStreak 0
  145.   writeini battlestats.dat Battle GauntletRecord 0
  146.   query %battlechan $readini(translation.dat, System, WipedBattleStats)
  147. }
  148.  
  149. ; Bot owners can change the time between battles.
  150. on 50:TEXT:!time between battles *:*:{  
  151.   writeini system.dat System TimeBetweenBattles $4
  152.   query %battlechan $readini(translation.dat, System, ChangeTime)
  153. }
  154.  
  155. ; Bot owners can summon npcs/monsters/bosses to the battlefield during the "entering" phase.
  156. on 50:TEXT:!summon*:*:{
  157.   if ($2 = npc) {
  158.     if ($isfile($npc($3)) = $true) {
  159.       .copy -o $npc($3) $char($3)
  160.       $boost_monster_stats($3)  
  161.       /enter $3
  162.     }
  163.     else { query %battlechan $readini(translation.dat, errors, NPCDoesNotExist) | halt }
  164.   }
  165.   if ($2 = monster) {
  166.     var %number.of.monsters $readini(battle2.txt, BattleInfo, Monsters)
  167.     if (%number.of.monsters >= 10) { query %battlechan $readini(translation.dat, errors, MonsterLimit) | halt }
  168.     if ($isfile($mon($3)) = $true) {
  169.       .copy -o $mon($3) $char($3)
  170.       /enter $3
  171.       var %number.of.players $readini(battle2.txt, battleinfo, players)
  172.       if (%number.of.players = $null) { var %number.of.players 1 }
  173.       $boost_monster_stats($3)  
  174.       $fulls($3) |  var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  175.     }
  176.     else { query %battlechan $readini(translation.dat, errors, monsterdoesnotexist) | halt }
  177.   }
  178.  
  179.   if ($2 = boss) {
  180.     var %number.of.monsters $readini(battle2.txt, BattleInfo, Monsters)
  181.     if (%number.of.monsters >= 10) { query %battlechan $readini(translation.dat, errors, MonsterLimit)  | halt }
  182.     if ($isfile($boss($3)) = $true) {
  183.       .copy -o $boss($3) $char($3)
  184.       /enter $3
  185.       var %number.of.players $readini(battle2.txt, battleinfo, players)
  186.       if (%number.of.players = $null) { var %number.of.players 1 }
  187.       $boost_monster_stats($3)  
  188.       $fulls($3) |  var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  189.     }
  190.     else { query %battlechan $readini(translation.dat, errors, monsterdoesnotexist) | halt }
  191.   }
  192.  
  193. }
  194.  
  195. ; Use these commands to check to see who's in battle..
  196. ON 2:TEXT:!batlist*:#:battlelist
  197. ON 2:TEXT:!bat list*:#:battlelist
  198. ON 2:TEXT:!bat info*:#:battlelist
  199.  
  200.  
  201. ; ==========================
  202. ; This is the alias that clears battles
  203. ; ==========================
  204. alias clear_battle {
  205.   ; Kill any related battle timers..
  206.   /.timerBattleStart off
  207.   /.timerBattleNext off
  208.   /.timerBattleBegin off
  209.   /.timerBattleRage off
  210.   /.timerHolyAura off
  211.   /.timerOrbTimer off
  212.   /.timerChestDestroy 1 45 /destroy_treasurechest
  213.  
  214.   ; Refresh players and remove monsters and NPCs that were in the battle.
  215.   if ($isfile(battle.txt) = $true) {
  216.     var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  217.     while (%battletxt.current.line <= %battletxt.lines) {
  218.       var %who.battle $read -l $+ %battletxt.current.line battle.txt
  219.  
  220.       if ($isfile($char(%who.battle)) = $true) {
  221.         var %monster.flag $readini($char(%who.battle), Info, Flag)
  222.  
  223.         if ((%monster.flag = monster) || (%monster.flag = npc)) { .remove $char(%who.battle) }
  224.         else { $fulls(%who.battle) }
  225.       }
  226.  
  227.       inc %battletxt.current.line
  228.     }
  229.   }
  230.  
  231.   ; Kill the battle info
  232.   set %battleis off | set %battleisopen off
  233.   .remove battle.txt | .remove battle2.txt
  234.   $clear_variables | writeini weather.lst weather current calm
  235.  
  236.   ; ; Erase any stray monsters/bosses..
  237.   ; var %value 1
  238.   ; while ($findfile( $char_path , *.char, %value , 0) != $null) {
  239.     ; set %file $nopath($findfile($char_path ,*.char,%value))
  240.     ; set %name $remove(%file,.char)
  241.  
  242.     ; if ($lines(status $+ %name $+ .txt) != $null) {   /.remove status $+ %name $+ .txt }
  243.  
  244.     ; if ((%name = new_chr) || (%name = $null)) { inc %value 1 }
  245.     ; else {
  246.       ; var %monster.flag $readini($char(%name), Info, Flag)
  247.       ; if ((%monster.flag = monster) || (%monster.flag = npc)) { .remove $char(%name) }
  248.       ; else { inc %value 1 }    
  249.     ; }
  250.   ; }
  251.  
  252.   ; ; Full everyone
  253.   ; var %value 1
  254.   ; while ($findfile( $char_path , *.char, %value , 0) != $null) {
  255.     ; set %file $nopath($findfile($char_path ,*.char,%value))
  256.     ; set %name $remove(%file,.char)
  257.     ; if ((%name = new_chr) || (%name = $null)) { inc %value 1 }
  258.     ; else {
  259.       ; $fulls(%name)
  260.       ; inc %value 1
  261.     ; }
  262.   ; }
  263.  
  264.   unset %file |  unset %name | unset %battletxt.current.line
  265.  
  266.   if ($readini(system.dat, system, automatedbattlesystem) != off) {
  267.  
  268.     var %time.between.battles $readini(system.dat, System, TimeBetweenBattles)
  269.     if (%time.between.battles = $null) { var %time.between.battles 3 }
  270.  
  271.     set %timer.time $calc(%time.between.battles * 60)
  272.  
  273.     query %battlechan $readini(translation.dat, Battle, StartBattle)
  274.     /.timerBattleStart 1 %timer.time /startnormal
  275.     halt
  276.   }
  277. }
  278.  
  279. ; ==========================
  280. ; This is the alias that opens battles
  281. ; ==========================
  282. alias startnormal {
  283.  
  284.   if (%battleis = on) { $clear_battle | halt }
  285.   .remove battle.txt | .remove battle2.txt
  286.  
  287.   var %time.to.enter $readini(system.dat, system, TimeToEnter)
  288.   if (%time.to.enter = $null) { var %time.to.enter 120 }
  289.   var %time.to.enter.minutes $round($calc(%time.to.enter / 60),1)
  290.   query %battlechan $readini(translation.dat, Battle, BattleOpen)
  291.   set %battleis on | set %battleisopen on
  292.  
  293.   unset %battle.type
  294.  
  295.   if ($1 = boss) { set %battle.type boss }
  296.   if ($1 = monster) { set %battle.type monster }
  297.   if ($1 = orbfountain) { set %battle.type orbfountain }
  298.   if ($1 = orbbattle) { set %battle.type orbfountain }
  299.   if ($1 = pvp) { set %mode.pvp on }
  300.   if ($1 = gauntlet) { set %mode.gauntlet on | set %mode.gauntlet.wave 1 }
  301.   if ($1 = manual) { set %battle.type manual }
  302.  
  303.  
  304.   /.timerBattleBegin 1 %time.to.enter /battlebegin
  305. }
  306.  
  307.  
  308. ; ==========================
  309. ; This is entering the battle
  310. ; ==========================
  311. ON 2:TEXT:!enter*:#:/enter $nick
  312. ON 50:TEXT:*enters the battle*:#:/enter $1
  313.  
  314.  
  315. alias enter {
  316.   $checkchar($1)
  317.   if (%battleisopen != on) { $set_chr_name($1) | query %battlechan $readini(translation.dat, battle, BattleClosed)  | halt }
  318.  
  319.   set %curbat $readini(battle2.txt, Battle, List)
  320.   if ($istok(%curbat,$1,46) = $true) { $set_chr_name($1) | query %battlechan $readini(translation.dat, errors, AlreadyInBattle) | halt }
  321.  
  322.   if ($readini(battle2.txt, BattleInfo, Players) >= 10) { query %battlechan $readini(translation.dat, errors, PlayerLimit) | halt }
  323.  
  324.   %curbat = $addtok(%curbat,$1,46)
  325.   writeini battle2.txt Battle List %curbat
  326.  
  327.   if ($readini($char($1), info, flag) = $null) {
  328.     var %battleplayers $readini(battle2.txt, BattleInfo, Players)
  329.     inc %battleplayers 1
  330.     writeini battle2.txt BattleInfo Players %battleplayers
  331.  
  332.     var %current.shop.level $readini(battle2.txt, BattleInfo, ShopLevel)
  333.     if (%current.shop.level = $null) { var %current.shop.level 0 }
  334.     var %player.shop.level $readini($char($1), stuff, shoplevel)
  335.     inc %current.shop.level %player.shop.level
  336.     writeini battle2.txt BattleInfo ShopLevel %current.shop.level
  337.  
  338.     var %current.difficulty $readini(battle2.txt, BattleInfo, Difficulty)
  339.     if (%current.difficulty = $null) { var %current.difficulty 0 }
  340.     var %player.difficulty $readini($char($1), info, difficulty)
  341.     if (%player.difficulty = $null) { var %player.difficulty 0 }
  342.     inc %current.difficulty %player.difficulty
  343.     writeini battle2.txt BattleInfo Difficulty %current.difficulty
  344.   }
  345.  
  346.  
  347.   $set_chr_name($1) | query %battlechan $readini(translation.dat, battle, EnteredTheBattle) | write battle.txt $1
  348.  
  349.   ; Full the person entering the battle.
  350.   $fulls($1)
  351. }
  352.  
  353. ; ==========================
  354. ; Flee the battle!
  355. ; ==========================
  356. ON 2:TEXT:!flee*:#:/flee $nick
  357. ON 2:TEXT:!run away*:#:/flee $nick
  358. ON 50:TEXT:*flees the battle*:#:/flee $1
  359.  
  360. alias flee {
  361.   $check_for_battle($1)
  362.  
  363.   if ($is_charmed($1) = true) { $set_chr_name($1) | query %battlechan $readini(translation.dat, status, CurrentlyCharmed) | halt }
  364.  
  365.   writeini $char($1) battle status runaway
  366.   $set_chr_name($1) | query %battlechan $readini(translation.dat, battle, FleeBattle)
  367.  
  368.   var %number.of.flees $readini($char($1), stuff, TimesFled)
  369.   if (%number.of.flees = $null) { var %number.of.flees 0 }
  370.   inc %number.of.items.sold 1
  371.   writeini $char($1) stuff TimesFled %number.of.flees
  372.  
  373.   $achievement_check($1, ScardyCat)
  374.  
  375.   $next
  376. }
  377.  
  378.  
  379. ; ==========================
  380. ; The battle begins
  381. ; ==========================
  382.  
  383. alias battlebegin {
  384.   unset %monster.list
  385.   set %battleisopen off
  386.  
  387.   ; First, see if there's any players in the battle..
  388.   set %number.of.players $readini(battle2.txt, BattleInfo, Players)
  389.   if ((%number.of.players = 0) || (%number.of.players = $null)) {  query %battlechan $readini(translation.dat, battle, NoPlayersOnField) | $clear_battle | halt }
  390.  
  391.   if (%mode.pvp = on) {
  392.     set %number.of.players $readini(battle2.txt, BattleInfo, Players)
  393.     if ((%number.of.players < 2) || (%number.of.players = $null)) {  query %battlechan $readini(translation.dat, battle, NotEnoughPlayersOnField) | $clear_battle | halt }
  394.   }
  395.  
  396.   $random.battlefield.pick
  397.   $random.weather.pick
  398.  
  399.   if (%mode.pvp != on) {
  400.     set %winning.streak $readini(battlestats.dat, battle, winningstreak)
  401.  
  402.     set %boss.battle.numbers 10.15.20.30.60.100.150.180.220.280.320.350.401.440.460.501.560
  403.     if ($istok(%boss.battle.numbers,%winning.streak,46) = $true) { set %bosschance 1 }
  404.     if ($istok(%boss.battle.numbers,%winning.streak,46) = $false) {  
  405.       ; Now we determine what kind of battle it is
  406.  
  407.       if (%winning.streak < 10) { var %bosschance $rand(11,100) }
  408.       if (%winning.streak >= 10) { var %bosschance $rand(1,100) }
  409.     }
  410.  
  411.     unset %boss.battle.numbers
  412.  
  413.     if (%battle.type = $null) {
  414.       if (%bosschance <= 10) { set %battle.type boss }
  415.       if ((%bosschance > 10) && (%bosschance < 95)) { set %battle.type monster }
  416.       if (%bosschance >= 95) { set %battle.type orbfountain }
  417.     }
  418.  
  419.     ; Okay, so now we need to determine how many monsters to pull.
  420.     set %number.of.monsters.needed 1
  421.     if (%battle.type = boss) { %number.of.monsters.needed = 1 }
  422.     if (%battle.type = orbfountain) {
  423.       %number.of.monsters.needed = 1
  424.       /.timerOrbTimer 1 3600 /endbattle
  425.     }
  426.     if ((%battle.type != boss) && (%battle.type != orbfountain)) {
  427.       %number.of.monsters.needed = $round($calc(%number.of.players / 2),0)
  428.       if (%number.of.monsters.needed > 4) { %number.of.monsters.needed = 4 }
  429.     }
  430.  
  431.     $winningstreak.addmonster.amount
  432.  
  433.     ; Let's see if there's any monsters already in battle (via !summon).  If so, we don't want more than 10..
  434.     var %number.of.monsters $readini(battle2.txt, BattleInfo, Monsters)
  435.     if (%number.of.monsters = $null) { var %number.of.monsters 0 }
  436.     if (%number.of.monsters >= 10) { set %number.of.monsters.needed 0 }
  437.  
  438.     ; Generate the monsters..
  439.  
  440.     if (%battle.type = orbfountain) {
  441.       $generate_monster(orbfountain)
  442.     }
  443.  
  444.     if (%battle.type = monster) {
  445.       $generate_monster(monster)
  446.     }
  447.  
  448.     if (%battle.type = boss) {
  449.       $generate_monster(boss)
  450.       var %difficulty $readini(battle2.txt, BattleInfo, Difficulty)
  451.       if (%difficulty > 0) { inc %winning.streak %difficulty }
  452.  
  453.       if (%battle.type != manual) {
  454.         if (%winning.streak >= 50) {
  455.  
  456.           if (%demonwall.fight != on) {
  457.             set %number.of.monsters.needed $round($calc(%number.of.players / 2),0)
  458.             if (%number.of.monsters.needed = $null) { set %number.ofmonsters.needed 2 }
  459.             if (%number.of.monsters.needed > 0) { $generate_monster(monster)   }
  460.           }
  461.         }
  462.  
  463.       }
  464.     }
  465.  
  466.     ; Check for a random back attack.
  467.     $random.surpriseattack
  468.  
  469.     ; Check for an NPC Ally to join the battle.
  470.     $random.battlefield.ally
  471.  
  472.     ; Turn on the rage timer.
  473.     if ((%number.of.monsters.needed <= 3) && (%battle.type != boss)) {  /.timerBattleRage 1 900 /battle_rage_warning }
  474.     if (%battle.type = boss) {  /.timerBattleRage 1 1200 /battle_rage_warning }
  475.     else { /.timerBattleRage 1 1800 /battle_rage_warning }
  476.  
  477.     if (%mode.gauntlet = on) { /.timerBattleRage off }
  478.  
  479.     unset %winning.streak
  480.   }
  481.  
  482.   ; Check for a random battle field curse.
  483.   $random.battlefield.curse
  484.  
  485.   $generate_battle_order
  486.   set %who $read -l1 battle.txt | set %line 1
  487.   set %current.turn 1
  488.   $battlelist
  489.   /.timerEnterPause 1 2 /query %battlechan $readini(translation.dat, battle, StepsUpFirst)
  490.   ; To keep someone from sitting and doing nothing for hours at a time, there's a timer that will auto-force the next turn.
  491.   var %nextTimer $readini(system.dat, system, TimeForIdle)
  492.   if (%nextTimer = $null) { var %nextTimer 180 }
  493.   /.timerBattleNext 1 %nextTimer /next
  494.  
  495.   unset %number.of.players
  496.  
  497.   if (%demonwall.fight = on) { /.timerBattleRage 1 1 /battle_rage_warning }
  498.  
  499.   $aicheck(%who)
  500. }
  501.  
  502. alias generate_monster {
  503.   if ($1 = orbfountain) {
  504.     .copy -o $mon(orb_fountain) $char(orb_fountain)  | set %curbat $readini(battle2.txt, Battle, List) | %curbat = $addtok(%curbat,orb_fountain,46) | writeini battle2.txt Battle List %curbat | write battle.txt orb_fountain
  505.     $boost_monster_stats(orb_fountain) | $fulls(orb_fountain)
  506.     var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  507.     $set_chr_name(orb_fountain)
  508.     query %battlechan $readini(translation.dat, battle, EnteredTheBattle)
  509.     query %battlechan 12 $+ %real.name  $+ $readini($char(orb_fountain), descriptions, char)
  510.   }
  511.  
  512.   if ($1 = monster) {
  513.     $get_mon_list
  514.     var %monsters.total $numtok(%monster.list,46)
  515.  
  516.     if ((%monsters.total = 0) || (%monster.list = $null)) { query %battlechan $readini(translation.dat, Errors, NoMonsAvailable) | $clear_battle | halt }
  517.     if (%monsters.total = 1) {
  518.       .copy -o $mon(%monster.list) $char(%monster.list) | set %curbat $readini(battle2.txt, Battle, List) |  %curbat = $addtok(%curbat,%monster.list,46) | writeini battle2.txt Battle List %curbat | write battle.txt %monster.list
  519.       $set_chr_name(%monster.list)
  520.       query %battlechan $readini(translation.dat, battle, EnteredTheBattle)
  521.       /.timerQueryPause 1 2 /query %battlechan 12 $+ %real.name  $+ $readini($char(%monster.list), descriptions, char)
  522.       $boost_monster_stats(%monster.list)  
  523.       $fulls(%monster.list)
  524.       var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  525.     }
  526.     else {
  527.  
  528.       if (%mode.gauntlet != $null) { set %number.of.monsters.needed 2  }
  529.       set %value 1
  530.       while (%value <= %number.of.monsters.needed) {
  531.         if (%monster.list = $null) { inc %value 1 }
  532.         set %monsters.total $numtok(%monster.list,46)
  533.         set %random.monster $rand(1, %monsters.total)
  534.         set %monster.name $gettok(%monster.list,%random.monster,46)
  535.         if (%monsters.total = 0) { inc %value 1 }
  536.         .copy -o $mon(%monster.name) $char(%monster.name) | set %curbat $readini(battle2.txt, Battle, List) | %curbat = $addtok(%curbat,%monster.name,46) |  writeini battle2.txt Battle List %curbat
  537.         $set_chr_name(%monster.name)
  538.         query %battlechan $readini(translation.dat, battle, EnteredTheBattle)
  539.         query %battlechan 12 $+ %real.name  $+ $readini($char(%monster.name), descriptions, char)
  540.         set %monster.to.remove $findtok(%monster.list, %monster.name, 46)
  541.         set %monster.list $deltok(%monster.list,%monster.to.remove,46)
  542.         write battle.txt %monster.name
  543.         $boost_monster_stats(%monster.name)
  544.         $fulls(%monster.name) |  var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  545.         if (%battlemonsters = 10) { set %number.of.monsters.needed 0 }
  546.         inc %value 1
  547.         else {  %monster.list = $deltok(%monster.list,%monster.name,46) | dec %value 1 }
  548.       }
  549.     }
  550.   }
  551.  
  552.   if ($1 = boss) {
  553.     $get_boss_type
  554.  
  555.     if (%boss.type = normal) {
  556.       if (%winning.streak < 50) { set %number.of.monsters.needed 1 }
  557.       if ((%winning.streak >= 50) && (%winning.streak <= 70)) { set %number.of.monsters.needed $rand(1,2) }
  558.       if (%winning.streak > 70) { set %number.of.monsters.needed $rand(2,3) }
  559.       if (%number.of.monsters.needed > 3) { %number.of.monsters.needed = 3 }
  560.  
  561.       $get_boss_list
  562.       var %monsters.total $numtok(%monster.list,46)
  563.  
  564.       if ((%monsters.total = 0) || (%monster.list = $null)) { query %battlechan 4Error: There are no bosses in the boss folder.. Have the bot admin check to make sure there are bosses for players to battle! | $clear_battle | halt }
  565.       if (%monsters.total = 1) {
  566.         .copy -o $boss(%monster.list) $char(%monster.list) | set %curbat $readini(battle2.txt, Battle, List) |  %curbat = $addtok(%curbat,%monster.list,46) |  writeini battle2.txt Battle List %curbat | write battle.txt %monster.list
  567.         $set_chr_name(%monster.list)
  568.         query %battlechan $readini(translation.dat, battle, EnteredTheBattle)
  569.         query %battlechan 12 $+ %real.name  $+ $readini($char(%monster.list), descriptions, char)
  570.         query %battlechan 2 $+ %real.name looks at the heroes and says " $+ $readini($char(%monster.list), descriptions, BossQuote) $+ "
  571.         var %boss.item $readini($char(%monster.list), stuff, drops)
  572.         if (%boss.item != $null) {
  573.           var %boss.item $readini($char(%monster.list), stuff, drops)
  574.           if (%boss.item != $null) { writeini battle2.txt battle bonusitem %boss.item | unset %boss.item }
  575.         }
  576.         $boost_monster_stats(%monster.list)
  577.         $fulls(%monster.list) |  var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  578.       }
  579.       else {
  580.         if (%mode.gauntlet != $null) { set %number.of.monsters.needed 2  }
  581.         set %value 1
  582.         while (%value <= %number.of.monsters.needed) {
  583.           if (%monster.list = $null) { inc %value 1 }
  584.           set %monsters.total $numtok(%monster.list,46)
  585.           set %random.monster $rand(1, %monsters.total)
  586.           set %monster.name $gettok(%monster.list,%random.monster,46)
  587.           .copy -o $boss(%monster.name) $char(%monster.name) | set %curbat $readini(battle2.txt, Battle, List) |  %curbat = $addtok(%curbat,%monster.name,46) |  writeini battle2.txt Battle List %curbat         $set_chr_name(%monster.name)
  588.           query %battlechan $readini(translation.dat, battle, EnteredTheBattle)
  589.           query %battlechan 12 $+ %real.name  $+ $readini($char(%monster.name), descriptions, char)
  590.           query %battlechan 2 $+ %real.name looks at the heroes and says " $+ $readini($char(%monster.name), descriptions, BossQuote) $+ "
  591.           var %boss.item $readini($char(%monster.name), stuff, drops)
  592.           if (%boss.item != $null) {
  593.             var %temp.boss.list $readini(battle2.txt, battle, bonusitem)
  594.             if (%temp.boss.list != $null) { writeini battle2.txt battle bonusitem %temp.boss.list $+ . $+ %boss.item }
  595.             if (%temp.boss.list = $null) { writeini battle2.txt battle bonusitem %boss.item }
  596.           }
  597.           set %monster.to.remove $findtok(%monster.list, %monster.name, 46)
  598.           set %monster.list $deltok(%monster.list,%monster.to.remove,46)
  599.           write battle.txt %monster.name
  600.           $boost_monster_stats(%monster.name)
  601.           $fulls(%monster.name) |   var %battlemonsters $readini(battle2.txt, BattleInfo, Monsters) | inc %battlemonsters 1 | writeini battle2.txt BattleInfo Monsters %battlemonsters
  602.           if (%battlemonsters = 10) { set %number.of.monsters.needed 0 }
  603.           inc %value 1
  604.         }
  605.       }
  606.     }
  607.  
  608.     if (%boss.type = doppelganger) {
  609.       query %battlechan $readini(translation.dat, events, DoppelgangerFight)
  610.       $generate_evil_clones
  611.     }
  612.  
  613.     if (%boss.type = warmachine) {
  614.       query %battlechan $readini(translation.dat, events, WarmachineFight)
  615.       $generate_monster_warmachine
  616.     }
  617.  
  618.     if (%boss.type = demonwall) {
  619.       query %battlechan $readini(translation.dat, events, DemonWallFight)
  620.       $generate_demonwall
  621.     }
  622.     unset %boss.type
  623.   }
  624. }
  625.  
  626. ; ==========================
  627. ; Battle Rage alias
  628. ; ==========================
  629. alias battle_rage_warning {
  630.   ; This alias is just used to display a 5 minute warning before the darkness overcomes the battlefield.
  631.   if (%demonwall.fight != on) {   query %battlechan $readini(translation.dat, battle, DarknessWarning) }
  632.   if (%demonwall.fight = on) { query %battlechan $readini(translation.dat, events, DemonWallFightWarning) }
  633.   set %darkness.fivemin.warn true
  634.   /.timerBattleRage 1 300 /battle_rage
  635. }
  636.  
  637. alias battle_rage {
  638.   ; When this alias is called all the monsters still alive in battle will become much harder to kill as all of their stats will be increased
  639.   ; The idea is to make it so battles don't last forever (someone can't stall for 2 hours on one battle).  Players need to kill monsters fast.
  640.  
  641.   if (%demonwall.fight = on) { query %battlechan $readini(translation.dat, events, DemonWallFightOver) | unset %demonwall.fight |  /endbattle defeat | halt }
  642.  
  643.   set %battle.rage.darkness on
  644.  
  645.   query %battlechan $readini(translation.dat, battle, DarknessCoversBattlefield)
  646.  
  647.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  648.   while (%battletxt.current.line <= %battletxt.lines) {
  649.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  650.     var %flag $readini($char(%who.battle), info, flag)
  651.  
  652.     if (%flag = monster) {
  653.       var %current.status $readini($char(%who.battle), battle, status)
  654.       if ((%current.status = dead) || (%current.status = runaway)) { inc %battletxt.current.line 1 }
  655.  
  656.       var %ignore.flag $readini($char(%who.battle), info, RageMode)
  657.       if (%ignore.flag != ignore) {
  658.  
  659.         $boost_monster_stats(%who.battle, rage)
  660.         writeini $char(%who.battle) Basestats HP $readini($char(%who.battle), Battle, HP)
  661.         writeini $char(%who.battle) Battle Tp $readini($char(%who.battle), BaseStats, TP)
  662.         writeini $char(%who.battle) Battle Str $readini($char(%who.battle), BaseStats, Str)
  663.         writeini $char(%who.battle) Battle Def $readini($char(%who.battle), BaseStats, Def)
  664.         writeini $char(%who.battle) Battle Int $readini($char(%who.battle), BaseStats, Int)
  665.         writeini $char(%who.battle) Battle Spd $readini($char(%who.battle), BaseStats, Spd)
  666.  
  667.       }
  668.  
  669.       inc %battletxt.current.line 1
  670.     }
  671.     else { inc %battletxt.current.line 1 }
  672.   }
  673. }
  674.  
  675. ; ==========================
  676. ; Generate the turn order
  677. ; ==========================
  678. alias generate_battle_order {
  679.  
  680.   ; Are all the monsters defeated?  If so, we need to end the battle as a victory.
  681.   if ($battle.monster.death.check = true) { /.timerEndBattle $+ $rand(a,z) 1 4 /endbattle victory | halt }
  682.   if ($battle.player.death.check = true) { /.timerEndBattle $+ $rand(a,z) 1 4 /endbattle defeat | halt }
  683.  
  684.   ; get rid of the Battle Table and the now un-needed file
  685.   if ($isfile(BattleTable.file) = $true) {
  686.     hfree BattleTable
  687.     .remove BattleTable.file
  688.   }
  689.  
  690.   ; make the Battle List table
  691.   hmake BattleTable
  692.  
  693.   ; load them from the file.   the initial list will be generated from the !enter commands.  
  694.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  695.   while (%battletxt.current.line <= %battletxt.lines) {
  696.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  697.     set %battle.speed $readini($char(%who.battle), battle, spd)
  698.     if ($readini($char(%who.battle), status, slow) = yes) { %battle.speed = $calc(%battle.spd / 2) }
  699.  
  700.     set %current.playerstyle $readini($char(%who.battle), styles, equipped)
  701.     set %current.playerstyle.level $readini($char(%who.battle), styles, %current.playerstyle)
  702.  
  703.     if (%current.playerstyle = Trickster) {
  704.       inc %battle.speed $calc(2 * %current.playerstyle.level)
  705.     }
  706.  
  707.     if (%current.playerstyle = HitenMitsurugi-ryu) {
  708.       inc %battle.speed $calc(3 * %current.playerstyle.level)
  709.     }
  710.  
  711.     unset %current.playerstyle | unset %current.playerstyle.level
  712.  
  713.     if (%surpriseattack = on) {
  714.       var %ai.type $readini($char(%who.battle), info, ai_type)
  715.       if (%ai.type != defender) {
  716.         if ($readini($char(%who.battle), info, flag) = monster) { inc %battle.speed 9999999999999999999999999 }
  717.       }
  718.     }
  719.  
  720.     if (%battle.speed <= 0) { set %battle.speed 1 }
  721.  
  722.     hadd BattleTable %who.battle %battle.speed
  723.     inc %battletxt.current.line
  724.   }
  725.  
  726.   ; save the BattleTable hashtable to a file
  727.   hsave BattleTable BattleTable.file
  728.  
  729.   ; load the BattleTable hashtable (as a temporary table)
  730.   hmake BattleTable_Temp
  731.   hload BattleTable_Temp BattleTable.file
  732.  
  733.   ; sort the Battle Table
  734.   hmake BattleTable_Sorted
  735.   var %battletableitem, %battletabledata, %battletableindex, %battletablecount = $hget(BattleTable_Temp,0).item
  736.   while (%battletablecount > 0) {
  737.     ; step 1: get the lowest item
  738.     %battletableitem = $hget(BattleTable_Temp,%battletablecount).item
  739.     %battletabledata = $hget(BattleTable_Temp,%battletablecount).data
  740.     %battletableindex = 1
  741.     while (%battletableindex < %battletablecount) {
  742.       if ($hget(BattleTable_Temp,%battletableindex).data < %battletabledata) {
  743.         %battletableitem = $hget(BattleTable_Temp,%battletableindex).item
  744.         %battletabledata = $hget(BattleTable_Temp,%battletableindex).data
  745.       }
  746.       inc %battletableindex
  747.     }
  748.  
  749.     ; step 2: remove the item from the temp list
  750.     hdel BattleTable_Temp %battletableitem
  751.  
  752.     ; step 3: add the item to the sorted list
  753.     %battletableindex = sorted_ $+ $hget(BattleTable_Sorted,0).item
  754.     hadd BattleTable_Sorted %battletableindex %battletableitem
  755.  
  756.     ; step 4: back to the beginning
  757.     dec %battletablecount
  758.   }
  759.  
  760.   ; get rid of the temp table
  761.   hfree BattleTable_Temp
  762.  
  763.   ; Erase the old battle.txt and replace it with the new one.
  764.   .remove battle.txt
  765.  
  766.   var %index = $hget(BattleTable_Sorted,0).item
  767.   while (%index > 0) {
  768.     dec %index
  769.     var %tmp = $hget(BattleTable_Sorted,sorted_ $+ %index)
  770.     write battle.txt %tmp
  771.   }
  772.  
  773.   ; get rid of the sorted table
  774.   hfree BattleTable_Sorted
  775.  
  776.   ; get rid of the Battle Table and the now un-needed file
  777.   hfree BattleTable
  778.   .remove BattleTable.file
  779.  
  780.   ; unset the battle.speed
  781.   unset %battle.speed
  782.  
  783.   ; increase the current turn.
  784.   inc %current.turn 1
  785.  
  786.   unset %surpriseattack
  787.   if (%first.round.protection.turn != $null) {
  788.     if (%current.turn > %first.round.protection.turn) { unset %first.round.protection | unset %first.round.protection.turn }
  789.   }
  790. }
  791.  
  792. ; ==========================
  793. ; The battle ends
  794. ; ==========================
  795. alias endbattle {
  796.   ; $1 can be victory or defeat.
  797.   ; If victory, add red orbs to everyone..  if boss, add a black orb to all survivors
  798.   ; if defeat, add a small amount of red orbs to everyone..
  799.  
  800.   if (%battleis = off) { halt }
  801.  
  802.   ; Let's increase the total number of battles that we've had so far.
  803.   if ((%mode.pvp != on) && (%mode.gauntlet != on)) { var %totalbattles $readini(battlestats.dat, Battle, TotalBattles) |  inc %totalbattles 1 | writeini battlestats.dat Battle TotalBattles %totalbattles }
  804.  
  805.   if ($1 = defeat) {
  806.     query %battlechan $readini(translation.dat, battle, BattleIsOver)
  807.     if (%mode.pvp != on)  {
  808.       query %battlechan $readini(translation.dat, battle, EvilHasWon)
  809.  
  810.       if (%mode.gauntlet = $null) {
  811.         var %defeats $readini(battlestats.dat, battle, totalLoss) | inc %defeats 1 | writeini battlestats.dat battle totalLoss %defeats
  812.         writeini battlestats.dat battle WinningStreak 0
  813.         var %losing.streak $readini(battlestats.dat, battle, LosingStreak) | inc %losing.streak 1 | writeini battlestats.dat battle LosingStreak %losing.streak
  814.       }
  815.  
  816.       ; Add base orbs.
  817.       if (%battle.type = monster) { set %base.redorbs $readini(system.dat, System, basexp) }
  818.       if (%battle.type = boss) { set %base.redorbs $readini(system.dat, System, basebossxp) }
  819.  
  820.       %base.redorbs = $round($calc(%base.redorbs * (.5 + %number.of.monsters.needed)), 0)
  821.       set %bonus.orbs $round($readini(battle2.txt, BattleInfo, OrbBonus),0)
  822.  
  823.       inc %base.redorbs %bonus.orbs
  824.       set %base.redorbs $round($calc(%base.redorbs / 2),0)
  825.       inc %base.redorbs $rand(1,20)
  826.  
  827.       var %max.orb.reward $readini(system.dat, system, MaxOrbReward)
  828.       if (%max.orb.reward = $null) { var %max.orb.reward 20000 }
  829.  
  830.       if ((%multiple.wave.bonus = yes) && (%mode.gauntlet != on)) { %max.orb.reward = $round($calc(%max.orb.reward * 2.1),0) }
  831.  
  832.       if ((%multiple.wave.bonus = yes) && (%mode.gauntlet = on)) {
  833.         %max.orb.reward = $round($calc(%max.orb.reward * 3.6),0)
  834.         inc %max.orb.reward $calc(%mode.gauntlet.wave * 100)
  835.         var %gauntlet.record $readini(battlestats.dat, battle, GauntletRecord)
  836.         if (%gauntlet.record = $null) { var %gauntlet.record 0 }
  837.         if (%mode.gauntlet.wave > %gauntlet.record) { writeini battlestats.dat battle GauntletRecord %mode.gauntlet.wave }
  838.       }
  839.  
  840.       if (%base.redorbs > %max.orb.reward) { set %base.redorbs %max.orb.reward }
  841.       $orb.adjust
  842.  
  843.       $battle.reward.redorbs
  844.       query %battlechan $readini(translation.dat, battle, RewardOrbsLoss)
  845.     }
  846.   }
  847.  
  848.   if ($1 = victory) {
  849.     query %battlechan $readini(translation.dat, battle, BattleIsOver)
  850.  
  851.     if (%mode.pvp != on) {
  852.  
  853.       var %winning.streak $readini(battlestats.dat, battle, WinningStreak) | inc %winning.streak 1 | writeini battlestats.dat battle WinningStreak %winning.streak
  854.  
  855.       var %winning.streak.record $readini(battlestats.dat, battle, WinningStreakRecord)
  856.       if (%winning.streak.record = $null) { var %winning.streak.record 0 }
  857.       if (%winning.streak > %winning.streak.record) { writeini battlestats.dat battle WinningStreakRecord %winning.streak }
  858.  
  859.       var %wins $readini(battlestats.dat, battle, totalWins) | inc %wins 1 | writeini battlestats.dat battle totalWins %wins
  860.       writeini battlestats.dat battle LosingStreak 0
  861.  
  862.       query %battlechan $readini(translation.dat, battle, GoodHasWon)
  863.  
  864.       ; Add base orbs.
  865.       if (%battle.type = monster) { set %base.redorbs $readini(system.dat, System, basexp) }
  866.       if (%battle.type = orbfountain) { set %base.redorbs $readini(system.dat, System, basexp) | inc %base.redorbs $rand(375,750) }
  867.       if (%battle.type = boss) { set %base.redorbs $readini(system.dat, System, basebossxp) }
  868.  
  869.       %base.redorbs = $round($calc(%base.redorbs * (1 + %number.of.monsters.needed)), 0)
  870.       set %bonus.orbs $round($readini(battle2.txt, BattleInfo, OrbBonus),0)
  871.       inc %base.redorbs %bonus.orbs
  872.  
  873.       var %max.orb.reward $readini(system.dat, system, MaxOrbReward)
  874.       if (%max.orb.reward = $null) { var %max.orb.reward 20000 }
  875.       if (%multiple.wave.bonus = yes) {
  876.         var %winning.streak $readini(battlestats.dat, battle, WinningStreak)
  877.         if (%mode.gauntlet.wave != $null) { inc %winning.streak %mode.gauntlet.wave }      
  878.  
  879.         if (%winning.streak <= 100) { %max.orb.reward = $round($calc(%max.orb.reward * 2.1),0)  }
  880.         if ((%winning.streak > 100) && (%winning.streak <= 200)) { %max.orb.reward = $round($calc(%max.orb.reward * 2.8),0)  }
  881.         if ((%winning.streak > 200) && (%winning.streak <= 400)) { %max.orb.reward = $round($calc(%max.orb.reward * 3),0)  }
  882.         if (%winning.streak > 400) { %max.orb.reward = $round($calc(%max.orb.reward * 3.5),0) }
  883.       }
  884.       if (%base.redorbs > %max.orb.reward) { set %base.redorbs %max.orb.reward }
  885.       $orb.adjust
  886.  
  887.       if (%difficulty != 0) { inc %base.redorbs $round($calc(%difficulty * 4.0),0) }
  888.  
  889.       $battle.reward.redorbs
  890.       $battle.reward.playerstylepoints
  891.       $battle.reward.playerstylexp
  892.       $battle.reward.ignitionGauge.all
  893.       query %battlechan $readini(translation.dat, battle, RewardOrbsWin)
  894.  
  895.       ; If boss battle, do black orbs for select players.
  896.       unset %black.orb.winners
  897.       if (%battle.type = boss) { $generate_style_order | $battle.reward.blackorbs
  898.         if (%black.orb.winners != $null) { query %battlechan $readini(translation.dat, battle, BlackOrbWin) }
  899.         $give_random_reward
  900.       }
  901.  
  902.       if (%battle.type != orbfountain) {
  903.         ; If the reward streak is > 15 then we can check for keys and if it's +25 then we can check for creating a chest
  904.         if ($readini(system.dat, system, EnableChests) = true) {
  905.           if (%winning.streak >= 15) {  $give_random_key_reward }
  906.           if (%winning.streak >= 25) {
  907.             var %chest.chance $rand(1,100)
  908.             if (%chest.chance >= 60) {  $create_treasurechest }
  909.           }
  910.         }
  911.       }
  912.  
  913.     }
  914.   }
  915.  
  916.   if (($1 = none) || ($1 = $null)) { query %battlechan $readini(translation.dat, battle, BattleIsOver) }
  917.  
  918.   ; then do a $clear_battle
  919.   $clear_battle | halt
  920. }
  921.  
  922. ; ==========================
  923. ; The $next command.
  924. ; ==========================
  925. alias next {
  926.   unset %skip.ai | unset %file.to.read.lines
  927.   ; Reset the Next timer.
  928.   var %nextTimer $readini(system.dat, system, TimeForIdle)
  929.   if (%nextTimer = $null) { var %nextTimer 180 }
  930.   /.timerBattleNext 1 %nextTimer /next
  931.  
  932.   if (%battleis = off) { $clear_battle | halt }
  933.  
  934.   inc %line 1
  935.   set %next.person $read -l $+ %line battle.txt
  936.   if (%next.person = $null) { set %line 1 | $generate_battle_order  }
  937.   set %who $read -l $+ %line battle.txt
  938.   $turn(%who)
  939. }
  940.  
  941.  
  942. ; ==========================
  943. ; Controls the turn
  944. ; ==========================
  945. alias turn {
  946.   unset %all_status | unset %status.message
  947.   set %status $readini($char($1), Battle, Status)
  948.   if ((%status = dead) || (%status = runaway)) { unset %status | $next | halt }
  949.   if ($readini($char($1), info, ai_type) = defender) { $next | halt }
  950.   if ($1 = orb_fountain) { $next | halt }
  951.  
  952.   else {
  953.  
  954.     ; Are all the monsters defeated?  If so, we need to end the battle as a victory.
  955.     if ($battle.monster.death.check = true) { /.timerEndBattle $+ $rand(a,z) 1 2 /endbattle victory | halt }
  956.  
  957.     ; Are all the players defeated?  If so, we need to end the battle as a loss.
  958.     if ($battle.player.death.check = true) { /.timerEndBattle $+ $rand(a,z) 1 2 /endbattle defeat | halt }
  959.  
  960.     set %wait.your.turn on
  961.  
  962.     $turn.statuscheck($1)
  963.  
  964.     $hp_status($1)
  965.     set %status.message $readini(translation.dat, battle, TurnMessage)
  966.  
  967.     .timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 1 /query %battlechan %status.message
  968.  
  969.     if (($lines(temp_status.txt) != $null) && ($lines(temp_status.txt) > 0)) {
  970.       /.timerThrottle $+ $rand(a,z) $+ $rand(1,1000) $+ $rand(a,z) 1 1 /display.statusmessages $1
  971.     }
  972.  
  973.     if ($readini($char($1), status, curse) != yes) {
  974.       ; Add some TP to the player if it's not at max.
  975.       set %tp.have $readini($char($1), battle, tp)
  976.       set %tp.max $readini($char($1), basestats, tp)
  977.       inc %tp.have 5
  978.  
  979.       if ($readini($char($1), skills, zen) > 0) {
  980.         var %zen.tp.gain $calc($readini($char($1), skills, Zen) * 5)
  981.         inc %tp.have %zen.tp.gain
  982.       }
  983.  
  984.       if (%tp.have >= %tp.max) { writeini $char($1) battle tp %tp.max }
  985.       else { writeini $char($1) battle tp %tp.have }
  986.       unset %tp.have | unset %tp.max
  987.     }
  988.  
  989.     if ($lines(temp_status.txt) != $null) {
  990.       set %file.to.read.lines $lines(temp_status.txt)
  991.       inc %file.to.read.lines 2
  992.     }
  993.  
  994.     writeini $char($1) Status burning no | writeini $char($1) Status drowning no | writeini $char($1) Status earth-quake no | writeini $char($1) Status tornado no
  995.     writeini $char($1) Status freezing no | writeini $char($1) status frozen no | writeini $char($1) status shock no
  996.  
  997.     if ($readini($char($1), status, staggered) = yes) { set %skip.ai on | writeini $char($1) status staggered no  | /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next | halt }
  998.     if (((($readini($char($1), Status, Blind) = yes) || ($readini($char($1), Status, Petrified) = yes) ||  ($readini($char($1), status, bored) = yes) || ($readini($char($1), Status, intimidate) = yes)))) {
  999.       writeini $char($1) status petrified no | writeini $char($1) status intimidate no | writeini $char($1) Status blind no | writeini $char($1) status paralysis no | writeini $char($1) status stun no | writeini $char($1) status bored no | writeini $char($1) status stop no |  set %skip.ai on | /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next | halt
  1000.     }
  1001.     if ($readini($char($1), Status, cocoon) = yes) { set %skip.ai on | query %battlechan $readini(translation.dat, status, CurrentlyCocoonEvolve) |  /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next  | halt }
  1002.     if ($readini($char($1), status, paralysis) = yes) { set %skip.ai on | /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next  | halt }
  1003.     if ($readini($char($1), status, sleep) = yes) { set %skip.ai on | /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next | halt  }
  1004.     if ($readini($char($1), status, stun) = yes) { set %skip.ai on | writeini $char($1) status stun no | /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next | halt }
  1005.     if ($readini($char($1), status, stop) = yes) { set %skip.ai on | writeini $char($1) status stop no | /.timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 %file.to.read.lines /next | halt }
  1006.   }
  1007.  
  1008.   if (%skip.ai != on) {
  1009.     ; Check for AI
  1010.     if (%file.to.read.lines > 0) {
  1011.       /.timerSlowYouDown $+ $rand(a,z) $+ $rand(1,100) 1 %file.to.read.lines /set %wait.your.turn off
  1012.       /.timerSlowYouDown2 $+ $rand(a,z) $+ $rand(1,100) 1 %file.to.read.lines /aicheck $1 | halt
  1013.     }
  1014.     else { set %wait.your.turn off | $aicheck($1) | halt }
  1015.   }
  1016. }
  1017.  
  1018.  
  1019.  
  1020. ; ==========================
  1021. ; See if all the players are dead.
  1022. ; ==========================
  1023. alias battle.player.death.check {
  1024.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  1025.   var %death.count 0
  1026.   while (%battletxt.current.line <= %battletxt.lines) {
  1027.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  1028.     var %flag $readini($char(%who.battle), info, flag)
  1029.     if ((%flag = monster) || (%flag = npc)) { inc %battletxt.current.line }
  1030.     else {
  1031.       var %current.status $readini($char(%who.battle), battle, status)
  1032.       if ((%current.status = dead) || (%current.status = runaway)) { inc %death.count 1 | inc %battletxt.current.line 1 }
  1033.       else { inc %battletxt.current.line 1 }
  1034.     }
  1035.   }
  1036.  
  1037.   if (%mode.pvp != on) {
  1038.     if (%death.count = $readini(battle2.txt, BattleInfo, Players)) { return true }
  1039.     else { return false }
  1040.   }
  1041.   if (%mode.pvp = on) {
  1042.     if (%death.count = $calc($readini(battle2.txt, BattleInfo, Players) - 1)) { return true }
  1043.     else { return false }
  1044.   }
  1045. }
  1046.  
  1047. ; ==========================
  1048. ; See if all the monsters are dead
  1049. ; ==========================
  1050. alias battle.monster.death.check {
  1051.   if (%mode.pvp = on) { return }
  1052.  
  1053.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  1054.   var %death.count 0
  1055.   while (%battletxt.current.line <= %battletxt.lines) {
  1056.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  1057.     if ($readini($char(%who.battle), info, flag) != monster) { inc %battletxt.current.line }
  1058.     else {
  1059.       var %current.status $readini($char(%who.battle), battle, status)
  1060.       if ((%current.status = dead) || (%current.status = runaway)) { inc %death.count 1 | inc %battletxt.current.line 1 }
  1061.       else { inc %battletxt.current.line 1 }
  1062.     }
  1063.   }
  1064.  
  1065.   if (%death.count = $readini(battle2.txt, BattleInfo, Monsters)) {
  1066.  
  1067.     $multiple_wave_check
  1068.     if (%multiple.wave = $null) { return true }
  1069.     if (%multiple.wave = yes) { unset %multiple.wave | return false }
  1070.   }
  1071.   else { return false }
  1072. }
  1073.  
  1074. ; ==========================
  1075. ; Get a list of people in battle
  1076. ; ==========================
  1077. alias battlelist {
  1078.   if (%battleis = off) { query %battlechan $readini(translation.dat, errors, NoBattleCurrently) | halt }
  1079.   unset %battle.list | set %lines $lines(battle.txt) | set %l 1
  1080.   while (%l <= %lines) {
  1081.     set %who.battle $read -l [ $+ [ %l ] ] battle.txt | set %status.battle $readini($char(%who.battle), Battle, Status)
  1082.     if (%status.battle = $null) { inc %l 1 }
  1083.     else {
  1084.       if (%status.battle = dead) {
  1085.         var %token.to.add 4 $+ %who.battle
  1086.         %battle.list = $addtok(%battle.list,%token.to.add,46) | inc %l 1
  1087.       }
  1088.       else {
  1089.         if ($readini($char(%who.battle), info, flag) = monster) { var %token.to.add 5 $+ %who.battle }
  1090.         if ($readini($char(%who.battle), info, flag) = npc) { var %token.to.add 12 $+ %who.battle }
  1091.         if ($readini($char(%who.battle), info, flag) = $null) { var %token.to.add 3 $+ %who.battle }
  1092.  
  1093.         %battle.list = $addtok(%battle.list,%token.to.add,46) | inc %l 1
  1094.       }
  1095.     }
  1096.   }
  1097.   unset %lines | unset %l
  1098.   $battlelist.cleanlist
  1099.   if (%battle.list = $null) { query %battlechan $readini(translation.dat, battle, NoOneJoinedBattleYet) | unset %battle.list | unset %who.battle | halt }
  1100.   query %battlechan $readini(translation.dat, battle, BatListTitleMessage)  
  1101.   if (%current.turn = $null) { var %current.turn 0 }
  1102.   query %battlechan 4[Turn #:12 %current.turn $+ 4][Weather:12 $readini(weather.lst, weather, current) $+ 4] [Battlefield:12 %current.battlefield $+ 4]
  1103.   query %battlechan 4[Battle Order: %battle.list $+ 4] | unset %battle.list | unset %who.battle
  1104. }
  1105.  
  1106. alias battlelist.cleanlist {
  1107.   ; CLEAN UP THE LIST
  1108.   if ($chr(046) isin %battle.list) { set %replacechar $chr(044) $chr(032)
  1109.     %battle.list = $replace(%battle.list, $chr(046), %replacechar)
  1110.   }
  1111. }
  1112.  
  1113. ; ==========================
  1114. ; REWARD ORBS
  1115. ; ===========================
  1116.  
  1117. alias battle.reward.redorbs {
  1118.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  1119.   while (%battletxt.current.line <= %battletxt.lines) {
  1120.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  1121.     var %flag $readini($char(%who.battle), info, flag)
  1122.     if ((%flag = monster) || (%flag = npc)) { inc %battletxt.current.line 1 }
  1123.     else {
  1124.       var %current.redorbs $readini($char(%who.battle), stuff, redorbs)
  1125.       inc %current.redorbs %base.redorbs
  1126.       var %total.redorbs.reward %base.redorbs
  1127.  
  1128.       ; Check for the orb hunter passive skill.
  1129.       if ($readini($char(%who.battle), skills, OrbHunter) != $null) {
  1130.         var %orbhunter.inc.amount $readini(skills.db, orbhunter, amount)
  1131.         if (%orbhunter.inc.amount = $null) { var %orbhunter.inc.amount 15 }
  1132.         inc %current.redorbs $round($calc(%orbhunter.inc.amount * $readini($char(%who.battle), skills, OrbHunter)),0)
  1133.         inc %total.redorbs.reward $round($calc(%orbhunter.inc.amount * $readini($char(%who.battle), skills, OrbHunter)),0)
  1134.       }
  1135.  
  1136.       ;  Check for the an accessory that increases red orbs
  1137.       set %current.accessory $readini($char(%who.battle), equipment, accessory)
  1138.       if ($readini(items.db, %current.accessory, accessorytype) = IncreaseRedOrbs) {
  1139.         set %accessory.amount $readini(items.db, %current.accessory, amount)
  1140.         var %increase.orbs.amount $round($calc(%base.redorbs * %accessory.amount),0)
  1141.         inc %current.redorbs %increase.orbs.amount
  1142.         inc %total.redorbs.reward %increase.orbs.amount
  1143.         unset %accessory.amount
  1144.       }
  1145.       unset %current.accessory
  1146.  
  1147.       writeini $char(%who.battle) stuff redorbs %current.redorbs
  1148.  
  1149.       %red.orb.winners = $addtok(%red.orb.winners, $+ %who.battle $+  $+ $chr(91) $+ $chr(43) $+ $bytes(%total.redorbs.reward,b) $+ $chr(93),46)
  1150.  
  1151.       inc %battletxt.current.line 1
  1152.     }
  1153.   }
  1154.  
  1155.   ; CLEAN UP THE LIST
  1156.   if ($chr(046) isin %red.orb.winners) { set %replacechar $chr(044) $chr(032)
  1157.     %red.orb.winners = $replace(%red.orb.winners, $chr(046), %replacechar)
  1158.   }
  1159. }
  1160.  
  1161. alias battle.reward.blackorbs {
  1162.   unset %black.orb.winners
  1163.   set %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1
  1164.   while (%battletxt.current.line <= %battletxt.lines) {
  1165.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  1166.     var %flag $readini($char(%who.battle), info, flag)
  1167.     if ((%flag = monster) || (%flag = npc)) { inc %battletxt.current.line 1 }
  1168.     else {
  1169.       set %current.status $readini($char(%who.battle), battle, status)
  1170.       if (%current.status = dead) { inc %battletxt.current.line 1 }
  1171.       else {
  1172.         ; Increase black orbs
  1173.         var %current.blackorbs $readini($char(%who.battle), stuff, blackorbs)
  1174.         inc %current.blackorbs 1
  1175.         writeini $char(%who.battle) stuff blackorbs %current.blackorbs
  1176.         %black.orb.winners = $addtok(%black.orb.winners,%who.battle,46)
  1177.         inc %battletxt.current.line 1
  1178.       }
  1179.     }
  1180.   }
  1181.   ; CLEAN UP THE LIST
  1182.   if ($chr(046) isin %black.orb.winners) { set %replacechar $chr(044) $chr(032)
  1183.     %black.orb.winners = $replace(%black.orb.winners, $chr(046), %replacechar)
  1184.   }
  1185.   unset %current.status
  1186. }
  1187.  
  1188. ; ===========================
  1189. ; REWARD PLAYER STYLE XP
  1190. ; ===========================
  1191.  
  1192. alias battle.reward.playerstylexp {
  1193.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1 | set %playerstyle.xp.reward $rand(1,3)
  1194.   while (%battletxt.current.line <= %battletxt.lines) {
  1195.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  1196.     var %flag $readini($char(%who.battle), info, flag)
  1197.     if ((%flag = monster) || (%flag = npc)) { inc %battletxt.current.line 1 }
  1198.     else {
  1199.       var %vogue.check $readini($char(%who.battle), skills, Vogue)
  1200.       if (%vogue.check > 0) {
  1201.         var %vogue.value $readini($char(%who.battle), skills, Vogue) * 1
  1202.         inc %playerstyle.xp.reward %vogue.value
  1203.       }
  1204.       $add.playerstyle.xp(%who.battle, %playerstyle.xp.reward)
  1205.       inc %battletxt.current.line 1
  1206.     }
  1207.   }
  1208.   unset %playerstyle.xp
  1209. }
  1210.  
  1211.  
  1212. ;==========================
  1213. ; REWARD IGNITION GAUGE
  1214. ;==========================
  1215.  
  1216. alias battle.reward.ignitionGauge.all {
  1217.   var %battletxt.lines $lines(battle.txt) | var %battletxt.current.line 1 | set %player.ig.reward 1
  1218.   while (%battletxt.current.line <= %battletxt.lines) {
  1219.     var %who.battle $read -l $+ %battletxt.current.line battle.txt
  1220.     var %flag $readini($char(%who.battle), info, flag)
  1221.     if ((%flag = monster) || (%flag = npc)) { inc %battletxt.current.line 1 }
  1222.     else {
  1223.       set %player.ig.current $readini($char(%who.battle), battle, IgnitionGauge)
  1224.       set %player.ig.max $readini($char(%who.battle), BaseStats, IgnitionGauge)
  1225.       inc %player.ig.current %player.ig.reward
  1226.       if (%player.ig.current > %player.ig.max) { writeini $char(%who.battle) battle IgnitionGauge %player.ig.max }
  1227.       else { writeini $char(%who.battle) battle IgnitionGauge %player.ig.current }
  1228.       inc %battletxt.current.line 1
  1229.     }
  1230.   }
  1231.   unset %player.ig.current | unset %player.ig.max | unset %player.ig.reward
  1232. }
  1233.  
  1234. alias battle.reward.ignitionGauge.single {
  1235.   if ($readini($char($1), info, flag) = monster) { return }
  1236.   set %player.ig.current $readini($char($1), battle, IgnitionGauge)
  1237.   set %player.ig.max $readini($char($1), BaseStats, IgnitionGauge)
  1238.   set %player.ig.reward 1
  1239.   inc %player.ig.current %player.ig.reward
  1240.   if (%player.ig.current > %player.ig.max) { writeini $char($1) battle IgnitionGauge %player.ig.max }
  1241.   else { writeini $char($1) battle IgnitionGauge %player.ig.current }
  1242. }
  1243.  
  1244. ;==========================
  1245. ; Check the various status effects
  1246. ;==========================
  1247. alias turn.statuscheck {
  1248.  
  1249.   if ($lines(temp_status.txt) != $null) {   /.remove temp_status.txt }
  1250.  
  1251.   $poison_check($1) | $zombie_check($1) | $zombieregenerating_check($1) | $virus_check($1)
  1252.   $frozen_check($1) | $shock_check($1)  | $burning_check($1) | $tornado_check($1) | $drowning_check($1) | $earth-quake_check($1)
  1253.   $staggered_check($1) | $intimidated_check($1) | $blind_check($1) | $curse_check($1) | unset %hp.percent  | $stopped_check($1) | $charm_check($1) | $amnesia_check($1) | $paralysis_check($1)
  1254.   $drunk_check($1) | $slowed_check($1) | $asleep_check($1) | $stunned_check($1) | $defensedown_check($1) | $strengthdown_check($1) | $ethereal_check($1)
  1255.   $cocoon_check($1) | $weapon_locked($1) | $petrified_check($1)  | $bored.check($1)
  1256.  
  1257.   $regenerating_check($1) | $TPregenerating_check($1) | $boosted_check($1)  | $ignition_check($1) | $conserveTP_check($1) | $revive_check($1)
  1258.  
  1259.   if (%all_status = $null) { %all_status = none }
  1260.  
  1261.   return
  1262. }
  1263.  
  1264. alias display.statusmessages {
  1265.   if (($lines(temp_status.txt) != $null) && ($lines(temp_status.txt) > 0)) {
  1266.     var %file.to.read temp_status.txt
  1267.     /.play %battlechan %file.to.read
  1268.     /.remove temp_status.txt
  1269.     /.timerReturnFromStatus $+ $rand(a,z) 1 2 /return
  1270.   }
  1271. }
  1272.  
  1273. ; ============================
  1274. ; STATUS EFFECTS aliases
  1275. ;=============================
  1276.  
  1277. alias poison_check {
  1278.   ;  Check for the an accessory that poisons the user
  1279.   set %current.accessory $readini($char($1), equipment, accessory)
  1280.   if ($readini(items.db, %current.accessory, accessorytype) = IncreaseMeleeAddPoison) {
  1281.     writeini $char($1) status poison yes
  1282.     writeini $char($1) status poison.timer 0
  1283.   }
  1284.   unset %current.accessory
  1285.  
  1286.   if (($readini($char($1), status, poison) = yes) || ($readini($char($1), status, poison-heavy) = yes)) {
  1287.     set %poison.timer $readini($char($1), status, poison.timer)  
  1288.     if (%poison.timer > 3) {  
  1289.       writeini $char($1) status poison no
  1290.       writeini $char($1) status poison-heavy no
  1291.       writeini $char($1) status poison.timer 1
  1292.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, PoisonWornOff)
  1293.       return
  1294.     }
  1295.     if (%poison.timer <= 3) {
  1296.       %poison.timer = $calc(%poison.timer + 1) | writeini $char($1) status poison.timer %poison.timer
  1297.       if ($readini($char($1), Status, poison-heavy) = yes) { $heavy-poison($1) | return }
  1298.       $status_message_check(poisoned)
  1299.       set %max.hp $readini($char($1), basestats, hp)
  1300.       set %poison $round($calc(%max.hp * .10),0)
  1301.       set %hp $readini($char($1), Battle, HP)  |   unset %max.hp
  1302.       if (%poison >= %hp) { query %battlechan %status.message | $set_chr_name($1) | query %battlechan $readini(translation.dat, status, PoisonKills) | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1303.       $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1304.       if (%poison < %hp) {
  1305.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, PoisonMessage) | dec %hp %poison | writeini $char($1) Battle HP %hp |  unset %hp | unset %poison |  return  }
  1306.     }
  1307.   }
  1308.   else { return }
  1309. }
  1310.  
  1311. alias heavy-poison { $status_message_check(poisoned heavily)
  1312.   set %max.hp $readini($char($1), basestats, hp)
  1313.   set %poison $round($calc(%max.hp * .20),0)
  1314.   set %hp $readini($char($1), Battle, HP) | $set_chr_name($1)
  1315.   unset %max.hp
  1316.   if (%poison >= %hp) { query %battlechan %status.message | query %battlechan $readini(translation.dat, status, PoisonKills) | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1317.   $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1318.   if (%poison < %hp) { $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, PoisonMessage) | dec %hp %poison | writeini $char($1) Battle HP %hp | unset %hp | unset %poison |  return  }
  1319. }
  1320.  
  1321. alias curse_check {
  1322.  
  1323.   set %current.accessory $readini($char($1), equipment, accessory)
  1324.   set %current.accessory.type $readini(items.db, %current.accessory, accessorytype)
  1325.  
  1326.   if (%current.accessory.type = CurseAddDrain) {
  1327.     writeini $char($1) status curse yes
  1328.     writeini $char($1) status curse.timer 0
  1329.     writeini $char($1) battle tp 0
  1330.   }
  1331.  
  1332.   unset %current.accessory | unset %current.accessory.type
  1333.  
  1334.   if ($readini($char($1), status, curse) = yes) {
  1335.     set %curse.timer $readini($char($1), status, curse.timer)  
  1336.     if (%curse.timer <= 3) { %curse.timer = $calc(%curse.timer + 1) | writeini $char($1) status curse.timer %curse.timer | $status_message_check(cursed)
  1337.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyCursed) | unset %curse.timer | return
  1338.     }
  1339.     else {
  1340.       writeini $char($1) status curse no | writeini $char($1) status curse.timer 1
  1341.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurseWornOff) | unset %curse.timer | return
  1342.     }
  1343.   }
  1344.   else { return }
  1345. }
  1346.  
  1347. alias regenerating_check {
  1348.   if (($readini($char($1), Status, zombieregenerating) = yes) || ($readini($char($1), Status, ZombieRegenerating) = on)) { return }
  1349.   if (($readini($char($1), Status, regenerating) = yes) || ($readini($char($1), Status, Regenerating) = on)) {
  1350.     $status_message_check(regenerating HP) | var %howmuch $skill.regen.calculate($1) | $set_chr_name($1)
  1351.     var %current.hp $readini($char($1), battle, HP) | inc %current.hp %howmuch | writeini $char($1) Battle HP %current.hp
  1352.     $regen_done_check($1, %howmuch, HP)
  1353.   }
  1354.   else { return }
  1355. }
  1356.  
  1357. alias TPregenerating_check {
  1358.   if (($readini($char($1), Status, TPRegenerating) = yes) || ($readini($char($1), Status, TPRegenerating) = on)) {
  1359.     $status_message_check(regenerating TP) | var %howmuch $skill.TPregen.calculate($1) | $set_chr_name($1)
  1360.     var %current.tp $readini($char($1), battle, TP) | inc %current.tp %howmuch | writeini $char($1) Battle TP %current.tp
  1361.     $regen_done_check($1, %howmuch, TP)
  1362.   }
  1363.   else { return }
  1364. }
  1365.  
  1366. alias regen_done_check {
  1367.   var %current $readini($char($1), Battle, $3) | var %max $readini($char($1), BaseStats, $3)
  1368.  
  1369.   if (($3 = hp) || ($3 = tp)) {
  1370.     if (%current >= %max) {
  1371.       $set_chr_name($1) | $set_chr_name($1) | write temp_status.txt $readini(translation.db, skill, FinishedRegen)
  1372.       if ($3 = TP) { writeini $char($1) Status TPRegenerating no }
  1373.       if ($3 = HP) { writeini $char($1) Status Regenerating no }
  1374.       var %max $readini($char($1), BaseStats, $3) |  writeini $char($1) Battle $3 %max | return
  1375.     }
  1376.     else { $set_chr_name($1) | write temp_status.txt $readini(translation.dat, skill, RegenerationMessage)  | return }
  1377.   }
  1378.  
  1379.   else { $set_chr_name($1) | write temp_status.txt $readini(translation.dat, skill, RegenerationMessage) | return }
  1380. }
  1381.  
  1382. alias zombieregenerating_check {
  1383.   if (($readini($char($1), Status, zombieregenerating) = yes) || ($readini($char($1), Status, ZombieRegenerating) = on)) {
  1384.     $status_message_check(regenerating HP) | var %howmuch $skill.zombieregen.calculate($1) | $set_chr_name($1)
  1385.     var %current.hp $readini($char($1), battle, HP) | inc %current.hp %howmuch | writeini $char($1) Battle HP %current.hp
  1386.  
  1387.     var %current $readini($char($1), Battle, hp) | var %max $readini($char($1), BaseStats, hp)
  1388.     if (%current >= %max) {  writeini $char($1) Battle hp %max }
  1389.  
  1390.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, skill, ZombieRegeneration)  | return
  1391.   }
  1392.   else { return }
  1393. }
  1394.  
  1395. alias staggered_check {
  1396.   if ($readini($char($1), Status, staggered) = yes) { $status_message_check(staggered)
  1397.     $set_chr_name($1) | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, TooStaggeredToFight)
  1398.     writeini $char($1) info CanStagger no
  1399.   }
  1400.   else { return }
  1401. }
  1402.  
  1403. alias blind_check {
  1404.   if ($readini($char($1), Status, blind) = yes) { $status_message_check(blind)
  1405.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, TooBlindToFight)
  1406.   }
  1407.   else { return }
  1408. }
  1409.  
  1410. alias petrified_check {
  1411.   if ($readini($char($1), Status, petrified) = yes) { $status_message_check(petrified)
  1412.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, TooPetrifiedToFight)
  1413.   }
  1414.   else { return }
  1415. }
  1416.  
  1417. alias cocoon_check {
  1418.   var %cocoon.timer $readini($char($1), status, cocoon.timer)  
  1419.   if (%cocoon.timer < 3) {
  1420.     if ($readini($char($1), Status, cocoon) = yes) {
  1421.       $status_message_check(evolving) |  %cocoon.timer = $calc(%cocoon.timer + 1) | writeini $char($1) status cocoon.timer %cocoon.timer
  1422.       $set_chr_name($1) | return
  1423.     }
  1424.   }
  1425.   else {
  1426.     if ($readini($char($1), Status, cocoon) = yes) {  
  1427.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CocoonWornOff)
  1428.       writeini $char($1) status cocoon no | writeini $char($1) status cocoon.timer 1
  1429.       unset %cocoon.timer | $boost_monster_stats($1, evolve) | $fulls($1) | return
  1430.     }
  1431.   }
  1432.   return
  1433. }
  1434.  
  1435. alias intimidated_check {
  1436.   if ($readini($char($1), Status, intimidate) = yes) { $status_message_check(intimidated)
  1437.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, TooIntimidatedToFight)
  1438.   }
  1439.   else { return }
  1440. }
  1441.  
  1442. alias frozen_check {
  1443.   if ($readini($char($1), Status, frozen) = yes) { $status_message_check(freezing)
  1444.     set %freezing $rand(1,10) | set %hp $readini($char($1), Battle, HP) | $set_chr_name($1)
  1445.     if (%freezing >= %hp) { query %battlechan $readini(translation.dat, status, FrozenDeath) | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1446.     $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1447.     if (%freezing < %hp) { $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, FrozenMessage) | dec %hp %freezing |  writeini $char($1) Battle HP %hp | return }
  1448.   }
  1449.   else { return }
  1450. }
  1451.  
  1452. alias asleep_check {
  1453.   if ($readini($char($1), Status, Sleep) = yes) { $status_message_check(asleep)
  1454.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyAsleep)
  1455.   }
  1456.   else { return }
  1457. }
  1458.  
  1459. alias stunned_check {
  1460.   if ($readini($char($1), Status, Stun) = yes) { $status_message_check(stunned)
  1461.   $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyStunned)  }
  1462.   else { return }
  1463. }
  1464.  
  1465. alias stopped_check {
  1466.   if ($readini($char($1), Status, Stop) = yes) { $status_message_check(frozen in time)
  1467.   $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyStopped)  }
  1468.   else { return }
  1469. }
  1470.  
  1471. alias shock_check {
  1472.   if ($readini($char($1), Status, shock) = yes) { $status_message_check(shocked)
  1473.     set %max.hp $readini($char($1), basestats, hp)
  1474.     set %shock $round($calc(%max.hp * .05),0)
  1475.     unset %max.hp | set %hp $readini($char($1), battle, hp)
  1476.     $set_chr_name($1)
  1477.     if (%shock >= %hp) { .timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 0 query %battlechan $readini(translation.dat, status, ShockDeath)  | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1478.     $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1479.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, ShockMessage)  | dec %hp %shock |  writeini $char($1) Battle HP %hp | return
  1480.   }
  1481.   else { return }
  1482. }
  1483.  
  1484. alias burning_check {
  1485.   if ($readini($char($1), Status, burning) = yes) { $status_message_check(burning)
  1486.     set %max.hp $readini($char($1), basestats, hp)
  1487.     set %burning $round($calc(%max.hp * .05),0)
  1488.     unset %max.hp | set %hp $readini($char($1), battle, hp)
  1489.     $set_chr_name($1)
  1490.     if (%burning >= %hp) { .timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 0 query %battlechan $readini(translation.dat, status, BurningDeath) | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1491.     $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1492.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, BurningMessage) | dec %hp %burning | writeini $char($1) Battle HP %hp | return
  1493.   }
  1494.   else { return }
  1495. }
  1496.  
  1497. alias tornado_check {
  1498.   if ($readini($char($1), Status, tornado) = yes) { $status_message_check(caught in a tornado)
  1499.     set %max.hp $readini($char($1), basestats, hp)
  1500.     set %tornado $round($calc(%max.hp * .05),0)
  1501.     unset %max.hp | set %hp $readini($char($1), battle, hp)
  1502.     $set_chr_name($1)
  1503.     if (%tornado >= %hp) { .timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 0 query %battlechan $readini(translation.dat, status, TornadoDeath) | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1504.     $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1505.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, TornadoMessage) | dec %hp %tornado | writeini $char($1) Battle HP %hp | return
  1506.   }
  1507.   else { return }
  1508. }
  1509.  
  1510. alias drowning_check {
  1511.   if ($readini($char($1), Status, drowning) = yes) { $status_message_check(drowning)
  1512.     set %max.hp $readini($char($1), basestats, hp)
  1513.     set %drowning $round($calc(%max.hp * .05),0)
  1514.     unset %max.hp | set %hp $readini($char($1), battle, hp)
  1515.     $set_chr_name($1)
  1516.     if (%drowning >= %hp) { .timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 0 query %battlechan $readini(translation.dat, status, DrowningDeath)  | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath $add.style.effectdeath
  1517.     $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1518.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, DrowningMessage) | writeini $char($1) Battle Status normal | dec %hp %drowning | writeini $char($1) Battle HP %hp | return
  1519.   }
  1520.   else { return }
  1521. }
  1522.  
  1523. alias earth-quake_check {
  1524.   if ($readini($char($1), Status, earth-quake) = yes) { $status_message_check(shaking)
  1525.     set %max.hp $readini($char($1), basestats, hp)
  1526.     set %shaken $round($calc(%max.hp * .05),0)
  1527.     unset %max.hp | set %hp $readini($char($1), battle, hp)
  1528.     $set_chr_name($1)
  1529.     if (%shaken >= %hp) { .timerThrottle $+ $rand(a,z) $+ $rand(1,100) $+ $rand(a,z) 1 0 query %battlechan $readini(translation.dat, status, EarthquakeDeath) | writeini $char($1) Battle HP 0 | writeini $char($1) Battle Status Dead | $add.style.effectdeath
  1530.     $goldorb_check($1) | $spawn_after_death($1) | remini $char($1) Renkei | next | halt }
  1531.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, EarthquakeMessage)   | writeini $char($1) Battle Status normal | dec %hp %shaken | writeini $char($1) Battle HP %hp | return
  1532.   }
  1533.   else { return }
  1534. }
  1535.  
  1536. alias weight_check {
  1537.   if ($readini($char($1), Status, weight) = yes) { $status_message_check(weighed down)
  1538.   $set_chr_name($1) | write temp_status.txt query %battlechan $readini(translation.dat, status, CurrentlyWeighed) | return }
  1539.   else { return }
  1540. }
  1541.  
  1542. alias weapon_locked {
  1543.   if ($readini($char($1), Status, weapon.locked) != $null) {
  1544.     set %weaponlock.timer $readini($char($1), status, weaponlock.timer)  
  1545.     if (%weaponlock.timer < 4) { %weaponlock.timer = $calc(%weaponlock.timer + 1) | writeini $char($1) status weaponlock.timer %weaponlock.timer | $status_message_check(Weapon Locked)
  1546.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyWeaponLocked) | unset %weaponlock.timer | return
  1547.     }
  1548.     else {
  1549.       remini $char($1) status weapon.locked | writeini $char($1) status weaponlock.timer 1
  1550.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, WeaponLockWornOff) | unset %weaponlock.timer | return
  1551.     }
  1552.   }
  1553.   else { return }
  1554. }
  1555.  
  1556. alias drunk_check {
  1557.   if ($readini($char($1), Status, drunk) = yes) {
  1558.     set %drunk.timer $readini($char($1), status, drunk.timer)  
  1559.     if (%drunk.timer <= 3) { %drunk.timer = $calc(%drunk.timer + 1) | writeini $char($1) status drunk.timer %drunk.timer | $status_message_check(drunk)
  1560.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyDrunk) | unset %drunk.timer | return
  1561.     }
  1562.     else {
  1563.       writeini $char($1) status drunk no | writeini $char($1) status drunk.timer 1
  1564.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, DrunkWornOff) | unset %drunk.timer | return
  1565.     }
  1566.   }
  1567.   else { return }
  1568. }
  1569.  
  1570. alias zombie_check {
  1571.   if ($readini($char($1), monster, type) = zombie) {
  1572.     writeini $char($1) status zombieregenerating on
  1573.     $status_message_check(zombie) | return
  1574.   }
  1575.   var %zombie.timer $readini($char($1), status, zombie.timer)  
  1576.   if (%zombie.timer <= 3) {
  1577.     if ($readini($char($1), Status, zombie) = yes) { $status_message_check(zombie) |  %zombie.timer = $calc(%zombie.timer + 1) | writeini $char($1) status zombie.timer %zombie.timer |  writeini $char($1) status zombieregenerating on
  1578.     $set_chr_name($1) | return }
  1579.   }
  1580.   else {
  1581.     if ($readini($char($1), Status, zombie) = yes) {   writeini $char($1) status zombie no | writeini $char($1) status zombie.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, ZombieWornOff) |  writeini $char($1) status zombieregenerating off | unset %zombie.timer | return  }
  1582.   }
  1583.   return
  1584. }
  1585.  
  1586. alias virus_check {
  1587.   var %virus.timer $readini($char($1), status, virus.timer)  
  1588.   if (%virus.timer <= 3) {
  1589.     if ($readini($char($1), Status, virus) = yes) { $status_message_check(virus) |  %virus.timer = $calc(%virus.timer + 1) | writeini $char($1) status virus.timer %virus.timer
  1590.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyHasVirus) | return }
  1591.   }
  1592.   else {
  1593.     if ($readini($char($1), Status, virus) = yes) {   writeini $char($1) status virus no | writeini $char($1) status virus.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, virusWornOff) |  writeini $char($1) status virusregenerating off | unset %virus.timer | return  }
  1594.   }
  1595.   return
  1596. }
  1597.  
  1598. alias slowed_check {
  1599.   var %slow.timer $readini($char($1), status, slow.timer)  
  1600.   if (%slow.timer <= 3) {
  1601.     if ($readini($char($1), Status, slow) = yes) { $status_message_check(slowed) |  %slow.timer = $calc(%slow.timer + 1) | writeini $char($1) status slow.timer %slow.timer
  1602.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, currentlyslowed) | return }
  1603.   }
  1604.   else {
  1605.     if ($readini($char($1), Status, slow) = yes) {   writeini $char($1) status slow no | writeini $char($1) status slow.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, SlowWornOff)  | unset %slow.timer | return  }
  1606.   }
  1607.   return
  1608. }
  1609.  
  1610. alias defensedown_check {
  1611.   var %defensedown.timer $readini($char($1), status, defensedown.timer)  
  1612.   if (%defensedown.timer = $null) { var %defensedown.timer 0 }
  1613.   if (%defensedown.timer <= 3) {
  1614.     if ($readini($char($1), Status, DefenseDown) = yes) { $status_message_check(Defense Down) |  %defensedown.timer = $calc(%defensedown.timer + 1) | writeini $char($1) status defensedown.timer %defensedown.timer
  1615.     $set_chr_name($1)  | write temp_status.txt $readini(translation.dat, status, currentlydefensedown) | unset %defensedown.timer | return }
  1616.   }
  1617.   else {
  1618.     if ($readini($char($1), Status, DefenseDown) = yes) {   writeini $char($1) status DefenseDown no | writeini $char($1) status defensedown.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, DefenseDownWornOff)  | unset %defensedown.timer | return  }
  1619.   }
  1620.   return
  1621. }
  1622.  
  1623. alias strengthdown_check {
  1624.   var %strengthdown.timer $readini($char($1), status, strengthdown.timer)  
  1625.   if (%strengthdown.timer = $null) { var %strengthdown.timer 0 }
  1626.   if (%strengthdown.timer <= 3) {
  1627.     if ($readini($char($1), Status, strengthDown) = yes) { $status_message_check(Strength Down) |  %strengthdown.timer = $calc(%strengthdown.timer + 1) | writeini $char($1) status strengthdown.timer %strengthdown.timer
  1628.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, currentlystrengthdown) | unset %strengthdown.timer | return }
  1629.   }
  1630.   else {
  1631.     if ($readini($char($1), Status, strengthDown) = yes) {   writeini $char($1) status strengthDown no | writeini $char($1) status strengthdown.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, StrengthDownWornOff)  | unset %strengthdown.timer | return  }
  1632.   }
  1633.   return
  1634. }
  1635.  
  1636. alias weaponlock_check {
  1637.   var %weaponlock.timer $readini($char($1), status, weaponlock.timer)  
  1638.   if (%weaponlock.timer = $null) { var %weaponlock.timer 0 }
  1639.   if (%weaponlock.timer <= 5) {
  1640.     if ($readini($char($1), Status, weapon.lock) != $null) { $status_message_check(Weapon Locked) |  %weaponlock.timer = $calc(%weaponlock.timer + 1) | writeini $char($1) status weaponlock.timer %weaponlock.timer
  1641.     $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, currentlyweaponlocked) | unset %weaponlock.timer | return }
  1642.   }
  1643.   else {
  1644.     if ($readini($char($1), Status, strengthDown) = yes) {  remini $char($1) status weapon.lock  | writeini $char($1) status strengthdown.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, WeaponLockWornOff)  | unset %weaponlock.timer | return  }
  1645.   }
  1646.   return
  1647. }
  1648.  
  1649. alias ethereal_check {
  1650.   var %ethereal.timer $readini($char($1), status, ethereal.timer)  
  1651.   if (%ethereal.timer = $null) { var %ethereal.timer 0 }
  1652.  
  1653.   if (%ethereal.timer <= 3) {
  1654.     if ($readini($char($1), Status, Ethereal) = yes) { $status_message_check(Ethereal) |  %ethereal.timer = $calc(%ethereal.timer + 1) | writeini $char($1) status ethereal.timer %ethereal.timer
  1655.     $set_chr_name($1) | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, currentlyethereal) | unset %ethereal.timer | return }
  1656.   }
  1657.   else {
  1658.     if ($readini($char($1), Status, Ethereal) = yes) {   writeini $char($1) status Ethereal no | writeini $char($1) status ethereal.timer 1 | $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, EtherealWornOff)  | unset %ethereal.timer | return  }
  1659.   }
  1660.   return
  1661. }
  1662.  
  1663. alias amnesia_check {
  1664.   if ($readini($char($1), status, amnesia) = yes) {
  1665.     set %amnesia.timer $readini($char($1), status, amnesia.timer)  
  1666.     if (%amnesia.timer <= 3) { %amnesia.timer = $calc(%amnesia.timer + 1) | writeini $char($1) status amnesia.timer %amnesia.timer | $status_message_check(under amnesia)
  1667.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyHasAmensia) | unset %amnesia.timer | return
  1668.     }
  1669.     else {
  1670.       writeini $char($1) status amnesia no | writeini $char($1) status amnesia.timer 1
  1671.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, AmnesiaWornOff) | unset %amnesia.timer | return
  1672.     }
  1673.   }
  1674.   else { return }
  1675. }
  1676.  
  1677. alias charm_check {
  1678.   if ($readini($char($1), status, charmed) = yes) {
  1679.     set %charm.timer $readini($char($1), status, charm.timer) | set %charmer $readini($char($1), status, charmer)
  1680.     if ($readini($char(%charmer), battle, status) = dead) {  writeini $char($1) status charm.timer 1 | writeini $char($1) status charmed no | $set_chr_name(%charmer) | write temp_status.txt $readini(translation.dat, status, CharmerDeathWornOff) | unset %charm.timer | unset %charmer | return  }
  1681.  
  1682.     if (%charm.timer > 1) { %charm.timer = $calc(%charm.timer - 1) | writeini $char($1) status charm.timer %charm.timer | $status_message_check(charmed)
  1683.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyCharmedMessage) | unset %charm.timer | unset %charmer | return
  1684.     }
  1685.     else {
  1686.       writeini $char($1) status charmed no | writeini $char($1) status charm.timer 1 | writeini $char($1) status charmer nooneIknowlol
  1687.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CharmWornOff) | unset %charm.timer | unset %charmer | return
  1688.     }
  1689.   }
  1690.   else { return }
  1691. }
  1692.  
  1693. alias paralysis_check {
  1694.   if ($readini($char($1), status, paralysis) = yes) {
  1695.     set %paralysis.timer $readini($char($1), status, paralysis.timer)  
  1696.     if (%paralysis.timer <= 2) { %paralysis.timer = $calc(%paralysis.timer + 1) | writeini $char($1) status paralysis.timer %paralysis.timer | $status_message_check(paralysis)
  1697.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyParalyzed) | unset %paralysis.timer | return
  1698.     }
  1699.     else {
  1700.       writeini $char($1) status paralysis no | writeini $char($1) status paralysis.timer 1
  1701.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, ParalysisWornOff) | unset %paralysis.timer | return
  1702.     }
  1703.   }
  1704.   else { return }
  1705. }
  1706.  
  1707. alias bored_check {
  1708.   if ($readini($char($1), status, bored) = yes) {
  1709.     set %bored.timer $readini($char($1), status, bored.timer)  
  1710.     if (%bored.timer = $null) { set %bored.timer 0 }
  1711.     if (%bored.timer <= 2) { %bored.timer = $calc(%bored.timer + 1) | writeini $char($1) status bored.timer %bored.timer | $status_message_check(bored)
  1712.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, CurrentlyBored) | unset %bored.timer | return
  1713.     }
  1714.     else {
  1715.       writeini $char($1) status bored no | writeini $char($1) status bored.timer 0
  1716.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, status, BoredWornOff) | unset %bored.timer | return
  1717.     }
  1718.   }
  1719.   else { return }
  1720. }
  1721.  
  1722. alias boosted_check {
  1723.   if ($readini($char($1), Status, boosted) = yes) { $status_message_check(power boosted) }
  1724. }
  1725.  
  1726. alias revive_check {
  1727.   if ($readini($char($1), Status, revive) = yes) { $status_message_check(will auto revive) }
  1728. }
  1729.  
  1730. alias conserveTP_check {
  1731.   if ($readini($char($1), status, conservetp) = yes) { $status_message_check(conserving TP) }
  1732. }
  1733.  
  1734. alias ignition_check {
  1735.   if ($readini($char($1), Status, ignition.on) = on) {
  1736.     set %ignition.name $readini($char($1), status, ignition.name)
  1737.     set %ignition.cost $readini(ignitions.db, %ignition.name, IgnitionConsume)
  1738.     set %player.current.ig $readini($char($1), battle, ignitionGauge)
  1739.  
  1740.     if (%player.current.ig < %ignition.cost) {
  1741.       $set_chr_name($1) | write temp_status.txt $readini(translation.dat, system, IgnitionReverted)
  1742.       writeini $char($1) status ignition.on off
  1743.       remini $char($1) status ignition.name | remini $char($1) status ignition.augment
  1744.       $revert($1, %ignition.name)
  1745.       unset %ignition.name | unset %ignition.cost | unset %player.current.ig
  1746.       return
  1747.     }
  1748.  
  1749.     dec %player.current.ig %ignition.cost
  1750.     writeini $char($1) battle IgnitionGauge %player.current.ig
  1751.     $status_message_check(ignition boosted)
  1752.     unset %ignition.name | unset %ignition.cost | unset %player.current.ig
  1753.   }
  1754.  
  1755. }
Advertisement
Add Comment
Please, Sign In to add comment