Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 43.89 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Passive Augments by Xelias
  3. # Version: 1.01
  4. # Type: Skill Enhacement
  5. # Date v1.01:   18.12.2009
  6. #
  7. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  8. #  
  9. #  This work is protected by the following license:
  10. # #----------------------------------------------------------------------------
  11. # #  
  12. # #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
  13. # #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
  14. # #  
  15. # #  You are free:
  16. # #  
  17. # #  to Share - to copy, distribute and transmit the work
  18. # #  to Remix - to adapt the work
  19. # #  
  20. # #  Under the following conditions:
  21. # #  
  22. # #  Attribution. You must attribute the work in the manner specified by the
  23. # #  author or licensor (but not in any way that suggests that they endorse you
  24. # #  or your use of the work).
  25. # #  
  26. # #  Noncommercial. You may not use this work for commercial purposes.
  27. # #  
  28. # #  Share alike. If you alter, transform, or build upon this work, you may
  29. # #  distribute the resulting work only under the same or similar license to
  30. # #  this one.
  31. # #  
  32. # #  - For any reuse or distribution, you must make clear to others the license
  33. # #    terms of this work. The best way to do this is with a link to this web
  34. # #    page.
  35. # #  
  36. # #  - Any of the above conditions can be waived if you get permission from the
  37. # #    copyright holder.
  38. # #  
  39. # #  - Nothing in this license impairs or restricts the author's moral rights.
  40. # #  
  41. # #----------------------------------------------------------------------------
  42. #
  43. #  Version history
  44. #
  45. # 1.01
  46. #
  47. #  *Added new Passive Skills (From RESIST_STATES to GEOMANCY)
  48. #  *Fixed a bug
  49. #
  50. # #----------------------------------------------------------------------------
  51. #  This script creates "Passive Skills". The "Passive Skills" you list in
  52. #  PASSIVE_SKILLS_IDS = [] are displayed in a separate menu.
  53. #  They are simple skills you can give an Icon, a name, a description...
  54. #  You can change the menu's name in PASSIVE_WORD = "Augments"
  55. #  Replace "Augments" by whatever name you want.
  56. #
  57. #  Passive Skills only work on actors !
  58. #
  59. #  Passive skills effects are listed here :
  60. #
  61. #  GUARD_PLUS will decrease even more the damage taken while defending.
  62. #  REFLECT_GUARD will counterattack a physical attack while defending.
  63. #  MAGIC_REFLECT will counterattack a magical attack while defending.
  64. #  ARTFUL_DODGER will allow a certain percentage chance to dodge an attack while defending.
  65. #  MP_SHIELD will allow damage to be inflicted on SP instead of HP until you run out of SP.
  66. #  MARTYR allows the character to gain SP when taking damage
  67. #  INQUISITOR allows the character to gain SP when dealing physical damage.
  68. #  WARMAGE allows the character to gain SP when dealing damage with spells.
  69. #  BLOOD_PRICE allows the character to pay HP instead of SP. HP cost is SP cost*5
  70. #  DEMI_MP allows the character to cast spells for half the SP cost
  71. #  TURBO_MP doubles the SP cost as well as the power of the skills.
  72. #  SPELLBREAKER increases the damage dealt by spells when you have low HP
  73. #  ADRENALINE increases the damage dealt by attacks when you have low HP
  74. #  LAST_STAND decreases the damage taken when you have low HP
  75. #  CHARGED_ATTACKS increases the power of physical attacks for 6 SP a hit until you run out of SP.
  76. #  BRAWLER allows you to inflict more damage when no weapons are equipped. Note that
  77. #  thanks to this script, bare-handed attacks are available. Just modify the BARE_ANIMATION_SELF_ID
  78. #  and BARE_ANIMATION_ID to modify the animations that play on the attacker and on the enemy
  79. #  while attacking without weapons, respectively.
  80. #  CRITICAL_BOOST increases the critical hit ratio
  81. #  VITAL_POINT increases the critical hit damage <-- needs to be redone
  82. #  FOCUS slightly increases the damage dealt by attacks when at full HP
  83. #  SERENITY slightly increases the damage dealt by spells when at full HP
  84. #  ONCE_MORE allows the actor to survive all hits when his HP are higher than 1 : then his
  85. #  HP will become 1, and next strike will be deadly. Think about Kingdom Hearts for this one.
  86. #  LEARNING allows the actor to learn blue magic. This blue magic is set in BLUE_SKILLS_IDS = []
  87. #  HEALER increases the potency of healing spells and objects on the actor.
  88. #  STATE_RESIST halves the chances the actor will be affected by a status effect
  89. #  BLOOD_SWORD absorbs  1/4 of damage done by physical attacks as HP for the actor.
  90. #  ELEMENTALISM reduces an enemy's resistance to elemental spells
  91. #  GEOMANCY increases the user's resistance to elemental spells.
  92. #  SLAYER increases the user's Light spell damage against Evil foes (specified with EVIL_ID)
  93. #
  94. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  95. # Passive Skills
  96.  
  97. GUARD_PLUS_ID = 401
  98. REFLECT_GUARD_ID =
  99. MAGIC_REFLECT_ID =
  100. ARTFUL_DODGER_ID =
  101. MP_SHIELD_ID = 402
  102. MARTYR_ID = 420
  103. INQUISITOR_ID = 419
  104. WARMAGE_ID = 418
  105. BLOOD_PRICE_ID = 403
  106. DEMI_MP_ID = 405
  107. TURBO_MP_ID = 406
  108. SPELLBREAKER_ID = 407
  109. ADRENALINE_ID = 408
  110. LAST_STAND_ID = 409
  111. CHARGED_ATTACKS_ID =  410
  112. BRAWLER_ID = 400
  113. CRITICAL_BOOST_ID = 411
  114. VITAL_POINT_ID =
  115. FOCUS_ID = 0
  116. SERENITY_ID = 0
  117. ONCE_MORE_ID = 412
  118. LEARNING_ID = 600
  119. HEALER_ID = 413
  120. STATE_RESIST_ID = 414
  121. BLOOD_SWORD_ID = 404
  122. ELEMENTALISM_ID = 415
  123. GEOMANCY_ID = 416
  124. SLAYER_ID = 417
  125. ICEHAND_ID = 422
  126. MASTERY_SWORD_ID = 425
  127. MASTERY_SWORDSPEAR_ID = 426
  128.  
  129. #BLUE_SKILLS_IDS = []
  130. BLUE_SKILLS = (2..113).to_a
  131.  
  132. BARE_ANIMATION_SELF_ID = 0
  133. BARE_ANIMATION_ID = 4
  134.  
  135. EVIL_IDS = [4,10,14,15,16,17,20,21,36,37,38,39,41,49,54,55,61,65,78,79,504,999]
  136.  
  137. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  138. #
  139. #  Passive skills can also be used to equip weapons and armors, and to be able to use skills.
  140. #  Configure it like that :
  141. #
  142. #  When [weapon/armor id] then return [passive skill id]
  143. #  When [skill id] then return [passive skill id]
  144. #
  145. #  Note that passive skills overwrite class restrictions : if a warrior gets a "Equip Staffs"
  146. #  passive ability, he will be able to equip staffs.
  147. #
  148. #  On a sad note, all weapons/armors need to be set to a skill in order to be equipped.
  149. #  If you put "nil"  or "0", the game will crash.
  150. #  So set a skill for each different weapon or armor. Default is 100
  151. #  The same applies for skills. Skills won't crash, but won't be able to be used. Which is bad.
  152. #  However if you put "when skill X then return skill X", the skill will be usable if you have it, which
  153. #  means you won't have to learn another passive skill.
  154. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  155.  
  156. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  157. # Alternative Attack Algorithms  by Xelias
  158. # Version: 1.00
  159. # Type: Battle Add-ON
  160. # Date v1.00:   7.11.2009
  161. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  162. #
  163. #   How to use this script :
  164. # This allows your weapons to follow different damage algorithms. Before that, you
  165. # MUST place your weapons following a normal algorithm in the
  166. # NORMAL_WEAPONS_IDS, or else... It wouldn't be good for your game.
  167. # Also place all weapons ID except SP damaging and absorbing ones, into the
  168. # "ALL_WEAPONS_IDS", because if you don't, a nasty bug will prevent you from
  169. # dealing damage with normal attack. Cool, huh ?
  170. #
  171. # ATMA_WEAPON_IDS = [X,X...] : A weapon with an ID equal to X will inflict
  172. # more damage depending on the user’s HP. If HP are full, attack power is doubled.
  173. # If HP are at minimum, attack power is normal. If HP are equal to half, attack power
  174. # is equal to 1,5 of the normal Attack power, and so on...
  175. # VALIANT_KNIFE_IDS = [X, X...] : The opposite effect of Atma Weapon.
  176. # If HP are at minimum, attack power is doubled, and so on...
  177. # LIMITED_MOON_IDS = [X, X...] : Follows the same formula than Atma Weapon
  178. # but works with SP
  179. # CONFORMER_IDS = [X, X...] : Deals damage based on user’s Level.
  180. # At Level 1, attack power is normal. At Level 99, attack power is doubled. You get
  181. # the idea
  182. # MASAMUNE_IDS = [X, X...] : Deals more damage the weaker the enemy is
  183. # For an enemy with 100% HP, attack power is normal. For an enemy with 1 HP,
  184. # attack power is doubled (which is pretty useless). For an enemy with half HP,
  185. # attack power is equal to 1,5 of the normal attack power, and so on...
  186. # PROJECTILE_IDS = [X, X...] : Ignores the opponent's defense in the damage
  187. # calculation. However, the Attack power is halved, preventing an attack to inflict
  188. # max damage at an opponent with max defense. Otherwise, it wouldn't be fair.
  189. # BOW_IDS = [X, X...] : inflicts damage based on user's Dexterity instead of Strength
  190. # DAGGER_IDS = [X, X...] : inflicts damage based on user's Agility instead of Strength
  191. # MIND_BLASTER_IDS = [X, X...] : Damage is inflicted to SP. Damage
  192. # relies also on the opponent's Magic Defense and your Intelligence
  193. # BLOOD_SWORD_W_IDS = [X, X...] & PERCENT_DRAINED = X :  
  194. # some damage is absorbed from the attack. How many? PERCENT_DRAINED %
  195. # GUARD_BREAKER_IDS = [X, X...] : Damage ignores if enemy is defending.  
  196. # As simple as that.
  197. # GENJI_WEAPON_IDS = [X, X...] : Critical Hit Ratio is doubled.
  198. # KIKU_ICHIMONJI_IDS = [X, X...] : Critical Hit power is doubled.
  199. # ROBOT_WEAPON_IDS = [X, X...] : Weapons that inflicts damage based on a combination of str, dex and agl.
  200. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  201.  
  202. # Alternate Attack Algorithms
  203.  
  204.   OTHER_WEAPONS_IDS = [1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 23, 24, 25, 26, 27, 28, 29,
  205.   31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 53, 54, 55, 56,
  206.   57, 58, 59, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96,
  207.   97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 108, 109, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
  208.   137, 138]
  209.  
  210.   ALL_WEAPONS_IDS = []
  211.  
  212.   ATMA_WEAPON_IDS = []
  213.   VALIANT_KNIFE_IDS = [9, 30, 47]
  214.   LIMITED_MOON_IDS = []
  215.   CONFORMER_IDS = []
  216.   MASAMUNE_IDS = []
  217.   PROJECTILE_IDS = []
  218.   BOW_IDS = [60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 95, 133, 134, 135, 136]
  219.   DAGGER_IDS = [16, 17, 18, 19, 20, 21, 22]
  220.   MIND_BLASTER_IDS = []
  221.   BLOOD_SWORD_W_IDS = [15, 40, 51, 107]
  222.   PERCENT_DRAINED = 10
  223.   GUARD_BREAKER_IDS = []
  224.   GENJI_WEAPON_IDS = []
  225.   KIKU_ICHIMONJI_IDS = []
  226.   ROBOT_WEAPON_IDS = [110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121]
  227.  
  228. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  229. #==============================================================================
  230. # % based weapons (& skills) states rates
  231. # By gerkrt/gerrtunk
  232. # Version: 1.0
  233. # Date: 23/12/2010
  234. #
  235. # Modified By Midnight Moon to support skills.
  236. # Date: 08/08/2011
  237. #==============================================================================
  238.  
  239. =begin
  240.  
  241. --------Introduction-----------
  242.  
  243. Normally you can add any combination of states for weapons and skills,
  244. but you dont have any other control. With this you can use any state based on %.
  245.  
  246. You can ask for bugs, suggerences, compatibilitzations and any other things.
  247.  
  248. The % means the posibilities that have the state to impact the enemy. After that
  249. impact, the traditional formula(versus random+abdce) is applied. It works like
  250. old rpgmakers state affliction.
  251.  
  252.  
  253. weapon_id=>[[state_id1, possibility], [state_id2, possibility]]
  254.  
  255. Weap_state_rates = {3=>[[2, 100], [4,100]], 11=>[[2, 100], [4,100]] }
  256.  
  257. You can add any number of states for weapon, and weapons, just add a , before these.
  258. and respect the {}.
  259.  
  260. ---------Syntax notes--------------
  261.  
  262. You can divide long lines like this:
  263.  
  264. Weap_state_rates = {3=>[[2, 100], [4,100]],
  265. 11=>[[2, 100], [4,100]] ,
  266. 15=>[[2, 100], [4,100]] }
  267.  
  268. See that the new line have to be after a , and that the final one dont put a
  269. final ,.
  270.  
  271.  
  272. =end
  273.  
  274. module Wep
  275.  
  276.   # Set Weapon_state_rates to nil if you want to deactivate
  277.   # % based weapons states rates
  278.  
  279.   Weapon_state_rates = {}
  280.  
  281.   # Set Skill_state_rates to nil if you want to deactivate
  282.   # % based skills states rates
  283.   # Skill_state_rates = {
  284.   # SKILL_ID => [ [ADD_STATE_1, PERCENT_CHANCE_SUCCESS, [REMOVE_STATE_1,
  285.   # REMOVE_STATE_2, ... ]], [ADD_STATE_2, PERCENT_CHANCE_SUCCESS, [REMOVE_STATE_1,
  286.   # REMOVE_STATE_2, ... ]], ... ]
  287.   # The removed states occur if the PERCENT_CHANCE_SUCCESS is successful--there is
  288.   # no separate percent chance of removal. You can omit them entirely actually.
  289.   #  [ [ADD_STATE_1, PERCENT_CHANCE_SUCCESS], [ADD_STATE_2, PERCENT_CHANCE_SUCCESS], ... ]
  290.   # If you want to just remove states and not add any, set the ADD_STATE value to 0.
  291.  
  292.  
  293.   Skill_state_rates = {    
  294.     1=>[[1, 100,[]]],
  295.     11=>[[11, 10,[12, 13]]],
  296.     12=>[[11, 20,[12, 13]]],
  297.     13=>[[11, 30,[12, 13]]],
  298.     14=>[[2, 10,[]]],
  299.     15=>[[2, 20,[]]],
  300.     16=>[[9, 30,[]]],
  301.     17=>[[12, 10,[11, 13]]],
  302.     18=>[[12, 20,[11, 13]]],
  303.     19=>[[12, 30,[11, 13]]],
  304.     21=>[[6, 20,[]]],
  305.     22=>[[6, 40,[]]],
  306.     23=>[[13, 10,[]]],
  307.     25=>[[13, 30,[]]],
  308.     33=>[[6, 20,[]]],
  309.     34=>[[4, 10,[]], [5, 10,[]], [6, 10,[]]],
  310.     38=>[[4, 10,[]]],
  311.     39=>[[4, 20,[]]],
  312.     40=>[[4, 30,[]]],
  313.     44=>[[3, 30,[]]],
  314.     45=>[[3, 40,[]]],
  315.     46=>[[3, 50,[]]],
  316.     49=>[[2, 40,[]]],
  317.     56=>[[11, 20,[12, 13]]],
  318.     57=>[[11, 40,[12, 13]]],
  319.     58=>[[1, 50,[]]],
  320.     160=>[[2, 20,[]]],
  321.     164=>[[4, 20,[]]],
  322.     165=>[[5, 20,[]]],
  323.     166=>[[6, 20,[]]],
  324.     167=>[[4, 40,[]]],
  325.     168=>[[5, 40,[]]],
  326.     169=>[[6, 40,[]]],
  327.     170=>[[9, 10,[]]],
  328.     171=>[[9, 20,[]]],
  329.     172=>[[9, 30,[]]],
  330.     176=>[[1, 50,[]]],
  331.     180=>[[2, 20,[]]],
  332.     188=>[[11, 10,[12, 13]]],
  333.     189=>[[11, 20,[12, 13]]],
  334.     190=>[[11, 30,[12, 13]]],
  335.     191=>[[12, 10,[11, 13]]],
  336.     192=>[[12, 20,[11, 13]]],
  337.     193=>[[12, 30,[11, 13]]],
  338.     197=>[[1, 50,[]]],
  339.     200=>[[2, 20,[]]],
  340.     203=>[[11, 10,[12, 13]]],
  341.     204=>[[11, 20,[12, 13]]],
  342.     205=>[[11, 30,[12, 13]]],
  343.     206=>[[12, 10,[11, 13]]],
  344.     207=>[[12, 20,[11, 13]]],
  345.     208=>[[12, 30,[11, 13]]],
  346.     209=>[[9, 10,[]]],
  347.     210=>[[9, 20,[]]],
  348.     211=>[[9, 30,[]]],
  349.     216=>[[9, 10,[]]],
  350.     217=>[[11, 10,[12, 13]]],
  351.     218=>[[12, 10,[11, 13]]],
  352.     220=>[[2, 20,[]]],
  353.     223=>[[9, 10,[]]],
  354.     224=>[[9, 20,[]]],
  355.     225=>[[9, 30,[]]],
  356.     226=>[[11, 10,[12, 13]]],
  357.     227=>[[11, 20,[12, 13]]],
  358.     228=>[[11, 30,[12, 13]]],
  359.     229=>[[12, 10,[11, 13]]],
  360.     230=>[[12, 20,[11, 13]]],
  361.     231=>[[12, 30,[11, 13]]],
  362.     240=>[[19, 40,[27]]],
  363.     241=>[[20, 40,[26]]],
  364.     260=>[[3, 40,[]]],
  365.     265=>[[4, 20,[]]],
  366.     266=>[[4, 40,[]]],
  367.     267=>[[4, 60,[]]],
  368.     268=>[[5, 20,[]]],
  369.     269=>[[5, 40,[]]],
  370.     270=>[[5, 60,[]]],
  371.     271=>[[6, 20,[]]],
  372.     272=>[[6, 40,[]]],
  373.     273=>[[6, 60,[]]],
  374.     277=>[[22, 50,[]]],
  375.     278=>[[1, 50,[]]],
  376.     281=>[[5, 10,[]]],
  377.     282=>[[5, 20,[]]],
  378.     283=>[[6, 10,[]]],
  379.     284=>[[6, 20,[]]],
  380.     286=>[[11, 10,[12, 13]]],
  381.     287=>[[11, 20,[12, 13]]],
  382.     288=>[[11, 30,[12, 13]]],
  383.     289=>[[12, 10,[11, 13]]],
  384.     290=>[[12, 20,[11, 13]]],
  385.     291=>[[12, 30,[11, 13]]],
  386.     292=>[[13, 10,[]]],
  387.     293=>[[13, 20,[]]],
  388.     294=>[[13, 30,[]]],
  389.     298=>[[1, 50,[]]],
  390.     299=>[[12, 50,[11, 13]]],
  391.     515=>[[12, 10,[11, 13]]],
  392.     516=>[[2, 100,[]]],
  393.     517=>[[21, 100,[24, 25]]],
  394.     518=>[[12, 30,[11, 13]]],
  395.     521=>[[9, 30,[]],[12, 30,[]]],
  396.     522=>[[11, 30,[]],[12, 30,[]]],
  397.     523=>[[12, 30,[11, 13]]],
  398.     524=>[[1, 100,[]]],
  399.     525=>[[12, 50,[11, 13]]],
  400.     526=>[[12, 50,[11, 13]]],
  401.     605=>[[3, 30,[]]],
  402.     606=>[[2, 20,[]]],
  403.     615=>[[2, 20,[]]],
  404.     619=>[[3, 20,[]]],
  405.     620=>[[3, 30,[]]],
  406.     624=>[[2, 20,[]]],
  407.     647=>[[1, 50,[]]],
  408.     648=>[[1, 30,[]]],
  409.     650=>[[1, 85,[]]],
  410.     651=>[[11, 10,[12, 13]]],
  411.     652=>[[11, 20,[12, 13]]],
  412.     653=>[[11, 30,[12, 13]]],
  413.     654=>[[2, 10,[]]],
  414.     655=>[[2, 20,[]]],
  415.     656=>[[9, 30,[]]],
  416.     657=>[[12, 10,[11, 13]]],
  417.     658=>[[12, 20,[11, 13]]],
  418.     659=>[[12, 30,[11, 13]]],
  419.     661=>[[6, 20,[]]],
  420.     662=>[[6, 40,[]]],
  421.     663=>[[13, 10,[]]],
  422.     665=>[[13, 30,[]]],
  423.     673=>[[6, 20,[]]],
  424.     674=>[[4, 10,[]], [5, 10,[]], [6, 10,[]]],
  425.     678=>[[4, 10,[]]],
  426.     679=>[[4, 20,[]]],
  427.     680=>[[4, 30,[]]],
  428.     684=>[[3, 30,[]]],
  429.     685=>[[3, 40,[]]],
  430.     686=>[[3, 50,[]]],
  431.     689=>[[2, 40,[]]],
  432.     696=>[[11, 20,[12, 13]]],
  433.     697=>[[11, 40,[12, 13]]],
  434.     698=>[[1, 50,[]]],
  435.     704=>[[14, 20,[]]],
  436.     704=>[[14, 20,[]]],
  437.     721=>[[12, 10,[11, 13]]],
  438.     722=>[[2, 100,[]]],
  439.     723=>[[21, 100,[24, 25]]],
  440.     724=>[[12, 30,[11, 13]]],
  441.     726=>[[1, 80,[]]],
  442.     727=>[[11, 20,[12, 13]]],
  443.     728=>[[9, 100,[]]],
  444.     729=>[[11, 10,[11, 13]]],
  445.     730=>[[11, 30,[11, 13]]],
  446.     733=>[[13, 20,[]]],
  447.     735=>[[22, 90,[28]]],
  448.     738=>[[7, 100,[]]],
  449.     739=>[[2, 50,[]]],
  450.     740=>[[6, 30,[]]],
  451.     741=>[[2, 10,[]]],
  452.     745=>[[9, 10,[]]],
  453.     746=>[[11, 10,[12, 13]]],
  454.     747=>[[12, 10,[11, 13]]],
  455.     751=>[[2, 20,[]]],
  456.     758=>[[11, 10,[12, 13]]],
  457.     759=>[[11, 20,[12, 13]]],
  458.     760=>[[11, 30,[12, 13]]],
  459.     761=>[[12, 10,[11, 13]]],
  460.     762=>[[12, 20,[11, 13]]],
  461.     763=>[[12, 30,[11, 13]]],
  462.     767=>[[1, 50,[]]],
  463.   }
  464.  
  465. end
  466.  
  467. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  468.  
  469. class Game_Battler
  470.  
  471. def states_plus(plus_state_set)
  472.     # 有効フラグをクリア
  473.     effective = false
  474.     # ループ (付加するステート)
  475.     for i in plus_state_set
  476.       # このステートが防御されていない場合
  477.       unless self.state_guard?(i)
  478.         # このステートがフルでなければ有効フラグをセット
  479.         effective |= self.state_full?(i) == false
  480.         # ステートが [抵抗しない] の場合
  481.         if $data_states[i].nonresistance
  482.           # ステート変化フラグをセット
  483.           @state_changed = true
  484.           # ステートを付加
  485.           add_state(i)
  486.         # このステートがフルではない場合
  487.         elsif self.state_full?(i) == false
  488.           # ステート有効度を確率に変換し、乱数と比
  489.   if self.is_a?(Game_Actor) && self.skill_learn?(STATE_RESIST_ID)
  490.     if rand(100) < [0,50,40,30,20,10,0][self.state_ranks[i]]
  491.             # ステート変化フラグをセット
  492.             @state_changed = true
  493.             # ステートを付加
  494.             add_state(i)
  495.           end
  496.           end
  497.         unless self.is_a?(Game_Actor) && self.skill_learn?(STATE_RESIST_ID)
  498.           if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
  499.           @state_changed = true
  500.             # ステートを付加
  501.             add_state(i)
  502.           end
  503.           end
  504.         end
  505.       end
  506.     end
  507.     # メソッド終了
  508.     return effective
  509.   end
  510.  
  511. #==============================================================================
  512. # ** Game_Battler (part 3)
  513. #------------------------------------------------------------------------------
  514. #  This class deals with battlers. It's used as a superclass for the Game_Actor
  515. #  and Game_Enemy classes.
  516. #==============================================================================
  517.  
  518.  #--------------------------------------------------------------------------
  519.  # * Applying Normal Attack Effects
  520.  #     attacker : battler
  521.  #--------------------------------------------------------------------------
  522.  
  523. def attack_effect(attacker)
  524.     # Clear critical flag
  525.     self.critical = false
  526.     # First hit detection
  527.     hit_result = (rand(100) < attacker.hit)
  528.     # If hit occurs
  529.     if hit_result == true
  530.       # Calculate basic damge
  531.         atk = [attacker.atk - self.pdef / 2, 0].max
  532.       self.damage = atk * (attacker.str) / 10
  533.     if attacker.is_a?(Game_Actor)
  534.    if ATMA_WEAPON_IDS.include?(attacker.weapon_id)
  535.      atk = [attacker.atk - self.pdef / 2,0].max
  536.      atk2 = atk * (attacker.str) / 10
  537.     self.damage = atk2 + ((atk2*((attacker.hp*100)/attacker.maxhp))/100)
  538.     end
  539.        if VALIANT_KNIFE_IDS.include?(attacker.weapon_id)
  540.      atk = [attacker.atk - self.pdef / 2,0].max
  541.      atk2 = atk * (attacker.str) / 10
  542.      minushp = attacker.maxhp - attacker.hp
  543.     self.damage = atk2 + ((atk2*((minushp*100)/attacker.maxhp))/100)
  544.     end
  545.      if LIMITED_MOON_IDS.include?(attacker.weapon_id)
  546.      atk = [attacker.atk - self.pdef / 2,0].max
  547.      atk2 = atk * (attacker.str) / 10
  548.     self.damage = atk2 + ((atk2*((attacker.sp*100)/attacker.maxsp))/100)
  549.   end
  550.        if CONFORMER_IDS.include?(attacker.weapon_id)
  551.      atk = [attacker.atk - self.pdef / 2,0].max
  552.      atk2 = atk * (attacker.str) / 10
  553.     self.damage = atk2 + (atk2*(((attacker.level*100) / 99)/100))
  554.   end
  555.       if MASAMUNE_IDS.include?(attacker.weapon_id)
  556.      atk = [attacker.atk - self.pdef / 2,0].max
  557.      atk2 = atk * (attacker.str) / 10
  558.      minushp = self.maxhp - self.hp
  559.     self.damage = atk2 + ((atk2*((minushp*100)/self.maxhp))/100)
  560.   end
  561.         if PROJECTILE_IDS.include?(attacker.weapon_id)
  562.      atk = [attacker.atk,0].max
  563.      self.damage = atk * (attacker.str) / 10
  564.    end
  565.       if BOW_IDS.include?(attacker.weapon_id)
  566.     atk = [attacker.atk - self.pdef / 2, 0].max
  567.      self.damage = atk * (attacker.dex) / 10
  568.    end
  569.       if DAGGER_IDS.include?(attacker.weapon_id)
  570.     atk = [attacker.atk - self.pdef / 2, 0].max
  571.      self.damage = atk * (attacker.agi) / 10
  572.    end
  573.       if BLOOD_SWORD_W_IDS.include?(attacker.weapon_id)
  574.     atk = [attacker.atk - self.pdef / 2, 0].max
  575.      self.damage = atk * (attacker.str) / 10
  576.    end
  577.       if MIND_BLASTER_IDS.include?(attacker.weapon_id)
  578.     atk = [attacker.atk - ((self.pdef+self.mdef)) / 4, 0].max
  579.      self.damage = atk * (((attacker.str + attacker.int)/2)) / 10
  580.    end
  581.       if GUARD_BREAKER_IDS.include?(attacker.weapon_id)
  582.     atk = [attacker.atk - self.pdef / 2, 0].max
  583.      self.damage = atk * (attacker.str) / 10
  584.    end
  585.       if GENJI_WEAPON_IDS.include?(attacker.weapon_id)
  586.     atk = [attacker.atk - self.pdef / 2, 0].max
  587.      self.damage = atk * (attacker.str) / 10
  588.    end
  589.       if KIKU_ICHIMONJI_IDS.include?(attacker.weapon_id)
  590.     atk = [attacker.atk - self.pdef / 2, 0].max
  591.      self.damage = atk * (attacker.str) / 10
  592.    end
  593.       if ROBOT_WEAPON_IDS.include?(attacker.weapon_id)
  594.     atk = [attacker.atk - self.pdef / 2, 0].max
  595.      self.damage = atk * (((attacker.str) / 3) + ((attacker.dex) / 3) + ((attacker.agi) / 3)) / 10
  596.    end
  597.        if OTHER_WEAPONS_IDS.include?(attacker.weapon_id)
  598.     atk = [attacker.atk - self.pdef / 2, 0].max
  599.      self.damage = atk * (attacker.str) / 10
  600.    end
  601.        if attacker.is_a?(Game_Actor) && attacker.atk == 0
  602.         atk = [attacker.str - self.pdef / 2, 0].max
  603.       self.damage = atk * (attacker.str) / 10
  604.       end
  605.       if attacker.skill_learn?(BRAWLER_ID)
  606.           atk = [10 + attacker.str/1 - self.pdef / 2, 0].max
  607.       self.damage = atk * (attacker.str) / 10
  608.     end
  609.    if attacker.is_a?(Game_Enemy)
  610.       atk = [attacker.atk - self.pdef / 2, 0].max
  611.      self.damage = atk * (attacker.str) / 10
  612.    end
  613.    end
  614.       # Element correction
  615.       self.damage *= elements_correct(attacker.element_set)
  616.       self.damage /= 100
  617.       # If damage value is strictly positive
  618.       if self.damage > 0
  619.         # Critical correction
  620.       if attacker.is_a?(Game_Actor) && attacker.skill_learn?(CRITICAL_BOOST_ID)
  621.         if rand(100) < 10 * attacker.dex / self.agi
  622.           self.damage *= 2
  623.           self.critical = true
  624.         end
  625.          if attacker.is_a?(Game_Actor)
  626.     if GENJI_WEAPON_IDS.include?(attacker.weapon_id)
  627.         if rand(100) < 8 * attacker.dex / self.agi
  628.           self.damage *= 2
  629.           self.critical = true
  630.         end
  631.         end
  632.       if KIKU_ICHIMONJI_IDS.include?(attacker.weapon_id)
  633.         if rand(100) < 4 * attacker.dex / self.agi
  634.           self.damage *= 4
  635.           self.critical = true
  636.         end
  637.       end
  638.         else
  639.           if rand(100) < 2 * attacker.dex / self.agi
  640.           self.damage *= 2
  641.           self.critical = true
  642.         end
  643.       end
  644.     end
  645.         # Guard correction
  646.         if self.guarding?
  647.           self.damage /= 2
  648.         end
  649.         if self.is_a?(Game_Actor) && self.guarding? && self.skill_learn?(GUARD_PLUS_ID)
  650.           if rand(100) < 50
  651.           hp_recovery = self.maxhp/10
  652.           self.hp += hp_recovery
  653.           self.damage *= 0
  654.           else
  655.           self.damage /= 16
  656.         end
  657.       end
  658.       end
  659.       # Dispersion
  660.       if self.damage.abs > 0
  661.         amp = [self.damage.abs * 15 / 100, 1].max
  662.         self.damage += rand(amp+1) + rand(amp+1) - amp
  663.       end
  664.       # Second hit detection
  665.       eva = 2 * self.agi / attacker.dex + self.eva
  666.       hit = self.damage < 0 ? 100 : 100 - eva
  667.       hit = self.cant_evade? ? 100 : hit
  668.       hit_result = (rand(100) < hit)
  669.     end
  670.     # If hit occurs
  671.     if hit_result == true
  672.       # State Removed by Shock
  673.       remove_states_shock
  674.       # Subtract damage from HP
  675.        if attacker.is_a?(Game_Actor)
  676.       if MIND_BLASTER_IDS.include?(attacker.weapon_id)
  677.         self.sp -= self.damage
  678.         self.damage = sprintf('%+d %s', -self.damage, $data_system.words.sp)
  679.         end
  680.       if BLOOD_SWORD_W_IDS.include?(attacker.weapon_id)
  681.        healing = (self.damage*PERCENT_DRAINED)/100
  682.         self.hp -= self.damage
  683.         attacker.hp += healing
  684.       end
  685.       if ALL_WEAPONS_IDS.include?(attacker.weapon_id)
  686.         self.hp -= self.damage
  687.       end
  688.       end
  689.       if self.is_a?(Game_Actor) && self.skill_learn?(MARTYR_ID) && self.damage > 0
  690.       sp_recovery = self.damage/10
  691.       self.sp += sp_recovery
  692.     end
  693.       if attacker.is_a?(Game_Actor) && attacker.skill_learn?(INQUISITOR_ID)
  694.       sp_recovery = self.damage/10
  695.       attacker.sp += sp_recovery
  696.     end
  697.       if attacker.is_a?(Game_Actor) && attacker.skill_learn?(ADRENALINE_ID) && ((attacker.hp*100)/attacker.maxhp) < 30
  698.       self.damage*= 2
  699.     end
  700.       if attacker.is_a?(Game_Actor) && attacker.skill_learn?(FOCUS_ID) && attacker.hp = attacker.maxhp
  701.       self.damage*= 2
  702.     end
  703.     if self.is_a?(Game_Actor) && self.skill_learn?(LAST_STAND_ID) && ((self.hp*100)/self.maxhp) < 30
  704.       self.damage/= 8
  705.     end
  706.     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(BLOOD_PRICE_ID) && self.hp > 1
  707.       attacker.hp -= attacker.hp/10
  708.       self.damage += self.damage/2
  709.       end
  710.     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(CHARGED_ATTACKS_ID) && attacker.sp > 0
  711.       attacker.sp -= 6
  712.       self.damage += self.damage/3
  713.     end
  714.     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(BLOOD_SWORD_ID)
  715.       hp_recovery = self.damage/10
  716.       attacker.hp += hp_recovery
  717.     end
  718.     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(MASTERY_SWORD_ID)
  719.       self.damage*=1.5
  720.       self.damage = self.damage.to_i
  721.     else
  722.       self.damage*=1
  723.     end
  724.     if self.is_a?(Game_Actor) && self.skill_learn?(ONCE_MORE_ID) && self.hp > 1 && self.damage > self.hp
  725.     self.damage = self.hp - 1  
  726.     end
  727.      if self.is_a?(Game_Actor) && self.skill_learn?(MP_SHIELD_ID) && self.sp > 0
  728.       self.sp -= (self.damage*0.8).to_i
  729.       self.hp -= (self.damage*0.2).to_i
  730.     else
  731.       self.hp -= self.damage
  732.     end
  733.       # State change
  734.       # Check to add unique states for weapons
  735.       if attacker.is_a? Game_Actor and Wep::Weapon_state_rates[attacker.weapon_id] != nil
  736.         state_add = []
  737.         state_remove = []
  738.         # Loop over state rates and check the posibilties. Create a state list.
  739.         for state_rate in Wep::Weapon_state_rates[attacker.weapon_id]
  740.           if rand(100) < state_rate[1]
  741.             state_add.push(state_rate[0])
  742.             for s in state_rate[2]
  743.               state_remove.push(s)
  744.             end
  745.           end
  746.         end
  747.         states_plus(state_add)
  748.         states_remove(state_remove)
  749.       else
  750.       @state_changed = false
  751.       states_plus(attacker.plus_state_set)
  752.       states_minus(attacker.minus_state_set)
  753.       end
  754.     # When missing
  755.     else
  756.       # Set damage to "Miss"
  757.       self.damage = "Miss!"
  758.       # Clear critical flag
  759.       self.critical = false
  760.     end
  761.     # End Method
  762.     return true
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # * Apply Skill Effects
  766.   #     user  : the one using skills (battler)
  767.   #     skill : skill
  768.   #--------------------------------------------------------------------------
  769.   def skill_effect(user, skill)
  770.     # Clear critical flag
  771.     self.critical = false
  772.     # If skill scope is for ally with 1 or more HP, and your own HP = 0,
  773.     # or skill scope is for ally with 0, and your own HP = 1 or more
  774.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  775.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  776.       # End Method
  777.       return false
  778.     end
  779.     # Clear effective flag
  780.     effective = false
  781.     # Set effective flag if common ID is effective
  782.     effective |= skill.common_event_id > 0
  783.     # First hit detection
  784.     hit = skill.hit
  785.     if skill.atk_f > 0 && skill.power > 0 && skill.int_f < 1
  786.       hit *= user.hit / 100
  787.     end
  788.     hit_result = (rand(100) < hit)
  789.     # Set effective flag if skill is uncertain
  790.     effective |= hit < 100
  791.     # If hit occurs
  792.     if hit_result == true
  793.       # Calculate power
  794.       power = skill.power + user.atk * skill.atk_f / 100
  795.       if power > 0
  796.         power -= self.pdef * skill.pdef_f / 200
  797.         power -= self.mdef * skill.mdef_f / 200
  798.         power = [power, 0].max
  799.       end
  800.       # Calculate rate
  801.       rate = 20
  802.       rate += (user.str * skill.str_f / 100)
  803.       rate += (user.dex * skill.dex_f / 100)
  804.       rate += (user.agi * skill.agi_f / 100)
  805.       rate += (user.int * skill.int_f / 100)
  806.       # Calculate basic damage
  807.       self.damage = power * rate / 20
  808.       # Element correction
  809.       elements = (elements_correct(skill.element_set))
  810.       if user.is_a?(Game_Actor) && user.skill_learn?(ELEMENTALISM_ID) && skill.int_f > 0 && self.damage > 0
  811.       elements *= 2
  812.       end
  813.       if self.is_a?(Game_Actor) && self.skill_learn?(GEOMANCY_ID) && skill.mdef_f > 0 && self.damage > 0
  814.         elements /= 2
  815.       end
  816.         self.damage *= elements
  817.       self.damage /= 100
  818.       # If damage value is strictly positive
  819.       if self.damage > 0
  820.         # Critical
  821.         if rand(100) < 4 * user.dex / self.agi
  822.             self.damage *= 2
  823.             self.critical = true
  824.           end
  825.         # Guard correction
  826.         if self.guarding?
  827.           self.damage /= 2
  828.         end
  829.         if self.is_a?(Game_Actor) && self.guarding? && self.skill_learn?(GUARD_PLUS_ID) && skill.int_f < 1 && self.damage > 0
  830.           if rand(100) < 50
  831.           hp_recovery = self.maxhp/4
  832.           self.hp += hp_recovery
  833.           self.damage *= 0
  834.           else
  835.           self.damage /= 16
  836.         end
  837.       end
  838.       if self.is_a?(Game_Actor) && self.guarding? && self.skill_learn?(GUARD_PLUS_ID) && skill.int_f > 0 && self.damage > 0
  839.         if rand(100) < 25
  840.         self.damage *= 0
  841.         else
  842.         self.damage /= 4
  843.       end
  844.       end
  845.       if self.is_a?(Game_Actor) && self.guarding? && self.skill_learn?(ARTFUL_DODGER_ID) && self.damage > 0
  846.         if rand(100) < 4 * self.agi / self.dex
  847.         self.damage = "Miss!"
  848.       else
  849.         self.damage /= 2
  850.       end
  851.       end
  852.     end
  853.       # Dispersion
  854.       if skill.variance > 0 and self.damage.abs > 0
  855.         amp = [self.damage.abs * skill.variance / 100, 1].max
  856.         self.damage += rand(amp+1) + rand(amp+1) - amp
  857.       end
  858.       # Second hit detection
  859.       eva = self.eva
  860.       #eva = 8 * self.agi / user.dex + self.eva
  861.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  862.       hit = self.cant_evade? ? 100 : hit
  863.       hit_result = (rand(100) < hit)
  864.       # Set effective flag if skill is uncertain
  865.       effective |= hit < 100
  866.     end
  867.     # If hit occurs
  868.     if hit_result == true
  869.       # If physical attack has power other than 0
  870.       if skill.power != 0 and skill.atk_f > 0
  871.         # State Removed by Shock
  872.         remove_states_shock
  873.         # Set to effective flag
  874.         effective = true
  875.       end
  876.       # Subtract damage from HP
  877.       last_hp = self.hp
  878.         if self.is_a?(Game_Actor) && self.skill_learn?(MARTYR_ID) && self.damage > 0
  879.       sp_recovery = self.damage/10
  880.       self.sp += sp_recovery
  881.     end
  882.         if user.is_a?(Game_Actor) && user.skill_learn?(INQUISITOR_ID)  && self.damage > 0 && skill.int_f < 1
  883.       sp_recovery = self.damage/10
  884.       user.sp += sp_recovery
  885.     end
  886.         if user.is_a?(Game_Actor) && user.skill_learn?(WARMAGE_ID)  && self.damage > 0 && skill.int_f > 0
  887.       sp_recovery = self.damage/10
  888.       user.sp += sp_recovery
  889.     end
  890.       if user.is_a?(Game_Actor) && user.skill_learn?(BLOOD_SWORD_ID)  && skill.pdef_f > 0
  891.       hp_recovery = self.damage/4
  892.       user.hp += hp_recovery
  893.     end
  894.       if user.is_a?(Game_Actor) && user.skill_learn?(TURBO_MP_ID) && skill.mdef_f > 0
  895.       self.damage*=3
  896.     end
  897.       if user.is_a?(Game_Actor) && user.skill_learn?(ICEHAND_ID) && skill.mdef_f > 0 && skill.element_set.include?(2)
  898.       self.damage*=3
  899.     else
  900.       self.damage*=1
  901.     end
  902.     if user.is_a?(Game_Actor) && user.skill_learn?(MASTERY_SWORD_ID) && skill.atk_f > 0 && skill.element_set.include?(20)
  903.       self.damage*=1.5
  904.       self.damage = self.damage.to_i
  905.     else
  906.       self.damage*=1
  907.     end
  908.     if user.is_a?(Game_Actor) && user.skill_learn?(MASTERY_SWORDSPEAR_ID) && skill.atk_f > 0 && skill.element_set.include?(20)
  909.       self.damage*=1.8
  910.       self.damage = self.damage.to_i
  911.       elsif user.is_a?(Game_Actor) && user.skill_learn?(MASTERY_SWORDSPEAR_ID) && skill.atk_f > 0 && skill.element_set.include?(21)
  912.       self.damage*=1.2
  913.       self.damage = self.damage.to_i
  914.     else
  915.       self.damage*=1
  916.     end
  917.       if user.is_a?(Game_Actor) && user.skill_learn?(SLAYER_ID) && skill.mdef_f > 0 && skill.element_set.include?(13)
  918.         if self.is_a?(Game_Enemy) && EVIL_IDS.include?(self.id)
  919.       self.damage*=4
  920.     else
  921.       self.damage*=1
  922.       end
  923.     end
  924.       if user.is_a?(Game_Actor) && user.skill_learn?(SPELLBREAKER_ID) && skill.mdef_f > 0 && ((user.hp*100)/ user.maxhp) < 30
  925.       self.damage*=3
  926.     end
  927.       if user.is_a?(Game_Actor) && user.skill_learn?(ADRENALINE_ID) && skill.pdef_f > 0 && ((user.hp*100)/ user.maxhp) < 30
  928.       self.damage*=3
  929.     end
  930.       if user.is_a?(Game_Actor) && user.skill_learn?(SERENITY_ID) && skill.mdef_f > 0 && user.hp = user.maxhp
  931.       self.damage += self.damage/3
  932.     end
  933.       if user.is_a?(Game_Actor) && user.skill_learn?(FOCUS_ID) && skill.pdef_f > 0 && user.hp = user.maxhp
  934.       self.damage += self.damage/3
  935.     end
  936.       if self.is_a?(Game_Actor) && self.skill_learn?(LAST_STAND_ID) && ((self.hp*100)/self.maxhp) < 30
  937.       self.damage/= 2
  938.     end
  939.       if self.is_a?(Game_Actor) && self.skill_learn?(ONCE_MORE_ID) && self.hp > 1 && self.damage > self.hp
  940.     self.damage = self.hp - 1  
  941.   end
  942.       if self.is_a?(Game_Actor) && self.skill_learn?(HEALER_ID) && self.damage < 0
  943.         self.damage *= 2
  944.       end
  945.     if self.is_a?(Game_Actor) && self.skill_learn?(LEARNING_ID) && BLUE_SKILLS_IDS.include?(skill.id)
  946.     learn_skill(skill.id)
  947.     end
  948.       if self.is_a?(Game_Actor) && self.skill_learn?(MP_SHIELD_ID) && self.sp > 0 && self.damage > 0
  949.       self.sp -= (self.damage*0.9).to_i
  950.       self.hp -= (self.damage*0.1).to_i
  951.       else
  952.        self.hp -= self.damage
  953.      end
  954.       effective |= self.hp != last_hp
  955.       # State change
  956.       @state_changed = false
  957.       if Wep::Skill_state_rates[skill.id] != nil
  958.         state_add = []
  959.         state_remove = []
  960.         # Loop over state rates and check the posibiltys. Create a state list.
  961.         for state_rate in Wep::Skill_state_rates[skill.id]
  962.           if rand(100) < state_rate[1]
  963.             state_add.push(state_rate[0])
  964.             for s in state_rate[2]
  965.               state_remove.push(s)
  966.             end
  967.           end
  968.         end
  969.         states_plus(state_add)
  970.         states_minus(state_remove)
  971.         #effective |= states_plus(state_add)
  972.         #effective |= states_minus(state_remove)
  973.       else
  974.         states_plus(skill.plus_state_set)
  975.         states_minus(skill.minus_state_set)
  976.         #effective |= states_plus(skill.plus_state_set)
  977.         #effective |= states_minus(skill.minus_state_set)
  978.         end
  979.       # If power is 0
  980.       if skill.power == 0
  981.         # Set damage to an empty string
  982.         self.damage = ""
  983.         # If state is unchanged
  984.         unless @state_changed
  985.           # Set damage to "Miss"
  986.           self.damage = "Miss!"
  987.         end
  988.       end
  989.     # If miss occurs
  990.     else
  991.       # Set damage to "Miss"
  992.       self.damage = "Miss!"
  993.     end
  994.     # If not in battle
  995.     unless $game_temp.in_battle
  996.       # Set damage to nil
  997.       self.damage = nil
  998.     end
  999.     # End Method
  1000.     return effective
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # * Application of Item Effects
  1004.   #     item : item
  1005.   #--------------------------------------------------------------------------
  1006.   def item_effect(item)
  1007.     # Clear critical flag
  1008.     self.critical = false
  1009.     # If item scope is for ally with 1 or more HP, and your own HP = 0,
  1010.     # or item scope is for ally with 0 HP, and your own HP = 1 or more
  1011.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  1012.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  1013.       # End Method
  1014.       return false
  1015.     end
  1016.     # Clear effective flag
  1017.     effective = false
  1018.     # Set effective flag if common ID is effective
  1019.     effective |= item.common_event_id > 0
  1020.     # Determine hit
  1021.     hit_result = (rand(100) < item.hit)
  1022.     # Set effective flag is skill is uncertain
  1023.     effective |= item.hit < 100
  1024.     # If hit occurs
  1025.     if hit_result == true
  1026.       # Calculate amount of recovery
  1027.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  1028.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  1029.       if recover_hp < 0
  1030.         recover_hp += self.pdef * item.pdef_f / 20
  1031.         recover_hp += self.mdef * item.mdef_f / 20
  1032.         recover_hp = [recover_hp, 0].min
  1033.       end
  1034.       # Element correction
  1035.       recover_hp *= elements_correct(item.element_set)
  1036.       recover_hp /= 100
  1037.       recover_sp *= elements_correct(item.element_set)
  1038.       recover_sp /= 100
  1039.       # Dispersion
  1040.       if item.variance > 0 and recover_hp.abs > 0
  1041.         amp = [recover_hp.abs * item.variance / 100, 1].max
  1042.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  1043.       end
  1044.       if item.variance > 0 and recover_sp.abs > 0
  1045.         amp = [recover_sp.abs * item.variance / 100, 1].max
  1046.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  1047.       end
  1048.       # If recovery code is negative
  1049.       if recover_hp < 0
  1050.         # Guard correction
  1051.         if self.guarding?
  1052.           recover_hp /= 2
  1053.         end
  1054.       end
  1055.       # Set damage value and reverse HP recovery amount
  1056.       if self.is_a?(Game_Actor) && self.skill_learn?(HEALER_ID) && recover_hp > 0
  1057.         recover_hp *= (1.5).to_i
  1058.         end
  1059.       self.damage = -recover_hp
  1060.       # HP and SP recovery
  1061.       last_hp = self.hp
  1062.       last_sp = self.sp
  1063.       self.hp += recover_hp
  1064.       self.sp += recover_sp
  1065.       effective |= self.hp != last_hp
  1066.       effective |= self.sp != last_sp
  1067.       # State change
  1068.       @state_changed = false
  1069.       effective |= states_plus(item.plus_state_set)
  1070.       effective |= states_minus(item.minus_state_set)
  1071.       # If parameter value increase is effective
  1072.       if item.parameter_type > 0 and item.parameter_points != 0
  1073.         # Branch by parameter
  1074.         case item.parameter_type
  1075.         when 1  # MaxHP
  1076.           @maxhp_plus += item.parameter_points
  1077.         when 2  # MaxSP
  1078.           @maxsp_plus += item.parameter_points
  1079.         when 3  # Strength
  1080.           @str_plus += item.parameter_points
  1081.         when 4  # Dexterity
  1082.           @dex_plus += item.parameter_points
  1083.         when 5  # Agility
  1084.           @agi_plus += item.parameter_points
  1085.         when 6  # Intelligence
  1086.           @int_plus += item.parameter_points
  1087.         end
  1088.         # Set to effective flag
  1089.         effective = true
  1090.       end
  1091.       # If HP recovery rate and recovery amount are 0
  1092.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  1093.         # Set damage to empty string
  1094.         self.damage = ""
  1095.         # If SP recovery rate / recovery amount are 0, and parameter increase
  1096.         # value is ineffective.
  1097.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  1098.            (item.parameter_type == 0 or item.parameter_points == 0)
  1099.           # If state is unchanged
  1100.           unless @state_changed
  1101.             # Set damage to "Miss"
  1102.             self.damage = "Miss!"
  1103.           end
  1104.         end
  1105.       end
  1106.     # If miss occurs
  1107.     else
  1108.       # Set damage to "Miss"
  1109.       self.damage = "Miss!"
  1110.     end
  1111.     # If not in battle
  1112.     unless $game_temp.in_battle
  1113.       # Set damage to nil
  1114.       self.damage = nil
  1115.     end
  1116.     # End Method
  1117.     return effective
  1118.   end
  1119.   #--------------------------------------------------------------------------
  1120.   # * Application of Slip Damage Effects
  1121.   #--------------------------------------------------------------------------
  1122.   def slip_damage_effect
  1123.     # Set damage
  1124.     self.damage = self.maxhp / 8
  1125.     # Dispersion
  1126.     if self.damage.abs > 0
  1127.       amp = [self.damage.abs * 15 / 100, 1].max
  1128.       self.damage += rand(amp+1) + rand(amp+1) - amp
  1129.     end
  1130.     # Subtract damage from HP
  1131.     self.hp -= self.damage
  1132.     # End Method
  1133.     return true
  1134.   end
  1135. end
  1136.  
  1137.   #--------------------------------------------------------------------------
  1138.   # * Calculating Element Correction
  1139.   #     element_set : element
  1140.   #--------------------------------------------------------------------------
  1141.   def elements_correct(element_set)
  1142.     # If not an element
  1143.     if element_set == []
  1144.       # Return 100
  1145.       return 100
  1146.     end
  1147.     # Return the weakest object among the elements given
  1148.     # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
  1149.     #    which inherit from this class.
  1150.     weakest = -100
  1151.     for i in element_set
  1152.       weakest = [weakest, self.element_rate(i)].max
  1153.     end
  1154.     return weakest
  1155.   end
  1156.  
  1157. class Scene_Battle
  1158.   def make_skill_action_result
  1159.     # Get skill
  1160.     @skill = $data_skills[@active_battler.current_action.skill_id]
  1161.     # If not a forcing action
  1162.     unless @active_battler.current_action.forcing
  1163.       # If unable to use due to SP running out
  1164.       unless @active_battler.skill_can_use?(@skill.id)
  1165.         # Clear battler being forced into action
  1166.         $game_temp.forcing_battler = nil
  1167.         # Shift to step 1
  1168.         @phase4_step = 1
  1169.         return
  1170.       end
  1171.     end
  1172.       if @active_battler.is_a?(Game_Actor) && @active_battler.skill_learn?(DEMI_MP_ID)
  1173.         @skill.sp_cost /= 1.5.floor
  1174.       end    
  1175.             if @active_battler.is_a?(Game_Actor) && @active_battler.skill_learn?(TURBO_MP_ID)
  1176.         @skill.sp_cost *= 1.5.floor
  1177.         end    
  1178.     # Use up SP
  1179.     if @active_battler.is_a?(Game_Actor) && @active_battler.skill_learn?(BLOOD_PRICE_ID)
  1180.     @active_battler.hp -= (@skill.sp_cost)
  1181.   else
  1182.     @active_battler.sp -= @skill.sp_cost
  1183.     end
  1184.     # Refresh status window
  1185.     @status_window.refresh
  1186.     # Show skill name on help window
  1187.     @help_window.set_text(@skill.name, 1)
  1188.     # Set animation ID
  1189.     @animation1_id = @skill.animation1_id
  1190.     @animation2_id = @skill.animation2_id
  1191.     # Set command event ID
  1192.     @common_event_id = @skill.common_event_id
  1193.     # Set target battlers
  1194.     set_target_battlers(@skill.scope)
  1195.     # Apply skill effect
  1196.     for target in @target_battlers
  1197.       target.skill_effect(@active_battler, @skill)
  1198.     end
  1199.   end
  1200. end
  1201.  
  1202. class Game_Actor < Game_Battler
  1203.   def animation1_id
  1204.     weapon = $data_weapons[@weapon_id]
  1205.     return weapon != nil ? weapon.animation1_id : BARE_ANIMATION_SELF_ID
  1206.   end
  1207.  
  1208.   def animation2_id
  1209.     weapon = $data_weapons[@weapon_id]
  1210.     return weapon != nil ? weapon.animation2_id : BARE_ANIMATION_ID
  1211.   end
  1212.  
  1213.   def element_set
  1214.     weapon = $data_weapons[@weapon_id]
  1215.     return weapon != nil ? weapon.element_set : [18]
  1216.   end
  1217.  
  1218. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement