赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 91 |
经验 | 0 |
最后登录 | 2024-2-24 |
在线时间 | 463 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 9128
- 在线时间
- 463 小时
- 注册时间
- 2015-5-8
- 帖子
- 865
|
本帖最后由 taeckle 于 2019-7-16 21:59 编辑
报告菜刀王大神,我把这个2人或2人以上有状态100时平分伤害脚本这样写了,你可否帮咱看下哪里不对(目前好像有不少BUG..):
#==============================================================================
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 / $game_variables[666]
target_actor.damage = self.damage
@@dividingly=self.damage if self.index < target_actor.index
target_actor.hp -= self.damage
if self.index > target_actor.index and @aoeofenemy
target_actor.damage+=@@dividingly;self.damage+=@@dividingly;@aoeofenemy=false
end
end
return @hp - self.damage
end
#--------------------------------------------------------------------------
def share_object
f = [] ; ($game_party.actors + $game_troop.enemies).each {|i| f.push(i) if i.state?(100)}
return f.size > 1
$game_variables[666] = f.size
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
#============================================================================== |
|