class Window_ItemList < Window_Selectable
def process_handling
return unless open? && active
return call_handler(:kfc) if handle?(:kfc) && Input.trigger?(:X)
super
end
alias item_kfc item
def item
return @item if @item
item_kfc
end
def item=(i)
@item = i
end
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, y, enabled)
change_color(normal_color, enabled)
name = item.name
name = "(A)" + name if $game_party.item_kfc.class == item.class && $game_party.item_kfc.id == item.id
draw_text(x + 24, y, width, line_height, name)
end
end
class Game_Party
attr_accessor :item_kfc
def use_item_kfc
if SceneManager.scene_is?(Scene_Map) && !$game_map.interpreter.running? && @item_kfc
if item_number(@item_kfc) > 0
SceneManager.call(Scene_Item)
SceneManager.scene.kfc = true
end
end
end
end
class Scene_Item < Scene_ItemBase
attr_reader :item_window
attr_accessor :kfc
alias start_kfc start
def start
start_kfc
if @kfc
@kfc = false
@item_window.item = $game_party.item_kfc
on_item_ok
end
end
alias create_item_window_kfc create_item_window
def create_item_window
create_item_window_kfc
@item_window.set_handler(:kfc, method(:on_item_kfc))
end
def on_item_kfc
if item_kfc?
Sound.play_ok
if $game_party.item_kfc.class == item.class && $game_party.item_kfc.id == item.id
$game_party.item_kfc = nil
else
$game_party.item_kfc = @item_window.item
end
@item_window.refresh
else
Sound.play_buzzer
end
end
def use_item
super
@item_window.redraw_current_item
@item_window.item = nil
end
def item_kfc?
item ? @item_window.enable?(item) && (1..10).include?(item.id) : false #(1..10).include?(item.id) 可以自己改,或者刪掉
end
end
class Scene_Map
alias update_scene_kfc update_scene
def update_scene
update_scene_kfc
update_call_kfc unless scene_changing?
end
def update_call_kfc
unless $game_map.interpreter.running?
$game_party.use_item_kfc if Input.trigger?(:X)
end
end
end