#==============================================================================
# □ 自定义内容结束
#==============================================================================
end
class Game_Actor
include Sys_Update
attr_accessor :attr_use # 属性攻撃使用回数
attr_accessor :attr_level # 属性レベル
attr_accessor :attr_lv_limit # レベル最大値
attr_accessor :attr_level_up # レベルアップフラグ
attr_accessor :attr_list # レベルアップテーブル
alias setup_attribute setup
def setup(actor_id)
setup_attribute(actor_id)
@attr_use = []
@attr_level = []
@attr_lv_limit = []
@attr_level_up = []
@attr_list = []
init_level = INIT_LEVEL[@actor_id]
lv_limit = LV_LIMIT[@actor_id]
for i in 0..UPDATE.max
if UPDATE.include?(i)
@attr_level = init_level
@attr_lv_limit = lv_limit
make_attr_list(i)
list = @attr_list
@attr_use = list[@attr_level]
end
end
end
#--------------------------------------------------------------------------
# ● 熟練度EXP 計算
#--------------------------------------------------------------------------
def make_attr_list(element)
up_interval = UP_INTERVAL[@actor_id]
up_slope = UP_SLOPE[@actor_id]
list = []
list[0] = 0
for lv in 1...@attr_lv_limit[element]
case LEVEL_UP_PATTERN
when 0
exp = up_interval[element] * lv
when 1
exp = list[lv-1] + up_slope[element] * lv + up_interval[element]
when 2
exp = list[lv-1] + up_slope[element] * lv * lv + up_interval[element]
end
list[lv] = exp.truncate
end
@attr_list[element] = list
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
include Sys_Update
#--------------------------------------------------------------------------
# ● 通常攻撃の効果適用
# attacker : 攻撃者 (バトラー)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# クリティカルフラグをクリア
self.critical = false
# 第一命中判定
hit_result = (rand(100) < attacker.hit)
# 命中の場合
if hit_result == true
# 基本ダメージを計算
#--修正------------
if attacker.is_a?(Game_Actor) and (attacker.weapon_id != 0 or ARM_SETTING)
level = 0
best_element = nil
attacker.attr_level_up = []
weapon_element = attacker.element_set
for i in 0...UPDATE.size
if weapon_element.include?(UPDATE)
element = UPDATE
# 使用回数のカウント
element_use_count(attacker, element)
# 多重に属性を付与している場合は最もレベルの高いものを優先
if level < attacker.attr_level[element]
level = attacker.attr_level[element]
best_element = element
end
end
end
if best_element != nil
# 補正値の算出
atk_rate = ATK_RATE[attacker.id]
temp_atk = (attacker.atk * atk_rate[best_element]/100) * level
atk = [attacker.atk + temp_atk - self.pdef / 2, 0].max
else
atk = [attacker.atk - self.pdef / 2, 0].max
end
else
atk = [attacker.atk - self.pdef / 2, 0].max
end
#------------------
self.damage = atk * (20 + attacker.str) / 20
# 属性修正
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# ダメージの符号が正の場合
if self.damage > 0
# クリティカル修正
if rand(100) < 4 * attacker.dex / self.agi
self.damage *= 2
self.critical = true
end
# 防御修正
if self.guarding?
self.damage /= 2
end
end
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
# 命中の場合
if hit_result == true
# ステート衝撃解除
remove_states_shock
# HP からダメージを減算
self.hp -= self.damage
# ステート変化
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# ミスの場合
else
# ダメージに "Miss" を設定
self.damage = "Miss"
# クリティカルフラグをクリア
self.critical = false
end
#--追加-------
# Miss時には後戻し
if attacker.is_a?(Game_Actor) and self.damage == "Miss" and (attacker.weapon_id != 0 or ARM_SETTING)
for i in 0..UPDATE.size-1
weapon_element = attacker.element_set
if weapon_element.include?(UPDATE)
element = UPDATE
element_use_recount(attacker, element)
end
end
end
#-------------
# メソッド終了
return true
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : スキルの使用者 (バトラー)
# skill : スキル
#--------------------------------------------------------------------------
alias skill_effect_sys_update skill_effect
def skill_effect(user, skill)
level = 0
if user.is_a?(Game_Actor)
best_element = nil
user.attr_level_up = []
skill_element = skill.element_set
for i in 0..UPDATE.size-1
if skill_element.include?(UPDATE)
element = UPDATE
# 使用回数のカウント
element_use_count(user, element)
# 多重に属性を付与している場合は最もレベルの高いものを優先
if level < user.attr_level[element]
level = user.attr_level[element]
end
end
end
if best_element != nil
skill_power_base = skill.dup
# 威力上昇
skill_rate = SKILL_RATE[attacker.id]
skill.power += skill.power * skill_rate[best_element]/100 * level
end
end
ret = skill_effect_sys_update(user, skill) # 原物
if user.is_a?(Game_Actor) and level != 0
skill = skill_power_base
for i in 0..UPDATE.size-1
if skill_element.include?(UPDATE)
element = UPDATE
# Miss時には後戻し
if self.damage == "Miss"
element_use_recount(user, element)
end
end
end
end
return ret
end
#--------------------------------------------------------------------------
# ● スキル使用回数更新
#--------------------------------------------------------------------------
def element_use_count(actor, element)
# 追尾系との併用
if ADD_ATK_PLUS
if $add_atk_exercise
return
end
end
if SKILL_CHASE_PLUS
if $skill_chase_exercise
return
end
end
if SKILL_LINK_PLUS
if $skill_linked
return
end
end
# 使用回数のカウント
actor.attr_use[element] += 1
# レベル上限を超えてない
if actor.attr_level[element] < actor.attr_lv_limit[element]
list = actor.attr_list[element]
next_exp = list[actor.attr_level[element]+1]
# レベル上昇判定
if actor.attr_use[element] == next_exp
# レベル上昇
actor.attr_level[element] += 1
actor.attr_level_up.push(element)
end
end
end
#--------------------------------------------------------------------------
# ● スキル使用回数再更新
#--------------------------------------------------------------------------
def element_use_recount(actor, element)
# 追尾系との併用
if ADD_ATK_PLUS
if $add_atk_exercise
return
end
end
if SKILL_CHASE_PLUS
if $skill_chase_exercise
return
end
end
if SKILL_LINK_PLUS
if $skill_linked
return
end
end
# レベル上昇済み判定
if actor.attr_level_up.include?(element)
# レベル上昇
actor.attr_level[element] -= 1
actor.attr_level_up.delete(element)
end
# 使用回数の再カウント
actor.attr_use[element] -= 1
end
end
#==============================================================================
# ■ Window_Attribute
#==============================================================================
class Window_Attribute < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor, element_set)
super(10, 50, 250, 64*element_set.size)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@actor = actor
@element = element_set
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
for i in [email protected]
self.contents.font.color = normal_color
draw_attribute_icon(@element, 10, 10 + i*32)
self.contents.draw_text(50, 0 + i*32, 48, 32, @actor.attr_level[@element].to_s)
self.contents.font.color = Color.new(255, 64, 0)
self.contents.draw_text(80, 0 + i*32, 150, 32, "LEVEL UP!")
end
end
end
class Scene_Battle
include Sys_Update
if SHOW_LV_UP
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias update_phase4_step2_attribute update_phase4_step2
def update_phase4_step2
if @active_battler.is_a?(Game_Actor)
@active_battler.attr_level_up = []
end
@attr_lvup = false
update_phase4_step2_attribute # 原物
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
alias update_phase4_step3_attribute update_phase4_step3
def update_phase4_step3
if @active_battler.is_a?(Game_Actor) and @active_battler.attr_level_up != []
if FLASH_PLUS
if !@flash_flag
@attr_lvup = true
@attr_lv_up_window = Window_Attribute.new(@active_battler, @active_battler.attr_level_up)
if SHOW_LV_SE != nil
Audio.se_play("Audio/SE/" + SHOW_LV_SE)
sleep(0.1)
end
end
else
@attr_lvup = true
@attr_lv_up_window = Window_Attribute.new(@active_battler, @active_battler.attr_level_up)
if SHOW_LV_SE != nil
Audio.se_play("Audio/SE/" + SHOW_LV_SE)
sleep(0.1)
end
end
end
update_phase4_step3_attribute
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
alias update_phase4_step5_attribute update_phase4_step5
def update_phase4_step5
if @active_battler.is_a?(Game_Actor) and @attr_lvup
@attr_lv_up_window.dispose
@active_battler.attr_level_up = []
end
update_phase4_step5_attribute # 原物
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_attribute update
def update
if @active_battler.is_a?(Game_Actor) and @active_battler.attr_level_up != [] and @attr_lvup
@attr_lv_up_window.contents_opacity -= 4
end
update_attribute # 原物
end
end # if SHOW_LV_UP
end
class Interpreter
include Sys_Update
#--------------------------------------------------------------------------
# ● 熟練度設定(レベルセット)
# actor_id : アクターID
# element : 属性ID
# level : 設定レベル
#--------------------------------------------------------------------------
def set_element_level(actor_id, element, level)
actor = $game_actors[actor_id]
if level > actor.attr_lv_limit[element]
level = actor.attr_lv_limit[element]
end
actor.attr_level[element] = level
list = actor.attr_list[element]
actor.attr_use = list[level]
end
#--------------------------------------------------------------------------
# ● 熟練度設定(レベルアップ)
# actor_id : アクターID
# element : 属性ID
#--------------------------------------------------------------------------
def element_level_up(actor_id, element)
actor = $game_actors[actor_id]
if actor.attr_level[element] < actor.attr_lv_limit[element]
actor.attr_level[element] += 1
list = actor.attr_list[element]
actor.attr_use = list[actor.attr_level[element]]
end
end
#--------------------------------------------------------------------------
# ● 熟練度設定(レベルダウン)
# actor_id : アクターID
# element : 属性ID
#--------------------------------------------------------------------------
def element_level_down(actor_id, element)
actor = $game_actors[actor_id]
if actor.attr_level[element] > 0
actor.attr_level[element] -= 1
list = actor.attr_list[element]
actor.attr_use = list[actor.attr_level[element]]
end
end
#--------------------------------------------------------------------------
# ● 熟練度設定(熟練度上限操作)
# actor_id : アクターID
# element : 属性ID
# limit : 熟練度上限値
#--------------------------------------------------------------------------
def set_element_limit(actor_id, element, limit)
actor = $game_actors[actor_id]
actor.attr_lv_limit[element] = limit
if actor.attr_level[element] > limit
set_element_level(actor_id, element, limit)
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
include Sys_Update
#--------------------------------------------------------------------------
# ● レベルの描画
# actor : アクター
# attribute_id: レベルを表示させる属性
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_attribute_level(actor, attribute_id, x, y)
level = actor.attr_level[attribute_id]
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, level.to_s, 2)
end
#--------------------------------------------------------------------------
# ● アイコンの描画
# attribute_id : アイコンを表示する属性
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_attribute_icon(attribute_id, x, y)
bitmap = RPG::Cache.icon(UPDATE_I[attribute_id])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw/2+20, y - ch + 15, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# ● アイコン(+)の描画
# attribute_id : アイコンを表示する属性
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_attribute_icon_p(attribute_id, x, y)
bitmap = RPG::Cache.icon(UPDATE_I[attribute_id])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw/2+20, y - ch+15, bitmap, src_rect)
self.contents.draw_text(x+25, y-18, 24, 24, "+")
end
#--------------------------------------------------------------------------
# ● アイコン(-)の描画
# attribute_id : アイコンを表示する属性
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_attribute_icon_m(attribute_id, x, y)
bitmap = RPG::Cache.icon(UPDATE_I[attribute_id])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw/2+20, y - ch+15, bitmap, src_rect)
self.contents.draw_text(x+25, y-18, 24, 24, "-")
end
#--------------------------------------------------------------------------
# ● 熟練度Nextの表示(使用回数/NEXT)
# actor_id : アクターID
# attribute_id : アイコンを表示する属性
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_attribute_next(actor, attribute_id, x, y)
list = actor.attr_list[attribute_id]
if actor.attr_level[attribute_id] == actor.attr_lv_limit[attribute_id]
next_exp = "-"
else
next_exp = list[actor.attr_level[attribute_id]+1].to_s
end
use = actor.attr_use[attribute_id]
attr_exp = use.to_s + "/" + next_exp
self.contents.draw_text(x, y, 100, 32, attr_exp)
end
end