module X☆R
# 在这儿添加:武器ID => 使用的子弹物品ID。
MOD = {21=>30, 22=>31}
# 特殊技能消耗:技能ID => 子弹数量 。未准备消耗子弹的武器,以及武器对应的
#子弹不够,都不能释放技能。没写入的技能消耗 1 。
SKILL_MOD = {77=>2, 79=>5}
# 没有子弹时的提醒语句。
NO_AMMUNITION_TIP = "子弹不足!"
end
class Game_Battler
#--------------------------------------------------------------------------
alias add_skill_can_use_xdrs skill_can_use?
def skill_can_use?(skill_id)
if self.is_a?(Game_Actor) and X☆R::SKILL_MOD.keys.include?(skill_id)
return false unless X☆R::MOD.keys.include?(self.weapon_id)
return false if $game_party.item_number(X☆R::MOD[self.weapon_id]) < X☆R::SKILL_MOD[skill_id]
end
add_skill_can_use_xdrs(skill_id)
end
end
#----------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
alias add_update_phase4_step2_xdrs update_phase4_step2
def update_phase4_step2
if @active_battler.is_a?(Game_Actor) and @active_battler.current_action.kind == 0 and
@active_battler.current_action.basic == 0 and X☆R::MOD.keys.include?(@active_battler.weapon_id)
unless @active_battler.current_action.forcing
unless consumption_bullets
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
end
add_update_phase4_step2_xdrs
end
#--------------------------------------------------------------------------
def consumption_bullets
cb = $game_party.item_number(X☆R::MOD[@active_battler.weapon_id]) > 0
cb ? lose_bullet : ammunition_tip
return cb
end
#--------------------------------------------------------------------------
def make_skill_action_result
# 获取特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 因为 SP 耗尽而无法使用的情况下
unless @active_battler.skill_can_use?(@skill.id)
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
if @active_battler.is_a?(Game_Actor) and X☆R::MOD.keys.include?(@active_battler.weapon_id)
lose_bullet
end
# 消耗 SP
@active_battler.sp -= @skill.sp_cost
# 刷新状态窗口
@status_window.refresh
# 在帮助窗口显示特技名
@help_window.set_text(@skill.name, 1)
# 设置动画 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 设置公共事件 ID
@common_event_id = @skill.common_event_id
# 设置对像侧战斗者
set_target_battlers(@skill.scope)
# 应用特技效果
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
def lose_bullet
kind = @active_battler.current_action.kind
id = kind == 0 ? 0 : @active_battler.current_action.skill_id
n = X☆R::SKILL_MOD.keys.include?(id) ? X☆R::SKILL_MOD[id] : 1
$game_party.gain_item(X☆R::MOD[@active_battler.weapon_id], -n)
end
#---------------------------------------------------------------------------
def ammunition_tip
$game_system.se_play($data_system.buzzer_se)
tip = Sprite.new
tip.x = 226; tip.y = 160
tip.bitmap = Bitmap.new(186, 32)
tip.bitmap.fill_rect(0, 0, 186, 32, Color.new(0,0,0))
tip.bitmap.font.color = Color.new(255,0,0)
tip.bitmap.draw_text(0,0,186,32,X☆R::NO_AMMUNITION_TIP,1)
for i in 1..30
Graphics.update
end
for i in 1..10
Graphics.update
tip.opacity -= 25
end
tip.bitmap.dispose; tip.dispose
end
end
#------------------------------------------------------------------------------