class RPG::BaseItem
#--------------------------------
# ○ 獲取抵擋備註
#--------------------------------
def qq_damage_parry
return (self.note =~ /<抵擋:\s*(\d+.*?)>/ ? $1.to_i: 0)
end
#--------------------------------
# ○ 获取必定命中的伤害比率备注信息(通用)
#--------------------------------
def certain_hit_damage_rate
return (self.note =~ /<必中伤害比率\s?(.*)?>/ ? $1.to_i / 100.0 : 1.0)
end
#--------------------------------
# ○ 獲取閃避備註
#--------------------------------
def qq_dege
if self.note =~ /<閃避:\s*(\d+.*?)>/
case $1.to_i
when 1
return "eva"
when 2
return "mev"
else
return 0
end
else
return 0
end
end
end
class Game_Actor < Game_Battler
#--------------------------------
# ○ 獲取角色抵擋備註
#--------------------------------
def qq_damage_parry
parry = actor.qq_damage_parry
parry += qq_equip_parry
return parry
end
#--------------------------------
# ○ 获取必定命中伤害比率备注信息(角色)
#--------------------------------
def certain_hit_damage_rate
rate = actor.certain_hit_damage_rate
rate *= c_hit_d_rate_plus
return rate
end
#--------------------------------
# ○ 獲取裝備抵擋備註
#--------------------------------
def qq_equip_parry
state_parry = self.states.inject(0){|p, s| p += s.qq_damage_parry}
weapon_parry = self.weapons.inject(0){|p, w| p += w.qq_damage_parry}
armor_parry = self.armors.inject(0){|p, a| p += a.qq_damage_parry}
return (state_parry + weapon_parry + armor_parry)
end
#--------------------------------
# ○ 获取状态/武器/防具的必定命中伤害比率备注信息
#--------------------------------
def c_hit_d_rate_plus
state_rate = self.states.inject(1.0) {|r, s| r *= s.certain_hit_damage_rate}
weapon_rate = self.weapons.inject(1.0){|r, w| r *= w.certain_hit_damage_rate}
armor_rate = self.armors.inject(1.0) {|r, a| r *= a.certain_hit_damage_rate}
return (state_rate * weapon_rate * armor_rate)
end
end
class Game_Enemy < Game_Battler
#--------------------------------
# ○ 獲取敵人備註
#--------------------------------
def qq_damage_parry
basic = enemy.qq_damage_parry
state_parry = self.states.inject(0){|p, s| p += s.qq_damage_parry}
return (basic + state_parry)
end
#--------------------------------
# ○ 获取必定命中伤害比率备注信息(敌人)
#--------------------------------
def certain_hit_damage_rate
basic = enemy.certain_hit_damage_rate
state_rate = self.states.inject(1.0){|r, s| r *= s.certain_hit_damage_rate}
return (basic * state_rate)
end
end
class Game_Battler < Game_BattlerBase
def parry
return (self.qq_damage_parry)
end
end
class Game_Battler < Game_BattlerBase
#--------------------------------
# ○ 获取必定命中伤害比率(统一入口)
#--------------------------------
def cdr
p "#{self.name}比率:#{self.certain_hit_damage_rate}"
return (self.certain_hit_damage_rate / 1.0)
end
#--------------------------------
# ○ 计算伤害
#--------------------------------
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
# 必中伤害倍率计算
value *= cdr if item.certain?
#----------------
value = apply_critical(value) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
value -= parry if !item.damage.recover?
value = 0 if !item.damage.recover? && value < 0
@result.make_damage(value.to_i, item)
end
#--------------------------------
# ○ 计算技能/物品的闪避几率(所有伤害类型的技能都改为无法闪避)
#--------------------------------
alias sny46_161005_item_eva item_eva
def item_eva(user, item)
return 0 if item.qq_dege == 0
return eval item.qq_dege if item.is_a?(RPG::Skill)
return sny46_161005_item_eva(user, item)
end
#--------------------------------
# ○ 计算技能/物品的成功几率(所有伤害类型的技能都改为不会miss)
#--------------------------------
alias sny46_161009_item_hit item_hit
def item_hit(user, item)
return 1 if item.is_a?(RPG::Skill)
return sny46_161009_item_hit(user, item)
end
end