WEAPON_AMMO = {10 => [1,1], 28 => [99,5]} # 武器ID => [残弹变量, 普通攻击消耗的子弹数量]
MAX_AMMO = {1 =>[10,100], 2 =>[30,101]} # 残弹变量 =>[装填上限,需要的道具ID]
class Game_Actor < Game_Battler
def 残弹
if WEAPON_AMMO[@weapon_id] != nil
return $game_variables[WEAPON_AMMO[@weapon_id][0]]
else
return -1
end
end
def 上弹
if WEAPON_AMMO[@weapon_id] != nil
a = WEAPON_AMMO[@weapon_id][0]
b = $game_party.item_number(MAX_AMMO[a][1])
if $game_variables[a] < MAX_AMMO[a][0] && b > 0
$game_party.lose_item(MAX_AMMO[a][1], [MAX_AMMO[a][0]-$game_variables[a],0].max)
$game_variables[a] = [MAX_AMMO[a][0],b].min
$game_variables[50] = "子弹装填完毕"
elsif b <= 0
$game_variables[50] = "子弹不足"
elsif $game_variables[a] >= MAX_AMMO[a][0]
$game_variables[a] = MAX_AMMO[a][0]
$game_variables[50] = "子弹已经满了"
end
else
$game_variables[50] = "这个武器没办法装子弹"
end
end
end
def 满弹
for i in MAX_AMMO.keys
a = $game_party.item_number(MAX_AMMO[i][1])
if $game_variables[i] < MAX_AMMO[i][0] && a > 0
$game_party.lose_item(MAX_AMMO[i][1], [MAX_AMMO[i][0]-$game_variables[i],0].max)
$game_variables[i] = [MAX_AMMO[i][0],a].min
end
end
end