class Game_Party
def avg_number(number, level=nil)
average = 0
for i in @actors
actor = level ? $data_actors[i] : $game_actors[i]
case number
when "level"
average += $game_actors[i].level
when "exp"
average += $game_actors[i].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[i].hit
when "eva"
average += $game_actors[i].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(/[ ]+/).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(/[ ]+/).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(/[ ]+/).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 drop_item?
self.note.split(/[ ]+/).each { |line|
return if !(line =~ /[(no_drop|不掉落物品|不掉落物品)]/)
}
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
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 获取基本体力最大值
#--------------------------------------------------------------------------
def base_maxhp
if enemy.auto_setup?
enemy_maxhp = $game_party.avg_hp_max(enemy.level)
if enemy.type == -1
enemy_maxhp *= (1 + rand(0))
else
enemy_maxhp *= Auto_Enemy::ENEMY_TYPE_HP[enemy.type]
end
enemy_maxhp = enemy_maxhp.to_i
enemy_maxhp += rand(10)
return enemy_maxhp
else
return enemy.maxhp
end
end
#--------------------------------------------------------------------------
# ● 获取基本魔力最大值
#--------------------------------------------------------------------------
def base_maxmp
if enemy.auto_setup?
enemy_maxmp = $game_party.avg_mp_max(enemy.level)
if enemy.type == -1
enemy_maxmp *= (1 + rand(0))
else
enemy_maxmp *= Auto_Enemy::ENEMY_TYPE_MP[enemy.type]
end
enemy_maxmp = enemy_maxmp.to_i
enemy_maxmp += rand(5)
return enemy_maxmp
else
return enemy.maxmp
end
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
def base_atk
if enemy.auto_setup?
enemy_atk = $game_party.avg_atk(enemy.level)
if enemy.type == -1
enemy_atk *= (1 + rand(0))
else
enemy_atk *= Auto_Enemy::ENEMY_TYPE_ATK[enemy.type]
end
enemy_atk = enemy_atk.to_i
enemy_atk += rand(5)
return enemy_atk
else
return enemy.atk
end
end
#--------------------------------------------------------------------------
# ● 获取基本防御力
#--------------------------------------------------------------------------
def base_def
if enemy.auto_setup?
enemy_def = $game_party.avg_def(enemy.level)
if enemy.type == -1
enemy_def *= (1 + rand(0))
else
enemy_def *= Auto_Enemy::ENEMY_TYPE_DEF[enemy.type]
end
enemy_def = enemy_def.to_i
enemy_def += rand(5)
return enemy_def
else
return enemy.def
end
end
#--------------------------------------------------------------------------
# ● 获取基本精神力
#--------------------------------------------------------------------------
def base_spi
if enemy.auto_setup?
enemy_spi = $game_party.avg_spi(enemy.level)
if enemy.type == -1
enemy_spi *= (1 + rand(0))
else
enemy_spi *= Auto_Enemy::ENEMY_TYPE_SPI[enemy.type]
end
enemy_spi = enemy_spi.to_i
enemy_spi += rand(5)
return enemy_spi
else
return enemy.spi
end
end
#--------------------------------------------------------------------------
# ● 获取基本敏捷
#--------------------------------------------------------------------------
def base_agi
if enemy.auto_setup?
enemy_agi = $game_party.avg_agi(enemy.level)
if enemy.type == -1
enemy_agi *= (1 + rand(0))
else
enemy_agi *= Auto_Enemy::ENEMY_TYPE_AGI[enemy.type]
end
enemy_agi = enemy_agi.to_i
enemy_agi += rand(5)
return enemy_agi
else
return enemy.agi
end
end
#--------------------------------------------------------------------------
# ● 获取命中率
#--------------------------------------------------------------------------
def hit
if enemy.auto_setup?
enemy_hit = $game_party.avg_hit
if enemy.type == -1
enemy_hit *= (1 + rand(0))
elsif enemy.type == 6
enemy_hit = 95
else
enemy_hit *= Auto_Enemy::ENEMY_TYPE_HIT[enemy.type]
end
return [[enemy_hit.to_i, 95].min, 50].max
else
return enemy.hit
end
end
#--------------------------------------------------------------------------
# ● 获取闪躲率
#--------------------------------------------------------------------------
def eva
if enemy.auto_setup?
enemy_eva = $game_party.avg_eva
if enemy.type == -1
enemy_eva *= (1 + rand(0))
elsif enemy.type == 6
enemy_eva = 95
else
enemy_eva *= Auto_Enemy::ENEMY_TYPE_EVA[enemy.type]
end
return [[enemy_eva.to_i, 95].min, 0].max
else
return enemy.eva
end
end
#--------------------------------------------------------------------------
# ● 获取经验值
#--------------------------------------------------------------------------
def exp
if enemy.auto_setup?
exp = ($game_party.avg_exp_needed * Auto_Enemy::EXPERIENCE).to_i
exp =* enemy.type == 6 ? Auto_Enemy::BOSS_EXP : 1
exp += rand(10)
return exp
else
return enemy.exp
end
end
def drop_item1
if enemy.auto_setup? or drop_item?
get_drop_item
else
return @drop_item1
end
end
def drop_item2
if (enemy.auto_setup? or drop_item?) and drop_item1.kind != 0
get_drop_item
else
return RPG::Enemy::DropItem.new
end
end
def get_drop_item
possible_drop_item = []
drop = RPG::Enemy::DropItem.new
drop.kind = rand(4)
case drop.kind
when 1
for i in 1...$data_items.size
item = $data_items[i]
if (item.level - enemy.level).abs <= 2 and item.level == 0
possible_drop_item.push(item.id) unless item.cannot_drop
end
end
drop.item_id = possible_drop_item[rand(possible_drop_item.size)]
when 2
for i in 1...$data_weapons.size
weapon = $data_weapons[i]
if (weapon.level - enemy.level).abs <= 2 and weapon.level == 0
possible_drop_item.push(weapon.id) unless weapon.cannot_drop
end
end
drop.weapon_id = possible_drop_item[rand(possible_drop_item.size)]
when 3
for i in 1...$data_armors.size
armor = $data_armors[i]
if (armor.level - enemy.level).abs <= 2 and armor.level == 0
possible_drop_item.push(armor.id) unless armor.cannot_drop
end
end
drop.armor_id = possible_drop_item[rand(possible_drop_item.size)]
end
drop.kind = 0 if possible_drop_item == []
ratio = enemy.level * rand(5) / Item_Setup::DROP_COEF
drop.denominator = [ratio, 1].max
return drop
end
end
class Game_Interpreter
def make_enemy_database
for i in 1...$data_enemies.size
game_enemy = Game_Enemy.new(1, i)
if $data_enemies[i].auto_setup?
$data_enemies[i].maxhp = game_enemy.base_maxhp
$data_enemies[i].maxmp = game_enemy.base_maxmp
$data_enemies[i].atk = game_enemy.base_atk
$data_enemies[i].def = game_enemy.base_def
$data_enemies[i].spi = game_enemy.base_spi
$data_enemies[i].agi = game_enemy.base_agi
$data_enemies[i].hit = game_enemy.hit
$data_enemies[i].eva = game_enemy.eva
$data_enemies[i].exp = game_enemy.exp
if $lazy_item_setup
$data_enemies[i].drop_item1 = game_enemy.drop_item1
$data_enemies[i].drop_item2 = game_enemy.drop_item2
end
end
end
save_data($data_enemies,"Data/Enemies.rvdata") if Auto_Enemy::WRITE_2_DATABASE
end
end
class Game_Party
def avg_number(number, level=nil)
average = 0
for i in @actors
actor = level ? $data_actors[i] : $game_actors[i]
case number
when "level"
average += $game_actors[i].level
when "exp"
average += $game_actors[i].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[i].hit
when "eva"
average += $game_actors[i].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(/[ ]+/).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(/[ ]+/).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(/[ ]+/).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 drop_item?
self.note.split(/[ ]+/).each { |line|
return if !(line =~ /[(no_drop|不掉落物品|不掉落物品)]/)
}
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
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 获取基本体力最大值
#--------------------------------------------------------------------------
def base_maxhp
if enemy.auto_setup?
enemy_maxhp = $game_party.avg_hp_max(enemy.level)
if enemy.type == -1
enemy_maxhp *= (1 + rand(0))
else
enemy_maxhp *= Auto_Enemy::ENEMY_TYPE_HP[enemy.type]
end
enemy_maxhp = enemy_maxhp.to_i
enemy_maxhp += rand(10)
return enemy_maxhp
else
return enemy.maxhp
end
end
#--------------------------------------------------------------------------
# ● 获取基本魔力最大值
#--------------------------------------------------------------------------
def base_maxmp
if enemy.auto_setup?
enemy_maxmp = $game_party.avg_mp_max(enemy.level)
if enemy.type == -1
enemy_maxmp *= (1 + rand(0))
else
enemy_maxmp *= Auto_Enemy::ENEMY_TYPE_MP[enemy.type]
end
enemy_maxmp = enemy_maxmp.to_i
enemy_maxmp += rand(5)
return enemy_maxmp
else
return enemy.maxmp
end
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
def base_atk
if enemy.auto_setup?
enemy_atk = $game_party.avg_atk(enemy.level)
if enemy.type == -1
enemy_atk *= (1 + rand(0))
else
enemy_atk *= Auto_Enemy::ENEMY_TYPE_ATK[enemy.type]
end
enemy_atk = enemy_atk.to_i
enemy_atk += rand(5)
return enemy_atk
else
return enemy.atk
end
end
#--------------------------------------------------------------------------
# ● 获取基本防御力
#--------------------------------------------------------------------------
def base_def
if enemy.auto_setup?
enemy_def = $game_party.avg_def(enemy.level)
if enemy.type == -1
enemy_def *= (1 + rand(0))
else
enemy_def *= Auto_Enemy::ENEMY_TYPE_DEF[enemy.type]
end
enemy_def = enemy_def.to_i
enemy_def += rand(5)
return enemy_def
else
return enemy.def
end
end
#--------------------------------------------------------------------------
# ● 获取基本精神力
#--------------------------------------------------------------------------
def base_spi
if enemy.auto_setup?
enemy_spi = $game_party.avg_spi(enemy.level)
if enemy.type == -1
enemy_spi *= (1 + rand(0))
else
enemy_spi *= Auto_Enemy::ENEMY_TYPE_SPI[enemy.type]
end
enemy_spi = enemy_spi.to_i
enemy_spi += rand(5)
return enemy_spi
else
return enemy.spi
end
end
#--------------------------------------------------------------------------
# ● 获取基本敏捷
#--------------------------------------------------------------------------
def base_agi
if enemy.auto_setup?
enemy_agi = $game_party.avg_agi(enemy.level)
if enemy.type == -1
enemy_agi *= (1 + rand(0))
else
enemy_agi *= Auto_Enemy::ENEMY_TYPE_AGI[enemy.type]
end
enemy_agi = enemy_agi.to_i
enemy_agi += rand(5)
return enemy_agi
else
return enemy.agi
end
end
#--------------------------------------------------------------------------
# ● 获取命中率
#--------------------------------------------------------------------------
def hit
if enemy.auto_setup?
enemy_hit = $game_party.avg_hit
if enemy.type == -1
enemy_hit *= (1 + rand(0))
elsif enemy.type == 6
enemy_hit = 95
else
enemy_hit *= Auto_Enemy::ENEMY_TYPE_HIT[enemy.type]
end
return [[enemy_hit.to_i, 95].min, 50].max
else
return enemy.hit
end
end
#--------------------------------------------------------------------------
# ● 获取闪躲率
#--------------------------------------------------------------------------
def eva
if enemy.auto_setup?
enemy_eva = $game_party.avg_eva
if enemy.type == -1
enemy_eva *= (1 + rand(0))
elsif enemy.type == 6
enemy_eva = 95
else
enemy_eva *= Auto_Enemy::ENEMY_TYPE_EVA[enemy.type]
end
return [[enemy_eva.to_i, 95].min, 0].max
else
return enemy.eva
end
end
#--------------------------------------------------------------------------
# ● 获取经验值
#--------------------------------------------------------------------------
def exp
if enemy.auto_setup?
exp = ($game_party.avg_exp_needed * Auto_Enemy::EXPERIENCE).to_i
exp =* enemy.type == 6 ? Auto_Enemy::BOSS_EXP : 1
exp += rand(10)
return exp
else
return enemy.exp
end
end
def drop_item1
if enemy.auto_setup? or drop_item?
get_drop_item
else
return @drop_item1
end
end
def drop_item2
if (enemy.auto_setup? or drop_item?) and drop_item1.kind != 0
get_drop_item
else
return RPG::Enemy::DropItem.new
end
end
def get_drop_item
possible_drop_item = []
drop = RPG::Enemy::DropItem.new
drop.kind = rand(4)
case drop.kind
when 1
for i in 1...$data_items.size
item = $data_items[i]
if (item.level - enemy.level).abs <= 2 and item.level == 0
possible_drop_item.push(item.id) unless item.cannot_drop
end
end
drop.item_id = possible_drop_item[rand(possible_drop_item.size)]
when 2
for i in 1...$data_weapons.size
weapon = $data_weapons[i]
if (weapon.level - enemy.level).abs <= 2 and weapon.level == 0
possible_drop_item.push(weapon.id) unless weapon.cannot_drop
end
end
drop.weapon_id = possible_drop_item[rand(possible_drop_item.size)]
when 3
for i in 1...$data_armors.size
armor = $data_armors[i]
if (armor.level - enemy.level).abs <= 2 and armor.level == 0
possible_drop_item.push(armor.id) unless armor.cannot_drop
end
end
drop.armor_id = possible_drop_item[rand(possible_drop_item.size)]
end
drop.kind = 0 if possible_drop_item == []
ratio = enemy.level * rand(5) / Item_Setup::DROP_COEF
drop.denominator = [ratio, 1].max
return drop
end
end
class Game_Interpreter
def make_enemy_database
for i in 1...$data_enemies.size
game_enemy = Game_Enemy.new(1, i)
if $data_enemies[i].auto_setup?
$data_enemies[i].maxhp = game_enemy.base_maxhp
$data_enemies[i].maxmp = game_enemy.base_maxmp
$data_enemies[i].atk = game_enemy.base_atk
$data_enemies[i].def = game_enemy.base_def
$data_enemies[i].spi = game_enemy.base_spi
$data_enemies[i].agi = game_enemy.base_agi
$data_enemies[i].hit = game_enemy.hit
$data_enemies[i].eva = game_enemy.eva
$data_enemies[i].exp = game_enemy.exp
if $lazy_item_setup
$data_enemies[i].drop_item1 = game_enemy.drop_item1
$data_enemies[i].drop_item2 = game_enemy.drop_item2
end
end
end
save_data($data_enemies,"Data/Enemies.rvdata") if Auto_Enemy::WRITE_2_DATABASE
end
end
class Game_Party
def avg_number(number, level=nil)
average = 0
for i in @actors
actor = level ? $data_actors[i] : $game_actors[i]
case number
when "level"
average += $game_actors[i].level
when "exp"
average += $game_actors[i].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[i].hit
when "eva"
average += $game_actors[i].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(/[ ]+/).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(/[ ]+/).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(/[ ]+/).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 drop_item?
self.note.split(/[ ]+/).each { |line|
return if !(line =~ /[(no_drop|不掉落物品|不掉落物品)]/)
}
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
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 获取基本体力最大值
#--------------------------------------------------------------------------
def base_maxhp
if enemy.auto_setup?
enemy_maxhp = $game_party.avg_hp_max(enemy.level)
if enemy.type == -1
enemy_maxhp *= (1 + rand(0))
else
enemy_maxhp *= Auto_Enemy::ENEMY_TYPE_HP[enemy.type]
end
enemy_maxhp = enemy_maxhp.to_i
enemy_maxhp += rand(10)
return enemy_maxhp
else
return enemy.maxhp
end
end
#--------------------------------------------------------------------------
# ● 获取基本魔力最大值
#--------------------------------------------------------------------------
def base_maxmp
if enemy.auto_setup?
enemy_maxmp = $game_party.avg_mp_max(enemy.level)
if enemy.type == -1
enemy_maxmp *= (1 + rand(0))
else
enemy_maxmp *= Auto_Enemy::ENEMY_TYPE_MP[enemy.type]
end
enemy_maxmp = enemy_maxmp.to_i
enemy_maxmp += rand(5)
return enemy_maxmp
else
return enemy.maxmp
end
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
def base_atk
if enemy.auto_setup?
enemy_atk = $game_party.avg_atk(enemy.level)
if enemy.type == -1
enemy_atk *= (1 + rand(0))
else
enemy_atk *= Auto_Enemy::ENEMY_TYPE_ATK[enemy.type]
end
enemy_atk = enemy_atk.to_i
enemy_atk += rand(5)
return enemy_atk
else
return enemy.atk
end
end
#--------------------------------------------------------------------------
# ● 获取基本防御力
#--------------------------------------------------------------------------
def base_def
if enemy.auto_setup?
enemy_def = $game_party.avg_def(enemy.level)
if enemy.type == -1
enemy_def *= (1 + rand(0))
else
enemy_def *= Auto_Enemy::ENEMY_TYPE_DEF[enemy.type]
end
enemy_def = enemy_def.to_i
enemy_def += rand(5)
return enemy_def
else
return enemy.def
end
end
#--------------------------------------------------------------------------
# ● 获取基本精神力
#--------------------------------------------------------------------------
def base_spi
if enemy.auto_setup?
enemy_spi = $game_party.avg_spi(enemy.level)
if enemy.type == -1
enemy_spi *= (1 + rand(0))
else
enemy_spi *= Auto_Enemy::ENEMY_TYPE_SPI[enemy.type]
end
enemy_spi = enemy_spi.to_i
enemy_spi += rand(5)
return enemy_spi
else
return enemy.spi
end
end
#--------------------------------------------------------------------------
# ● 获取基本敏捷
#--------------------------------------------------------------------------
def base_agi
if enemy.auto_setup?
enemy_agi = $game_party.avg_agi(enemy.level)
if enemy.type == -1
enemy_agi *= (1 + rand(0))
else
enemy_agi *= Auto_Enemy::ENEMY_TYPE_AGI[enemy.type]
end
enemy_agi = enemy_agi.to_i
enemy_agi += rand(5)
return enemy_agi
else
return enemy.agi
end
end
#--------------------------------------------------------------------------
# ● 获取命中率
#--------------------------------------------------------------------------
def hit
if enemy.auto_setup?
enemy_hit = $game_party.avg_hit
if enemy.type == -1
enemy_hit *= (1 + rand(0))
elsif enemy.type == 6
enemy_hit = 95
else
enemy_hit *= Auto_Enemy::ENEMY_TYPE_HIT[enemy.type]
end
return [[enemy_hit.to_i, 95].min, 50].max
else
return enemy.hit
end
end
#--------------------------------------------------------------------------
# ● 获取闪躲率
#--------------------------------------------------------------------------
def eva
if enemy.auto_setup?
enemy_eva = $game_party.avg_eva
if enemy.type == -1
enemy_eva *= (1 + rand(0))
elsif enemy.type == 6
enemy_eva = 95
else
enemy_eva *= Auto_Enemy::ENEMY_TYPE_EVA[enemy.type]
end
return [[enemy_eva.to_i, 95].min, 0].max
else
return enemy.eva
end
end
#--------------------------------------------------------------------------
# ● 获取经验值
#--------------------------------------------------------------------------
def exp
if enemy.auto_setup?
exp = ($game_party.avg_exp_needed * Auto_Enemy::EXPERIENCE).to_i
exp =* enemy.type == 6 ? Auto_Enemy::BOSS_EXP : 1
exp += rand(10)
return exp
else
return enemy.exp
end
end
def drop_item1
if enemy.auto_setup? or drop_item?
get_drop_item
else
return @drop_item1
end
end
def drop_item2
if (enemy.auto_setup? or drop_item?) and drop_item1.kind != 0
get_drop_item
else
return RPG::Enemy::DropItem.new
end
end
def get_drop_item
possible_drop_item = []
drop = RPG::Enemy::DropItem.new
drop.kind = rand(4)
case drop.kind
when 1
for i in 1...$data_items.size
item = $data_items[i]
if (item.level - enemy.level).abs <= 2 and item.level == 0
possible_drop_item.push(item.id) unless item.cannot_drop
end
end
drop.item_id = possible_drop_item[rand(possible_drop_item.size)]
when 2
for i in 1...$data_weapons.size
weapon = $data_weapons[i]
if (weapon.level - enemy.level).abs <= 2 and weapon.level == 0
possible_drop_item.push(weapon.id) unless weapon.cannot_drop
end
end
drop.weapon_id = possible_drop_item[rand(possible_drop_item.size)]
when 3
for i in 1...$data_armors.size
armor = $data_armors[i]
if (armor.level - enemy.level).abs <= 2 and armor.level == 0
possible_drop_item.push(armor.id) unless armor.cannot_drop
end
end
drop.armor_id = possible_drop_item[rand(possible_drop_item.size)]
end
drop.kind = 0 if possible_drop_item == []
ratio = enemy.level * rand(5) / Item_Setup::DROP_COEF
drop.denominator = [ratio, 1].max
return drop
end
end
class Game_Interpreter
def make_enemy_database
for i in 1...$data_enemies.size
game_enemy = Game_Enemy.new(1, i)
if $data_enemies[i].auto_setup?
$data_enemies[i].maxhp = game_enemy.base_maxhp
$data_enemies[i].maxmp = game_enemy.base_maxmp
$data_enemies[i].atk = game_enemy.base_atk
$data_enemies[i].def = game_enemy.base_def
$data_enemies[i].spi = game_enemy.base_spi
$data_enemies[i].agi = game_enemy.base_agi
$data_enemies[i].hit = game_enemy.hit
$data_enemies[i].eva = game_enemy.eva
$data_enemies[i].exp = game_enemy.exp
if $lazy_item_setup
$data_enemies[i].drop_item1 = game_enemy.drop_item1
$data_enemies[i].drop_item2 = game_enemy.drop_item2
end
end
end
save_data($data_enemies,"Data/Enemies.rvdata") if Auto_Enemy::WRITE_2_DATABASE
end
end