查看: 1600|回复: 2

[已经解决] 如何把所有攻击类型反弹给对方队伍的随机一个成员

[复制链接]
梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
发表于 2011-11-24 10:06:11 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
当战斗者为20号状态,把当前受到的所有攻击类型(包括普通、魔法和物理特技)反弹给对方队伍的随机一个成员,如果只在 Game_Battler 3 和 Scene_Battle 4 修改,应该怎么改?
囡囚囨囚囨図囨囧
梦石
0
星屑
65
在线时间
400 小时
注册时间
2005-10-24
回帖
579
发表于 2011-12-6 07:49:04 | 显示全部楼层
Scene_Battle 4中有很多地方都可以下手,set_target_battlers应该是比较好的选择
回复

使用道具 举报

梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
 楼主| 发表于 2011-12-7 09:18:54 | 显示全部楼层
本帖最后由 幻耶 于 2011-12-7 09:30 编辑

改成这样?对方攻击会出错啊:undefined method 'states?' for []:Array
  1.   def set_target_battlers(scope)
  2.     # 行动方的战斗者是敌人的情况下
  3.     if @active_battler.is_a?(Game_Enemy)
  4.       # 效果范围分支
  5.       case scope
  6.       when 1  # 敌单体
  7.         if @target_battlers.states.include?(20)
  8.           index = @active_battler.current_action.target_index
  9.           @target_battlers.push($game_troop.smooth_target_enemy(index))
  10.         else
  11.           index = @active_battler.current_action.target_index
  12.           @target_battlers.push($game_party.smooth_target_actor(index))
  13.         end
复制代码

点评

楼上说得没错,应该用诸如 for battler in @target_battlers 检查每一个攻击目标/特技作用  发表于 2011-12-7 12:24
数组没有states方法。。。  发表于 2011-12-7 10:27
囡囚囨囚囨図囨囧
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部