module Sound def self.play_buzzer $game_system.se_play($data_system.buzzer_se) end end class Game_Actor def attack_item_enough? return true if (item_id = $data_classes[self.class_id].arrow_id) == 0 $game_party.item_number(item_id) > 0 end end class Scene_Battle #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- alias cld99_update update def update if @actor_command_window && @active_battler && @active_battler.is_a?(Game_Actor) if !@active_battler.attack_item_enough? @actor_command_window.disable_item(0) else @actor_command_window.refresh end end cld99_update end #-------------------------------------------------------------------------- # ● 刷新画面 (角色命令回合 : 基本命令) #-------------------------------------------------------------------------- alias cld99_update_phase3_basic_command update_phase3_basic_command def update_phase3_basic_command if Input.trigger?(Input::C) if @actor_command_window.index == 0 #攻击 return Sound.play_buzzer if !@active_battler.attack_item_enough? end end cld99_update_phase3_basic_command end #-------------------------------------------------------------------------- # ● 生成基本行动结果 #-------------------------------------------------------------------------- alias make_basic_action_result_for_sp_cost make_basic_action_result def make_basic_action_result # 攻击的情况下 if @active_battler.current_action.basic == 0 if @active_battler.is_a?(Game_Actor) if (item_id = $data_classes[@active_battler.class_id].arrow_id) > 0 $game_party.lose_item(item_id, 1) end end end make_basic_action_result_for_sp_cost end end
module Sound
def self.play_buzzer
$game_system.se_play($data_system.buzzer_se)
end
end
class Game_Actor
def attack_item_enough?
return true if (item_id = $data_classes[self.class_id].arrow_id) == 0
$game_party.item_number(item_id) > 0
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias cld99_update update
def update
if @actor_command_window && @active_battler && @active_battler.is_a?(Game_Actor)
if !@active_battler.attack_item_enough?
@actor_command_window.disable_item(0)
else
@actor_command_window.refresh
end
end
cld99_update
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 基本命令)
#--------------------------------------------------------------------------
alias cld99_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
if Input.trigger?(Input::C)
if @actor_command_window.index == 0 #攻击
return Sound.play_buzzer if !@active_battler.attack_item_enough?
end
end
cld99_update_phase3_basic_command
end
#--------------------------------------------------------------------------
# ● 生成基本行动结果
#--------------------------------------------------------------------------
alias make_basic_action_result_for_sp_cost make_basic_action_result
def make_basic_action_result
# 攻击的情况下
if @active_battler.current_action.basic == 0
if @active_battler.is_a?(Game_Actor)
if (item_id = $data_classes[@active_battler.class_id].arrow_id) > 0
$game_party.lose_item(item_id, 1)
end
end
end
make_basic_action_result_for_sp_cost
end
end
|