#==============================================================================
# 储存回复 HP 血量的变量 ID
VAR_HP = 1
# 储存回复 SP 血量的变量 ID
VAR_SP = 2
# 战斗不能的状态 ID ,加HP/SP时排除死亡角色。
DEAD_ID = 1
#==============================================================================
class Scene_Battle
def battle_end(result)
# 清除战斗中标志
$game_temp.in_battle = false
# 清除全体同伴的行动
$game_party.clear_actions
# 解除战斗用状态
for actor in $game_party.actors
actor.remove_states_battle
end
# 清除敌人
$game_troop.enemies.clear
# 调用战斗返回
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
###########################################################################
# HP
if $game_variables[VAR_HP] > 0
for i in 0...$game_party.actors.size
if $game_variables[VAR_HP] == 0
break
end
actor = $game_party.actors[i]
if not actor.state?(DEAD_ID) and actor.hp < actor.maxhp
if actor.maxhp - actor.hp <= $game_variables[VAR_HP]
renew_hp = actor.maxhp - actor.hp
else
renew_hp = $game_variables[VAR_HP]
end
$game_variables[VAR_HP] -= renew_hp
actor.hp += renew_hp
end
end
end
# SP
if $game_variables[VAR_SP] > 0
for i in 0...$game_party.actors.size
if $game_variables[VAR_SP] == 0
break
end
actor = $game_party.actors[i]
if not actor.state?(DEAD_ID) and actor.sp < actor.maxsp
if actor.maxsp - actor.sp <= $game_variables[VAR_SP]
renew_sp = actor.maxsp - actor.sp
else
renew_sp = $game_variables[VAR_SP]
end
$game_variables[VAR_SP] -= renew_sp
actor.sp += renew_sp
end
end
end
###########################################################################
# 切换到地图画面
$scene = Scene_Map.new
end
end
#===============================================================================