本帖最后由 Sion 于 2013-1-29 18:17 编辑
# Mini_Vip_System by Sion # 66rpg.com 转载请注明出处 # 说明:在角色备注里加入<vip> 则当vip附加战斗不能状态时Gameover module BattleManager def self.judge_win_loss #覆盖默认方法 if @phase return process_vip_dead if $game_party.vip_dead? return process_abort if $game_party.members.empty? return process_defeat if $game_party.all_dead? return process_victory if $game_troop.all_dead? return process_abort if aborting? end return false end def self.process_vip_dead $game_message.add(sprintf("VIP挂了,任务失败……")) wait_for_message SceneManager.goto(Scene_Gameover) battle_end(2) return true end end class Scene_Base def check_gameover #覆盖默认方法 SceneManager.goto(Scene_Gameover) if $game_party.all_dead? SceneManager.goto(Scene_Gameover) if $game_party.vip_dead? end end class Game_Party def vip_dead? $game_party.dead_members.each do |actor| actor.is_vip? return true if actor.is_vip? end return false end end class Game_Actor def is_vip? object = $data_actors[@actor_id] object.note.each_line do |line| return true if line.include?("<vip>") end return false end end
# Mini_Vip_System by Sion
# 66rpg.com 转载请注明出处
# 说明:在角色备注里加入<vip> 则当vip附加战斗不能状态时Gameover
module BattleManager
def self.judge_win_loss #覆盖默认方法
if @phase
return process_vip_dead if $game_party.vip_dead?
return process_abort if $game_party.members.empty?
return process_defeat if $game_party.all_dead?
return process_victory if $game_troop.all_dead?
return process_abort if aborting?
end
return false
end
def self.process_vip_dead
$game_message.add(sprintf("VIP挂了,任务失败……"))
wait_for_message
SceneManager.goto(Scene_Gameover)
battle_end(2)
return true
end
end
class Scene_Base
def check_gameover #覆盖默认方法
SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
SceneManager.goto(Scene_Gameover) if $game_party.vip_dead?
end
end
class Game_Party
def vip_dead?
$game_party.dead_members.each do |actor| actor.is_vip?
return true if actor.is_vip?
end
return false
end
end
class Game_Actor
def is_vip?
object = $data_actors[@actor_id]
object.note.each_line do |line|
return true if line.include?("<vip>")
end
return false
end
end
再次优化了代码,应该算是完成了吧。 |