class Hash
def key_clear
str = <<= STR
temp = {}
self.each_key {|key|
temp[key] = 0
}
return temp
STR
eval(str,binding)
end
end
class Game_System
attr_accessor :enemy_ids
alias ori_initialize initialize
def initialize
ori_initialize
# 用来保存目前杀死的敌人id=>数量
@enemy_ids = Enemy_ids.dup
@enemy_ids.key_clear
end
end
class Game_Battler
# 这里设置特定敌人id和需要的数量
# 这里是1号敌人需要杀死10个
Enemy_ids = {1=>10}
def dead?
if (@hp == 0 and not @immortal)
if self.is_a?(Game_Enemy)
id = self.instance_variable_get :@enemy_id
now_mission = $game_system.enemy_ids
goal_mission = Enemy_ids
# 检索是否存在于列表中
if now_mission[id] != nil and goal_mission[id] != nil ||
now_mission[id] < goal_mission[id]
$game_system.enemy_ids[id] += 1
break
end
end
return true
end
end
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |