Advertisement
dsiver144

DSI Equipment Set v1.25

May 18th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.03 KB | None | 0 0
  1. #==============================================================================
  2. # DSI Equipment Set v1.25
  3. # -- Last Updated: 2017.05.18
  4. # -- Author: dsiver144
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #==============================================================================
  8. $imported = {} if $imported.nil?
  9. $imported["DSI-EquipSet"] = true
  10. #==============================================================================
  11. # + Updates
  12. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  13. # 2017.05.15 - Finish first version.
  14. # 2017.05.16 - Fix some bugs.
  15. # 2017.05.18 - Fix more bugs.
  16. #==============================================================================
  17. # + Instructions
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # To install this script, open up your script editor and copy/paste this script
  20. # to an open slot below �� Materials/�f�� but above �� Main. Remember to save.
  21. #==============================================================================
  22. module DSIVER144
  23. module Equipment_Set
  24. Equipments = {}
  25. #-------------------------------------------------------------------------
  26. Equipments[1] = {}
  27. Equipments[1][:name] = "Earth Mage Set"
  28. Equipments[1][:items] = ["w13","a12","a36","a1","a2"] # weapon 13, armor 12, armor 36, ...
  29. Equipments[1][:set] = []
  30. Equipments[1][:set][1] = {}
  31. Equipments[1][:set][1][:skill_id] = [[28,22]] # Replace 28 with 169
  32. # [[28,169],[29,169],[x,y],...] You can enhance more than 1 skill
  33. Equipments[1][:set][1][:info] = ["DMG + 1 when using Earth Mage card."]
  34. Equipments[1][:set][3] = {}
  35. Equipments[1][:set][3][:skill_id] = [[28,23]] # Place 28 with 170
  36. Equipments[1][:set][3][:info] = ["DMG + 2 when using Earth Mage card.", "20% chance to poison the chosen target when using X Skilllllll."]
  37. Equipments[1][:set][5] = {}
  38. Equipments[1][:set][5][:skill_id] = [[28,24]] # Place 28 with 171
  39. Equipments[1][:set][5][:info] = ["HP barrier is projected on the caster for 1 turn.","+5 HP restored. Cure certain status effects"]
  40.  
  41. Equipments[2] = {}
  42. Equipments[2][:name] = "Grand Gaia Set"
  43. Equipments[2][:items] = ["w89","a521","a523","a522","a524"] # weapon 13, armor 12, armor 36, ...
  44. Equipments[2][:set] = []
  45. Equipments[2][:set][1] = {}
  46. Equipments[2][:set][1][:skill_id] = [[30,18]] # Replace 28 with 169
  47. Equipments[2][:set][1][:info] = ["Stalagmite Dmg +1."]
  48. Equipments[2][:set][3] = {}
  49. Equipments[2][:set][3][:skill_id] = [[29,19]] # Place 28 with 170
  50. Equipments[2][:set][3][:info] = ["Wood Hammer Dmg +2", "20% chance to stun enemies for 1 turn."]
  51. Equipments[2][:set][5] = {}
  52. Equipments[2][:set][5][:skill_id] = [[30,20]] # Place 28 with 171
  53. Equipments[2][:set][5][:info] = ["Stalagmite Dmg +3", "30% chance to Vanquish on hit", "Healing Effect Removed", "Mp cost +2."]
  54. #------------------------------------------------------------------------
  55. # * new method: convert_to_equipdata
  56. #------------------------------------------------------------------------
  57. def self.convert_to_equipdata(string_array)
  58. equip_data = []
  59. string_array.each do |str|
  60. if str =~ /w(\d+)/i
  61. equip_data
  62. end
  63. end
  64. end
  65. #------------------------------------------------------------------------
  66. # * new method: convert_equipdata_to_str
  67. #------------------------------------------------------------------------
  68. def self.convert_equipdata_to_str(equips)
  69. str_array = []
  70. equips.each do |equip|
  71. if equip.is_a?(RPG::Weapon)
  72. str_array << "w#{equip.id}"
  73. end
  74. if equip.is_a?(RPG::Armor)
  75. str_array << "a#{equip.id}"
  76. end
  77. end
  78. return str_array
  79. end
  80. #------------------------------------------------------------------------
  81. # * new method: check_for_set
  82. #------------------------------------------------------------------------
  83. def self.check_for_set(equips)
  84. $game_system.set_effect.clear
  85. Equipments.each_pair do |set_id, equip_set|
  86. a = convert_equipdata_to_str(equips).sort
  87. b = equip_set[:items].sort
  88. c = a - (a - b) # Get Same Equip
  89. if c.size == 0
  90. next
  91. end
  92. set_type = c.size
  93. if [2,4].include?(set_type)
  94. set_type -= 1
  95. end
  96. new_set = {}
  97. new_set[:set_id] = set_id
  98. new_set[:have_item] = c
  99. new_set[:have_noitem] = a - b
  100. [1,3,5].each do |set_index|
  101. break if set_type < set_index
  102. new_set[:skill_id] ||= []
  103. new_set[:skill_id] << equip_set[:set][set_index][:skill_id]
  104. end
  105. new_set[:skill_id].uniq!
  106. $game_system.set_effect << new_set
  107. end
  108. end
  109. end # Equipment_Set
  110. end # DSIVER144
  111. #==============================================================================
  112. # DataManager
  113. #==============================================================================
  114. module DataManager
  115. include DSIVER144::Equipment_Set
  116. #--------------------------------------------------------------------------
  117. # alias method: load_database
  118. #--------------------------------------------------------------------------
  119. class <<self; alias load_database_equipment_set load_database; end
  120. def self.load_database
  121. load_database_equipment_set
  122. init_equiment_set
  123. end
  124. #--------------------------------------------------------------------------
  125. # Load Notetag Rental Weapons
  126. #--------------------------------------------------------------------------
  127. def self.init_equiment_set
  128. Equipments.each_pair do |set_id, equipment_set|
  129. equipment_set[:items].each do |str|
  130. if str =~ /(w|a)(\d+)/i
  131. item = $1 == "w" ? $data_weapons[$2.to_i] : $data_armors[$2.to_i]
  132. next if item.nil?
  133. item.eqset_id = set_id
  134. end
  135. end
  136. end
  137. end
  138. end # DataManager
  139. class RPG::EquipItem
  140. attr_accessor :eqset_id
  141. end
  142. #=============================================================================
  143. # ** Game_System
  144. #=============================================================================
  145. class Game_System
  146. attr_accessor :set_effect
  147. alias_method(:dsi_equipment_set_effect_initialize, :initialize)
  148. #------------------------------------------------------------------------
  149. # * new method: initialize
  150. #------------------------------------------------------------------------
  151. def initialize
  152. @set_effect = []
  153. dsi_equipment_set_effect_initialize
  154. end
  155. end # Game_System
  156. #=============================================================================
  157. # ** Scene_Battle
  158. #=============================================================================
  159. class Scene_Battle
  160. #--------------------------------------------------------------------------
  161. # Handles card costs
  162. #--------------------------------------------------------------------------
  163. def invoke_card_cost(effect_name)
  164. effect_array = PC27::CG::CARD_EFFECT[effect_name]
  165. if effect_array[0] == :draw
  166. card_effect_draw_cards(effect_array[1], effect_array[2], effect_array[3])
  167. new_skill_id = @skill.id
  168. $game_system.set_effect.each do |eq_set|
  169. if eq_set[:skill_id]
  170. eq_set[:skill_id].each do |replacer|
  171. replacer.each do |pair|
  172. if @skill.id == pair[0]
  173. new_skill_id = pair[1]
  174. end
  175. end
  176. end
  177. end
  178. end
  179. BattleManager.actor.input.set_skill(new_skill_id)
  180. BattleManager.actor.last_skill.object = @skill
  181. if !@skill.need_selection?
  182. @skill_window.hide
  183. next_command
  184. elsif @skill.for_opponent?
  185. select_enemy_selection
  186. else
  187. select_actor_selection
  188. end
  189. else
  190. $game_message.background = 1
  191. $game_message.position = 1
  192. $game_message.add(PC27::CG::CARD_EFF_TEXT)
  193. wait_for_message
  194. prepare_select_window(:cost, effect_array[0])
  195. @temp_effect_data = [] unless @temp_effect_data
  196. @temp_effect_data[0] = :cost
  197. process_select_cards(effect_name)
  198. end
  199. end
  200. #--------------------------------------------------------------------------
  201. # On Skill Ok checks for card costs
  202. #--------------------------------------------------------------------------
  203. alias pc27_cardgame_scene_battle_on_skill_ok on_skill_ok
  204. def on_skill_ok
  205. @skill = @skill_window.item
  206. BattleManager.actor.card_to_stack?(@skill.id)
  207. if @skill.cost
  208. invoke_card_cost(@skill.cost)
  209. @skill_window.hide
  210. else
  211. new_skill_id = @skill.id
  212. $game_system.set_effect.each do |eq_set|
  213. if eq_set[:skill_id]
  214. eq_set[:skill_id].each do |replacer|
  215. replacer.each do |pair|
  216. if @skill.id == pair[0]
  217. new_skill_id = pair[1]
  218. end
  219. end
  220. end
  221. end
  222. end
  223. BattleManager.actor.input.set_skill(new_skill_id)
  224. BattleManager.actor.last_skill.object = @skill
  225. if !@skill.need_selection?
  226. @skill_window.hide
  227. next_command
  228. elsif @skill.for_opponent?
  229. select_enemy_selection
  230. else
  231. select_actor_selection
  232. end
  233. end
  234. end
  235. end # Scene_Battle
  236. class Game_Interpreter
  237. #--------------------------------------------------------------------------
  238. # * Change Equipment
  239. #--------------------------------------------------------------------------
  240. alias_method(:dsi_change_equipment_command_319, :command_319)
  241. def command_319
  242. dsi_change_equipment_command_319
  243. actor = $game_actors[@params[0]]
  244. DSIVER144::Equipment_Set.check_for_set(actor.equips)
  245. end
  246. end
  247. #==============================================================================
  248. # ** Scene_Equip
  249. #==============================================================================
  250. class Scene_Equip
  251. include DSIVER144::Equipment_Set
  252. alias_method(:dsi_equipment_set_info_window_creation, :start)
  253. #--------------------------------------------------------------------------
  254. # * Start Processing
  255. #--------------------------------------------------------------------------
  256. def start
  257. dsi_equipment_set_info_window_creation # Call original method
  258. create_equipment_set_info_window
  259. create_equipment_set_skill_info_window
  260. end
  261. #--------------------------------------------------------------------------
  262. # * Update All Windows
  263. #--------------------------------------------------------------------------
  264. alias_method(:dsi_equipment_set_update_all_windows, :update_all_windows)
  265. def update_all_windows
  266. return if @equipment_set_skill_info_window.visible
  267. dsi_equipment_set_update_all_windows
  268. end
  269. #-------------------------------------------------------------------------
  270. # * new method: easeInOutQuad
  271. #-------------------------------------------------------------------------
  272. def easeInOutQuad(t, b, c, d)
  273. t = t / (d/2.0)
  274. if (t < 1)
  275. return c/2*t*t + b
  276. end
  277. t -= 1
  278. return -c/2.0 * (t*(t-2) - 1) + b
  279. end
  280. #-------------------------------------------------------------------------
  281. # * new method: update
  282. #-------------------------------------------------------------------------
  283. alias_method(:dsi_update_equipment_set, :update)
  284. def update
  285. dsi_update_equipment_set
  286. if Input.trigger?(:X) && $game_system.set_effect.size > 0
  287. if @item_window.active
  288. if @item_window.item
  289. if @item_window.item.eqset_id
  290. @equipment_set_skill_info_window.show_skill_info(@item_window.item.eqset_id)
  291. @equipment_set_skill_info_window.visible = !@equipment_set_skill_info_window.visible
  292. @equipment_set_skill_info_window.update
  293. end
  294. end
  295. end
  296. if @slot_window.active
  297. if @slot_window.item
  298. if @slot_window.item.eqset_id
  299. @equipment_set_skill_info_window.show_skill_info(@slot_window.item.eqset_id)
  300. @equipment_set_skill_info_window.visible = !@equipment_set_skill_info_window.visible
  301. @equipment_set_skill_info_window.update
  302. end
  303. end
  304. end
  305. end
  306. if @equipment_set_skill_info_window.visible && Input.trigger?(:B)
  307. @equipment_set_skill_info_window.visible = false
  308. @equipment_set_skill_info_window.update
  309. end
  310. if @item_window.active
  311. if @item_window_index != @item_window.index
  312. @item_window_index = @item_window.index
  313. if @item_window.item && @item_window.item.eqset_id
  314. @equipment_set_info_window.show_info(@item_window.item.eqset_id)
  315. show_set_info_window
  316. else
  317. hide_set_info_window
  318. end
  319. end
  320. end
  321. if @slot_window.active
  322. if @slot_window_index != @slot_window.index
  323. @slot_window_index = @slot_window.index
  324. if @slot_window.item && @slot_window.item.eqset_id
  325. @equipment_set_info_window.show_info(@slot_window.item.eqset_id)
  326. show_set_info_window
  327. else
  328. hide_set_info_window
  329. end
  330. end
  331. end
  332. end
  333. #--------------------------------------------------------------------------
  334. # * new method: create_equipment_set_info_window
  335. #--------------------------------------------------------------------------
  336. def create_equipment_set_skill_info_window
  337. ww = Graphics.width - 90
  338. wh = Graphics.height - 100
  339. wx = (Graphics.width - ww) * 0.5
  340. wy = (Graphics.height - wh) * 0.5
  341. @equipment_set_skill_info_window = Window_EquipmentSetSkillInfo.new(wx,wy,ww,wh)
  342. @equipment_set_skill_info_window.z = 200
  343. DSIVER144::Equipment_Set.check_for_set(@actor.equips)
  344. @equipment_set_skill_info_window.visible = false
  345. end
  346. #--------------------------------------------------------------------------
  347. # * new method: create_equipment_set_info_window
  348. #--------------------------------------------------------------------------
  349. def create_equipment_set_info_window
  350. wx = @slot_window.x + @slot_window.width
  351. wy = @command_window.y
  352. ww = Graphics.width - @slot_window.width
  353. wh = @slot_window.height + @command_window.height
  354. @equipment_set_info_window = Window_EquipmentSetInfo.new(wx,wy,ww,wh)
  355. @equipment_info_x_ori = @equipment_set_info_window.x
  356. @equipment_set_info_window.x = Graphics.width
  357. @slot_window_index = @slot_window.index
  358. @item_window_index = @item_window.index
  359. @slide_animation = false
  360. DSIVER144::Equipment_Set.check_for_set(@actor.equips)
  361. end
  362. #--------------------------------------------------------------------------
  363. # * new method: show_set_info_window
  364. #--------------------------------------------------------------------------
  365. def show_set_info_window
  366. return if @equipment_set_info_window.x == @equipment_info_x_ori
  367. duration = 30
  368. start_time = Graphics.frame_count
  369. start_x = @equipment_set_info_window.x#Graphics.width
  370. change_x = @equipment_info_x_ori - start_x
  371. while (current_time = Graphics.frame_count - start_time) < duration
  372. @equipment_set_info_window.x = easeInOutQuad(current_time, start_x, change_x, duration)
  373. update_basic
  374. end
  375. end
  376. #--------------------------------------------------------------------------
  377. # * new method: hide_set_info_window
  378. #--------------------------------------------------------------------------
  379. def hide_set_info_window
  380. return if @equipment_set_info_window.x == Graphics.width
  381. duration = 30
  382. start_time = Graphics.frame_count
  383. start_x = @equipment_set_info_window.x
  384. change_x = Graphics.width - start_x
  385. while (current_time = Graphics.frame_count - start_time) < duration
  386. @equipment_set_info_window.x = easeInOutQuad(current_time, start_x, change_x, duration)
  387. update_basic
  388. end
  389. end
  390. #--------------------------------------------------------------------------
  391. # * new method: check_for_equipment_set
  392. #--------------------------------------------------------------------------
  393. def check_for_equipment_set
  394. DSIVER144::Equipment_Set.check_for_set(@actor.equips)
  395. if $game_system.set_effect.size > 0
  396. @equipment_set_info_window.show
  397. if @slot_window.item
  398. if @slot_window.item.eqset_id
  399. @equipment_set_info_window.show_info(@slot_window.item.eqset_id)
  400. show_set_info_window
  401. else
  402. hide_set_info_window
  403. end
  404. else
  405. hide_set_info_window
  406. end
  407. else
  408. hide_set_info_window
  409. end
  410. end
  411. #--------------------------------------------------------------------------
  412. # * new method: command_clear
  413. #--------------------------------------------------------------------------
  414. alias_method(:dsi_command_clear_equipment_set, :command_clear)
  415. def command_clear
  416. dsi_command_clear_equipment_set # Call original method
  417. check_for_equipment_set
  418. end
  419. #--------------------------------------------------------------------------
  420. # * new method: on_item_ok
  421. #--------------------------------------------------------------------------
  422. alias_method(:dsi_on_item_ok_equipment_set, :on_item_ok)
  423. def on_item_ok
  424. dsi_on_item_ok_equipment_set # Call original method
  425. check_for_equipment_set
  426. end
  427. end # Scene_Equip
  428. #==============================================================================
  429. # ** Window_EquipmentSetSkillInfo
  430. #==============================================================================
  431. class Window_EquipmentSetSkillInfo < Window_Base
  432. include DSIVER144::Equipment_Set
  433. #-------------------------------------------------------------------------
  434. # * new method: show_skill_info
  435. #-------------------------------------------------------------------------
  436. def show_skill_info(set_id)
  437. contents.clear
  438. contents.turn_on_wordwraping
  439. x = 0; y = 0
  440. change_color(text_color(20))
  441. contents.font.size = 20
  442. draw_text(x,y,contents_width,line_height,"Equipment Set Effect",1)
  443. equip_set = Equipments[set_id]
  444. check_set = $game_system.set_effect.select {|set| set[:set_id] == set_id}[0]
  445. reset_font_settings
  446. y += 24
  447. info = ""
  448. [1,3,5].each do |set_type|
  449. change_color(text_color(11), true)
  450. enable_color = check_set && check_set[:have_item].size >= set_type ? 11 : 10
  451. txt_color = check_set && check_set[:have_item].size >= set_type ? 7 : 0
  452. info << "\\c[#{enable_color}][#{set_type}] Set Effect" + "\n"
  453. equip_set[:set][set_type][:info].each do |text|
  454. info << "\\c[#{txt_color}] + " + text + "\n"
  455. end
  456. end
  457. contents.draw_text_ex(x,y,info,false,18)
  458. end
  459. end # Window_EquipmentSetSkillInfo
  460. #==============================================================================
  461. # ** Window_EquipmentSetInfo
  462. #==============================================================================
  463. class Window_EquipmentSetInfo < Window_Base
  464. include DSIVER144::Equipment_Set
  465. attr_accessor :last_set_id
  466. #-------------------------------------------------------------------------
  467. # * new method: show_info
  468. #-------------------------------------------------------------------------
  469. def show_info(set_id)
  470. contents.clear
  471. equip_set = Equipments[set_id]
  472. check_set = $game_system.set_effect.select {|set| set[:set_id] == set_id}[0]
  473. x = 0; y = 0
  474. change_color(normal_color, true)
  475. draw_text(x,y,contents.width,line_height,equip_set[:name],1)
  476. y += 24;
  477. equip_set[:items].each do |str_data|
  478. if check_set && check_set[:have_item].include?(str_data)
  479. change_color(text_color(11), true)
  480. else
  481. change_color(normal_color, false)
  482. end
  483. if str_data =~ /(w|a)(\d+)/i
  484. name = $1 == "a" ? $data_armors[$2.to_i].name : $data_weapons[$2.to_i].name
  485. end
  486. draw_text(x,y,contents.width,line_height," - " + name)
  487. y += 16;
  488. end
  489. y += 16
  490. draw_text_ex(x,y,"Press [A] for more info.")
  491. @last_set_id = set_id
  492. end
  493. end # Window_EquipmentSetInfo
  494. #==============================================================================
  495. # ** Window_EquipCommand
  496. #------------------------------------------------------------------------------
  497. # This window is for selecting commands (change equipment/ultimate equipment
  498. # etc.) on the skill screen.
  499. #==============================================================================
  500. class Window_EquipCommand < Window_HorzCommand
  501. #--------------------------------------------------------------------------
  502. # * Get Window Width
  503. #--------------------------------------------------------------------------
  504. def window_width
  505. @window_width
  506. end
  507. #--------------------------------------------------------------------------
  508. # * Get Digit Count
  509. #--------------------------------------------------------------------------
  510. def col_max
  511. return 2
  512. end
  513. #--------------------------------------------------------------------------
  514. # * Create Command List
  515. #--------------------------------------------------------------------------
  516. def make_command_list
  517. add_command(Vocab::equip2, :equip)
  518. add_command(Vocab::clear, :clear)
  519. end
  520. end # Window_EquipCommand
  521. #===============================================================================
  522. # * END OF FILE
  523. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement