module Absorb_text TEXT_TE="" TEXT_TEXT="%s吸收了%d点伤害。" end class Game_Battler < Game_BattlerBase alias make_damage_value_absorb make_damage_value def make_damage_value(user, item) if $game_switches[122]==true @value_absorb=0 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 = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @value_absorb=value $game_variables[92]+=@value_absorb @result.make_damage(value.to_i, item) elsif $game_switches[122]==false make_damage_value_absorb(user,item) end end end class Game_ActionResult alias make_damage_absorb make_damage def make_damage(value, item) if $game_switches[121]==true @value_absorb_1=value value=0 @critical = false if value == 0 @hp_damage = value if item.damage.to_hp? @mp_damage = value if item.damage.to_mp? @mp_damage = [@battler.mp, @mp_damage].min @hp_drain = @hp_damage if item.damage.drain? @mp_drain = @mp_damage if item.damage.drain? @hp_drain = [@battler.hp, @hp_drain].min @success = true if item.damage.to_hp? || @mp_damage != 0 elsif $game_switches[121]==false make_damage_absorb(value, item) end end def enemy_absorb_text if $game_switches[121]==true fmt = @battler.actor? ? Absorb_text::TEXT_TE : Absorb_text::TEXT_TEXT sprintf(fmt,@battler.name, @value_absorb_1) end end alias hp_damage_text_absorb hp_damage_text def hp_damage_text if $game_switches[121]==true if @hp_drain > 0 fmt = @battler.actor? ? Vocab::ActorDrain : Absorb_text::TEXT_TE sprintf(fmt, @battler.name, Vocab::hp, @hp_drain) elsif @hp_damage > 0 fmt = @battler.actor? ? Vocab::ActorDamage : Absorb_text::TEXT_TE sprintf(fmt, @battler.name, @hp_damage) elsif @hp_damage < 0 fmt = @battler.actor? ? Vocab::ActorRecovery : Absorb_text::TEXT_TE sprintf(fmt, @battler.name, Vocab::hp, -hp_damage) else fmt = @battler.actor? ? Vocab::ActorNoDamage : Absorb_text::TEXT_TE sprintf(fmt, @battler.name) end elsif $game_switches[121]==false hp_damage_text_absorb end end end class Window_BattleLog alias display_damage_enemy_absorb display_damage def display_damage(target, item) display_hp_absorb(target, item)# if target.result.barrier?# display_damage_enemy_absorb(target, item) end def display_hp_absorb(target, item) add_text(target.result.enemy_absorb_text) wait end end
百里_飞柳 发表于 2024-9-7 09:15
额每个战斗角色都会走这一套流程,居然用全局开关共用吗?
建议在 game battler 里面增加各个角色自己的实 ...
module Absorb_text TEXT_TE="" TEXT_TEXT="%s吸收了%d点伤害。" end class Game_Battler < Game_BattlerBase alias make_damage_value_absorb make_damage_value def make_damage_value(user, item) if $game_switches[122]==true @value_absorb=0 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 = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) if @battler.actor? ==false @value_absorb=value $game_variables[92]+=@value_absorb end elsif $game_switches[122]==false make_damage_value_absorb(user,item) end end end class Game_ActionResult alias make_damage_absorb make_damage def make_damage(value, item) if $game_switches[121]==true && @battler.actor? ==false if value==0 value_absorb_1=0 elsif value>0 @value_absorb_1=value value=0 end @critical = false if value == 0 @hp_damage = value if item.damage.to_hp? @mp_damage = value if item.damage.to_mp? @mp_damage = [@battler.mp, @mp_damage].min @hp_drain = @hp_damage if item.damage.drain? @mp_drain = @mp_damage if item.damage.drain? @hp_drain = [@battler.hp, @hp_drain].min @success = true if item.damage.to_hp? || @mp_damage != 0 elsif $game_switches[121]==false || @battler.actor? ==true make_damage_absorb(value, item) end end def enemy_absorb_text if $game_switches[121]==true && @value_absorb_1>0 fmt = @battler.actor? ? Absorb_text::TEXT_TE : Absorb_text::TEXT_TEXT sprintf(fmt,@battler.name, @value_absorb_1) end end alias hp_damage_text_absorb hp_damage_text def hp_damage_text if $game_switches[121]==true if @hp_drain > 0 fmt = @battler.actor? ? Vocab::ActorDrain : Absorb_text::TEXT_TE sprintf(fmt, @battler.name, Vocab::hp, @hp_drain) elsif @hp_damage > 0 fmt = @battler.actor? ? Vocab::ActorDamage : Absorb_text::TEXT_TE sprintf(fmt, @battler.name, @hp_damage) elsif @hp_damage < 0 fmt = @battler.actor? ? Vocab::ActorRecovery : Absorb_text::TEXT_TE sprintf(fmt, @battler.name, Vocab::hp, -hp_damage) else fmt = @battler.actor? ? Vocab::ActorNoDamage : Absorb_text::TEXT_TE sprintf(fmt, @battler.name) end elsif $game_switches[121]==false hp_damage_text_absorb end end end class Window_BattleLog alias display_damage_enemy_absorb display_damage def display_damage(target, item) display_hp_absorb(target, item)# if target.result.barrier?# display_damage_enemy_absorb(target, item) end def display_hp_absorb(target, item) add_text(target.result.enemy_absorb_text) wait end end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |