加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
这是在论坛找到的一个变量护盾脚本,当状态在角色上面时能正常的减少伤害,但是状态在敌人身上时就失效了(无法抵消伤害)
求大大帮忙改造下
class Game_Actor alias apply_guard_without_state apply_guard def apply_guard(value) value = apply_guard_without_state(value) if state?(50) && value > 0 v = $game_variables if v[30] >= value $Hurt_Shield = value $Magic_Shield = "have" v[30] -= value 0 else value -= v[30] $Hurt_Shield = value $Magic_Shield = "have" v[30] = 0 $game_party.members.each {|actor| actor.remove_state(50) } value end else $Magic_Shield = "" value end end end class Game_ActionResult #-------------------------------------------------------------------------- # ● 获取 HP 伤害的文字 #-------------------------------------------------------------------------- def hp_damage_text if @hp_drain > 0 fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain sprintf(fmt, @battler.name, Vocab::hp, @hp_drain) elsif @hp_damage > 0 fmt = @battler.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage sprintf(fmt, @battler.name, @hp_damage) elsif @hp_damage < 0 fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery sprintf(fmt, @battler.name, Vocab::hp, -hp_damage) elsif $Magic_Shield == "have" fmt = "魔法之盾抵消了%s点伤害" sprintf(fmt,$Hurt_Shield.to_i) else fmt = @battler.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage sprintf(fmt, @battler.name) end end end
class Game_Actor
alias apply_guard_without_state apply_guard
def apply_guard(value)
value = apply_guard_without_state(value)
if state?(50) && value > 0
v = $game_variables
if v[30] >= value
$Hurt_Shield = value
$Magic_Shield = "have"
v[30] -= value
0
else
value -= v[30]
$Hurt_Shield = value
$Magic_Shield = "have"
v[30] = 0
$game_party.members.each {|actor| actor.remove_state(50) }
value
end
else
$Magic_Shield = ""
value
end
end
end
class Game_ActionResult
#--------------------------------------------------------------------------
# ● 获取 HP 伤害的文字
#--------------------------------------------------------------------------
def hp_damage_text
if @hp_drain > 0
fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
sprintf(fmt, @battler.name, Vocab::hp, @hp_drain)
elsif @hp_damage > 0
fmt = @battler.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage
sprintf(fmt, @battler.name, @hp_damage)
elsif @hp_damage < 0
fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
sprintf(fmt, @battler.name, Vocab::hp, -hp_damage)
elsif $Magic_Shield == "have"
fmt = "魔法之盾抵消了%s点伤害"
sprintf(fmt,$Hurt_Shield.to_i)
else
fmt = @battler.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
sprintf(fmt, @battler.name)
end
end
end
|