Advertisement
Jragyn

[VXa] J XAS Compilation 1.0.10

Mar 25th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 54.33 KB | None | 0 0
  1. =begin
  2.  
  3. XAS Add-on Compilation
  4. Version: 1.0.10
  5. By: theJragyn
  6.  
  7. Note: I didn't write XAS, but I did put together all these modifications myself.
  8. I don't need credit because hopefully these will be implemented by the creator
  9. at some point or another, but refrain from saying you wrote these if possible.
  10.  
  11. The way this compilation is setup, if there is configuration to be done, you
  12. will have to scroll down through the script to each section, or CTRL+F search
  13. for the wordage in the brackets [].
  14.  
  15. Also, if you wanted to (for whatever reason) disable/enable any of these scripts
  16. while in-game, you can via easy script calls:
  17.  
  18.   $game_system.NAME_OF_ADDON = true(enable)/false(disable)
  19.  
  20. ie:
  21.  
  22. $game_system.agi_move_var = false
  23.  
  24. is a script call that will disable the Agility Move Variance script entirely,
  25. returning all player movement to default. Using the same script call but with
  26. the value "true" will turn it right back on.
  27.  
  28. Current List:
  29. --Agility Move Variance [agi_move_var]
  30. --Death Self-Switch [death_selfsw]
  31. --EXP Factor && Gold Variance [expgp_variance]
  32. --Slip HP/MP Damage [hpmp_slipdmg]
  33. --Heal on Level-Up [heal_on_levelup]
  34. --No Leader Changing [no_leader_chg]
  35. --Clear Equipped Skills [clear_skill]
  36. --Alternative touch_attack Formula [alt_touchatk]
  37. --Parry FX [parry_fx]
  38. --Timely Active Regen [timely_regen]
  39. --Record Keeping [the_records]
  40. --Confusion State [state_confu]
  41. --Throw Equip Requirements [throw_reqs]
  42.  
  43. #-------------------------------------------------------------------------------
  44. v1.0.10 Adds:
  45. --Throw Equip Requirements [throw_reqs]
  46.     Expands allowing armor requirements to throw specific... stuff.
  47. --------------------------------------------------------------------------------
  48. v1.0.9 Adds:
  49. --KGC Battle Difficulty Compatibility
  50.     Modifies some of the existing methods to accomodate KGC's Battle Difficulty.
  51.     Keep in mind this is a separate script, not included in here.
  52. --------------------------------------------------------------------------------
  53. v1.0.8 Adds:
  54. --Record Keeping [the_records]
  55.     Adds in a record keeping system and houses them into $game_variable[x]s.
  56. --Confusion State [state_confu]
  57.     Re-adds the function of Confusion into XAS ABS.
  58. --------------------------------------------------------------------------------
  59. v1.0.7 Fixes:
  60. --Writes in method to read notes from an enemy.
  61. --Dynamically sizes the damage bitmap according to the number of items.
  62. --------------------------------------------------------------------------------
  63. v1.0.6 Adds:
  64. --Timely Active Regen [timely_regen]
  65.     Re-adds the function of HRG/MRG/TRG into XAS ABS.
  66. --------------------------------------------------------------------------------
  67. v1.0.5 Fixes:
  68. --Parry Effects [alt_touchatk][parry_fx]
  69.     Fixed an issue where heal skills caused issues with parry.
  70.     Added a new note-tag to give skills the ability to be un-parry-able.
  71. --------------------------------------------------------------------------------
  72. v1.0.4 Adds:
  73. --Item Drops [alt_touchatk]
  74.     Updated the battle formula to be compatible with ["YEA-ExtraDrops"].
  75.     (still requires alt_touchatk since the dmg rewrite adds this in too)
  76. --------------------------------------------------------------------------------
  77. v1.0.3 Fixes:
  78. --Parry Effects [alt_touchatk][parry_fx]
  79.     Updated Parry Effects to allow enemies to parry too, and also skills can be
  80.     parried from either player/enemy. Based off of attacker.tgr, self.grd.
  81. --------------------------------------------------------------------------------
  82. v1.0.2 Adds:
  83. --No Popup Movement [popup_nomove]
  84.     Disables the movement of popups (except crits, they still zoom in/out).
  85. --------------------------------------------------------------------------------
  86. v1.0.1 Adds:
  87. --Alternative touch_attack Formula; Parry FX [alt_touchatk][parry_fx]
  88.     Also fixes the issue with multiple drops at once. (requires [alt_touchatk]).
  89. --------------------------------------------------------------------------------
  90. v1.0.0 List:
  91. --Agility Move Variance [agi_move_var]
  92.     Adjusts move/dash speed based on the leader's agility rating.
  93. --Death Self-Switch [death_selfsw]
  94.     Flips a self-switch on death. This is event independant.
  95. --EXP Factor && Gold Variance [expgp_variance]
  96.     Enables EXP multipliers for killing high/low level enemies.
  97.     Also enables the addition of variance in Gold for defeated foes.
  98. --Slip HP/MP Damage [hpmp_slipdmg]
  99.     Continues functionality with HP slip damage, but adds capability of MP & TP.
  100. --Heal on Level-Up [heal_on_levelup]
  101.     Heals the current player full HP/MP on level up.
  102. --No Leader Changing [no_leader_chg]
  103.     Disables the ability to change the active player.
  104. --Clear Equipped Skills [clear_skill]
  105.     Removes all equipped skills when changing equipment.
  106. --Alternative touch_attack Formula; Parry FX [alt_touchatk][parry_fx]
  107.     Completely re-writes the formula for the "touch_attack" method.
  108.     Adds in the capability to "Parry" enemy attacks (requires [alt_touchatk]).
  109.     Also fixes the issue with multiple drops at once. (requires [alt_touchatk]).
  110. --------------------------------------------------------------------------------
  111.  
  112. I have recognized that pickups do not reflect MP heal/damage, though it does
  113. actually heal MP. I'll fix it, eventually.
  114. =end
  115.  
  116. class Game_System
  117.   alias j_xas_addons initialize
  118.   def initialize
  119.     j_xas_addons
  120. #=================================================#
  121. # You can use the below @blahblah = true/false    #
  122. # to set the starting functions to be ON or OFF.  #
  123.     @agi_move_var   = true                        #
  124.     @death_selfsw   = true                        #
  125.     @expgp_variance = true                        #
  126.     @hpmptp_slipdmg = true                        #
  127.     @heal_on_levelup= true                        #
  128.     @no_leader_chg  = true                        #
  129.     @clear_skill    = true                        #
  130.     @alt_touchatk   = true                        #
  131.     @parry_fx       = true                        #
  132.     @popup_nomove   = true                        #
  133.     @timely_regen   = true                        #
  134.     @the_records    = true                        #
  135.     @state_confu    = true                        #
  136.     @throw_reqs     = true                        #
  137. #=================================================#
  138.   end
  139.   attr_accessor :agi_move_var
  140.   attr_accessor :death_selfsw
  141.   attr_accessor :expgp_variance
  142.   attr_accessor :hpmptp_slipdmg
  143.   attr_accessor :heal_on_levelup
  144.   attr_accessor :no_leader_chg
  145.   attr_accessor :clear_skill
  146.   attr_accessor :alt_touchatk
  147.   attr_accessor :parry_fx
  148.   attr_accessor :popup_nomove
  149.   attr_accessor :timely_regen
  150.   attr_accessor :the_records
  151.   attr_accessor :state_confu
  152.   attr_accessor :throw_reqs
  153. end#Game_System
  154.  
  155. # Defines what .note does when read off of an enemy
  156. class Game_Enemy
  157.   def note
  158.     enemy ? enemy.note : ""
  159.   end
  160. end#Game_Enemy
  161.  
  162. =begin
  163. #-------------------------------------------------------------------------------
  164.   Agility Move Variance [agi_move_var]
  165.     Adjusts move/dash speed based on the leader's agility rating.
  166.  
  167. Over-write [Game_Character::update_battler_move_speed]
  168. Changes move_speed to base off of leader-agility
  169.  
  170. Move Speed from agility is a feature that allows for the player to move around
  171. based on how high their agility is. Since XAS utilizes an ABS battle system,
  172. having agility otherwise is pretty much pointless unless a damage formula uses
  173. it in some way. So why not use it? Here are a few things you should know about
  174. this: "Normal" speed, is roughly equivelant to 45-50 AGI. Anymore than 60 will
  175. put the player at pretty damn fast speeds around the screen, and less than 40
  176. will result in some seriously slow movement (maybe thats what you want though?)
  177.  
  178. The variables below are where the basic move speed, and dash speed are managed.
  179.  
  180. =end
  181. #-------------------------------------------------------------------------------
  182. class Game_Character < Game_CharacterBase
  183.   attr_accessor :base_move_speed
  184.   attr_accessor :dash_move_speed
  185.   attr_accessor :move_speed
  186.  
  187.   @base_speed = 0
  188.   @dash_speed = 0
  189.  
  190.   alias j_agi_move_var update_battler_move_speed
  191.   def update_battler_move_speed
  192.     if $game_system.agi_move_var
  193.       @dash_move_speed = @dash_active ? DASH_MOVE_SPEED : 0
  194.       if battler.is_a?(Game_Actor)
  195.         sp1 = @base_speed = 1.5 + ($game_party.members[0].agi * 0.05).to_f
  196.         sp2 = @dash_speed = 0.1 + ($game_party.members[0].agi * 0.025).to_f
  197.       else
  198.         sp1 = @base_move_speed
  199.         sp2 = @dash_move_speed
  200.       end
  201.       sp3 = self.battler.state_move_speed
  202.       if @dash_active
  203.         @move_speed = (sp1 + sp2 + sp3)
  204.       else
  205.         @move_speed = (sp1 + sp3)
  206.       end
  207.     else# if you don't use this function, it still works like normal.
  208.       j_agi_move_var
  209.     end
  210.   end#def
  211. end#Game_Character
  212.  
  213. =begin
  214. #-------------------------------------------------------------------------------
  215.   Death Self-Switch [death_selfsw]
  216.     Flips a self-switch on death. This is event independant.
  217.    
  218. The function of this is more for eventing purposes. If you haven't noticed,
  219. you CAN make it so that everytime you kill an enemy, it flips a switch, which
  220. is usable for bosses n such where you will only ever fight the enemy once, but
  221. I found that I needed to be able to sometimes have things happen specifically
  222. when you defeat certain enemies, IE: kill a specific enemy on a map and it flips
  223. a switch and triggers an event somewhere else on that map to do something, etc.
  224.  
  225. Since enemies do stuff with the self-switch "D" by nature, I chose "C".
  226. If you wanted, "A" or "B" are other options.
  227.  
  228. =end
  229. #=================================================#
  230. module XAS_J                                      #
  231. # You can change this to either "A", "B", or "C". #
  232. # "D" is reserved for the "Sensor" switch.        #
  233.   DEATH_SELF_SWITCH = "C"                         #
  234. end                                               #
  235. #=================================================#
  236.  
  237. class Game_Character < Game_CharacterBase
  238.   include XAS_J
  239.    
  240.   alias j_deathswitch execute_enemy_defeated_process
  241.   def execute_enemy_defeated_process
  242.     j_deathswitch
  243.     if $game_system.death_selfsw
  244.       key = [$game_map.map_id, self.id, XAS_J::DEATH_SELF_SWITCH]
  245.       $game_self_switches[key] = true
  246.     end
  247.     $game_variables[XAS_J::CT_KILLS] += 1 if $game_system.the_records
  248.   end
  249. end#Game_Character
  250.  
  251. =begin
  252. #-------------------------------------------------------------------------------
  253.   EXP Factor && Gold Variance [expgp_variance]
  254.     Enables EXP multipliers for killing high/low level enemies.
  255.     Also enables the addition of variance in Gold for defeated foes.
  256.    
  257. Gold Variance just applies a +/- of user-defined variance for gold acquired
  258. after defeating an enemy. If the words aren't present in the notes, it simply
  259. doesn't do anything.
  260.  
  261. EXP Factor adds the function of "levels" into enemies. If you defeat an enemy
  262. that is higher level than you, then you will be rewarded BONUS percentage of the
  263. normally earned EXP on defeat. If you defeat an enemy that is lower level than
  264. you, then you will only earn a fraction of the enemies' normal EXP. This
  265. requires a note in the enemies' notebox, or the enemy will return the normal
  266. amount of EXP no matter what the player's level is. You can scroll down a bit
  267. and modify the rates per level difference. Just look for the "lvl" case.
  268.  
  269. Also, the EXP Factor adds in the EXR rate, which is an EX-Param that whose use
  270. was omitted in the XAS ABS.
  271.  
  272. Since these both alter the same method, and can be ignored by just not putting a
  273. note in the enemy's notebox, they are enabled/disabled with the same command.
  274.  
  275.  
  276. =end
  277. #=================================================#
  278. module XAS_J                                      #
  279. # This is just for modifying wordage for gold     #
  280. # variance and level access.                      #
  281.   GOLD_WORDS = /<GG: (\d+)>/                      #
  282.   # Default: <Gold: x> where x is the amount of   #
  283.   # variance you want to have from the base G.    #
  284.   LEVEL_WORDS = /<Level: (\d+)>/                  #
  285.   # Default: <Level: x> where x is the level of   #
  286.   # monster that you are fighting.                #
  287. end                                               #
  288. #=================================================#
  289.  
  290. class Game_Character < Game_CharacterBase
  291.   include XAS_J
  292.  
  293.   # This rewrites the exp/gold gain method if using these functions.
  294.   alias j_xas_exp_gold_var execute_gain_exp_gold
  295.   def execute_gain_exp_gold(enemy)
  296.     if $game_system.expgp_variance
  297.       exp = self.battler.exp
  298.       gold = self.battler.gold
  299.       @exp_fx = XAS_J.exp_factor(enemy)
  300.       case XAS_BA::EXP_TYPE
  301.         when 0
  302.           # only the leader gets the XP
  303.           actor = $game_party.members[0]
  304.           actor.gain_exp(exp * @exp_fx)
  305.         when 1
  306.           # the entire party gets full XP
  307.           for i in 0...$game_party.members.size
  308.             actor = $game_party.members[i]
  309.             actor.gain_exp(exp * @exp_fx)
  310.           end
  311.         when 2
  312.           # the XP is divided between all the members
  313.           exp = exp / $game_party.members.size
  314.           for i in 0...$game_party.members.size
  315.             actor = $game_party.members[i]          
  316.             actor.gain_exp(exp * @exp_fx)
  317.           end
  318.         when 3
  319.           # the XP is cut in half for inactive characters
  320.           $game_party.members[0].gain_exp(exp * @exp_fx)
  321.           exp /= 2
  322.           for i in 1...$game_party.members.size
  323.             actor = $game_party.members[i]          
  324.             actor.gain_exp(exp * @exp_fx)
  325.           end              
  326.       end
  327.       if enemy.note =~ XAS_J::GOLD_WORDS
  328.         variance = $1.to_i
  329.         $gold_var = rand(variance+1) + rand(variance+1) - variance
  330.       else
  331.         $gold_var = 0
  332.       end
  333.       $game_party.gain_gold(gold + $gold_var)
  334.       else
  335.         j_xas_exp_gold_var(enemy)
  336.       end
  337.   end
  338.  
  339. end#Game_Character
  340. #-------------------------------------------------------------------------------
  341. module XAS_J
  342.   # The actual method to apply the magnifier to the EXP
  343.   def self.exp_factor(enemy)
  344.     return 1.0 unless enemy.note =~ XAS_J::LEVEL_WORDS
  345.     actor = $game_party.members[0]
  346.     rate = actor.exr.to_f
  347.     rank = $1.to_i
  348.     lvl = rank - actor.level
  349.     sexp = 1.0
  350.     case lvl
  351.     # The instance where enemies are 16+ levels higher than you.
  352.       when 16..100000; sexp = 10.0
  353.       when 15; sexp = 5.0
  354.       when 14; sexp = 4.25
  355.       when 13; sexp = 3.5
  356.       when 12; sexp = 3.0
  357.       when 11; sexp = 2.5
  358.       when 10; sexp = 2.25
  359.       when 9;  sexp = 2.0
  360.       when 8;  sexp = 1.75
  361.       when 7;  sexp = 1.55
  362.       when 6;  sexp = 1.4
  363.       when 5;  sexp = 1.3
  364.       when 4;  sexp = 1.25
  365.       when 3;  sexp = 1.15
  366.       when 2;  sexp = 1.1
  367.       when 1;  sexp = 1.05
  368.     # The instance where enemies are the same level as you.
  369.       when 0;  sexp = 1.0
  370.       when -1; sexp = 0.95
  371.       when -2; sexp = 0.9
  372.       when -3; sexp = 0.8
  373.       when -4; sexp = 0.7
  374.       when -5; sexp = 0.6
  375.       when -6; sexp = 0.5
  376.       when -7; sexp = 0.4
  377.       when -8; sexp = 0.3
  378.       when -9; sexp = 0.2
  379.       when -10;sexp = 0.1
  380.       when -11;sexp = 0.05
  381.     # The instance where enemies are 12+ levels lower than you.
  382.       when -100000..-12; sexp = 0.01
  383.       end#case
  384.     return (sexp * rate).to_f
  385.   end#def
  386. end#module XAS_J
  387. #-------------------------------------------------------------------------------
  388. class Sprite_Character < Sprite_Base
  389.   include XAS_J
  390.   alias j_xas_expgp_pop update_exp_gold_pop
  391.   def update_exp_gold_pop
  392.     if $game_system.expgp_variance
  393.       return unless XAS_DAMAGE_POP::DAMAGE_EXP_GOLD_POP
  394.       enemy = $data_enemies[@character.battler.enemy_id]
  395.       exp_pop = (enemy.exp * XAS_J.exp_factor(enemy)).to_i
  396.       gold_pop = @character.battler.gold + $gold_var
  397.  
  398.       case @character.collapse_duration
  399.         when 110
  400.           @character.make_treasure(enemy)
  401.         when 80
  402.           if exp_pop != 0
  403.             @character.battler.damage = XAS_WORD::EXP + " " + exp_pop.to_s
  404.             @character.battler.damage_pop = true
  405.             @character.battler.damage_type = "Exp"
  406.           end  
  407.         when 40
  408.           if gold_pop != 0
  409.             word = $data_system.currency_unit
  410.             @character.battler.damage = word + " " + gold_pop.to_s
  411.             @character.battler.damage_pop = true
  412.             @character.battler.damage_type = "Gold"
  413.           end#if
  414.       end#case
  415.     else
  416.       j_xas_expgp_pop
  417.     end#Game_System
  418.   end
  419.    
  420. end#Sprite_Character
  421.  
  422. =begin
  423. #-------------------------------------------------------------------------------
  424.   Slip HP/MP Damage [hpmp_slipdmg]
  425.     Continues functionality with HP slip damage, but adds capability of MP & TP.
  426.    
  427. The XAS system by default had HP slip damage, but now it MP and TP slip
  428. capabilities. All you need to do is add in a notebox the necessary wordage and
  429. it will work just like usual. Of course, if you put negative numbers, it will
  430. work as expected.
  431.  
  432. Keep in mind, by default, TP max is fixed at 100, thus, it does not use the
  433. percentage factor, it will be a fixed integer.
  434.  
  435. =end
  436. #=================================#
  437. module XAS_J                      #
  438. # The wordage for notes in        #
  439. # the state-note-boxes            #
  440.   SLIP_HP = /<Slip HP = (\S+)>/   #
  441.   #default: <Slip HP = x>         #
  442.   SLIP_MP = /<Slip MP = (\S+)>/   #
  443.   #default: <Slip MP = x>         #
  444.   SLIP_TP = /<Slip TP = (\S+)>/   #
  445.   #default: <Slip TP = x>         #
  446.                                   #
  447.   #where x is the percent of said #
  448.   #stat you want reduced.         #
  449. end                               #
  450. #=================================#
  451.  
  452. class Game_Character < Game_CharacterBase
  453.  
  454.   alias j_xas_statefx execute_states_effects
  455.   def execute_states_effects(state)
  456.     if $game_system.hpmptp_slipdmg
  457.       if state.note =~ XAS_J::SLIP_HP
  458.         do_sliphp_damage($1.to_i)
  459.       end
  460.       if state.note =~ XAS_J::SLIP_MP
  461.         do_slipmp_damage($1.to_i)
  462.       end
  463.       if state.note =~ XAS_J::SLIP_TP
  464.         do_sliptp_damage($1.to_i)
  465.       end
  466.     else
  467.       j_xas_statefx(state)
  468.     end#Game_System
  469.   end
  470.  
  471.   def do_sliphp_damage(damage)
  472.     damage = 1 if damage == nil
  473.     damage_slip = self.battler.mhp * damage / 100
  474.     damage_slip = 1 if damage_slip < 1
  475.     self.battler.hp -= damage_slip
  476.     self.battler.damage = damage_slip
  477.     self.battler.damage_pop = true
  478.   end
  479.  
  480.   def do_slipmp_damage(damage)
  481.     damage = 1 if damage == nil
  482.     damage_slip = self.battler.mmp * damage / 100
  483.     damage_slip = 1 if damage_slip < 1
  484.     self.battler.mp -= damage_slip
  485.     self.battler.damage_type = "Mp"
  486.     self.battler.damage = damage_slip
  487.     self.battler.damage_pop = true
  488.   end
  489.  
  490.   def do_sliptp_damage(damage)
  491.     damage = 1 if damage == nil
  492.     damage_slip = damage
  493.     damage_slip = 1 if damage_slip < 1
  494.     self.battler.tp -= damage_slip
  495.     self.battler.damage_type = "Tp"
  496.     self.battler.damage = damage_slip
  497.     self.battler.damage_pop = true
  498.   end
  499.  
  500. end#Game_Character
  501. =begin
  502. #-------------------------------------------------------------------------------
  503.   Heal on Level-Up [heal_on_levelup]
  504.     Heals the current player full HP/MP on level up.
  505.    
  506. Pretty self-explanatory.
  507.  
  508. =end
  509. #=======================================#
  510. module XAS_J                            #
  511. # Here, you can edit the animation ID   #
  512. # for when you level up.                #
  513.   HEAL_ANI_ID = 37                      #
  514. end                                     #
  515. #=======================================#
  516. class Game_Player < Game_Character
  517.  
  518.   alias j_xas_healonlvlup check_actor_level
  519.   def check_actor_level
  520.     if $game_system.heal_on_levelup
  521.       return if $game_party.in_battle
  522.       return if self.battler == nil
  523.       return if self.battler.old_level == self.battler.level
  524.       self.battler.hp = self.battler.mhp
  525.       self.battler.mp = self.battler.mmp
  526.       self.animation_id = XAS_J::HEAL_ANI_ID
  527.       reset_old_level(false)
  528.       if self.battler.level > 1
  529.          Audio.se_play("Audio/SE/" + XAS_SOUND::LEVEL_UP , 100, 100)
  530.          if XAS_WORD::ENABLE_WORD
  531.             $game_player.battler.damage = XAS_WORD::LEVEL_UP
  532.             $game_player.battler.damage_pop = true
  533.          end
  534.       end
  535.       $game_player.need_refresh = true
  536.     else
  537.       j_xas_healonlvlup
  538.     end#Game_System
  539.   end
  540. end#Game_player
  541.  
  542. =begin
  543. #-------------------------------------------------------------------------------
  544.   No Leader Changing [no_leader_chg]
  545.     Disables the ability to change the active player.
  546.    
  547. This allows you to turn ON a switch to prevent the player from switching who
  548. the leader is on the field.
  549.  
  550. =end
  551. #=======================================#
  552. module XAS_J                            #
  553. # Choose the Switch ID that you         #
  554. # want to ENABLE to prevent switching.  #
  555.   ANTI_CHANGE_SW = 12                   #
  556. end                                     #
  557. #=======================================#
  558. class Game_Player < Game_Character
  559.   include XAS_J
  560.  
  561.   alias j_xas_nochange can_use_change_leader_command?
  562.   def can_use_change_leader_command?
  563.     if $game_system.no_leader_chg
  564.       return false if $game_switches[XAS_J::ANTI_CHANGE_SW] == true
  565.     end
  566.     j_xas_nochange
  567.   end
  568. end#Game_Player
  569.  
  570. =begin
  571. #-------------------------------------------------------------------------------
  572.   Clear Equipped Skills [clear_skill]
  573.     Removes all equipped skills when changing equipment.
  574.    
  575. There is no configuration necessary.
  576. This little snippet kicks off skills that the player no longer knows if they are
  577. still equipped.
  578.  
  579. This is kind of a situational script, so you may not ever need/use it.
  580.  
  581. =end
  582. class Game_Actor < Game_Battler
  583.  
  584.   alias clearforgotten forget_skill
  585.   def forget_skill(s_id)
  586.     clearforgotten(s_id)
  587.     if $game_system.clear_skill
  588.       if @skill_id == s_id
  589.         @skill_id = 0
  590.       end
  591.     end
  592.   end
  593.  
  594. end#Game_Actor
  595.  
  596. =begin
  597. #-------------------------------------------------------------------------------
  598.   Alternative touch_attack Formula; Parry FX [alt_touchatk][parry_fx]
  599.     Completely re-writes the formula for the "touch_attack" method.
  600.     Also fixes the issue with multiple drops at once.
  601.    
  602. With this, the entire attack formula for how monsters use their "basic" attack.
  603. The same "a.atk * 4 - b.def * 2" concept is still there, but it incorporates a
  604. lot of other things that weren't a factor in the original formula. With this,
  605. enemies now have a chance of critical strike from attacking, you can also make
  606. it so that enemies' attacks are physical or magical (instead of just physical).
  607. In addition, something that was missing before, this formula applies the other
  608. ex-params, PDR/MDR, against the damage formula. This also impacts the MRF stat,
  609. which is "Magic Reflect"-chance, which had no meaning, but now it does! Just
  610. naturally, if a skill is reflectable, based on the MRF chance, you will just...
  611. reflect the skill. No state/tags/actions necessary.
  612.  
  613. Also, a new concept of "Parrying" is possible, which is essentially a chance for
  614. the attack to completely be negated, skipping evasion/crit, regardless of being
  615. physical/magical. Pretty much, this is a "Miss", but with a different animation.
  616. Since at this time, the TGR and GRD stats have no purpose in an ABS...
  617.  
  618. (TGR normally determines which target amidst a party of members will be hit when
  619. random targetting is applied, and GRD is an amplification of the damage reduced
  620. when using the "defend" command in a turn-based battle, neither of which are
  621. useful since "guarding" nullifies damage, and there is only ever one player on
  622. the map at once)
  623.  
  624. If you want a skill to NOT be parry-able, use this note-tag:
  625.   <No Parry>
  626. And the skill will bypass all normal parry possibilities, and go like normal.
  627.  
  628. ...the formula for parrying is similer to the evasion formula, but for the
  629. enemies' TGR rating vs the player's GRD rating. This means that if you want to
  630. use the parry function, you will need to start giving equipment GRD and give
  631. enemies TGR.
  632.  
  633. In addition to these features, it has been noted that enemies will only drop one
  634. item, even if 3 are able to drop at 1/1 rate. This will fix that by dropping all
  635. items in a pile, and collecting them will list them all at once. This is also
  636. written to be compatible with Yanfly's Extra Drops script.
  637.  
  638. =end
  639. #=======================================================#
  640. module XAS_J                                            #
  641. # PARRY_WORDS is what pops up when a successful parry   #
  642. # occurs. Phys/Magi_atk will change the damage formula  #
  643. # between physical/magical formulai. If no formula is   #
  644. # selected, it will default to a 1/2 & 1/2 mix between  #
  645. # physical and magical instead. PHYS/MAGI_ATK must be   #
  646. # put in the enemy's notebox in the database.           #
  647.   NO_PARRY = /<No Parry>/                               #
  648.   PARRY_WORDS = "PARRY"                                 #
  649.   PARRY_ANI   = 127                                     #
  650.   PHYS_ATK =  /<p_atk>/                                 #
  651.   MAGI_ATK =  /<m_atk>/                                 #
  652.   SPEED_ATK = /<a_atk>/                                 #
  653.   HEAL_FONT_COLOR = Color.new(192, 255, 192)            #
  654.   MAGI_FONT_COLOR = Color.new(255, 192, 255)            #
  655.   PARRY_FONT_COLOR = Color.new(170, 170, 170)           #
  656. end                                                     #
  657. #=======================================================#
  658. module XRXS_BattlerAttachment
  659.   alias j_xas_touchatk execute_attack_damage
  660.   def execute_attack_damage(attacker)
  661.     if $game_system.alt_touchatk
  662.       actor = $game_party.members[0]
  663.       enemy = $data_enemies[attacker.battler.enemy_id]
  664.       damage = 0
  665.       self.battler.damage_type = 0
  666.       self.battler.result.missed = false
  667.       # Will the attack be parried?
  668.       if $game_system.parry_fx
  669.         if ((rand(enemy.tgr * 100)) < (actor.grd * 100 - 100) && face_direction?(attacker))
  670.           self.battler.damage_type = "Parry"
  671.           self.battler.result.missed = true
  672.           $game_variables[XAS_J::CT_PARRYS] += 1 if $game_system.the_records
  673.           return
  674.         end
  675.       end#Game_System
  676.       if rand(enemy.hit.to_f * 100) < (actor.eva * 100)
  677.         self.battler.result.missed = true
  678.         return
  679.       end
  680.       fx   = XAS_J.exp_factor(attacker.battler)
  681.       patk = attacker.battler.atk * fx
  682.       matk = attacker.battler.mat * fx
  683.       aatk = attacker.battler.agi * fx
  684.      
  685.       pdef = actor.def; mdef = actor.mdf; adef = actor.agi
  686.       # Is the attack is a physical attack?
  687.       if enemy.note =~ XAS_J::PHYS_ATK
  688.         damage = ((patk * 3) - pdef)
  689.         damage *= actor.pdr.to_f
  690.       # Is the attack is a magical attack?
  691.       elsif enemy.note =~ XAS_J::MAGI_ATK
  692.         damage = ((patk * 1 + matk * 2) - ((mdef + pdef) / 2))
  693.         damage *= actor.mdr.to_f
  694.       elsif enemy.note =~ XAS_J::SPEED_ATK
  695.         damage = ((patk * 1 + aatk * 2) - ((pdef + adef) / 2))
  696.         damage *= ((actor.pdr.to_f / 2) + (actor.mdr.to_f / 2))
  697.       # Is the attack undefined?
  698.       else
  699.         damage = (((patk + matk) * 1.5) - (pdef + mdef))
  700.         damage *= ((actor.pdr.to_f + actor.mdr.to_f) / 2)      
  701.       end
  702.       crimult = 1.0
  703.       if $imported["BattleDifficulty"] == true
  704.         crimult = KGC::BattleDifficulty.get[:cri] / 100
  705.       end
  706.       if rand((enemy.cri.to_f * crimult) * 100) > rand(actor.cev * 10000 - 100)
  707.         damage *= 3
  708.         self.battler.damage_type = "Critical"
  709.       end
  710.      
  711.       damage = damage.to_i
  712.       damage = 0 if damage < 0
  713.       $game_variables[XAS_J::CT_DMGTAKEN] += damage if $game_system.the_records
  714.       self.battler.result.hp_damage = damage
  715.       self.battler.hp -= damage.abs
  716.     else
  717.       j_xas_touchatk(attacker)
  718.     end
  719.   end
  720.  
  721. # Re-writes the battle function to add in the chance to parry an attack.
  722.   alias j_xas_parryaddon execute_battler_skill_effect
  723.   def execute_battler_skill_effect(attacker, skill, user)
  724.     self.battler.result.clear
  725.     self.battler.result.evaded = false
  726.     if $game_system.parry_fx
  727.       if skill.note =~ XAS_J::NO_PARRY
  728.         self.battler.item_apply(attacker, skill)
  729.       else
  730.         actor = $game_party.members[0]
  731.         tgrmult = 1.0
  732.         grdmult = 1.0
  733.         if $imported["BattleDifficulty"] == true
  734.           tgrmult = KGC::BattleDifficulty.get[:tgr] / 100
  735.           grdmult = KGC::BattleDifficulty.get[:grd] / 100
  736.         end
  737.         if attacker.is_a?(Game_Actor)
  738.           self.battler.item_apply(attacker, skill) if self.battler.is_a?(Game_Actor)
  739.           hit   = actor.tgr * 100
  740.           if self.battler.is_a?(Game_Actor)
  741.             parry = 0
  742.           else
  743.             parry = $data_enemies[self.battler.enemy_id].grd * 100 * (grdmult)
  744.           end
  745.         else attacker.is_a?(Game_Enemy)
  746.           self.battler.item_apply(attacker, skill) if self.is_a?(Game_Enemy)          
  747.           hit = $data_enemies[attacker.enemy_id].tgr * 100 * (tgrmult)
  748.           parry = actor.grd * 100
  749.         end
  750.         if rand(hit) < parry && face_direction?(actor)
  751.           self.battler.damage_type = "Parry"; self.battler.result.missed = true
  752.           return
  753.         else
  754.           self.battler.item_apply(attacker, skill)
  755.         end
  756.       end
  757.     else
  758.       j_xas_parryaddon(attacker, skill, user)
  759.     end#parry_fx
  760.   end
  761.  
  762. # Adds in recognition for direction of the player since the Game_Actor
  763. # class does not have a default function.
  764.   alias j_xas_parryfix? face_direction?
  765.   def face_direction?(attacker)
  766.     if $game_system.parry_fx
  767.       if attacker.is_a?(Game_Event)
  768.         target = $game_player.direction
  769.       case target
  770.         when 2; return true if attacker.direction == 8
  771.         when 4; return true if attacker.direction == 6
  772.         when 6; return true if attacker.direction == 4
  773.         when 8; return true if attacker.direction == 2    
  774.         end
  775.       elsif attacker.is_a?(Game_Actor)
  776.         target = self.direction
  777.       case target
  778.         when 2; return true if $game_player.direction == 8
  779.         when 4; return true if $game_player.direction == 6
  780.         when 6; return true if $game_player.direction == 4
  781.         when 8; return true if $game_player.direction == 2    
  782.         end
  783.       end
  784.       return false
  785.     else
  786.       j_xas_parryfix?(attacker)
  787.     end
  788.   end  
  789.  
  790.   alias j_xas_parryaddon target_missed?
  791.   def target_missed?(attacker)
  792.     if $game_system.parry_fx
  793.       if self.battler.result.missed
  794.         if self.battler.damage_type == "Parry"
  795.           self.battler.damage = XAS_J::PARRY_WORDS
  796.           self.battler.damage_pop = true
  797.           self.animation_id = XAS_J::PARRY_ANI
  798.           if attacker.is_a?(Game_Event)
  799. # When the enemy is parried, they are flung back a couple spaces if possible.
  800.             attacker.jump(0,0)
  801.             attacker.move_backward
  802.             attacker.move_backward
  803.           else
  804. # When the player is parried, they are flung back a couple spaces if possible.
  805.             $game_variables[XAS_J::CT_PARRYS] += 1 if $game_system.the_records
  806.             $game_player.jump(0,0)
  807.             $game_player.move_backward
  808.             $game_player.move_backward
  809.           end
  810.           return true
  811.         else
  812.           self.battler.damage = XAS_WORD::MISSED
  813.           self.battler.damage_pop = true
  814.           return true
  815.         end
  816.       end
  817.       if self.battler.result.evaded
  818.         self.battler.damage = XAS_WORD::EVADED
  819.         self.battler.damage_pop = true
  820.         return true
  821.       end
  822.       return false
  823.     else
  824.       j_xas_parryaddon(attacker)
  825.     end
  826.   end
  827.  
  828.   alias j_xas_reflectfx reflect_state?
  829.   def reflect_state?(bullet, skill)
  830.     if $game_system.alt_touchatk
  831.       if bullet.action.reflectable
  832.         if self.battler.state_reflect
  833.           if skill.note =~ /<Auto Target>/
  834.             bullet.moveto(bullet.action.user.x, bullet.action.user.y)
  835.           else
  836.             bullet.turn_back
  837.           end
  838.           bullet.action.user = self
  839.           bullet.action.hit_events = []
  840.           bullet.turn_back
  841.           bullet.jump(0,0)
  842.           bullet.turn_back
  843.           self.battler.damage = XAS_WORD::REFLECT
  844.           self.battler.damage_pop = true
  845.           self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  846.           self.battler.invunerable_duration = 20
  847.           return true
  848.         elsif (rand(100) < (self.battler.mrf * 100).to_f)
  849.           if skill.note =~ /<Auto Target>/
  850.             bullet.moveto(bullet.action.user.x,bullet.action.user.y)
  851.           else
  852.             bullet.turn_back
  853.           end
  854.           bullet.action.user = self
  855.           bullet.action.hit_events = []
  856.           bullet.turn_back
  857.           bullet.jump(0,0)
  858.           bullet.turn_back
  859.           self.battler.damage = XAS_WORD::REFLECT
  860.           self.battler.damage_pop = true
  861.           self.animation_id = XAS_ANIMATION::REFLECT_ANIMATION_ID
  862.           self.battler.invunerable_duration = 20
  863.           return true
  864.         end
  865.       end
  866.       return false
  867.     else
  868.       j_xas_reflectfx(bullet, skill)
  869.     end
  870.   end
  871.  
  872. end#XRXS_BattlerAttachment
  873.  
  874.  
  875. class Sprite_Base < Sprite
  876.   include XAS_DAMAGE_POP
  877.   include XAS_BA_ItemDrop
  878. #-------------------------------------------------------------------------------
  879. # Removes "picture" capability for drawing, uses standard draw_text instead.
  880. # Also accomodates new damage types like MP/healing/Parry.
  881. # This is also altered to fix the issue with dropping only 1 item on the map.
  882. #-------------------------------------------------------------------------------
  883.   alias j_xas_alt_damage damage
  884.   def damage(value, type = "")
  885.     if $game_system.alt_touchatk
  886.       dispose_damage
  887.       @damage_ox = 0
  888.       @damage_type = type
  889.       damage_string = value.to_s
  890.       bitmap = Bitmap.new(160, 148)
  891.       bitmap.font.name = DAMAGE_FONT_NAME
  892.       bitmap.font.size = DAMAGE_FONT_SIZE
  893.       bitmap.font.bold = DAMAGE_FONT_BOLD
  894.       bitmap.font.italic = DAMAGE_FONT_ITALIC
  895.       bitmap.font.color = Color.new(0,0,0)
  896.       case @damage_type
  897.         when "Exp";   string_color = DAMAGE_EXP_FONT_COLOR
  898.         when "Gold";  string_color = DAMAGE_GOLD_FONT_COLOR
  899.         when "Item";  string_color = DAMAGE_ITEM_FONT_COLOR
  900.         when "Parry"; string_color = XAS_J::PARRY_FONT_COLOR
  901.       else
  902.         string_color = DAMAGE_DEFAULT_FONT_COLOR
  903.       end
  904.       if @damage_type != "Item" && value.to_i < 0
  905.         bitmap.font.size = DAMAGE_FONT_SIZE + 8
  906.         string_color = XAS_J::HEAL_FONT_COLOR
  907.         value = value.abs
  908.       end
  909.       damage_string = value.to_s
  910.       if @damage_type == "Mp"
  911.         damage_string = damage_string + " MP"
  912.         string_color = XAS_J::MAGI_FONT_COLOR
  913.       end
  914.       bitmap.font.color = string_color
  915.       a = 0
  916.       if @damage_type == "Item"
  917.         for n in $names #items, not healing stuff
  918.           bitmap.draw_text(0, 12 + a, 160, 36, n.to_s, 1)
  919.           bitmap.draw_text(1, 13 + a, 160, 36, n.to_s, 1)
  920.           a += 24
  921.         end
  922.         unless $hitems.empty? #hp healing stuff, not items
  923.           bitmap.font.size = DAMAGE_FONT_SIZE + 8
  924.           string_color = XAS_J::HEAL_FONT_COLOR
  925.           bitmap.font.color = string_color
  926.           for i in $hitems
  927.             bitmap.draw_text(0, 12 + a, 160, 36, i.to_s + " HP", 1)
  928.             bitmap.draw_text(1, 13 + a, 160, 36, i.to_s + " HP", 1)
  929.             a += 24
  930.           end
  931.         end
  932.         unless $mitems.empty? #mp healing stuff, not items
  933.           bitmap.font.size = DAMAGE_FONT_SIZE + 8
  934.           string_color = XAS_J::MAGI_FONT_COLOR
  935.           bitmap.font.color = string_color
  936.           for i in $mitems
  937.             bitmap.draw_text(0, 12 + a, 160, 36, i.to_s, 1)
  938.             bitmap.draw_text(1, 13 + a, 160, 36, i.to_s, 1)
  939.             a += 24
  940.           end
  941.         end
  942.       else
  943.         bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  944.         bitmap.draw_text(1, 13, 160, 36, damage_string, 1)
  945.       end      
  946.       @_damage_sprite = ::Sprite.new(self.viewport)
  947.       @_damage_sprite.bitmap = bitmap
  948.       @_damage_sprite.ox = 80
  949.       @_damage_sprite.oy = 20
  950.       @_damage_sprite.x = self.x + @damage_ox
  951.       @_damage_sprite.y = self.y - self.oy / 2
  952.       @_damage_sprite.z = 3000
  953.       @_damage_duration = 60
  954.     else
  955.       j_xas_alt_damage(value, type = "")
  956.     end
  957.   end
  958.    
  959. end#Sprite_Base
  960. #-------------------------------------------------------------------------------
  961. # Fixes the issue with multiple drops not dropping.
  962. # Also accomodates Yanfly's multiple drops.
  963. # This is also altered to fix the issue with dropping only 1 item on the map.
  964. #-------------------------------------------------------------------------------
  965. module XAS_BA_ItemDrop
  966.   alias j_xas_fixdrops make_treasure
  967.   def make_treasure(target)
  968.     if $game_system.alt_touchatk
  969.       drops = []
  970.   # if yanfly drops are included, will push those drops into the droplist too.
  971.       if $imported["YEA-ExtraDrops"] == true
  972.         for drop in target.extra_drops
  973.           next if rand > drop.drop_rate
  974.           drops << drop
  975.         end
  976.       end
  977.   # Runs through the standard drop process, too.
  978.       for drop in target.drop_items
  979.         next if rand(drop.denominator) != 0
  980.         next if drop.kind == 0
  981.         drops << drop
  982.       end
  983.   # Actually drops all the items and turns them into collectable events.
  984.       return unless $game_player.map_passable?(self.x, self.y, 0)
  985.       for di in drops
  986.         command = RPG::MoveCommand.new
  987.         command.code = 14
  988.         command.parameters = [0,0]
  989.         route = RPG::MoveRoute.new
  990.         route.repeat = false
  991.         route.list = [command, RPG::MoveCommand.new]        
  992.         page = RPG::Event::Page.new
  993.         page.move_type = 3
  994.         page.move_route = route
  995.         page.move_frequency = 6
  996.         page.priority_type = 1
  997.         page.trigger = 2
  998.         page.through = true
  999. # This will move the drops around, but they could land in non-passable areas.
  1000. #~         ix = self.x
  1001. #~         iy = self.y
  1002. #~         ix += rand(2) - 1
  1003. #~         iy += rand(2) - 1
  1004.         event = RPG::Event.new(self.x, self.y)
  1005.         event.pages = [page]
  1006.         token = Token_Event.new($game_map.map_id, event)
  1007.         if di.kind == 1
  1008.           token.icon_name = $data_items[di.data_id].icon_index
  1009.         elsif di.kind == 2
  1010.           token.icon_name = $data_weapons[di.data_id].icon_index
  1011.         elsif di.kind == 3
  1012.           token.icon_name = $data_armors[di.data_id].icon_index
  1013.         end
  1014.         token.treasure = [di.kind, di.data_id]
  1015.         token.treasure_time = 120 + XAS_BA::TREASURE_ERASE_TIME * 60
  1016.         token.jump_high(0,0,20)
  1017.         token.force_update = true
  1018.         token.move_speed = 6
  1019.         $game_map.add_token(token)
  1020.       end
  1021.     else
  1022.       j_xas_fixdrops(enemy)
  1023.     end
  1024.   end
  1025. end#moduleXASBAItemDrop
  1026.  
  1027. class Game_Player < Game_Character
  1028.   alias j_xas_collectdrops check_treasure_here
  1029.   def check_treasure_here
  1030.     if $game_system.alt_touchatk
  1031.       name = ""
  1032.       $names = []
  1033.       $hitems = []
  1034.       $mitems = []
  1035.       for event in $game_map.events_xy(@x, @y)
  1036.         if event.treasure != nil
  1037.           name_pop = true
  1038.           case event.treasure[0]
  1039.             when 1
  1040.               item = $data_items[event.treasure[1]]
  1041.               if can_execute_field_item_effect?(item)
  1042.                 if item.id == 2
  1043.                   $mitems << self.battler.damage.abs.to_s + " MP"
  1044.                 elsif item.id == 9
  1045.                   $mitems << self.battler.damage.abs.to_s + " MP"
  1046.                 else
  1047.                   $hitems << self.battler.damage.abs.to_s
  1048.                 end
  1049.               else
  1050.                 $game_party.gain_item(item, 1)
  1051.                 $names << item.name
  1052.               end
  1053.               $game_map.need_refresh = true
  1054.             when 2
  1055.               item = $data_weapons[event.treasure[1]]
  1056.               $game_party.gain_item(item, 1, false)
  1057.               $names << item.name
  1058.             when 3
  1059.               item = $data_armors[event.treasure[1]]
  1060.               $game_party.gain_item(item, 1, false)
  1061.               $names << item.name
  1062.           end
  1063.           Audio.se_play("Audio/SE/" + XAS_SOUND::ITEM_DROP , 100, 100)  
  1064.           event.erase
  1065.           if item != nil
  1066.             if item.note =~ /<Drop Animation = (\d+)>/
  1067.               self.animation_id = $1.to_i
  1068.             end
  1069.           end
  1070.       end#if event.treasure
  1071.       end#for event
  1072.       if XAS_DAMAGE_POP::DAMAGE_ITEM_POP and name_pop
  1073.         self.battler.damage = item.name
  1074.         self.battler.damage_pop = true
  1075.         self.battler.damage_type = "Item"
  1076.       end
  1077.     else
  1078.       j_xas_collectdrops
  1079.     end
  1080.   end#def
  1081.  
  1082. end#Game_Player
  1083.  
  1084. =begin
  1085. #-------------------------------------------------------------------------------
  1086.   No Popup Movement [popup_nomove]
  1087.     Disables the movement of popups (except crits, they still zoom in/out).
  1088.    
  1089. No configuration necessary.
  1090. Just turn it ON or OFF.
  1091. If it is ON, then damage pops will not do more than appear beneath the target,
  1092. and then fade away after 60 frames(about 1~2 seconds)
  1093. =end
  1094. class Sprite_Damage < Sprite
  1095.   alias j_xas_popup update_normal_popup
  1096.   def update_normal_popup
  1097.     if $game_system.popup_nomove
  1098.       self.opacity -= 25 if @duration <= 10
  1099.     else
  1100.       j_xas_popup
  1101.     end
  1102.   end
  1103. end#Sprite_Damage
  1104.  
  1105. =begin
  1106. #-------------------------------------------------------------------------------
  1107.   Timely Active Regen [timely_regen]
  1108.     Re-adds the function of HRG/MRG/TRG into XAS ABS.
  1109.    
  1110. This can work as a direct add-on, as it does refunctionalize the HRG/MRG/TRG,
  1111. but it also adds in customizable timing for how often the regen ticks based on
  1112. notes of the enemy, and the notes of the actor/equip/state.
  1113.  
  1114. COUNT_TIME is the base time between ticks with no modifications in frames.
  1115. 60 frames is roughly 1 second or so.
  1116.  
  1117. REDUCTION is a notetag you can put in either enemy's or equipment's noteboxes
  1118. to reduce the COUNT_TIME for that specific Enemy/Actor.
  1119.  
  1120. MIN_COUNT is the smallest number of frames to pass between regeneration ticks.
  1121. I highly recommend that you do NOT put this less than 30. (gets excessive)
  1122.  
  1123. NOTE:: Incase you didn't know this already, you can actually put negative
  1124. values in the HRG/MRG/TRG field in a state or equipment, and it will function
  1125. as a poison, or serve to reduce the effects of regeneration. If you opt to use
  1126. poison in THIS fashion, keep in mind that "Reduce = #" will also reduce the
  1127. time between damage ticks in that way too.
  1128. =end
  1129.  
  1130. #=====================================#
  1131. module XAS_J                          #
  1132.   COUNT_TIME = 300                    #
  1133.   REDUCTION  = /<Reduce = (\d+)>/     #
  1134.   # default: <Reduce = x> where x is  #
  1135.   # the number to reduce COUNT_TIME by#
  1136.   MIN_COUNT  = 60                     #
  1137. end                                   #
  1138. #=====================================#
  1139.  
  1140. class Game_Character < Game_CharacterBase
  1141.   include XRXS_BattlerAttachment
  1142.  
  1143.   # creates all battler's count and count_reduction
  1144.   alias j_xas_regen_count init_public_members
  1145.   def init_public_members
  1146.       j_xas_regen_count
  1147.     if $game_system.timely_regen
  1148.       @count = 0
  1149.       @count_reduce = 0
  1150.     end
  1151.   end
  1152.  
  1153.   # adds in new method to update HRG/MRG/TRG as long as the battler lives
  1154.   alias j_xas_regen_add update_battler
  1155.   def update_battler
  1156.     if $game_system.timely_regen
  1157.       update_hrg_mrg_trg unless self.battler.hp == 0
  1158.     end
  1159.     j_xas_regen_add
  1160.   end
  1161.  
  1162.   # the new method that counts up to the required @count to cause regen
  1163.   # the regen runs through checking notes on enemies and actor's
  1164.   def update_hrg_mrg_trg
  1165.     if $game_system.timely_regen
  1166.       @count += 1
  1167.       x = self.battler
  1168.       if self.battler.is_a?(Game_Enemy)
  1169.         if self.battler.note =~ XAS_J::REDUCTION
  1170.           @count_reduce = $1.to_i
  1171.         end
  1172.       end
  1173.       if self.battler.is_a?(Game_Actor)
  1174.         minus = 0
  1175.         if self.battler.note =~ XAS_J::REDUCTION
  1176.           minus += $1.to_i
  1177.         end
  1178.         for i in self.battler.equips.compact
  1179.           if i.note =~ XAS_J::REDUCTION
  1180.             minus += $1.to_i
  1181.           end
  1182.         end
  1183.         for i in self.battler.states
  1184.           if i.note =~ XAS_J::REDUCTION
  1185.             minus += $1.to_i
  1186.           end
  1187.         end
  1188.         @count_reduce = minus
  1189.       end
  1190.       if @count >= [(XAS_J::COUNT_TIME - @count_reduce), XAS_J::MIN_COUNT].max
  1191.         @count = 0
  1192.         if x.hrg != 0
  1193.           regen = (x.mhp * x.hrg).to_i
  1194.           x.hp += regen
  1195.           if $game_system.the_records
  1196.             $game_variables[XAS_J::CT_HEALSTTL] += regen
  1197.             $game_variables[XAS_J::CT_HEALSMAX] = regen if regen > $game_variables[XAS_J::CT_HEALSMAX]
  1198.           end
  1199.           x.damage = -(regen)
  1200.           x.damage_pop = true
  1201.         end
  1202.         if x.mrg != 0
  1203.           regen = (x.mmp * x.mrg).to_i
  1204.           x.mp += regen
  1205.           x.damage_type = "Mp"
  1206.           x.damage = (-regen)
  1207.           x.damage_pop = true
  1208.         end
  1209.         if x.trg != 0
  1210.           regen = (100 * x.trg).to_i
  1211.           x.tp += regen
  1212.           x.damage = -(regen)
  1213.           x.damage_pop = true
  1214.         end
  1215.         $game_map.need_refresh = true
  1216.       end#count
  1217.     end#Game_System
  1218.   end#update
  1219.  
  1220. end#Game_Character
  1221.  
  1222. =begin
  1223. #-------------------------------------------------------------------------------
  1224.   Record Keeping [the_records]
  1225.     Adds in a record keeping system and houses them into $game_variable[x]s.
  1226.  
  1227. This tracks a lot of different little variables that most people don't think to
  1228. much about, but hey, if you do, you can even assign them to variables for...
  1229. well... whatever kind of reasons or eventing you need to.
  1230.  
  1231. _RECORDS is a blank variable that can be used for whatever really. I use it for
  1232. tracking completion percent, but you can use it for whatever. (it was a
  1233. place-holder variable until I thought of something better, but I never did)
  1234.  
  1235. _DMGTAKEN is how much damage the player has taken, cumulatively.
  1236.  
  1237. _DMGTTL is how much damage you've dealt out via skills/attacks, cumulatively.
  1238.  
  1239. _DMGMAX is the highest damage pop that you have afflicted on an enemy. It will
  1240. constantly be replaced and updated with your highest single-hit blow.
  1241.  
  1242. _CRITS is the number of critical blows landed by the you.
  1243.  
  1244. _HEALSTTL is the cumulative amount of HP you've recovered.
  1245.  
  1246. _HEALSMAX is the highest amount of HP you've recovered in one pop.
  1247.  
  1248. _PARRYS is the total number of times you have parried an attack. (this will only
  1249. reflect 0 if you aren't using @parry_fx)
  1250.  
  1251. _EVADES is the total number of times you've evaded an attack.
  1252.  
  1253. _KILLS is the total number of monsters that have been defeated via normal means.
  1254. (normal means is defeating reducing HP to 0, or state-instant-death; obscure
  1255. means would be like creating a monster that is deleted like you delete events)
  1256.    
  1257. If you can think of more things you want tracked, let me know, I'll see if I
  1258. can't get them added. :)
  1259.  
  1260. =end
  1261. #=====================================#
  1262. module XAS_J                          #
  1263.   CT_RECORDS  = 31                    #
  1264.   CT_DMGTAKEN = 32                    #
  1265.   CT_DMGTTL   = 33                    #
  1266.   CT_DMGMAX   = 34                    #
  1267.   CT_CRITS    = 35                    #
  1268.   CT_HEALSTTL = 36                    #
  1269.   CT_HEALSMAX = 37                    #
  1270.   CT_PARRYS   = 38                    #
  1271.   CT_EVADES   = 39                    #
  1272.   CT_KILLS    = 40                    #
  1273. end                                   #
  1274. #=====================================#
  1275.  
  1276. class Game_Battler < Game_BattlerBase
  1277.   def make_damage_value(user, item)
  1278.     value = item.damage.eval(user, self, $game_variables)
  1279.     value *= item_element_rate(user, item)
  1280.     value *= pdr if item.physical?
  1281.     value *= mdr if item.magical?
  1282.     value *= rec if item.damage.recover?
  1283.     value = apply_critical(value) if @result.critical
  1284.     value = apply_variance(value, item.damage.variance)
  1285.     value = apply_guard(value)
  1286.     @result.make_damage(value.to_i, item)
  1287.     if $game_system.the_records
  1288.       if user.is_a?(Game_Actor)
  1289.         $game_variables[XAS_J::CT_CRITS] += 1 if @result.critical
  1290.         if value > 0
  1291.           $game_variables[XAS_J::CT_DMGTTL] += value.to_i
  1292.           $game_variables[XAS_J::CT_DMGMAX] = value.to_i if value > $game_variables[XAS_J::CT_DMGMAX]
  1293.         end
  1294.         if value < 0
  1295.           $game_variables[XAS_J::CT_HEALSTTL] += value.abs.to_i
  1296.           $game_variables[XAS_J::CT_HEALSMAX] = value.abs.to_i if value.abs > $game_variables[XAS_J::CT_HEALSMAX]
  1297.         end
  1298.       end
  1299.       if user.is_a?(Game_Enemy)
  1300.         $game_variables[XAS_J::CT_EVADES] += 1 if @result.evaded
  1301.         $game_variables[XAS_J::CT_DMGTAKEN] += value.to_i if value > 0
  1302.       end
  1303.     end
  1304.   end#def
  1305.  
  1306.   alias j_bd_item_cri item_cri
  1307.   def item_cri(user, item)
  1308.     crimult = 1.0
  1309.     if $imported["BattleDifficulty"] == true
  1310.       crimult = KGC::BattleDifficulty.get[:cri] / 100 if user.is_a?(Game_Enemy)
  1311.     end
  1312.     j_bd_item_cri(user, item) * crimult
  1313.   end
  1314. end#Game_Battler
  1315.  
  1316. =begin
  1317. #-------------------------------------------------------------------------------
  1318.   Confusion State [state_confu]
  1319.     Re-adds the function of Confusion into XAS ABS.
  1320.    
  1321. This scriptlet adds in random movement when afflicted with a state, to mimic
  1322. being confused. It's kinda primitive, but it works. The battler (either enemy or
  1323. player) will just randomly walk around, as though you set their move-route to
  1324. "move random", and will continue to do so until the state wears off.
  1325.  
  1326. Keep in mind, this shares functionality with "stop", which means ABSOLUTELY
  1327. NOTHING can be done while confused.
  1328.  
  1329. CONFUSE is the note that you stick in the notebox of states.
  1330.  
  1331. CONFU_CNT is how many frames between movement steps. You really shouldn't need
  1332. to change this, but its recommended not to drop it to less than 30.
  1333.  
  1334. NOTE!! For some reason, this does not quite work fully yet. In order for the
  1335. state to be re-applied, the player has to be healed for any amount or a state
  1336. of any sort be cured, otherwise you'll be immune to the state indefinitely.
  1337.  
  1338. As a work around, I set it up to fire off a skill at the end of the removal that
  1339. removes the state so it works, but I don't really feel fully comfortable with
  1340. just leaving it like this.
  1341.  
  1342. CONFU_SKL is the skill ID that will be autocast when the state is removed that
  1343. fully removes the skill and enables the state to be re-added again. Thiss skill
  1344. will ideally be a skill that has no animation, cost, or casting time.
  1345.  
  1346. =end
  1347.  
  1348. #=====================================#
  1349. module XAS_J                          #
  1350.   CONFUSE    = /<Confuse>/            #
  1351.   CONFU_CNT  = 30                     #
  1352.   CONFU_SKL  = 27                     #
  1353. end                                   #
  1354. #=====================================#
  1355.  
  1356.  
  1357. class Game_Character < Game_CharacterBase
  1358.  
  1359.   #alters writes in the function of confusion into the state_update method.
  1360.   alias j_xas_confuse_note update_state_abs_effects
  1361.   def update_state_abs_effects(state)
  1362.     j_xas_confuse_note(state)
  1363.     if $game_system.state_confu
  1364.       if state.note =~ XAS_J::CONFUSE
  1365.         self.battler.state_stop = true
  1366.         @move_speed = 3.5
  1367.         execute_state_confuse(state)
  1368.       end
  1369.     end
  1370.   end
  1371.  
  1372.   #a new method to actually accomplish the "confusion".
  1373.   def execute_state_confuse(state)
  1374.     if self.battler.state_duration[state.id] % XAS_J::CONFU_CNT == 0
  1375.       move_random
  1376.     end
  1377.   end
  1378.  
  1379.   #adds in the temporary fix that I've come up with regarding confusion.
  1380.   def update_remove_state(state)
  1381.     self.battler.state_duration[state.id] -= 1
  1382.     if self.battler.state_duration[state.id] <= 0    
  1383.       self.battler.remove_state(state.id)
  1384.       self.shoot(XAS_J::CONFU_SKL) if state.note =~ XAS_J::CONFUSE
  1385.     end          
  1386.   end
  1387. end#Game_Character
  1388.  
  1389. =begin
  1390. #-------------------------------------------------------------------------------
  1391.   Throw Equip Requirements [throw_reqs]
  1392.     Expands allowing armor requirements to throw specific... stuff.
  1393.    
  1394. This modification requires the existing MOG - XAS PICKUP AND THROW (v1.0+) to
  1395. function at all.
  1396.  
  1397. It expands the original functionality beyond just being able to pickup and
  1398. throw, but now to even require specific armors to be equipped to pick up the
  1399. various boulders.
  1400.  
  1401. With a simple note-tag extra you can now add a requirement of a specific armor
  1402. to pickup and throw specific things, ie: snow mitts to throw snowballs, or
  1403. maybe power gloves to throw boulders.
  1404.  
  1405. Use this note-tag now to add a requirement:
  1406.  
  1407. <Throw#:ID> or <Throw#:ID,ID,ID,etc>
  1408. where # is the number of spaces to be thrown (as with before)
  1409.  
  1410. and ID is the armor required.
  1411.  
  1412. Example:
  1413. <Throw3>
  1414. Throws the object 3 spaces infront of you, no equipment requirement. (default)
  1415.  
  1416. <Throw2:10>
  1417. Allows you to pickup/throw the object 2 spaces if you are wearing ARMOR_ID 10.
  1418.  
  1419. <Throw8:4,5,6>
  1420. Allows you to pickup/throw the object 8 spaces if you are wearing any of the
  1421. three ARMOR_ID's: 4 or 5 or 6.
  1422.  
  1423.  
  1424. =end
  1425. class Game_Event < Game_Character
  1426.   alias j_xas_throwreq initialize
  1427.   def initialize(map_id, event)
  1428.     j_xas_throwreq(map_id, event)
  1429.     if $game_system.throw_reqs
  1430.       if event.name =~ /<Throw(\d+):*(\d+(?:\s*,\s*\d+)*)>/i
  1431.         @throw = $1.to_i
  1432.         $2.scan(/\d+/).each { |num| @throw_equip << (num.to_i) if num.to_i > 0 }
  1433.       end
  1434.     end
  1435.   end
  1436. end#Game_Event
  1437.  
  1438. class Game_Temp
  1439.   attr_accessor :t_equips
  1440.   alias j_xas_tequips initialize
  1441.   def initialize
  1442.     @t_equips = false
  1443.     j_xas_tequips
  1444.   end
  1445. end#Game_Temp
  1446.  
  1447. class Game_Character < Game_CharacterBase
  1448.   attr_accessor :throw_equip
  1449.   alias j_xas_equipthrow initialize
  1450.   def initialize
  1451.       @throw_equip = [] if $game_system.throw_reqs
  1452.       j_xas_equipthrow
  1453.     end
  1454.  
  1455. end#Game_Character
  1456.  
  1457. class Game_Player < Game_Character
  1458.  
  1459.   # adds in the new method for checking equipment before lifting an object.
  1460.   alias j_xas_checkequips can_check_pickup_event?
  1461.   def can_check_pickup_event?
  1462.     if $game_system.throw_reqs
  1463.       check_equips
  1464.       return false unless $game_temp.t_equips
  1465.     end
  1466.     j_xas_checkequips
  1467.   end
  1468.  
  1469.   def check_equips
  1470.     f_x = $game_map.x_with_direction(@x, @direction)
  1471.     f_y = $game_map.y_with_direction(@y, @direction)
  1472.     for event in $game_map.events_xy(f_x, f_y)
  1473.       te = event.throw_equip
  1474.       if te.empty?
  1475.         # if there are no throwing requirements?
  1476.         return $game_temp.t_equips = true
  1477.       else
  1478.         # check to see if the leader is wearing the required armor.
  1479.         for i in $game_party.members[0].armors
  1480.           if te.include?(i.id)
  1481.             $game_temp.t_equips = true
  1482.             return
  1483.           else
  1484.             $game_temp.t_equips = false
  1485.           end
  1486.         end#armors
  1487.       end#if
  1488.     end#event
  1489.   end
  1490.  
  1491. end#Game_Player
  1492.  
  1493. class Game_Interpreter
  1494.   include XAS_J
  1495. end
  1496. #=End=Compilation=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement