# [精英敵人] 原作 tan12345(va) 移植 hyrious(xp)
class Game_Enemy < Game_Battler
# 精英怪出現機率,默認30代表30%
BY = 10
# 精英怪屬性加成比例(默認是同時也是經驗,金錢,掉落率加成比例),默認1.3代表屬性是普通怪的1.3倍,
# 以下是相關屬性加成表
# BYPHP(最大HP)/BYPSP(最大SP)/BYPEXP(經驗值)/BYPSTAT(全能力)
# BYPATT(攻擊力)/BYPDEF(物理/魔法防禦)/BYPEVA(迴避率)/BYPGOLD(金錢)
BYPHP = 16+(16*rand(4))
BYPSP = 16+(16*rand(4))
BYPSTAT = 3+(1*rand(4))
BYPATT = 2+(1*rand(4))
BYPDEF = 2+(1*rand(4))
BYPEVA = 10+(1*rand(10))
BYPEXP = 12+(1*rand(3))
BYPGOLD = 9+(1*rand(3))
# 不會成為精英的敵人(默認表示2號和3號敵人不會變成精英,適合設定BOSS)
NO_BY = [1, 2, 3]
attr_reader :is_by # 是否精英
#--------------------------------------------------------------------------
# ● 是否精英
#--------------------------------------------------------------------------
def is_by?
return true if @is_by
return false
end
#--------------------------------------------------------------------------
# ● 初始化對象(包括精英初始化)
#--------------------------------------------------------------------------
alias tan_initialize initialize
def initialize(troop_id, member_index)
tan_initialize(troop_id, member_index)
@is_by = (rand(100) <= BY && !NO_BY.include?(@enemy_id))
@hp = (@hp * (BYPHP+(16*$game_variables[1054]))).to_i if @is_by
@sp = (@sp * (BYPSP+(16*$game_variables[1054]))).to_i if @is_by
add_state(2) if @is_by # 生成精英怪物時候自動施放狀態 #1012
$game_variables[9] += 1 if @is_by # 生成精英怪物時候該變數+1 #849
$game_variables[15] += 1 if @is_by # 生成精英怪物時候該變數+1 #955
end
#--------------------------------------------------------------------------
# ● 精英改名
#--------------------------------------------------------------------------
alias hy_name name
def name
is_by? ? "精英的" + hy_name : hy_name
end
#--------------------------------------------------------------------------
# ● 獲取經驗值
#--------------------------------------------------------------------------
alias tan_exp exp
def exp
return (tan_exp * BYPEXP).to_i if @is_by
tan_exp
end
#--------------------------------------------------------------------------
# ● 獲取金錢
#--------------------------------------------------------------------------
alias tan_gold gold
def gold
return (tan_gold * BYPGOLD).to_i if @is_by
tan_gold
end
#--------------------------------------------------------------------------
# ● 獲取物品掉率的倍率
#--------------------------------------------------------------------------
alias tan_treasure_prob treasure_prob
def treasure_prob
return (tan_treasure_prob * 2).to_i if @is_by
tan_treasure_prob
end
#--------------------------------------------------------------------------
# ● 屬性值增強(很多)
# 嫌不夠可以自行調整算式, 更多base_請參考Game_Enemy
#--------------------------------------------------------------------------
alias hy_base_maxhp base_maxhp
def base_maxhp
return (hy_base_maxhp * BYPHP).to_i if @is_by
hy_base_maxhp
end
alias hy_base_maxsp base_maxsp
def base_maxsp
return (hy_base_maxsp * BYPSP).to_i if @is_by
hy_base_maxsp
end
alias hy_base_str base_str
def base_str
return (hy_base_str * BYPSTAT).to_i if @is_by
hy_base_str
end
alias hy_base_dex base_dex
def base_dex
return (hy_base_dex * BYPSTAT).to_i if @is_by
hy_base_dex
end
alias hy_base_agi base_agi
def base_agi
return (hy_base_agi * BYPSTAT).to_i if @is_by
hy_base_agi
end
alias hy_base_int base_int
def base_int
return (hy_base_int * BYPSTAT).to_i if @is_by
hy_base_int
end
alias hy_base_atk base_atk
def base_atk
return (hy_base_atk * BYPATT).to_i if @is_by
hy_base_atk
end
alias hy_base_pdef base_pdef
def base_pdef
return (hy_base_pdef * BYPDEF).to_i if @is_by
hy_base_pdef
end
alias hy_base_mdef base_mdef
def base_mdef
return (hy_base_mdef * BYPDEF).to_i if @is_by
hy_base_mdef
end
alias hy_base_eva base_eva
def base_eva
return (hy_base_eva + BYPEVA).to_i if @is_by
hy_base_eva
end
end
#--------------------------------------------------------------------------
# ● 怪物圖片是否放大
#--------------------------------------------------------------------------
class Sprite_Battler < RPG::Sprite
alias old_update_xr update
def update
if @data_battler != @battler
@data_battler = @battler
if @battler != nil and @battler.is_a?(Game_Enemy)
self.zoom_x = self.zoom_y = @battler.is_by? ? 2 : 1
end
end
old_update_xr
end
end