Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # DSI Card Fusion
- # -- Last Updated: 2017.11.25
- # -- Author: dsiver144
- # -- Level: Normal
- # -- Requires: n/a
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["DSI-CardFusion"] = true
- #==============================================================================
- # + Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2017.11.25 - Finish first version.
- #==============================================================================
- # + Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼Materials but above ▼Main. Remember to save.
- #==============================================================================
- module DSIVER144
- module CARD_FUSION
- SELECTED_ICON = 3849
- SUCCESS_ANIME = 530
- FAIL_ANIME = 531
- DISABLE_SWITCH = 10 # Turn this switch on will disable fusion mode in battle
- TRANSFORM_TIME = 12 # Playaround with this when you change the fusion
- # animation.
- COMBINATIONS = {} # Don't delete this
- NEW_DISCOVERY_BGM = ["Field3",70,100]
- SELECT_SE = ["CursorFF7",70,100]
- DESELECT_SE = ["Cancel (FF7)",70,100]
- TOGGLE_SE = ["Miss",70,100]
- COMBINATIONS[1] = {}
- COMBINATIONS[1][:mode] = :right_order
- COMBINATIONS[1][:cards] = [17,18,19]
- COMBINATIONS[1][:card_get] = 20
- COMBINATIONS[2] = {}
- COMBINATIONS[2][:mode] = :any_order
- COMBINATIONS[2][:cards] = [28,28,28,28,28]
- COMBINATIONS[2][:card_get] = 18
- #------------------------------------------------------------------------
- CARD_POS = {}
- CARD_POS[3] = [[60,240],[230,240],[400,240]]
- CARD_POS[4] = [[30,240],[160,240],[290,240],[420,240]]
- CARD_POS[5] = [[15,240],[120,240],[225,240],[330,240],[435,240]]
- #------------------------------------------------------------------------
- # * new method: check
- #------------------------------------------------------------------------
- def self.check(card_ids)
- COMBINATIONS.each_pair do |index,item|
- if item[:mode] == :right_order
- if card_ids == item[:cards]
- if !$game_system.fusion_discovered.include?(index)
- $new_combination = true
- $game_system.fusion_discovered << index
- end
- return item[:card_get]
- end
- else
- if card_ids.sort == item[:cards].sort
- if !$game_system.fusion_discovered.include?(index)
- $new_combination = true
- $game_system.fusion_discovered << index
- end
- return item[:card_get]
- end
- end
- end
- return nil
- end
- end # CARD_FUSION
- end # DSIVER144
- class Scene_Battle
- include DSIVER144::CARD_FUSION
- #--------------------------------------------------------------------------
- # * Start Turn
- #--------------------------------------------------------------------------
- alias_method(:dsi_card_fusion_turn_start, :turn_start)
- def turn_start
- @fusion_enable = true
- dsi_card_fusion_turn_start
- end
- #--------------------------------------------------------------------------
- # Create Skill Window with card help window instead of normal help window (overwrite)
- #--------------------------------------------------------------------------
- def create_skill_window
- @fusion_mode = :none
- @skill_window = Window_BattleSkill.new(@cardhelp_window, @info_viewport)
- @skill_window.set_handler(:ok, method(:on_skill_ok))
- @skill_window.set_handler(:cancel, method(:on_skill_cancel))
- wy = @skill_window.height + @skill_window.y
- @fusion_indicator = Window_Base.new(0,wy,@skill_window.width,46)
- @fusion_indicator.draw_text_ex(0,0,"\\i[1609] Card Fusion")
- @fusion_indicator.hide
- @skill_window.indicator_window = @fusion_indicator
- @fusion_window = Window_FusionBattleSkill.new(@cardhelp_window, @info_viewport)
- @fusion_window.hide
- @fusion_window.deactivate
- @fusion_enable = true
- @fusion_window.indicator_window = @fusion_indicator
- @fusion_window.off_method = method(:turn_off_fusion_mode)
- @fusion_window.complete_method = method(:fusion_complete)
- @fusion_window.confirm_method = method(:fusion_comfirmation)
- #------------------------------------------------------------------------
- @fusion_text = Window_Base.new(0,0,150,46)
- cw = @fusion_text.contents_width; ch = @fusion_text.contents_height
- @fusion_text.draw_text(0,0, cw, ch,"Fuse Chosen Cards?",1)
- @fusion_command_window = Window_FusionCofirm.new(0,0)
- @fusion_command_window.set_handler(:ok, method(:on_fusion_ok))
- @fusion_command_window.set_handler(:cancel, method(:on_fusion_cancel))
- @fusion_text.x = 0.5*(Graphics.width - @fusion_text.width)
- @fusion_command_window.x = @fusion_text.x
- @fusion_text.y = 0.5*(Graphics.height - @fusion_text.height - @fusion_command_window.height) - 50
- @fusion_command_window.y = @fusion_text.y + @fusion_text.height
- @fusion_command_window.hide.deactivate
- @fusion_text.hide
- @new_discover_text = Window_Base.new(0,0,450,46)
- cw = @new_discover_text.contents_width; ch = @new_discover_text.contents_height
- @new_discover_text.draw_text(0,0, cw, ch,"You've just discovered a new fusion combination!",1)
- @new_discover_text.openness = 0
- @new_discover_text.x = 0.5*(Graphics.width - @new_discover_text.width)
- @new_discover_text.y = 0.5*(Graphics.height - @new_discover_text.height) - 50
- @new_discover_text.close
- #------------------------------------------------------------------------
- @fusion_card_sprites = {}
- for i in 1..5
- @fusion_card_sprites[i] = Sprite_Base.new(@viewport)
- end
- @fusion_card_sprites.values.each do |sprite|
- sprite.z = 500
- sprite.zoom_x = 0.5
- sprite.zoom_y = 0.5
- sprite.visible = false
- end
- end
- #--------------------------------------------------------------------------
- # * new method: update_indicator
- #--------------------------------------------------------------------------
- def update_indicator
- if BattleManager.actor
- if BattleManager.actor.tp > 0 && @fusion_enable && !$game_switches[DISABLE_SWITCH]
- @fusion_mode = :enable
- else
- @fusion_mode = :disable
- end
- end
- if @fusion_window.active
- @fusion_mode = :now
- end
- if @fusion_mode == :enable
- @fusion_indicator.change_color(@fusion_indicator.normal_color,true)
- elsif @fusion_mode == :disable
- @fusion_indicator.change_color(@fusion_indicator.normal_color,false)
- elsif @fusion_mode == :now
- @fusion_indicator.change_color(@fusion_indicator.crisis_color,true)
- end
- p @fusion_mode
- @fusion_indicator.contents.clear
- @fusion_indicator.draw_icon(1609, 0, 0)
- @fusion_indicator.draw_text(25,0,150,30,"Card Fusion")
- end
- #--------------------------------------------------------------------------
- # * [Skill] Command
- #--------------------------------------------------------------------------
- def command_skill
- @skill_window.actor = BattleManager.actor
- @skill_window.stype_id = @actor_command_window.current_ext
- @skill_window.refresh
- @skill_window.show.activate
- @fusion_indicator.show
- update_indicator
- end
- #--------------------------------------------------------------------------
- # * Skill [Cancel]
- #--------------------------------------------------------------------------
- def on_skill_cancel
- @skill_window.hide
- @actor_command_window.activate
- @fusion_indicator.hide
- end
- #--------------------------------------------------------------------------
- # * new method: turn_off_fusion_mode
- #--------------------------------------------------------------------------
- def turn_off_fusion_mode
- @fusion_window.hide.deactivate
- @skill_window.actor = BattleManager.actor
- @skill_window.show.activate
- @skill_window.refresh
- update_indicator
- end
- #--------------------------------------------------------------------------
- # * new method: fusion_complete
- #--------------------------------------------------------------------------
- def fusion_complete
- @fusion_enable = false
- end
- #--------------------------------------------------------------------------
- # * new method: confirm_on
- #--------------------------------------------------------------------------
- def confirm_on
- @fusion_command_window.show.activate
- @fusion_text.show
- end
- #--------------------------------------------------------------------------
- # * new method: show_card_images
- #--------------------------------------------------------------------------
- def show_card_images
- pos = CARD_POS[@selected_cards.size]
- @selected_cards.each_with_index do |id,index|
- @fusion_card_sprites[index + 1].visible = true
- @fusion_card_sprites[index + 1].bitmap = Cache.picture("Card#{id}")
- offset_x = @fusion_card_sprites[index + 1].bitmap.width * 0.5
- offset_y = @fusion_card_sprites[index + 1].bitmap.height * 0.5
- @fusion_card_sprites[index + 1].ox = offset_x
- @fusion_card_sprites[index + 1].oy = offset_y
- @fusion_card_sprites[index + 1].x = pos[index][0] + offset_x * 0.5
- @fusion_card_sprites[index + 1].y = pos[index][1] + offset_y * 0.5
- end
- if @selected_cards.size == 3
- @center_x = @fusion_card_sprites[2].x
- end
- if @selected_cards.size == 4
- @center_x = 0.5*(Graphics.width - @fusion_card_sprites[1].bitmap.width) + 90
- end
- if @selected_cards.size == 5
- @center_x = @fusion_card_sprites[3].x
- end
- end
- #--------------------------------------------------------------------------
- # * new method: hide_card_images
- #--------------------------------------------------------------------------
- def hide_card_images
- while @fusion_card_sprites[1].opacity > 0
- @fusion_card_sprites.values.each do |sprite|
- sprite.opacity -= 5
- end
- Graphics.update
- end
- @fusion_card_sprites.values.each do |sprite|
- sprite.visible = false
- sprite.opacity = 255
- sprite.bitmap = nil
- end
- 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: card_animation3
- #--------------------------------------------------------------------------
- def card_animation3(success)
- spr1 = @fusion_card_sprites[1]
- spr2 = @fusion_card_sprites[2]
- spr3 = @fusion_card_sprites[3]
- colorWhite = Color.new(255,255,255)
- spr1.flash(colorWhite,20)
- spr2.flash(colorWhite,20)
- spr3.flash(colorWhite,20)
- while spr1.zoom_x < 0.6
- spr1.zoom_x += 0.01
- spr1.zoom_y += 0.01
- spr2.zoom_x += 0.01
- spr2.zoom_y += 0.01
- spr3.zoom_x += 0.01
- spr3.zoom_y += 0.01
- spr1.update
- spr2.update
- spr3.update
- Graphics.update
- end
- while spr1.zoom_x > 0.5
- spr1.zoom_x -= 0.01
- spr1.zoom_y -= 0.01
- spr2.zoom_x -= 0.01
- spr2.zoom_y -= 0.01
- spr3.zoom_x -= 0.01
- spr3.zoom_y -= 0.01
- spr1.update
- spr2.update
- spr3.update
- Graphics.update
- end
- s1 = spr1.x
- s3 = spr3.x
- d1 = @center_x - s1
- d3 = @center_x - s3
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- spr1.x = easeInOutQuad(current_time, s1, d1, 45)
- spr3.x = easeInOutQuad(current_time, s3, d3, 45)
- Graphics.update
- end
- if success
- spr1.visible = false
- spr2.visible = false
- spr3.start_animation($data_animations[SUCCESS_ANIME])
- t = 0
- while spr3.animation?
- spr3.update
- Graphics.update
- t += 1
- if t == TRANSFORM_TIME
- spr3.bitmap = Cache.picture("Card#{@new_card_id}")
- end
- end
- else
- spr3.start_animation($data_animations[FAIL_ANIME])
- while spr3.animation?
- spr3.update
- Graphics.update
- end
- 20.times do
- Graphics.update
- end
- s12 = spr1.x
- s32 = spr3.x
- d1 = s1 - s12
- d3 = s3 - s32
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- spr1.x = easeInOutQuad(current_time, s12, d1, 45)
- spr3.x = easeInOutQuad(current_time, s32, d3, 45)
- Graphics.update
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: card_animation4
- #--------------------------------------------------------------------------
- def card_animation4(success)
- spr1 = @fusion_card_sprites[1]
- spr2 = @fusion_card_sprites[2]
- spr3 = @fusion_card_sprites[3]
- spr4 = @fusion_card_sprites[4]
- colorWhite = Color.new(255,255,255)
- spr1.flash(colorWhite,20)
- spr2.flash(colorWhite,20)
- spr3.flash(colorWhite,20)
- spr4.flash(colorWhite,20)
- while spr1.zoom_x < 0.6
- spr1.zoom_x += 0.01
- spr1.zoom_y += 0.01
- spr2.zoom_x += 0.01
- spr2.zoom_y += 0.01
- spr3.zoom_x += 0.01
- spr3.zoom_y += 0.01
- spr4.zoom_x += 0.01
- spr4.zoom_y += 0.01
- spr1.update
- spr2.update
- spr3.update
- spr4.update
- Graphics.update
- end
- while spr1.zoom_x > 0.5
- spr1.zoom_x -= 0.01
- spr1.zoom_y -= 0.01
- spr2.zoom_x -= 0.01
- spr2.zoom_y -= 0.01
- spr3.zoom_x -= 0.01
- spr3.zoom_y -= 0.01
- spr4.zoom_x -= 0.01
- spr4.zoom_y -= 0.01
- spr1.update
- spr2.update
- spr3.update
- spr4.update
- Graphics.update
- end
- s1 = spr1.x
- s2 = spr2.x
- s3 = spr3.x
- s4 = spr4.x
- d1 = @center_x - s1
- d2 = @center_x - s2
- d3 = @center_x - s3
- d4 = @center_x - s4
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- spr1.x = easeInOutQuad(current_time, s1, d1, 45)
- spr2.x = easeInOutQuad(current_time, s2, d2, 45)
- spr3.x = easeInOutQuad(current_time, s3, d3, 45)
- spr4.x = easeInOutQuad(current_time, s4, d4, 45)
- Graphics.update
- end
- if success
- spr1.visible = false
- spr2.visible = false
- spr3.visible = false
- spr4.start_animation($data_animations[530])
- t = 0
- while spr4.animation?
- spr4.update
- Graphics.update
- t += 1
- if t == TRANSFORM_TIME
- spr4.bitmap = Cache.picture("Card#{@new_card_id}")
- end
- end
- else
- spr4.start_animation($data_animations[531])
- while spr4.animation?
- spr4.update
- Graphics.update
- end
- 20.times do
- Graphics.update
- end
- s12 = spr1.x
- s22 = spr2.x
- s32 = spr3.x
- s42 = spr4.x
- d1 = s1 - s12
- d2 = s2 - s22
- d3 = s3 - s32
- d4 = s4 - s42
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- spr1.x = easeInOutQuad(current_time, s12, d1, 45)
- spr2.x = easeInOutQuad(current_time, s22, d2, 45)
- spr3.x = easeInOutQuad(current_time, s32, d3, 45)
- spr4.x = easeInOutQuad(current_time, s42, d4, 45)
- Graphics.update
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: card_animation5
- #--------------------------------------------------------------------------
- def card_animation5(success)
- spr1 = @fusion_card_sprites[1]
- spr2 = @fusion_card_sprites[2]
- spr3 = @fusion_card_sprites[3]
- spr4 = @fusion_card_sprites[4]
- spr5 = @fusion_card_sprites[5]
- colorWhite = Color.new(255,255,255)
- spr1.flash(colorWhite,20)
- spr2.flash(colorWhite,20)
- spr3.flash(colorWhite,20)
- spr4.flash(colorWhite,20)
- spr5.flash(colorWhite,20)
- while spr1.zoom_x < 0.6
- spr1.zoom_x += 0.01
- spr1.zoom_y += 0.01
- spr2.zoom_x += 0.01
- spr2.zoom_y += 0.01
- spr3.zoom_x += 0.01
- spr3.zoom_y += 0.01
- spr4.zoom_x += 0.01
- spr4.zoom_y += 0.01
- spr5.zoom_x += 0.01
- spr5.zoom_y += 0.01
- spr1.update
- spr2.update
- spr3.update
- spr4.update
- spr5.update
- Graphics.update
- end
- while spr1.zoom_x > 0.5
- spr1.zoom_x -= 0.01
- spr1.zoom_y -= 0.01
- spr2.zoom_x -= 0.01
- spr2.zoom_y -= 0.01
- spr3.zoom_x -= 0.01
- spr3.zoom_y -= 0.01
- spr4.zoom_x -= 0.01
- spr4.zoom_y -= 0.01
- spr5.zoom_x -= 0.01
- spr5.zoom_y -= 0.01
- spr1.update
- spr2.update
- spr3.update
- spr4.update
- spr5.update
- Graphics.update
- end
- s1 = spr1.x
- s2 = spr2.x
- s3 = spr3.x
- s4 = spr4.x
- s5 = spr5.x
- d1 = @center_x - s1
- d2 = @center_x - s2
- d3 = @center_x - s3
- d4 = @center_x - s4
- d5 = @center_x - s5
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- spr1.x = easeInOutQuad(current_time, s1, d1, 45)
- spr2.x = easeInOutQuad(current_time, s2, d2, 45)
- spr3.x = easeInOutQuad(current_time, s3, d3, 45)
- spr4.x = easeInOutQuad(current_time, s4, d4, 45)
- spr5.x = easeInOutQuad(current_time, s5, d5, 45)
- Graphics.update
- end
- if success
- spr1.visible = false
- spr2.visible = false
- spr3.visible = false
- spr4.visible = false
- spr5.start_animation($data_animations[530])
- t = 0
- while spr5.animation?
- spr5.update
- Graphics.update
- t += 1
- if t == TRANSFORM_TIME
- spr5.bitmap = Cache.picture("Card#{@new_card_id}")
- end
- end
- else
- spr5.start_animation($data_animations[531])
- while spr5.animation?
- spr5.update
- Graphics.update
- end
- 20.times do
- Graphics.update
- end
- s12 = spr1.x
- s22 = spr2.x
- s32 = spr3.x
- s42 = spr4.x
- s52 = spr5.x
- d1 = s1 - s12
- d2 = s2 - s22
- d3 = s3 - s32
- d4 = s4 - s42
- d5 = s5 - s52
- start_time = Graphics.frame_count
- while (current_time = Graphics.frame_count - start_time) < 45
- spr1.x = easeInOutQuad(current_time, s12, d1, 45)
- spr2.x = easeInOutQuad(current_time, s22, d2, 45)
- spr3.x = easeInOutQuad(current_time, s32, d3, 45)
- spr4.x = easeInOutQuad(current_time, s42, d4, 45)
- spr5.x = easeInOutQuad(current_time, s52, d5, 45)
- Graphics.update
- end
- end
- end
- #--------------------------------------------------------------------------
- # * new method: fusion_comfirmation
- #--------------------------------------------------------------------------
- def fusion_comfirmation(card_ids, new_card_id)
- @fusion_window.deactivate
- @selected_cards = card_ids.clone
- @new_card_id = new_card_id
- confirm_on
- show_card_images
- end
- #--------------------------------------------------------------------------
- # * new method: on_fusion_ok
- #--------------------------------------------------------------------------
- def on_fusion_ok
- @fusion_command_window.hide.deactivate
- @fusion_text.hide
- success = (@new_card_id != nil)
- BattleManager.actor.tp -= 1
- @status_window.refresh
- card_animation3(success) if @selected_cards.size == 3
- card_animation4(success) if @selected_cards.size == 4
- card_animation5(success) if @selected_cards.size == 5
- if success
- @fusion_window.fusion_complete
- if $new_combination
- $game_system.save_bgm
- RPG::BGM.new(*NEW_DISCOVERY_BGM).play
- @new_discover_text.open
- while @new_discover_text.openness < 255
- @new_discover_text.update
- Graphics.update
- end
- while true
- Graphics.update
- Input.update
- break if Input.trigger?(:C) || Input.trigger?(:B)
- end
- $game_system.replay_bgm
- @new_discover_text.close
- end
- else
- @fusion_window.fusion_fail
- end
- hide_card_images
- @selected_cards.clear
- @selected_cards = nil
- @new_card_id = nil
- $new_combination = nil
- update_indicator
- end
- #--------------------------------------------------------------------------
- # * new method: on_fusion_cancel
- #--------------------------------------------------------------------------
- def on_fusion_cancel
- @selected_cards.clear
- @selected_cards = nil
- @new_card_id = nil
- hide_card_images
- @fusion_command_window.hide.deactivate
- @fusion_text.hide
- @fusion_window.activate
- end
- #--------------------------------------------------------------------------
- # * new method: update
- #--------------------------------------------------------------------------
- alias_method(:dsi_scene_battle_scene_update, :update)
- def update
- dsi_scene_battle_scene_update
- if @skill_window.active
- if Input.trigger?(:X)
- if @fusion_enable && BattleManager.actor.tp > 0 && !$game_switches[DISABLE_SWITCH]
- RPG::SE.new(*TOGGLE_SE).play
- @skill_window.hide.deactivate
- @fusion_window.actor = BattleManager.actor
- @fusion_window.stype_id = @actor_command_window.current_ext
- @fusion_window.refresh
- @fusion_window.show.activate
- update_indicator
- else
- Sound.play_buzzer
- end
- end
- end
- end
- end
- class Window_FusionCofirm < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * overwrite method: col_max
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * overwrite method: window_width
- #--------------------------------------------------------------------------
- def window_width
- return 150
- end
- #--------------------------------------------------------------------------
- # * overwrite method: make_command_list
- #--------------------------------------------------------------------------
- def make_command_list
- add_command("Fuse", :ok)
- add_command("Cancel", :cancel)
- end
- end
- class Window_FusionBattleSkill < Window_BattleSkill
- include DSIVER144::CARD_FUSION
- attr_accessor :off_method
- attr_accessor :complete_method
- attr_accessor :confirm_method
- #-----------------------------------------------------------------------------
- # changes the BattleSkillList Window layout (overwrite)
- #-----------------------------------------------------------------------------
- def initialize(help_window, info_viewport)
- super(help_window, info_viewport)
- @selected = []
- @selected_indexes = []
- end
- #-----------------------------------------------------------------------------
- # changes the max. amount of collums to 1 (overwrite)
- #-----------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # Make skill list from @hand, not from @skills (overwrite)
- #--------------------------------------------------------------------------
- def make_item_list
- if @actor
- @actor.sort_cards(:hand)
- @data = @actor.hand
- end
- end
- #--------------------------------------------------------------------------
- # * Display Skill in Active State?
- #--------------------------------------------------------------------------
- def enable?(item)
- super && @actor.turn_actions[:actions] != 0
- end
- #-------------------------------------------------------------------------
- # * new method: add_card
- #-------------------------------------------------------------------------
- def add_card(card_id)
- @selected << card_id
- @selected_indexes << index
- end
- #-------------------------------------------------------------------------
- # * new method: empty?
- #-------------------------------------------------------------------------
- def empty?
- @selected_indexes.size == 0
- end
- #-------------------------------------------------------------------------
- # * new method: empty!
- #-------------------------------------------------------------------------
- def empty!
- @selected_indexes.clear
- @selected.clear
- refresh
- end
- #-------------------------------------------------------------------------
- # * overwrite method: fusion_fail
- #-------------------------------------------------------------------------
- def fusion_fail
- empty!
- @off_method.call()
- @complete_method.call()
- @new_card_id = nil
- end
- #-------------------------------------------------------------------------
- # * overwrite method: fusion_complete
- #-------------------------------------------------------------------------
- def fusion_complete
- return unless @new_card_id
- @selected.each {|id| @actor.card_to_grave?(id)}
- @actor.hand.push($data_skills[@new_card_id])
- select(0)
- empty! # Empty selected cards array
- @off_method.call()
- @complete_method.call()
- @new_card_id = nil
- end
- #-------------------------------------------------------------------------
- # * overwrite method: update
- #-------------------------------------------------------------------------
- def update
- super
- return unless self.active
- if Input.trigger?(:C)
- if @selected_indexes.include?(index)
- Sound.play_buzzer
- return
- end
- RPG::SE.new(*SELECT_SE).play
- return if @selected.size >= 5
- add_card(item.id) if item
- refresh
- end
- if Input.trigger?(:X)
- if @selected.size >= 3
- @new_card_id = DSIVER144::CARD_FUSION.check(@selected)
- @confirm_method.call(@selected,@new_card_id)
- end
- end
- if Input.trigger?(:B)
- if !empty?
- RPG::SE.new(*DESELECT_SE).play
- empty!
- else
- RPG::SE.new(*TOGGLE_SE).play
- @off_method.call() if @off_method
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item Name [overwrite]
- # enabled : Enabled flag. When false, draw semi-transparently.
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true, selected = false, width = 172)
- return unless item
- draw_icon(item.icon_index, x, y, enabled)
- if selected
- draw_icon(SELECTED_ICON, x, y, enabled)
- end
- change_color(normal_color, enabled)
- draw_text(x + 24, y, width, line_height, item.name)
- end
- #--------------------------------------------------------------------------
- # * Draw Item [overwrite]
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- if @selected_indexes.include?(index)
- draw_item_name(item, rect.x, rect.y, enable?(item), true)
- else
- draw_item_name(item, rect.x, rect.y, enable?(item), false)
- end
- end
- end
- end
- class Window_BattleSkill < Window_SkillList
- attr_accessor :indicator_window
- #-----------------------------------------------------------------------------
- # changes the BattleSkillList Window layout (overwrite)
- #-----------------------------------------------------------------------------
- def initialize(help_window, info_viewport)
- y = 0
- super(0, 0, (Graphics.width - 210) * 0.7, info_viewport.rect.y - 46)
- self.visible = false
- @help_window = help_window
- @info_viewport = info_viewport
- end
- alias_method(:dsiver144_show, :show)
- def show
- if @indicator_window
- @indicator_window.show
- end
- dsiver144_show
- end
- alias_method(:dsiver144_hide, :hide)
- def hide
- if @indicator_window
- @indicator_window.hide
- end
- dsiver144_hide
- end
- end
- class Game_System
- attr_accessor :fusion_discovered
- alias_method(:dsi_fusion_discovered_init, :initialize)
- def initialize
- @fusion_discovered = []
- dsi_fusion_discovered_init
- end
- end # Game_System
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement