Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # DSI Equipment Set v1.2
- # -- Last Updated: 2017.05.18
- # -- Author: dsiver144
- # -- Level: Normal
- # -- Requires: n/a
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["DSI-EquipSet"] = true
- #==============================================================================
- # + Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2017.05.15 - Finish first version.
- # 2017.05.16 - Fix some bugs.
- # 2017.05.18 - Fix more bugs.
- #==============================================================================
- # + Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below �� Materials/�f�� but above �� Main. Remember to save.
- #==============================================================================
- module DSIVER144
- module Equipment_Set
- Equipments = {}
- #-------------------------------------------------------------------------
- Equipments[1] = {}
- Equipments[1][:name] = "Earth Mage Set"
- Equipments[1][:items] = ["w13","a12","a36","a1","a2"] # weapon 13, armor 12, armor 36, ...
- Equipments[1][:set] = []
- Equipments[1][:set][1] = {}
- Equipments[1][:set][1][:skill_id] = [[28,22]] # Replace 28 with 169
- # [[28,169],[29,169],[x,y],...] You can enhance more than 1 skill
- Equipments[1][:set][1][:info] = ["DMG + 1 when using Earth Mage card."]
- Equipments[1][:set][3] = {}
- Equipments[1][:set][3][:skill_id] = [[28,23]] # Place 28 with 170
- Equipments[1][:set][3][:info] = ["DMG + 2 when using Earth Mage card.", "20% chance to poison the chosen target when using X Skilllllll."]
- Equipments[1][:set][5] = {}
- Equipments[1][:set][5][:skill_id] = [[28,24]] # Place 28 with 171
- Equipments[1][:set][5][:info] = ["HP barrier is projected on the caster for 1 turn.","+5 HP restored. Cure certain status effects"]
- Equipments[2] = {}
- Equipments[2][:name] = "Grand Gaia Set"
- Equipments[2][:items] = ["w89","a521","a523","a522","a524"] # weapon 13, armor 12, armor 36, ...
- Equipments[2][:set] = []
- Equipments[2][:set][1] = {}
- Equipments[2][:set][1][:skill_id] = [[30,18]] # Replace 28 with 169
- Equipments[2][:set][1][:info] = ["Stalagmite Dmg +1."]
- Equipments[2][:set][3] = {}
- Equipments[2][:set][3][:skill_id] = [[29,19]] # Place 28 with 170
- Equipments[2][:set][3][:info] = ["Wood Hammer Dmg +2", "20% chance to stun enemies for 1 turn."]
- Equipments[2][:set][5] = {}
- Equipments[2][:set][5][:skill_id] = [[30,20]] # Place 28 with 171
- Equipments[2][:set][5][:info] = ["Stalagmite Dmg +3", "30% chance to Vanquish on hit", "Healing Effect Removed", "Mp cost +2."]
- #------------------------------------------------------------------------
- # * new method: convert_to_equipdata
- #------------------------------------------------------------------------
- def self.convert_to_equipdata(string_array)
- equip_data = []
- string_array.each do |str|
- if str =~ /w(\d+)/i
- equip_data
- end
- end
- end
- #------------------------------------------------------------------------
- # * new method: convert_equipdata_to_str
- #------------------------------------------------------------------------
- def self.convert_equipdata_to_str(equips)
- str_array = []
- equips.each do |equip|
- if equip.is_a?(RPG::Weapon)
- str_array << "w#{equip.id}"
- end
- if equip.is_a?(RPG::Armor)
- str_array << "a#{equip.id}"
- end
- end
- return str_array
- end
- #------------------------------------------------------------------------
- # * new method: check_for_set
- #------------------------------------------------------------------------
- def self.check_for_set(equips)
- $game_system.set_effect.clear
- Equipments.each_pair do |set_id, equip_set|
- a = convert_equipdata_to_str(equips).sort
- b = equip_set[:items].sort
- c = a - (a - b) # Get Same Equip
- if c.size == 0
- next
- end
- set_type = c.size
- if [2,4].include?(set_type)
- set_type -= 1
- end
- new_set = {}
- new_set[:set_id] = set_id
- new_set[:have_item] = c
- new_set[:have_noitem] = a - b
- [1,3,5].each do |set_index|
- break if set_type < set_index
- new_set[:skill_id] ||= []
- new_set[:skill_id] << equip_set[:set][set_index][:skill_id]
- end
- new_set[:skill_id].uniq!
- $game_system.set_effect << new_set
- end
- end
- end # Equipment_Set
- end # DSIVER144
- #==============================================================================
- # DataManager
- #==============================================================================
- module DataManager
- include DSIVER144::Equipment_Set
- #--------------------------------------------------------------------------
- # alias method: load_database
- #--------------------------------------------------------------------------
- class <<self; alias load_database_equipment_set load_database; end
- def self.load_database
- load_database_equipment_set
- init_equiment_set
- end
- #--------------------------------------------------------------------------
- # Load Notetag Rental Weapons
- #--------------------------------------------------------------------------
- def self.init_equiment_set
- Equipments.each_pair do |set_id, equipment_set|
- equipment_set[:items].each do |str|
- if str =~ /(w|a)(\d+)/i
- item = $1 == "w" ? $data_weapons[$2.to_i] : $data_armors[$2.to_i]
- next if item.nil?
- item.eqset_id = set_id
- p [item.name, set_id]
- end
- end
- end
- end
- end # DataManager
- class RPG::EquipItem
- attr_accessor :eqset_id
- end
- #=============================================================================
- # ** Game_System
- #=============================================================================
- class Game_System
- attr_accessor :set_effect
- alias_method(:dsi_equipment_set_effect_initialize, :initialize)
- #------------------------------------------------------------------------
- # * new method: initialize
- #------------------------------------------------------------------------
- def initialize
- @set_effect = []
- dsi_equipment_set_effect_initialize
- end
- end # Game_System
- #=============================================================================
- # ** Scene_Battle
- #=============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # Handles card costs
- #--------------------------------------------------------------------------
- def invoke_card_cost(effect_name)
- effect_array = PC27::CG::CARD_EFFECT[effect_name]
- if effect_array[0] == :draw
- card_effect_draw_cards(effect_array[1], effect_array[2], effect_array[3])
- new_skill_id = @skill.id
- $game_system.set_effect.each do |eq_set|
- if eq_set[:skill_id]
- eq_set[:skill_id].each do |replacer|
- replacer.each do |pair|
- if @skill.id == pair[0]
- new_skill_id = pair[1]
- end
- end
- end
- end
- end
- BattleManager.actor.input.set_skill(new_skill_id)
- BattleManager.actor.last_skill.object = @skill
- if !@skill.need_selection?
- @skill_window.hide
- next_command
- elsif @skill.for_opponent?
- select_enemy_selection
- else
- select_actor_selection
- end
- else
- $game_message.background = 1
- $game_message.position = 1
- $game_message.add(PC27::CG::CARD_EFF_TEXT)
- wait_for_message
- prepare_select_window(:cost, effect_array[0])
- @temp_effect_data = [] unless @temp_effect_data
- @temp_effect_data[0] = :cost
- process_select_cards(effect_name)
- end
- end
- #--------------------------------------------------------------------------
- # On Skill Ok checks for card costs
- #--------------------------------------------------------------------------
- alias pc27_cardgame_scene_battle_on_skill_ok on_skill_ok
- def on_skill_ok
- @skill = @skill_window.item
- BattleManager.actor.card_to_stack?(@skill.id)
- if @skill.cost
- invoke_card_cost(@skill.cost)
- @skill_window.hide
- else
- new_skill_id = @skill.id
- $game_system.set_effect.each do |eq_set|
- if eq_set[:skill_id]
- eq_set[:skill_id].each do |replacer|
- replacer.each do |pair|
- if @skill.id == pair[0]
- new_skill_id = pair[1]
- end
- end
- end
- end
- end
- BattleManager.actor.input.set_skill(new_skill_id)
- BattleManager.actor.last_skill.object = @skill
- if !@skill.need_selection?
- @skill_window.hide
- next_command
- elsif @skill.for_opponent?
- select_enemy_selection
- else
- select_actor_selection
- end
- end
- end
- end # Scene_Battle
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Change Equipment
- #--------------------------------------------------------------------------
- alias_method(:dsi_change_equipment_command_319, :command_319)
- def command_319
- dsi_change_equipment_command_319
- actor = $game_actors[@params[0]]
- DSIVER144::Equipment_Set.check_for_set(actor.equips)
- end
- end
- #==============================================================================
- # ** Scene_Equip
- #==============================================================================
- class Scene_Equip
- include DSIVER144::Equipment_Set
- alias_method(:dsi_equipment_set_info_window_creation, :start)
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- dsi_equipment_set_info_window_creation # Call original method
- create_equipment_set_info_window
- create_equipment_set_skill_info_window
- end
- #--------------------------------------------------------------------------
- # * Update All Windows
- #--------------------------------------------------------------------------
- alias_method(:dsi_equipment_set_update_all_windows, :update_all_windows)
- def update_all_windows
- return if @equipment_set_skill_info_window.visible
- dsi_equipment_set_update_all_windows
- end
- #-------------------------------------------------------------------------
- # * new method: easeInOutQuad
- #-------------------------------------------------------------------------
- def easeInOutQuad(t, b, c, d)
- t = t / (d/2.0)
- if (t < 1)
- return c/2*t*t + b
- end
- t -= 1
- return -c/2.0 * (t*(t-2) - 1) + b
- end
- #-------------------------------------------------------------------------
- # * new method: update
- #-------------------------------------------------------------------------
- alias_method(:dsi_update_equipment_set, :update)
- def update
- dsi_update_equipment_set
- if Input.trigger?(:X) && $game_system.set_effect.size > 0
- if @slot_window.item
- if @slot_window.item.eqset_id
- @equipment_set_skill_info_window.show_skill_info(@slot_window.item.eqset_id)
- @equipment_set_skill_info_window.visible = !@equipment_set_skill_info_window.visible
- @equipment_set_skill_info_window.update
- end
- end
- end
- if @equipment_set_skill_info_window.visible && Input.trigger?(:B)
- @equipment_set_skill_info_window.visible = false
- @equipment_set_skill_info_window.update
- end
- if @slot_window_index != @slot_window.index
- @slot_window_index = @slot_window.index
- if @slot_window.item && @slot_window.item.eqset_id
- @equipment_set_info_window.show_info(@slot_window.item.eqset_id)
- if @equipment_set_info_window.x > @equipment_info_x_ori
- show_set_info_window
- end
- else
- hide_set_info_window
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: create_equipment_set_info_window
- #--------------------------------------------------------------------------
- def create_equipment_set_skill_info_window
- ww = Graphics.width - 90
- wh = Graphics.height - 100
- wx = (Graphics.width - ww) * 0.5
- wy = (Graphics.height - wh) * 0.5
- @equipment_set_skill_info_window = Window_EquipmentSetSkillInfo.new(wx,wy,ww,wh)
- @equipment_set_skill_info_window.z = 200
- DSIVER144::Equipment_Set.check_for_set(@actor.equips)
- @equipment_set_skill_info_window.visible = false
- end
- #--------------------------------------------------------------------------
- # * new method: create_equipment_set_info_window
- #--------------------------------------------------------------------------
- def create_equipment_set_info_window
- wx = @slot_window.x + @slot_window.width
- wy = @command_window.y
- ww = Graphics.width - @slot_window.width
- wh = @slot_window.height + @command_window.height
- @equipment_set_info_window = Window_EquipmentSetInfo.new(wx,wy,ww,wh)
- @equipment_info_x_ori = @equipment_set_info_window.x
- @equipment_set_info_window.x = Graphics.width
- @slot_window_index = @slot_window.index
- DSIVER144::Equipment_Set.check_for_set(@actor.equips)
- end
- #--------------------------------------------------------------------------
- # * new method: show_set_info_window
- #--------------------------------------------------------------------------
- def show_set_info_window
- return if @equipment_set_info_window.x == @equipment_info_x_ori
- start_time = Graphics.frame_count
- start_x = Graphics.width
- change_x = @equipment_info_x_ori - start_x
- while (current_time = Graphics.frame_count - start_time) < 45
- @equipment_set_info_window.x = easeInOutQuad(current_time, start_x, change_x, 45)
- Graphics.update
- end
- @equipment_set_info_window.x = @equipment_info_x_ori
- end
- #--------------------------------------------------------------------------
- # * new method: hide_set_info_window
- #--------------------------------------------------------------------------
- def hide_set_info_window
- return if @equipment_set_info_window.x == Graphics.width
- start_time = Graphics.frame_count
- start_x = @equipment_info_x_ori
- change_x = Graphics.width - start_x
- while (current_time = Graphics.frame_count - start_time) < 45
- @equipment_set_info_window.x = easeInOutQuad(current_time, start_x, change_x, 45)
- Graphics.update
- end
- @equipment_set_info_window.x = Graphics.width
- end
- #--------------------------------------------------------------------------
- # * new method: check_for_equipment_set
- #--------------------------------------------------------------------------
- def check_for_equipment_set
- DSIVER144::Equipment_Set.check_for_set(@actor.equips)
- if $game_system.set_effect.size > 0
- @equipment_set_info_window.show
- if @slot_window.item
- if @slot_window.item.eqset_id
- @equipment_set_info_window.show_info(@slot_window.item.eqset_id)
- show_set_info_window
- else
- hide_set_info_window
- end
- else
- hide_set_info_window
- end
- else
- hide_set_info_window
- end
- end
- #--------------------------------------------------------------------------
- # * new method: command_clear
- #--------------------------------------------------------------------------
- alias_method(:dsi_command_clear_equipment_set, :command_clear)
- def command_clear
- dsi_command_clear_equipment_set # Call original method
- check_for_equipment_set
- end
- #--------------------------------------------------------------------------
- # * new method: on_item_ok
- #--------------------------------------------------------------------------
- alias_method(:dsi_on_item_ok_equipment_set, :on_item_ok)
- def on_item_ok
- dsi_on_item_ok_equipment_set # Call original method
- check_for_equipment_set
- end
- end # Scene_Equip
- #==============================================================================
- # ** Window_EquipmentSetSkillInfo
- #==============================================================================
- class Window_EquipmentSetSkillInfo < Window_Base
- include DSIVER144::Equipment_Set
- #-------------------------------------------------------------------------
- # * new method: show_skill_info
- #-------------------------------------------------------------------------
- def show_skill_info(set_id)
- contents.clear
- contents.turn_on_wordwraping
- x = 0; y = 0
- change_color(text_color(20))
- contents.font.size = 20
- draw_text(x,y,contents_width,line_height,"Equipment Set Effect",1)
- equip_set = Equipments[set_id]
- check_set = $game_system.set_effect.select {|set| set[:set_id] == set_id}[0]
- reset_font_settings
- y += 24
- info = ""
- [1,3,5].each do |set_type|
- change_color(text_color(11), true)
- enable_color = check_set[:have_item].size >= set_type ? 11 : 10
- txt_color = check_set[:have_item].size >= set_type ? 7 : 0
- info << "\\c[#{enable_color}][#{set_type}] Set Effect" + "\n"
- equip_set[:set][set_type][:info].each do |text|
- info << "\\c[#{txt_color}] + " + text + "\n"
- end
- end
- contents.draw_text_ex(x,y,info,false,18)
- end
- end # Window_EquipmentSetSkillInfo
- #==============================================================================
- # ** Window_EquipmentSetInfo
- #==============================================================================
- class Window_EquipmentSetInfo < Window_Base
- include DSIVER144::Equipment_Set
- attr_accessor :last_set_id
- #-------------------------------------------------------------------------
- # * new method: show_info
- #-------------------------------------------------------------------------
- def show_info(set_id)
- contents.clear
- equip_set = Equipments[set_id]
- check_set = $game_system.set_effect.select {|set| set[:set_id] == set_id}[0]
- x = 0; y = 0
- change_color(normal_color, true)
- draw_text(x,y,contents.width,line_height,equip_set[:name],1)
- y += 24;
- equip_set[:items].each do |str_data|
- if check_set[:have_item].include?(str_data)
- change_color(text_color(11), true)
- else
- change_color(normal_color, false)
- end
- if str_data =~ /(w|a)(\d+)/i
- name = $1 == "a" ? $data_armors[$2.to_i].name : $data_weapons[$2.to_i].name
- end
- draw_text(x,y,contents.width,line_height," - " + name)
- y += 16;
- end
- y += 16
- draw_text_ex(x,y,"Press [A] for more info.")
- @last_set_id = set_id
- end
- end # Window_EquipmentSetInfo
- #==============================================================================
- # ** Window_EquipCommand
- #------------------------------------------------------------------------------
- # This window is for selecting commands (change equipment/ultimate equipment
- # etc.) on the skill screen.
- #==============================================================================
- class Window_EquipCommand < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- @window_width
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::equip2, :equip)
- add_command(Vocab::clear, :clear)
- end
- end # Window_EquipCommand
- #===============================================================================
- # * END OF FILE
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement