Project1

标题: 关於自行设定技能的状态命中率 [打印本页]

作者: 柳橙汁    时间: 2011-4-27 15:26
标题: 关於自行设定技能的状态命中率
本帖最后由 柳橙汁 于 2011-4-27 15:27 编辑

我在Game_Battler 3的
# 状态变化
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)

下面添加了这段
for attacker in $game_party.actors + $game_troop.enemies
for target in $game_troop.enemies
if attacker.is_a?(Game_Actor) and target.is_a?(Game_Enemy) and skill.id == 3 and rand(100) < 50
target.add_state(30)
end
end
end
意思就是:如果攻击方使用3号技能时就有50%机率使该位敌人附加30号状态

后来我把这段后面注释掉 使其必定附加30号状态
if attacker.is_a?(Game_Actor) and target.is_a?(Game_Enemy) and skill.id == 3 #and rand(100) < 50
进行测试的时候发现
所有的敌人都会被附加30号状态!!!
注:3号技能为单体技

我想请问:
我这段要如何修改才不会对全体对象附加状态?


dsu_plus_rewardpost_czw
作者: pigsss    时间: 2011-4-27 16:15
for target in $game_troop.enemies 这句就包含了所有的敌人
最好在Scene_Battle 里设定这种,Scene_Battle 4 的step4——step5 都可以
作者: 柳橙汁    时间: 2011-4-27 16:46
本帖最后由 柳橙汁 于 2011-4-27 16:47 编辑

那这句 for target in $game_troop.enemies 要如何改?
作者: pigsss    时间: 2011-4-27 22:51
本帖最后由 pigsss 于 2011-4-27 22:52 编辑

回复 柳橙汁 的帖子
  1. #--------------------------------------------------------------------------
  2.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  3.   #--------------------------------------------------------------------------
  4.   def update_phase4_step4
  5.     # 对像方动画
  6.     for target in @target_battlers
  7.       target.animation_id = @animation2_id
  8.       target.animation_hit = (target.damage != "Miss")
  9.       #------------------------------
  10.       if @active_battler.current_action.skill_id == 3 and rand(100) < 50
  11.       target.add_state(30)
  12.       end
  13.       #------------------------------
  14.     end
  15.     # 限制动画长度、最低 8 帧
  16.     @wait_count = 8
  17.     # 移至步骤 5
  18.     @phase4_step = 5
  19.   end
复制代码

作者: 柳橙汁    时间: 2011-4-28 22:08
回复 pigsss 的帖子

感謝!! :loveliness:




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1