def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # 基础计算
damage = 0 if damage < 0 # 设负数伤害为 0
damage *= elements_max_rate(attacker.element_set) # 属性校正
damage /= 100
if damage == 0 # 若伤害为 0
damage = rand(2) # 一半机率伤害为1
elsif damage > 0 # 若伤害为正数
# 改变人物的重击率 =============================================================
jjj = []
for iii in attacker.states
jjj.push(iii.id)
end
kkk = attacker.cri
if jjj.include?(27)
kkk *= 50
end
if jjj.include?(28)
kkk /= 2
end
# 角色如果装备着特殊装备,则改变重击率
if attacker.is_a?(Game_Actor)
kkk += attacker.critical_up
end
@critical = (rand(100) < kkk) # 会心一击判断
# ==============================================================================
@critical = false if prevent_critical # 防止会心一击判断
# 强硬!必有会心一击!========================
if jjj.include?(46)
@critical = true
end
# ============================================
damage *= 3 if @critical # 会心一击校正
end
damage = apply_variance(damage, 20) # 分散度
damage = apply_guard(damage) # 防御校正
# 攻击特定属性的怪要出问题 =====================================================
if self.is_a?(Game_Enemy)
if $data_enemies[self.enemy_id].note.split(/,/)[0] == "特种敌人"
neodamage = rand(3) + 1
neodamage = 3 if @critical
damage = [damage, neodamage].min
end
end
# ==============================================================================
# 如果攻击者有特定状态,那么攻击也要出问题 =====================================
#if attacker.is_a?(Game_Actor)
jjj = []
for iii in attacker.states
jjj.push(iii.id)
end
if jjj.include?(25)
neodamage = rand(3) + 1
neodamage = 3 if @critical
damage = [damage, neodamage].min
end
#end
# ==============================================================================
# 用法术攻击特定属性的怪要出问题 ===============================================
if self.is_a?(Game_Enemy)
if $data_enemies[self.enemy_id].note.split(/,/)[0] == "特种敌人"
if obj.is_a?(RPG::Skill)
damage = [damage, 1].min
end
end
end
# ==============================================================================
# 如果攻击者有特定状态,那么攻击也要出问题 =====================================
#if user.is_a?(Game_Actor)
jjj = []
for iii in user.states
jjj.push(iii.id)
end
if jjj.include?(25)
if obj.is_a?(RPG::Skill)
damage = [damage, 1].min
end
end
#end
# ==============================================================================
if obj.damage_to_mp
@mp_damage = damage # 伤害魔力
else
@hp_damage = damage # 伤害体力
end
# 只有在装备了两把武器时修正有效
return unless user.actor?
return if user.weapons[0] == nil
return if user.weapons[1] == nil
if obj.damage_to_mp
@mp_damage = @mp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害MP
else
@hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害HP
end
end
#--------------------------------------------------------------------------
# ● 使用通常攻击的効果 全部战斗不能,不能绝对回避的处理
#--------------------------------------------------------------------------
def perfect_attack_effect(attacker)
clear_action_results
make_attack_damage_value(attacker) # 计算伤害
execute_damage(attacker) # 反映伤害
apply_state_changes(attacker) # 状态变化
end
#--------------------------------------------------------------------------
# ● 使用技能的效果 全部战斗不能,不能绝对回避的处理
#--------------------------------------------------------------------------
def perfect_skill_effect(user, skill)
clear_action_results
make_obj_damage_value(user, skill) # 伤害計算
make_obj_absorb_effect(user, skill) # 吸収効果計算
execute_damage(user) # 伤害反映
apply_state_changes(skill) # ステート変化
end
#--------------------------------------------------------------------------
# ● 使用物品的効果 全部战斗不能,不能绝对回避的处理
#--------------------------------------------------------------------------
def perfect_item_effect(user, item)
clear_action_results
hp_recovery = calc_hp_recovery(user, item) # 计算HP的回复量
mp_recovery = calc_mp_recovery(user, item) # 计算MP的回复量
make_obj_damage_value(user, item) # 计算伤害
@hp_damage -= hp_recovery # 扣除HP的回复量
@mp_damage -= mp_recovery # 扣除MP的回复量
make_obj_absorb_effect(user, item) # 计算吸收效果
execute_damage(user) # 反映伤害
item_growth_effect(user, item) # 使用成长效果
if item.physical_attack and @hp_damage == 0 # 物理ノー伤害判定
return
end
apply_state_changes(item) # 状态变化
end
#--------------------------------------------------------------------------
# ● 伤害的反映
#--------------------------------------------------------------------------
alias execute_damage_n01 execute_damage
def execute_damage(user)
execute_damage_n01(user)
# 吸収时这里的处理相冲
if @absorbed
user.hp_damage = -@hp_damage
user.mp_damage = -@mp_damage
end
end
#--------------------------------------------------------------------------
# ● 使用技能的効果
#--------------------------------------------------------------------------
alias skill_effect_n01 skill_effect
def skill_effect(user, obj)
# 保持变化前的HPMP
nowhp = self.hp
nowmp = self.mp
# 为了计算现在HPMP的威力获取变化前的使用者的HPMP
if obj.extension.include?("HP消耗")
user_hp = user.hp + user.calc_mp_cost(obj)
user_mp = user.mp
else
user_hp = user.hp
user_mp = user.mp + user.calc_mp_cost(obj)
end
# 确认扩张设定
check_extension(obj)
# 计算伤害
skill_effect_n01(user, obj)
# 有伤害系的扩张时这里的处理会相冲
if @extension
self.hp = nowhp
self.mp = nowmp
end
# 攻击未名中时中断处理
return if self.evaded or self.missed
# 变换伤害属性
damage = @hp_damage unless obj.damage_to_mp
damage = @mp_damage if obj.damage_to_mp
# 比例伤害
if @ratio_maxdamage != nil
damage = self.maxhp * @ratio_maxdamage / 100 unless obj.damage_to_mp
damage = self.maxmp * @ratio_maxdamage / 100 if obj.damage_to_mp
end
if @ratio_nowdamage != nil
damage = self.hp * @ratio_nowdamage / 100 unless obj.damage_to_mp
damage = self.mp * @ratio_nowdamage / 100 if obj.damage_to_mp
end
# 成本威力
if @cost_damage
cost = user.calc_mp_cost(obj)
if obj.extension.include?("HP消耗")
damage = damage * cost / user.maxhp
else
damage = damage * cost / user.maxmp
end
end
# 现在HP威力
damage = damage * user_hp / user.maxhp if @nowhp_damage
# 现在MP威力
damage = damage * user_mp / user.maxmp if @nowmp_damage
# 放弃伤害属性的变换
@hp_damage = damage unless obj.damage_to_mp
@mp_damage = damage if obj.damage_to_mp
# 反应扩张
if @extension
self.hp -= @hp_damage
self.mp -= @mp_damage
end
# 初期化
@extension = false
@cost_damage = false
@nowhp_damage = false
@nowmp_damage = false
@ratio_maxdamage = nil
@ratio_nowdamage = nil
end
#--------------------------------------------------------------------------
# ● 确认扩张设定
#--------------------------------------------------------------------------
def check_extension(skill)
for ext in skill.extension
# 成本威力
if ext == "成本威力"
@extension = true
next @cost_damage = true
# 现在HP威力
elsif ext == "现HP威力"
@extension = true
next @nowhp_damage = true
# 现在MP威力
elsif ext == "现MP威力"
@extension = true
next @nowmp_damage = true
else
# 比例伤害
name = ext.split('')
if name[5] == "M"
name = name.join
name.slice!("%伤害MAX/")
@extension = true
next @ratio_maxdamage = name.to_i
elsif name[5] == "N"
name = name.join
name.slice!("%伤害NOW/")
@extension = true
next @ratio_nowdamage = name.to_i
end
end
end
end
#--------------------------------------------------------------------------
# ● 初期配置的変更
#--------------------------------------------------------------------------
def change_base_position(x, y)
@base_position_x = x
@base_position_y = y
end
#--------------------------------------------------------------------------
# ● 初期化
#--------------------------------------------------------------------------
def reset_coordinate
@move_x = @move_y = @move_z = @jump = @derivation = 0
@active = @non_dead = @individual = false
end
#--------------------------------------------------------------------------
# ● 使用连续伤害的効果
#--------------------------------------------------------------------------
def slip_damage_effect
if slip_damage? and @hp > 0
@hp_damage = apply_variance(maxhp / 20, 10)
@hp_damage = @hp - 1 if @hp_damage >= @hp
self.hp -= @hp_damage
if self.hp <= 0
self.hp = 1
end
end
end
#--------------------------------------------------------------------------
# ● 事件的伤害POP
#--------------------------------------------------------------------------
def damage_num(num = nil)
return if dead? or !$game_temp.in_battle or num == 0
@force_damage = num
end
end
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● 增加回合数
#--------------------------------------------------------------------------
def increase_turn(enemy)
for page in troop.pages
if page.span == 1
@event_flags