#===================================
# module Fusion
#===================================
module Fusion
#--------------------------------------------------------------------
# Fusable_Items = [item.id, ...etc
#--------------------------------------------------------------------
Fusable_Items = [001, 002, 003, 004, 005, 006, 007]
#--------------------------------------------------------------------
# Mixables = { item.id => [items that can be mixed with the item.]
# (Two required in the brackets.
#--------------------------------------------------------------------
Mixables = {
1 => [1, 3, 4],
3 => [1, 4]
}
#--------------------------------------------------------------------
# Yield = { yield => [[first item, second item], [first item, second item], etc]
# Yield is the ID tag for when it is looked up in the recipe book.
# It is used for the order in the recipe book. Start at 0.
#--------------------------------------------------------------------
Yield = {
0 => [[1, 3], [1, 1]],
1 => [[1, 4]]
}
#-------------------------------------------------------------------
# Yield_To_Item = { Yield => Item.id
# Takes the Yield, and gives it an item id. You need one for
# every number in Yield.
#-------------------------------------------------------------------
Yield_To_Item = {
0 => 2,
1 => 5
}
#--------------------------------------------------------------------
# Item_Level = { item_id => item_level
#--------------------------------------------------------------------
Item_Level = {
1 => 1,
2 => 2,
3 => 3,
4 => 1,
5 => 2
}
end
#===================================
# END module Fusion
#===================================
#===================================
# Game_Party
#===================================
class Game_Party
alias leon_fusion_gameparty_initialize initialize
attr_accessor :fusion_list
attr_accessor :fusion_number
def initialize
@fusion_list = []
@fusion_number = {}
leon_fusion_gameparty_initialize
end
end
#===================================
# END Game_Party
#===================================
#===================================
# Window_Fusion_Info
#===================================
class Window_Fusion_Info < Window_Base
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
end
def update(info_text)
self.contents.clear
self.contents.draw_text(0, 0, 614, 32, info_text)
end
end
#===================================
# END Window_Fusion_Info
#===================================
#===================================
# Window_Fusion_Left
#===================================
class Window_Fusion_Left < Window_Selectable
def initialize
super(0, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
# Change the $fontface variable to change the font style
$fontface = "Tahoma"
# Change the $fontsize variable to change the font size
$fontsize = 20
self.index = 0
self.active = true
refresh
end
def item
if @data != nil
return @data[index]
end
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
fus = Fusion
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
if fus::Fusable_Items.include?(i)
@data.push($data_items[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
# Change the $fontface variable to change the font style
$fontface = "Tahoma"
# Change the $fontsize variable to change the font size
$fontsize = 20
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
x = 4
y = index * 32
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 200, y, 16, 32, ":", 1)
self.contents.draw_text(x + 216, y, 24, 32, number.to_s, 2)
end
end
#===================================
# END Window_Fusion_Left
#===================================
#===================================
# Window_Fusion_Right
#===================================
class Window_Fusion_Right < Window_Selectable
def initialize
super(320, 64, 320, 416)
self.contents = Bitmap.new(width - 32, height - 32)
# Change the $fontface variable to change the font style
$fontface = "Tahoma"
# Change the $fontsize variable to change the font size
$fontsize = 20
self.index = -1
self.active = false
self.visible = false
end
def item
if @data != nil
return @data[index]
end
end
def refresh(first_item)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
fus = Fusion
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
if fus::Mixables[first_item] != nil
if fus::Mixables[first_item].include?(i)
@data.push($data_items[i])
end
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
# Change the $fontface variable to change the font style
$fontface = "Tahoma"
# Change the $fontsize variable to change the font size
$fontsize = 20
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
x = 4
y = index * 32
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 200, y, 16, 32, ":", 1)
self.contents.draw_text(x + 216, y, 24, 32, number.to_s, 2)
end
end
#===================================
# END Window_Fusion_Right
#===================================
#===================================
# Window_Fusion_Confirm
#===================================
class Window_Fusion_Confirm < Window_Selectable
def initialize
super(195, 160, 250, 160)
@options = ["Yes", "No"]
@item_max = @options.size
self.contents = Bitmap.new(width - 32, height - 32)
# Change the $fontface variable to change the font style
$fontface = "Tahoma"
# Change the $fontsize variable to change the font size
$fontsize = 20
self.index = -1
self.z += 100
self.active = false
self.visible = false
end
def refresh(result)
self.contents.clear
item = $data_items[result]
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 32 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(4, 0, 218, 32, "Fuse to create")
self.contents.draw_text(32, 32, 218, 32, item.name + "?")
for i in 0...@options.size
x = 4
y = i * 32 + 64
self.contents.draw_text(0, y, 218, 32, @options[i], 1)
end
end
def update_cursor_rect
if @index <0
self.cursor_rect.empty
else
y = @index * 32 + 64
self.cursor_rect.set(0, y, self.width - 32, 32)
end
end
end
#===================================
# END Window_Fusion_Confirm
#===================================
#===================================
# Scene_Fusion
#===================================
class Scene_Fusion
def main
@info_window = Window_Fusion_Info.new
@left_window = Window_Fusion_Left.new
@right_window = Window_Fusion_Right.new
@confirm_window = Window_Fusion_Confirm.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@info_window.dispose
@left_window.dispose
@right_window.dispose
@confirm_window.dispose
end
def update
@left_window.update
@right_window.update
@confirm_window.update
if @left_window.active
update_left
return
end
if @right_window.active
update_right
return
end
if @confirm_window.active
update_confirm
return
end
end
def update_left
if Input.trigger?(Input::

$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @left_window.item != nil
@item_1 = @left_window.item.id
@left_window.active = false
@right_window.active = true
@right_window.visible = true
@right_window.index = 0
@right_window.refresh(@item_1)
return
end
end
end
def update_right
if Input.trigger?(Input::

$game_system.se_play($data_system.cancel_se)
@left_window.active = true
@right_window.active = false
@right_window.visible = false
@right_window.index = -1
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
fus = Fusion
fix = fus::Yield.keys
fix.sort!
@fix_1 = false
@counter = 0
if @right_window.item != nil
@item_2 = @right_window.item.id
for i in 0...fix.size
for j in 0...fus::Yield[i].size
if @item_1 == fus::Yield[i][j][0] and @item_2 == fus::Yield[i][j][1]
if @item_1 == @item_2 and $game_party.item_number(@item_1) < 2
@result = nil
return
end
@number = j
@result = fus::Yield_To_Item[fix[i]]
@right_window.active = false
@confirm_window.visible = true
@confirm_window.active = true
@confirm_window.index = 0
@confirm_window.refresh(@result)
@fix_1 = true
elsif @item_2 == fus::Yield[i][j][0] and @item_1 == fus::Yield[i][j][1]
if @item_1 == @item_2 and $game_party.item_number(@item_1) < 2
@result = nil
return
end
@number = j
@result = fus::Yield_To_Item[fix[i]]
@right_window.active = false
@confirm_window.visible = true
@confirm_window.active = true
@confirm_window.index = 0
@confirm_window.refresh(@result)
@fix_1 = true
return
else
unless @fix_1 == true
@result = nil
end
end
end
end
if @result == nil
return
end
end
end
end
def update_confirm
@fix_1 = false
if Input.trigger?(Input::

@result = nil
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@confirm_window.visible = false
@confirm_window.active = false
@confirm_window.index = -1
end
if Input.trigger?(Input::C)
case @confirm_window.index
when 0
unless $game_party.fusion_list.include?(@result)
$game_party.fusion_list.push(@result)
$game_party.fusion_list.sort!
end
unless$game_party.fusion_number.keys.include?(@result)
$game_party.fusion_number[@result] = []
end
unless $game_party.fusion_number[@result].include?(@number)
$game_party.fusion_number[@result].push(@number)
$game_party.fusion_number[@result].sort!
end
$game_system.se_play($data_system.decision_se)
$game_party.lose_item(@item_1, 1)
$game_party.lose_item(@item_2, 1)
$game_party.gain_item(@result, 1)
$scene = Scene_Fusion.new
when 1
@result = nil
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@confirm_window.visible = false
@confirm_window.active = false
@confirm_window.index = -1
end
end
end
end