设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4762|回复: 84
打印 上一主题 下一主题

[已经过期] 请教10号角色和20号角色同时在战斗队伍中时平分伤害的写法

[复制链接]

Lv5.捕梦者

梦石
0
星屑
33284
在线时间
10511 小时
注册时间
2009-3-15
帖子
4758
1
发表于 2019-7-3 19:53:11 | 显示全部楼层
本帖最后由 soulsaga 于 2019-7-7 09:23 编辑

RUBY 代码复制
  1. class Game_Battler
  2.   alias aoe_skill_effect skill_effect
  3. def skill_effect(user, skill)
  4.    @敌群攻=false
  5.    @敌群攻=true if $game_variables[17] > 1 and user.is_a?(Game_Enemy)
  6.    aoe_skill_effect(user, skill)
  7. end
  8. end

点评

写漏了..更新一下..  发表于 2019-7-3 20:02
多谢大神!  发表于 2019-7-3 19:57

评分

参与人数 1+1 收起 理由
taeckle + 1 大神威武!

查看全部评分

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33284
在线时间
10511 小时
注册时间
2009-3-15
帖子
4758
2
发表于 2019-7-4 16:59:10 | 显示全部楼层
话说群体攻击伤害怎么平分法?
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33284
在线时间
10511 小时
注册时间
2009-3-15
帖子
4758
3
发表于 2019-7-4 19:03:13 | 显示全部楼层
本帖最后由 soulsaga 于 2019-7-4 22:52 编辑

搞错了............

点评

这就是完整脚本啊..你还想要什么..  发表于 2019-7-4 23:10
好像这个脚本当我方第3个角色在场时受到群体攻击不掉血了,,  发表于 2019-7-4 20:30
结合上面芯☆淡茹水大神的脚本  发表于 2019-7-4 20:16
大神可否重开一楼把这个平分伤害的脚本完整的写在下面呐。。  发表于 2019-7-4 20:15
改好了  发表于 2019-7-4 19:28
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33284
在线时间
10511 小时
注册时间
2009-3-15
帖子
4758
4
发表于 2019-7-4 23:09:31 | 显示全部楼层
本帖最后由 soulsaga 于 2019-7-5 09:58 编辑

RUBY 代码复制
  1. #==============================================================================
  2. class Game_Actor
  3.   #--------------------------------------------------------------------------
  4.   alias :xr_sd_set_hp :hp=
  5.   def hp=(hp)
  6.     hp = self.damage.is_a?(Numeric) && self.damage > 0 ? share_damage : hp
  7.     xr_sd_set_hp(hp)
  8.     @recipient = false
  9.   end
  10.   #--------------------------------------------------------------------------
  11. def share_damage
  12.     target_actor = share_object
  13.     result = !!target_actor && target_actor.can_take_damage?
  14.     if result
  15.       @recipient = true
  16.       self.damage = self.damage / 2
  17.       target_actor.damage = self.damage
  18.       @平分伤害=self.damage if @平分伤害.nil?
  19.       if self.index > target_actor.index and @敌群攻
  20.       target_actor.hp -= self.damage;target_actor.damage+=self.damage;self.damage+=@平分伤害;@敌群攻=false
  21.       end
  22.   end
  23.   return @hp - self.damage
  24.   end
  25. #--------------------------------------------------------------------------
  26.   def share_object
  27.     return nil if ![10, 20].include?(@actor_id)
  28.     return $game_party.actors.find{|a| a.id == (@actor_id == 10 ? 20 : 10) }
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   def can_take_damage?
  32.     return !@recipient && exist?
  33.   end
  34. end
  35. #==============================================================================
  36. class Scene_Battle
  37.   #--------------------------------------------------------------------------
  38.   alias xr_sd_update_phase4_step5 update_phase4_step5
  39.   def update_phase4_step5
  40.     $game_party.actors.each{|a| a.damage_pop = !a.damage.nil?}
  41.     xr_sd_update_phase4_step5
  42.   end
  43. end
  44. #=============================================================================


这次3人正常..

点评

10号角色和20号角色受到的伤害数字显示一样,但两个角色真实扣除的HP不一样  发表于 2019-7-8 22:24
是显示正确实际伤害不对还是2人承受伤害量不同?  发表于 2019-7-8 14:57
我新建一个工程测试的,伤害数字显示一样,但真实扣除的HP不一样。。  发表于 2019-7-8 07:48
不是一样?  发表于 2019-7-7 20:21
报告大神,目前不会跳出了,伤害显示也都正确,我方第3者也有伤害扣除,只是10号和20角色真实扣除的HP还不是统一的。。  发表于 2019-7-7 19:36
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33284
在线时间
10511 小时
注册时间
2009-3-15
帖子
4758
5
发表于 2019-7-10 10:51:01 | 显示全部楼层
本帖最后由 soulsaga 于 2019-7-15 01:17 编辑
taeckle 发表于 2019-7-10 02:22
继续召唤大神。。平分伤害这4个字原来这么难。。


RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   def share_damage
  3.     target_actor = share_object
  4.     result = !!target_actor && target_actor.can_take_damage?
  5.     if result
  6.       @recipient = true
  7.       self.damage = self.damage / 2
  8.       target_actor.damage = self.damage
  9.       @@平分伤害=self.damage if self.index < target_actor.index
  10.       target_actor.hp -= self.damage
  11.       if self.index > target_actor.index and @敌群攻
  12.       target_actor.damage+=@@平分伤害;self.damage+=@@平分伤害;@敌群攻=false
  13.       end
  14.   end
  15.   return @hp - self.damage
  16.   end


更新脚本..测试正常..

点评

报告大神,是咱自己的打错字母的问题,现在没问题了,这个平分伤害的脚本完工了!  发表于 2019-7-16 06:38
问题来了,我把上面那个脚本所有3个“平分伤害”改成“dividingly”就不平分伤害了。。如果不改就还能平分,,,  发表于 2019-7-16 06:29
还有受到群体攻击技能攻击时也不平分伤害了。。。  发表于 2019-7-16 06:17
报告大神,目前最新的脚本当10号和20号受到带有群体攻击率的单体攻击技能攻击时,具体来说当此单体攻击技能变成群体攻击时,又不平分了。。  发表于 2019-7-16 06:11
已更新脚本..  发表于 2019-7-15 01:26
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-16 23:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表