本帖最后由 soulsaga 于 2019-7-5 09:58 编辑
#============================================================================== class Game_Actor #-------------------------------------------------------------------------- alias :xr_sd_set_hp :hp= def hp=(hp) hp = self.damage.is_a?(Numeric) && self.damage > 0 ? share_damage : hp xr_sd_set_hp(hp) @recipient = false end #-------------------------------------------------------------------------- def share_damage target_actor = share_object result = !!target_actor && target_actor.can_take_damage? if result @recipient = true self.damage = self.damage / 2 target_actor.damage = self.damage @平分伤害=self.damage if @平分伤害.nil? if self.index > target_actor.index and @敌群攻 target_actor.hp -= self.damage;target_actor.damage+=self.damage;self.damage+=@平分伤害;@敌群攻=false end end return @hp - self.damage end #-------------------------------------------------------------------------- def share_object return nil if ![10, 20].include?(@actor_id) return $game_party.actors.find{|a| a.id == (@actor_id == 10 ? 20 : 10) } end #-------------------------------------------------------------------------- def can_take_damage? return !@recipient && exist? end end #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- alias xr_sd_update_phase4_step5 update_phase4_step5 def update_phase4_step5 $game_party.actors.each{|a| a.damage_pop = !a.damage.nil?} xr_sd_update_phase4_step5 end end #=============================================================================
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
alias :xr_sd_set_hp :hp=
def hp=(hp)
hp = self.damage.is_a?(Numeric) && self.damage > 0 ? share_damage : hp
xr_sd_set_hp(hp)
@recipient = false
end
#--------------------------------------------------------------------------
def share_damage
target_actor = share_object
result = !!target_actor && target_actor.can_take_damage?
if result
@recipient = true
self.damage = self.damage / 2
target_actor.damage = self.damage
@平分伤害=self.damage if @平分伤害.nil?
if self.index > target_actor.index and @敌群攻
target_actor.hp -= self.damage;target_actor.damage+=self.damage;self.damage+=@平分伤害;@敌群攻=false
end
end
return @hp - self.damage
end
#--------------------------------------------------------------------------
def share_object
return nil if ![10, 20].include?(@actor_id)
return $game_party.actors.find{|a| a.id == (@actor_id == 10 ? 20 : 10) }
end
#--------------------------------------------------------------------------
def can_take_damage?
return !@recipient && exist?
end
end
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
alias xr_sd_update_phase4_step5 update_phase4_step5
def update_phase4_step5
$game_party.actors.each{|a| a.damage_pop = !a.damage.nil?}
xr_sd_update_phase4_step5
end
end
#=============================================================================
这次3人正常.. |