Kyriaki

Yanfly Engine RD - Extra Equipment Options ReDONE

Jun 7th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.30 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Yanfly Engine RD - Extra Equipment Options ReDONE
  4. # Last Date Updated: 2009.06.14
  5. # Level: Normal, Hard
  6. #
  7. # This is a rewrite of my former Extra Equipment Options script so if you have
  8. # that one, discard it and use this one. This script provides equipment more
  9. # flexibility and options.
  10. #
  11. # BONUS STATS
  12. # By default, VX gave equipment a maximum stat increase of 500. For those who
  13. # love insanely huge numbers or has a game that provides insanely huge numbers,
  14. # equipment creation becomes a problem. The script allows you to bypass the
  15. # maximum increase and also allows you to give equipment stat boosts to MaxHP,
  16. # MaxMP, Hit, Eva, Cri, and Odds, which weren't originally available.
  17. #
  18. # TRAITS
  19. # Some equipment traits were limited to just weapons or armours. Some weren't
  20. # even available at all. Equipment traits will allow you give weapons and armour
  21. # more traits than what was originally available for them such as autobattling
  22. # and auto-states.
  23. #
  24. # REQUIREMENTS
  25. # If you don't want equipment to be worn immediately right away, you can set
  26. # certain requirements on them to be met first before allowing actors to wear
  27. # them. Should at any time the actor fall below the requirements, the pieces
  28. # of unwearable equipment will be purged.
  29. #
  30. # CURSED ITEMS
  31. # Some items can now curse equipment slots. If a piece of equipment is cursed,
  32. # the player cannot unequip it until the actor is purified or an event manually
  33. # changes the equipment worn.
  34. #
  35. #===============================================================================
  36. # Updates:
  37. # ----------------------------------------------------------------------------
  38. # o 2009.06.06 - Improved efficiency when checking equipment purging.
  39. # o 2009.06.02 - Added percentile increase.
  40. # o 2009.06.01 - Started version 2.0 and finished.
  41. # o 2009.04.26 - Temporarily removed buggy features.
  42. # o 2009.04.23 - Started on script and finished.
  43. #===============================================================================
  44. # Instructions
  45. #===============================================================================
  46. #
  47. # The following tags go into your weapon and armour's noteboxes.
  48. #
  49. # <bonus stat +x>
  50. # This will raise the stat by x value. If "+" then x will increase. If "-"
  51. # then x will decrease. The "stat" can be replaced by maxhp, maxmp, atk, def,
  52. # spi, agi, hit, eva, cri, or odds. This also lets you surpass the default 500
  53. # value limit when using x.
  54.  
  55. # <bonus stat +x%>
  56. # This will raise the stat by x percent. If "+" then x will increase. If "-"
  57. # then x will decrease. The "stat" can be replaced by maxhp, maxmp, atk, def,
  58. # spi, agi, hit, eva, cri, or odds. <bonus atk +5%> will raise atk by 5%.
  59. #
  60. # <trait x>
  61. # This will allow you to give your actors specific traits when equipping a piece
  62. # of equipment. Add more of the tag to have more traits. Traits are as follows:
  63. # auto battle => Makes the actor automatically fight in battle
  64. # super guard => Gives the actor more damage reduction when guarding
  65. # pharmacology => Items used by the actor give double effect
  66. # fast attack => Actor attacks faster in battle
  67. # dual attack => Actor attacks twice in battle
  68. # prevent cri => Actor cannot suffer critical hits
  69. # half mp cost => Actor consumes half mp when casting skills
  70. # double exp => Actor gains double exp in battle
  71. # auto hp rec => Actor regenerates HP in battle
  72. #
  73. # <auto state x> or <auto state x,x>
  74. # This will automatically place state x on your actors when that piece of
  75. # equipment is worn. To make a piece of equipment have more than one auto state,
  76. # place more of the autostate tags or use the x,x tag.
  77. #
  78. # <require more stat x>
  79. # This will cause the piece of equipment to require more than x amount of stat
  80. # before it can be worn. The "stat" can be replaced by maxhp, maxmp, atk, def,
  81. # spi, agi, hit, eva, cri, or odds.
  82. #
  83. # <require less stat x>
  84. # This will cause the piece of equipment to require less than x amount of stat
  85. # before it can be worn. The "stat" can be replaced by maxhp, maxmp, atk, def,
  86. # spi, agi, hit, eva, cri, or odds.
  87. #
  88. # <require switch x> or <require switch x,x>
  89. # This will cause the piece of equipment to requires the switches x to be on
  90. # before it can be worn. To require multiple switches, add more tags or use the
  91. # x,x tag instead.
  92. #
  93. # <cursed item>
  94. # When the actor equips this item, the equipment slot will become cursed until
  95. # the item is unequipped through an event or a purifying item is used on the
  96. # actor. Once purified, the cursed equipment will still be on the actor, still
  97. # provide stat bonuses, but can be finally unequipped. Note that actors only
  98. # become cursed when the player equips the item. If the item is equipped via
  99. # event, it will not be cursed. You can also force curse a slot by using the
  100. # following event script: $game_actors[1].set_cursed_slot(0)
  101. #
  102. # <purify item>
  103. # NOTE: This is for usable items only. This will completely uncurse the target
  104. # ally and any cursed equipment previously on the before-cursed ally can now be
  105. # unequipped. Cursed equipment stat bonuses still remain. For those who would
  106. # like to event script purification, it's $game_actors[1].purify_curses
  107. #
  108. #===============================================================================
  109. #
  110. # Compatibility
  111. # - Works With: KGC's EquipExtension, ExtendedEquipScene
  112. # - Alias: Game_Battler: states, stats=, item_effect, item_test
  113. # - Alias: Game_Actor: base_stats, HECO, level_up, level_down, traits
  114. # - Alias: Game_Actor: change_equip
  115. # - Alias: Game_Interpreter: command_121
  116. # - Alias: Scene_Equip: update, update_equip_selection, update_item_selection
  117. #
  118. #===============================================================================
  119.  
  120. $imported = {} if $imported == nil
  121. $imported["ExtraEquipmentOptions"] = true
  122.  
  123. module YE
  124. module EQUIP
  125.  
  126. # Set this option to true if you want unequippable items to be purged
  127. # each time after a change in levels, stats, or switches.
  128. PURGE_UNEQUIPPABLE_ITEMS = true
  129.  
  130. # This determines whether or not equipment will purge in battle. I highly
  131. # recommend that you don't enable this.
  132. ALLOW_PURGE_IN_BATTLE = false
  133.  
  134. # This pops up a window to alert the player that a cursed item has been
  135. # equipped on the actor. Also, you may adjust other settings here, too.
  136. CURSED_WINDOW = true
  137. CURSED_SOUND = RPG::SE.new("Down", 80, 150)
  138. CURSED_WIDTH = 360
  139. CURSED_WIN_Y = 180
  140. CURSED_MESSAGE = "%s equips a cursed item!"
  141.  
  142. end # EQUIP
  143. end # YE
  144.  
  145. #===============================================================================
  146. # Editting anything past this point may potentially result in causing computer
  147. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  148. # Therefore, edit at your own risk.
  149. #===============================================================================
  150.  
  151. module YE
  152. module REGEXP
  153. module EQUIP
  154.  
  155. if $imported["LimitBreak"]
  156. HECOLIMIT = KGC::LimitBreak::ACTOR_PARAMETER_LIMIT
  157. else
  158. HECOLIMIT = 999
  159. end
  160. BONUS_PARAM = /^<(?:BONUS|bonus)[ ]*(.*)[ ]([\+\-]\d+)>/i
  161. BONUS_PARAMP = /^<(?:BONUS|bonus)[ ]*(.*)[ ]([\+\-]\d+)([%%])>/i
  162.  
  163. REQUIRE_MORE = /^<(?:REQUIRE_MORE|require more)[ ]*(.*)[ ](\d+)>/i
  164. REQUIRE_LESS = /^<(?:REQUIRE_LESS|require less)[ ]*(.*)[ ](\d+)>/i
  165. REQUIRE_SWITCH = /^<(?:REQUIRE_SWITCH|require switch)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  166.  
  167. AUTO_STATE = /<(?:AUTO_STATE|auto state|autostate)[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  168.  
  169. AUTO_BATTLE = /^<(?:TRAIT|trait|bonus trait)[ ](?:AUTO_BATTLE|auto battle)>/i
  170. SUPER_GUARD = /^<(?:TRAIT|trait|bonus trait)[ ](?:SUPER_GUARD|super guard)>/i
  171. ITEM_BOOST = /^<(?:TRAIT|trait|bonus trait)[ ](?:PHARMACOLOGY|item boost)>/i
  172. FAST_ATTACK = /^<(?:TRAIT|trait|bonus trait)[ ](?:FAST_ATTACK|fast attack)>/i
  173. DUAL_ATTACK = /^<(?:TRAIT|trait|bonus trait)[ ](?:DUAL_ATTACK|dual attack)>/i
  174. PREVENT_CRI = /^<(?:TRAIT|trait|bonus trait)[ ](?:PREVENT_CRI|prevent cri)>/i
  175. HALF_MP_COST = /^<(?:TRAIT|trait|bonus trait)[ ](?:HALF_MP_COST|half mp cost)>/i
  176. DOUBLE_EXP = /^<(?:TRAIT|trait|bonus trait)[ ](?:DOUBLE_EXP|double exp)>/i
  177. AUTO_HP_REC = /^<(?:TRAIT|trait|bonus trait)[ ](?:AUTO_HP_REC|auto_hp_rec)>/i
  178.  
  179. CURSED_ITEM = /^<(?:CURSED_ITEM|cursed item|cursed)>/i
  180. PURIFY_ITEM = /^<(?:PURIFY_ITEM|purify item|purify)>/i
  181.  
  182. end
  183. end
  184. end
  185.  
  186. #===============================================================================
  187. # RPG::BaseItem
  188. #===============================================================================
  189.  
  190. class RPG::BaseItem
  191.  
  192. #--------------------------------------------------------------------------
  193. # Yanfly_Cache_BaseItem_EEO
  194. #--------------------------------------------------------------------------
  195. def yanfly_cache_baseitem_eeo
  196. @requirements = false
  197. @bonus_param = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0,
  198. :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0 }
  199. @bonus_paramp = { :maxhp => 100, :maxmp => 100, :atk => 100, :def => 100,
  200. :spi => 100, :agi => 100, :hit => 100, :eva => 100, :cri => 100, :odds => 100 }
  201. @require_more = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0,
  202. :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0, :level => 0, :switch => false }
  203. @require_less = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0,
  204. :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0, :level => 0, :switch => false }
  205. @bonus_trait = []; @require_switch = []; @auto_state = []; @cursed = false
  206. @purify = false
  207.  
  208. self.note.split(/[\r\n]+/).each { |line|
  209. case line
  210. when YE::REGEXP::EQUIP::BONUS_PARAM
  211. case $1.to_s
  212. when "maxhp","MAXHP"; @bonus_param[:maxhp] += $2.to_i
  213. when "maxmp","MAXMP"; @bonus_param[:maxmp] += $2.to_i
  214. when "atk","ATK"; @bonus_param[:atk] += $2.to_i
  215. when "def","DEF"; @bonus_param[:def] += $2.to_i
  216. when "spi","SPI"; @bonus_param[:spi] += $2.to_i
  217. when "agi","AGI"; @bonus_param[:agi] += $2.to_i
  218. when "hit","HIT"; @bonus_param[:hit] += $2.to_i
  219. when "eva","EVA"; @bonus_param[:eva] += $2.to_i
  220. when "cri","CRI"; @bonus_param[:cri] += $2.to_i
  221. when "odds","ODDS"; @bonus_param[:odds] += $2.to_i
  222. end
  223. when YE::REGEXP::EQUIP::BONUS_PARAMP
  224. case $1.to_s
  225. when "maxhp","MAXHP"; @bonus_paramp[:maxhp] += $2.to_i
  226. when "maxmp","MAXMP"; @bonus_paramp[:maxmp] += $2.to_i
  227. when "atk","ATK"; @bonus_paramp[:atk] += $2.to_i
  228. when "def","DEF"; @bonus_paramp[:def] += $2.to_i
  229. when "spi","SPI"; @bonus_paramp[:spi] += $2.to_i
  230. when "agi","AGI"; @bonus_paramp[:agi] += $2.to_i
  231. when "hit","HIT"; @bonus_paramp[:hit] += $2.to_i
  232. when "eva","EVA"; @bonus_paramp[:eva] += $2.to_i
  233. when "cri","CRI"; @bonus_paramp[:cri] += $2.to_i
  234. when "odds","ODDS"; @bonus_paramp[:odds] += $2.to_i
  235. end
  236.  
  237. when YE::REGEXP::EQUIP::AUTO_BATTLE
  238. @bonus_trait.push("auto battle")
  239. when YE::REGEXP::EQUIP::SUPER_GUARD
  240. @bonus_trait.push("super guard")
  241. when YE::REGEXP::EQUIP::ITEM_BOOST
  242. @bonus_trait.push("item boost")
  243. when YE::REGEXP::EQUIP::FAST_ATTACK
  244. @bonus_trait.push("fast attack")
  245. when YE::REGEXP::EQUIP::DUAL_ATTACK
  246. @bonus_trait.push("dual attack")
  247. when YE::REGEXP::EQUIP::PREVENT_CRI
  248. @bonus_trait.push("prevent cri")
  249. when YE::REGEXP::EQUIP::HALF_MP_COST
  250. @bonus_trait.push("half mp cost")
  251. when YE::REGEXP::EQUIP::DOUBLE_EXP
  252. @bonus_trait.push("double exp")
  253. when YE::REGEXP::EQUIP::AUTO_HP_REC
  254. @bonus_trait.push("auto hp rec")
  255.  
  256. when YE::REGEXP::EQUIP::REQUIRE_MORE
  257. @requirements = true
  258. @require_more[:switch] = true
  259. case $1.to_s
  260. when "level","LEVEL"; @require_more[:level] = $2.to_i
  261. when "maxhp","MAXHP"; @require_more[:maxhp] = $2.to_i
  262. when "maxmp","MAXMP"; @require_more[:maxmp] = $2.to_i
  263. when "atk","ATK"; @require_more[:atk] = $2.to_i
  264. when "def","DEF"; @require_more[:def] = $2.to_i
  265. when "spi","SPI"; @require_more[:spi] = $2.to_i
  266. when "agi","AGI"; @require_more[:agi] = $2.to_i
  267. when "hit","HIT"; @require_more[:hit] = $2.to_i
  268. when "eva","EVA"; @require_more[:eva] = $2.to_i
  269. when "cri","CRI"; @require_more[:cri] = $2.to_i
  270. when "odds","ODDS"; @require_more[:odds] = $2.to_i
  271. end
  272. when YE::REGEXP::EQUIP::REQUIRE_LESS
  273. @requirements = true
  274. @require_less[:switch] = true
  275. case $1.to_s
  276. when "level","LEVEL"; @require_less[:level] = $2.to_i
  277. when "maxhp","MAXHP"; @require_less[:maxhp] = $2.to_i
  278. when "maxmp","MAXMP"; @require_less[:maxmp] = $2.to_i
  279. when "atk","ATK"; @require_less[:atk] = $2.to_i
  280. when "def","DEF"; @require_less[:def] = $2.to_i
  281. when "spi","SPI"; @require_less[:spi] = $2.to_i
  282. when "agi","AGI"; @require_less[:agi] = $2.to_i
  283. when "hit","HIT"; @require_less[:hit] = $2.to_i
  284. when "eva","EVA"; @require_less[:eva] = $2.to_i
  285. when "cri","CRI"; @require_less[:cri] = $2.to_i
  286. when "odds","ODDS"; @require_less[:odds] = $2.to_i
  287. end
  288. when YE::REGEXP::EQUIP::REQUIRE_SWITCH
  289. $1.scan(/\d+/).each { |num|
  290. if num.to_i > 0
  291. @require_switch.push(num.to_i)
  292. end }
  293. when YE::REGEXP::EQUIP::AUTO_STATE
  294. $1.scan(/\d+/).each { |num|
  295. if num.to_i > 0
  296. @auto_state.push(num.to_i)
  297. end }
  298. when YE::REGEXP::EQUIP::CURSED_ITEM
  299. @cursed = true
  300. when YE::REGEXP::EQUIP::PURIFY_ITEM
  301. @purify = true
  302. end
  303. }
  304. end
  305.  
  306. #--------------------------------------------------------------------------
  307. # Definitions
  308. #--------------------------------------------------------------------------
  309. def bonus_param
  310. yanfly_cache_baseitem_eeo if @bonus_param == nil
  311. return @bonus_param
  312. end
  313. def bonus_paramp
  314. yanfly_cache_baseitem_eeo if @bonus_paramp == nil
  315. return @bonus_paramp
  316. end
  317. def bonus_trait
  318. yanfly_cache_baseitem_eeo if @bonus_trait == nil
  319. return @bonus_trait
  320. end
  321. def requirements
  322. yanfly_cache_baseitem_eeo if @requirements == nil
  323. return @requirements
  324. end
  325. def require_more
  326. yanfly_cache_baseitem_eeo if @require_more == nil
  327. return @require_more
  328. end
  329. def require_less
  330. yanfly_cache_baseitem_eeo if @require_less == nil
  331. return @require_less
  332. end
  333. def require_switch
  334. yanfly_cache_baseitem_eeo if @require_switch == nil
  335. return @require_switch
  336. end
  337. def auto_state
  338. yanfly_cache_baseitem_eeo if @auto_state == nil
  339. return @auto_state
  340. end
  341. def cursed
  342. yanfly_cache_baseitem_eeo if @cursed == nil
  343. return @cursed
  344. end
  345. def purify
  346. yanfly_cache_baseitem_eeo if @purify == nil
  347. return @purify
  348. end
  349.  
  350. end # RPG::BaseItem
  351.  
  352. #===============================================================================
  353. # Game Battler
  354. #===============================================================================
  355.  
  356. class Game_Battler
  357.  
  358. #--------------------------------------------------------------------------
  359. # alias states
  360. #--------------------------------------------------------------------------
  361. alias states_eeo states unless $@
  362. def states
  363. result = states_eeo
  364. if self.actor?
  365. for state_id in self.equipment_auto_states
  366. unless result.include?($data_states[state_id])
  367. result.push($data_states[state_id])
  368. end
  369. end
  370. end
  371. result.sort! { |a, b| b.priority <=> a.priority }
  372. return result
  373. end
  374.  
  375. #--------------------------------------------------------------------------
  376. # alias remove_state
  377. #--------------------------------------------------------------------------
  378. alias remove_state_eeo remove_state unless $@
  379. def remove_state(state_id)
  380. return if self.actor? and self.equipment_auto_states.include?(state_id)
  381. remove_state_eeo(state_id)
  382. end
  383.  
  384. #--------------------------------------------------------------------------
  385. # overwrite state?
  386. #--------------------------------------------------------------------------
  387. def state?(state_id)
  388. return states.include?($data_states[state_id])
  389. end
  390.  
  391. #--------------------------------------------------------------------------
  392. # alias maxhp=
  393. #--------------------------------------------------------------------------
  394. alias maxhpset_eeo maxhp= unless $@
  395. def maxhp=(newvalue)
  396. maxhpset_eeo(newvalue)
  397. self.purge_unequippables if self.actor?
  398. end
  399.  
  400. #--------------------------------------------------------------------------
  401. # alias maxmp=
  402. #--------------------------------------------------------------------------
  403. alias maxmpset_eeo maxmp= unless $@
  404. def maxmp=(newvalue)
  405. maxmpset_eeo(newvalue)
  406. self.purge_unequippables if self.actor?
  407. end
  408.  
  409. #--------------------------------------------------------------------------
  410. # alias atk=
  411. #--------------------------------------------------------------------------
  412. alias atkset_eeo atk= unless $@
  413. def atk=(newvalue)
  414. atkset_eeo(newvalue)
  415. self.purge_unequippables if self.actor?
  416. end
  417.  
  418. #--------------------------------------------------------------------------
  419. # alias def=
  420. #--------------------------------------------------------------------------
  421. alias defset_eeo def= unless $@
  422. def def=(newvalue)
  423. defset_eeo(newvalue)
  424. self.purge_unequippables if self.actor?
  425. end
  426.  
  427. #--------------------------------------------------------------------------
  428. # alias spi=
  429. #--------------------------------------------------------------------------
  430. alias spiset_eeo spi= unless $@
  431. def spi=(newvalue)
  432. spiset_eeo(newvalue)
  433. self.purge_unequippables if self.actor?
  434. end
  435.  
  436. #--------------------------------------------------------------------------
  437. # alias agi=
  438. #--------------------------------------------------------------------------
  439. alias agiset_eeo agi= unless $@
  440. def agi=(newvalue)
  441. agiset_eeo(newvalue)
  442. self.purge_unequippables if self.actor?
  443. end
  444.  
  445. #--------------------------------------------------------------------------
  446. # alias item_effect
  447. #--------------------------------------------------------------------------
  448. alias item_effect_eeo item_effect unless $@
  449. def item_effect(user, item)
  450. clear_action_results
  451. if item.purify and self.actor?
  452. self.purify_curses
  453. end
  454. item_effect_eeo(user, item)
  455. end
  456.  
  457. #--------------------------------------------------------------------------
  458. # alias item_test
  459. #--------------------------------------------------------------------------
  460. alias item_test_eeo item_test unless $@
  461. def item_test(user, item)
  462. return true if item.purify and self.actor?
  463. return item_test_eeo(user, item)
  464. end
  465.  
  466. end
  467.  
  468. #===============================================================================
  469. # Game Actor
  470. #===============================================================================
  471.  
  472. class Game_Actor < Game_Battler
  473.  
  474. #--------------------------------------------------------------------------
  475. # alias base maxhp
  476. #--------------------------------------------------------------------------
  477. alias base_maxhp_eeo base_maxhp unless $@
  478. def base_maxhp
  479. n = base_maxhp_eeo
  480. equips.compact.each { |item|
  481. n += item.bonus_param[:maxhp]
  482. n *= item.bonus_paramp[:maxhp] / 100.0
  483. }
  484. return Integer(n)
  485. end
  486.  
  487. #--------------------------------------------------------------------------
  488. # alias base maxmp
  489. #--------------------------------------------------------------------------
  490. alias base_maxmp_eeo base_maxmp unless $@
  491. def base_maxmp
  492. n = base_maxmp_eeo
  493. equips.compact.each { |item|
  494. n += item.bonus_param[:maxmp]
  495. n *= item.bonus_paramp[:maxmp] / 100.0
  496. }
  497. return Integer(n)
  498. end
  499.  
  500. #--------------------------------------------------------------------------
  501. # alias base atk
  502. #--------------------------------------------------------------------------
  503. alias base_atk_eeo base_atk unless $@
  504. def base_atk
  505. n = base_atk_eeo
  506. equips.compact.each { |item|
  507. n += item.bonus_param[:atk]
  508. n *= item.bonus_paramp[:atk] / 100.0
  509. }
  510. return Integer(n)
  511. end
  512.  
  513. #--------------------------------------------------------------------------
  514. # alias base def
  515. #--------------------------------------------------------------------------
  516. alias base_def_eeo base_def unless $@
  517. def base_def
  518. n = base_def_eeo
  519. equips.compact.each { |item|
  520. n += item.bonus_param[:def]
  521. n *= item.bonus_paramp[:def] / 100.0
  522. }
  523. return Integer(n)
  524. end
  525.  
  526. #--------------------------------------------------------------------------
  527. # alias base spi
  528. #--------------------------------------------------------------------------
  529. alias base_spi_eeo base_spi unless $@
  530. def base_spi
  531. n = base_spi_eeo
  532. equips.compact.each { |item|
  533. n += item.bonus_param[:spi]
  534. n *= item.bonus_paramp[:spi] / 100.0
  535. }
  536. return Integer(n)
  537. end
  538.  
  539. #--------------------------------------------------------------------------
  540. # alias base agi
  541. #--------------------------------------------------------------------------
  542. alias base_agi_eeo base_agi unless $@
  543. def base_agi
  544. n = base_agi_eeo
  545. equips.compact.each { |item|
  546. n += item.bonus_param[:agi]
  547. n *= item.bonus_paramp[:agi] / 100.0
  548. }
  549. return Integer(n)
  550. end
  551.  
  552. #--------------------------------------------------------------------------
  553. # alias hit
  554. #--------------------------------------------------------------------------
  555. alias hit_eeo hit unless $@
  556. def hit
  557. n = hit_eeo
  558. equips.compact.each { |item|
  559. n += item.bonus_param[:hit]
  560. n *= item.bonus_paramp[:hit] / 100.0
  561. }
  562. limit = YE::REGEXP::EQUIP::HECOLIMIT
  563. n = [[Integer(n), 0].max, limit].min
  564. return n
  565. end
  566.  
  567. #--------------------------------------------------------------------------
  568. # alias eva
  569. #--------------------------------------------------------------------------
  570. alias eva_eeo eva unless $@
  571. def eva
  572. n = eva_eeo
  573. equips.compact.each { |item|
  574. n += item.bonus_param[:eva]
  575. n *= item.bonus_paramp[:eva] / 100.0
  576. }
  577. limit = YE::REGEXP::EQUIP::HECOLIMIT
  578. n = [[Integer(n), 0].max, limit].min
  579. return n
  580. end
  581.  
  582. #--------------------------------------------------------------------------
  583. # alias cri
  584. #--------------------------------------------------------------------------
  585. alias cri_eeo cri unless $@
  586. def cri
  587. n = cri_eeo
  588. equips.compact.each { |item|
  589. n += item.bonus_param[:cri]
  590. n *= item.bonus_paramp[:cri] / 100.0
  591. }
  592. limit = YE::REGEXP::EQUIP::HECOLIMIT
  593. n = [[Integer(n), 0].max, limit].min
  594. return n
  595. end
  596.  
  597. #--------------------------------------------------------------------------
  598. # alias odds
  599. #--------------------------------------------------------------------------
  600. alias odds_eeo odds unless $@
  601. def odds
  602. n = odds_eeo
  603. equips.compact.each { |item|
  604. n += item.bonus_param[:odds]
  605. n *= item.bonus_paramp[:odds] / 100.0
  606. }
  607. limit = YE::REGEXP::EQUIP::HECOLIMIT
  608. n = [[Integer(n), 0].max, limit].min
  609. return n
  610. end
  611.  
  612. #--------------------------------------------------------------------------
  613. # alias level_up
  614. #--------------------------------------------------------------------------
  615. alias level_up_eeo level_up unless $@
  616. def level_up
  617. level_up_eeo
  618. purge_unequippables
  619. end
  620.  
  621. #--------------------------------------------------------------------------
  622. # alias level_down
  623. #--------------------------------------------------------------------------
  624. alias level_down_eeo level_down unless $@
  625. def level_down
  626. level_down_eeo
  627. purge_unequippables
  628. end
  629.  
  630. #--------------------------------------------------------------------------
  631. # alias auto_battle
  632. #--------------------------------------------------------------------------
  633. alias auto_battle_eeo auto_battle unless $@
  634. def auto_battle
  635. for item in equips.compact
  636. return true if item.bonus_trait.include?("auto battle")
  637. end
  638. return auto_battle_eeo
  639. end
  640.  
  641. #--------------------------------------------------------------------------
  642. # alias super_guard
  643. #--------------------------------------------------------------------------
  644. alias super_guard_eeo super_guard unless $@
  645. def super_guard
  646. for item in equips.compact
  647. return true if item.bonus_trait.include?("super guard")
  648. end
  649. return super_guard_eeo
  650. end
  651.  
  652. #--------------------------------------------------------------------------
  653. # alias pharmacology
  654. #--------------------------------------------------------------------------
  655. alias pharmacology_eeo pharmacology unless $@
  656. def pharmacology
  657. for item in equips.compact
  658. return true if item.bonus_trait.include?("item boost")
  659. end
  660. return pharmacology_eeo
  661. end
  662.  
  663. #--------------------------------------------------------------------------
  664. # alias fast_attack
  665. #--------------------------------------------------------------------------
  666. alias fast_attack_eeo fast_attack unless $@
  667. def fast_attack
  668. for item in equips.compact
  669. return true if item.bonus_trait.include?("fast attack")
  670. end
  671. return fast_attack_eeo
  672. end
  673.  
  674. #--------------------------------------------------------------------------
  675. # alias dual_attack
  676. #--------------------------------------------------------------------------
  677. alias dual_attack_eeo dual_attack unless $@
  678. def dual_attack
  679. for item in equips.compact
  680. return true if item.bonus_trait.include?("dual attack")
  681. end
  682. return dual_attack_eeo
  683. end
  684.  
  685. #--------------------------------------------------------------------------
  686. # alias prevent_critical
  687. #--------------------------------------------------------------------------
  688. alias prevent_critical_eeo prevent_critical unless $@
  689. def prevent_critical
  690. for item in equips.compact
  691. return true if item.bonus_trait.include?("prevent cri")
  692. end
  693. return prevent_critical_eeo
  694. end
  695.  
  696. #--------------------------------------------------------------------------
  697. # alias half_mp_cost
  698. #--------------------------------------------------------------------------
  699. alias half_mp_cost_eeo half_mp_cost unless $@
  700. def half_mp_cost
  701. for item in equips.compact
  702. return true if item.bonus_trait.include?("half mp cost")
  703. end
  704. return half_mp_cost_eeo
  705. end
  706.  
  707. #--------------------------------------------------------------------------
  708. # alias double_exp_gain
  709. #--------------------------------------------------------------------------
  710. alias double_exp_gain_eeo double_exp_gain unless $@
  711. def double_exp_gain
  712. for item in equips.compact
  713. return true if item.bonus_trait.include?("double exp")
  714. end
  715. return double_exp_gain_eeo
  716. end
  717.  
  718. #--------------------------------------------------------------------------
  719. # alias auto_hp_recover
  720. #--------------------------------------------------------------------------
  721. alias auto_hp_recover_eeo auto_hp_recover unless $@
  722. def auto_hp_recover
  723. for item in equips.compact
  724. return true if item.bonus_trait.include?("auto hp rec")
  725. end
  726. return auto_hp_recover_eeo
  727. end
  728.  
  729. #--------------------------------------------------------------------------
  730. # alias equippable?
  731. #--------------------------------------------------------------------------
  732. alias equippable_eeo equippable? unless $@
  733. def equippable?(item)
  734. if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
  735. return false unless meet_requirements(item)
  736. end
  737. return equippable_eeo(item)
  738. end
  739.  
  740. #--------------------------------------------------------------------------
  741. # meet_requirements
  742. #--------------------------------------------------------------------------
  743. def meet_requirements(item)
  744. return true unless item.requirements
  745. for switch_id in item.require_switch
  746. return false unless $game_switches[switch_id]
  747. end
  748. if item.require_more[:switch] = true
  749. return false if self.level <= item.require_more[:level]
  750. return false if self.maxhp <= item.require_more[:maxhp]
  751. return false if self.maxmp <= item.require_more[:maxmp]
  752. return false if self.atk <= item.require_more[:atk]
  753. return false if self.def <= item.require_more[:def]
  754. return false if self.spi <= item.require_more[:spi]
  755. return false if self.agi <= item.require_more[:agi]
  756. return false if self.hit <= item.require_more[:hit]
  757. return false if self.eva <= item.require_more[:eva]
  758. return false if self.odds <= item.require_more[:odds]
  759. end
  760. #---
  761. if item.require_less[:switch] = true
  762. return false if self.level >= item.require_less[:level] and
  763. item.require_less[:level] != 0
  764. return false if self.maxhp >= item.require_less[:maxhp] and
  765. item.require_less[:maxhp] != 0
  766. return false if self.maxmp >= item.require_less[:maxmp] and
  767. item.require_less[:maxmp] != 0
  768. return false if self.atk >= item.require_less[:atk] and
  769. item.require_less[:atk] != 0
  770. return false if self.def >= item.require_less[:def] and
  771. item.require_less[:def] != 0
  772. return false if self.spi >= item.require_less[:spi] and
  773. item.require_less[:spi] != 0
  774. return false if self.agi >= item.require_less[:agi] and
  775. item.require_less[:agi] != 0
  776. return false if self.hit >= item.require_less[:hit] and
  777. item.require_less[:hit] != 0
  778. return false if self.eva >= item.require_less[:eva] and
  779. item.require_less[:eva] != 0
  780. return false if self.cri >= item.require_less[:cri] and
  781. item.require_less[:cri] != 0
  782. return false if self.odds >= item.require_less[:odds] and
  783. item.require_less[:odds] != 0
  784. end
  785. #---
  786. return true
  787. end
  788.  
  789. #--------------------------------------------------------------------------
  790. # purge_unequippables
  791. #--------------------------------------------------------------------------
  792. def purge_unequippables(test = false)
  793. return unless YE::EQUIP::PURGE_UNEQUIPPABLE_ITEMS
  794. return if $game_temp.in_battle and !YE::EQUIP::ALLOW_PURGE_IN_BATTLE
  795. @purge_on = true
  796. for i in 0..4
  797. change_equip(i, nil, test) unless equippable?(equips[i])
  798. end
  799. if $imported["EquipExtension"]
  800. return if extra_armor_number == 0
  801. for i in 5..armor_number
  802. change_equip(i, nil, test) unless equippable?(equips[i])
  803. end
  804. end
  805. @purge_on = nil
  806. end
  807.  
  808. #--------------------------------------------------------------------------
  809. # alias change_equip
  810. #--------------------------------------------------------------------------
  811. alias change_equip_eeo change_equip unless $@
  812. def change_equip(equip_type, item, test = false)
  813. change_equip_eeo(equip_type, item, test)
  814. if $imported["ExtendedEquipScene"] or $imported["SceneEquipReDux"]
  815. purge_unequippables(test) if @purge_on != true and !test
  816. else
  817. purge_unequippables(test) if @purge_on != true and !test
  818. end
  819. end
  820.  
  821. #--------------------------------------------------------------------------
  822. # equipment_auto_states
  823. #--------------------------------------------------------------------------
  824. def equipment_auto_states
  825. result = []
  826. if $game_temp.in_battle
  827. for item in equips.compact
  828. for state_id in item.auto_state
  829. result.push(state_id)
  830. end
  831. end
  832. else
  833. for item in equips.compact
  834. for state_id in item.auto_state
  835. result.push(state_id) unless $data_states[state_id].battle_only
  836. end
  837. end
  838. end
  839. return result.uniq
  840. end
  841.  
  842. #--------------------------------------------------------------------------
  843. # cursed_slot
  844. #--------------------------------------------------------------------------
  845. def cursed_slot?(slot)
  846. @cursed_slot = {} if @cursed_slot == nil
  847. @cursed_slot[slot] = false if @cursed_slot[slot] == nil
  848. return @cursed_slot[slot]
  849. end
  850.  
  851. #--------------------------------------------------------------------------
  852. # set_cursed_slot
  853. #--------------------------------------------------------------------------
  854. def set_cursed_slot(slot, curse = true)
  855. @cursed_slot = {} if @cursed_slot == nil
  856. @cursed_slot[slot] = curse
  857. end
  858.  
  859. #--------------------------------------------------------------------------
  860. # purify_curses
  861. #--------------------------------------------------------------------------
  862. def purify_curses
  863. @cursed_slot = {}
  864. end
  865.  
  866. end # Game_Actor
  867.  
  868. #===============================================================================
  869. # Scene_Equip
  870. #===============================================================================
  871.  
  872. class Scene_Equip < Scene_Base
  873.  
  874. #--------------------------------------------------------------------------
  875. # alias update
  876. #--------------------------------------------------------------------------
  877. alias update_equip_eeo update unless $@
  878. def update
  879. if @cursed_window != nil
  880. update_cursed_window
  881. else
  882. update_equip_eeo
  883. end
  884. end
  885.  
  886. #--------------------------------------------------------------------------
  887. # alias update_equip_selection
  888. #--------------------------------------------------------------------------
  889. alias update_equip_selection_eeo update_equip_selection unless $@
  890. def update_equip_selection
  891. if Input.trigger?(Input::C) and cursed_slot?
  892. Sound.play_buzzer
  893. return
  894. elsif Input.trigger?(Input::A) and cursed_slot?
  895. Sound.play_buzzer
  896. return
  897. end
  898. update_equip_selection_eeo
  899. end
  900.  
  901. #--------------------------------------------------------------------------
  902. # alias update_item_selection
  903. #--------------------------------------------------------------------------
  904. alias update_item_selection_eeo update_item_selection unless $@
  905. def update_item_selection
  906. if Input.trigger?(Input::C)
  907. if @item_window.item != nil and @item_window.item.cursed
  908. @actor.set_cursed_slot(@equip_window.index)
  909. create_cursed_window
  910. end
  911. end
  912. update_item_selection_eeo
  913. end
  914.  
  915. #--------------------------------------------------------------------------
  916. # update_cursed_window
  917. #--------------------------------------------------------------------------
  918. def update_cursed_window
  919. if Input.trigger?(Input::C) or Input.trigger?(Input::B)
  920. @cursed_window.dispose
  921. @cursed_window = nil
  922. end
  923. end
  924.  
  925. #--------------------------------------------------------------------------
  926. # cursed_slot?
  927. #--------------------------------------------------------------------------
  928. def cursed_slot?
  929. if @equip_window.item == nil
  930. @actor.set_cursed_slot(@equip_window.index, false)
  931. end
  932. if @actor.cursed_slot?(@equip_window.index)
  933. if @equip_window.item.cursed
  934. return true
  935. else
  936. @actor.set_cursed_slot(@equip_window.index, false)
  937. end
  938. end
  939. return false
  940. end
  941.  
  942. #--------------------------------------------------------------------------
  943. # create_cursed_window
  944. #--------------------------------------------------------------------------
  945. def create_cursed_window
  946. return unless YE::EQUIP::CURSED_WINDOW
  947. dx = (544 - YE::EQUIP::CURSED_WIDTH) / 2
  948. dy = YE::EQUIP::CURSED_WIN_Y
  949. dw = YE::EQUIP::CURSED_WIDTH
  950. text = sprintf(YE::EQUIP::CURSED_MESSAGE, @actor.name)
  951. @cursed_window = Window_Base.new(dx, dy, dw, 56)
  952. @cursed_window.back_opacity = 255
  953. @cursed_window.contents.draw_text(4, 0, dw-40, 24, text, 1)
  954. YE::EQUIP::CURSED_SOUND.play if YE::EQUIP::CURSED_SOUND != nil
  955. end
  956.  
  957. end # Scene_Equip
  958.  
  959. #===============================================================================
  960. #
  961. # END OF FILE
  962. #
  963. #===============================================================================
Add Comment
Please, Sign In to add comment