class Game_Party
def avg_number(number, level=nil)
average = 0
for i in @actors
actor = level ? $data_actors : $game_actors
case number
when "level"
average += $game_actors.level
when "exp"
average += $game_actors.next_exp_s
when "hp"
if level
average += actor.parameters[0, level]
else
average += actor.maxhp
end
when "mp"
if level
average += actor.parameters[1, level]
else
average += actor.maxmp
end
when "atk"
if level
average += actor.parameters[2, level]
else
average += actor.atk
end
when "def"
if level
average += actor.parameters[3, level]
else
average += actor.def
end
when "spi"
if level
average += actor.parameters[4, level]
else
average += actor.spi
end
when "agi"
if level
average += actor.parameters[5, level]
else
average += actor.agi
end
when "hit"
average += $game_actors.hit
when "eva"
average += $game_actors.eva
end
end
average /= members.size
return average
end
# 獲取平均等級
def avg_level
return avg_number("level")
end
# 獲取平均升級經驗
def avg_exp_needed
return avg_number("exp")
end
def avg_hp_max(level=nil)
return avg_number("hp", level)
end
def avg_mp_max(level=nil)
return avg_number("mp", level)
end
def avg_atk(level=nil)
return avg_number("atk", level)
end
def avg_def(level=nil)
return avg_number("def", level)
end
def avg_spi(level=nil)
return avg_number("spi", level)
end
def avg_agi(level=nil)
return avg_number("agi", level)
end
def avg_hit
return avg_number("hit")
end
def avg_eva
return avg_number("eva")
end
end
class RPG::Enemy
# 获取等级
def get_level
elevel = 0
self.note.split(/[\r\n]+/).each { |line|
if line =~ /\[(level|等級|等级) {1,2}\]/
a = line.split(/ /)[1]
elevel += a.to_i
elsif line =~ /\[player_level|主角等級|主角等级\]/
elevel += $game_party.avg_level
end
}
return elevel==0 ? nil : elevel
end
# 获取强度
def get_str
self.note.split(/[\r\n]+/).each { |line|
if line =~ /\[(strength|強度|强度) \w+\]/
a = line.split(/ /)[1]
d = ""
while ((c = a.slice!(/./m)) != nil)
d += c if c != "]"
end
return d
end
}
return "default"
end
def get_enemy_type
self.note.split(/[\r\n]+/).each { |line|
if line =~ /\[(type|類型|类型) \w+\]/
a = line.split(/ /)[1]
d = ""
while ((c = a.slice!(/./m)) != nil)
d += c if c != "]"
end
return d
end
}
return "default"
end
# 计算等级
def level
if auto_level?
if auto_str?
return [get_level + str, 1].max
else
return get_level
end
elsif auto_str?
elevel = $game_party.avg_level + str
return [elevel, 1].max
end
end
def str
estr = Auto_Enemy::STRENGTH[get_str]
if estr != nil
return estr
else
return Auto_Enemy::STRENGTH["default"]
end
end
def type
if $enemies_class != nil
return $enemies_class[@enemy_id] if $enemies_class[@enemy_id]!=nil
end
return Auto_Enemy::ENEMY_TYPE[get_enemy_type]
end
def auto_level?
return get_level
end
def auto_str?
return get_str
end
def auto_setup?
return (auto_level? or auto_str?)
end
end