加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我的伤害公式判定存在漏洞,初衷是(被史莱姆打到后,注意是史莱姆打拥有ID300技能的人后,100%几率队伍各成员+5000的血,能P出来,说明进入判断了)
问题来了,如果是unless作为关键字,0号位正常加血,如果战斗中不存在1,2,3号位的角色,那么就会报错(报找不到"hp"的方法,这个我能理解);但如果用if作为关键字,则0号位不加血,应该怎么做判断,达到目的且不报错?求帮忙看看哪里出问题了,摸了一个小时{:2_254:}
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 = 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 self.skills.include?($data_skills[300])&&self.is_a?(Game_Actor) if rand(100)<100 $game_party.members[0].hp+=5000 unless $game_party.battle_members.include?(0) $game_party.members[1].hp+=5000 unless $game_party.battle_members.include?(1) $game_party.members[2].hp+=5000 unless $game_party.battle_members.include?(2) $game_party.members[3].hp+=5000 unless $game_party.battle_members.include?(3) p $game_party.members[0].hp p $game_party.members[1].hp # 4.times {|i|$game_party.members[i].hp+=self.def*5000 if $game_party.battle_members.include?(i) } p"├祈祷发动,生命值增加5000" else p"├×祈祷不触发" end end 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 = 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 self.skills.include?($data_skills[300])&&self.is_a?(Game_Actor)
if rand(100)<100
$game_party.members[0].hp+=5000 unless $game_party.battle_members.include?(0)
$game_party.members[1].hp+=5000 unless $game_party.battle_members.include?(1)
$game_party.members[2].hp+=5000 unless $game_party.battle_members.include?(2)
$game_party.members[3].hp+=5000 unless $game_party.battle_members.include?(3)
p $game_party.members[0].hp
p $game_party.members[1].hp
# 4.times {|i|$game_party.members[i].hp+=self.def*5000 if $game_party.battle_members.include?(i) }
p"├祈祷发动,生命值增加5000"
else
p"├×祈祷不触发"
end
end
end
|