Project1

标题: 如何改成在混乱时有可能攻击敌人 [打印本页]

作者: 天蓬元帥辦公室    时间: 2017-10-9 10:35
标题: 如何改成在混乱时有可能攻击敌人
想请教一下,在版本1.00中,如何改成在混乱时有可能攻击同伴,但也有可能攻击敌人? (简单来讲就是不分敌盟随机目标攻击)
作者: 正太君    时间: 2017-10-10 16:38
本帖最后由 正太君 于 2017-10-10 16:42 编辑

应该是找到这个定义修改,未测试,目测可行...
RUBY 代码复制
  1. def make_basic_action_result
  2.     # 攻击的情况下
  3.     if @active_battler.current_action.basic == 0
  4.       # 设置攻击 ID
  5.       @animation1_id = @active_battler.animation1_id
  6.       @animation2_id = @active_battler.animation2_id
  7.       # 行动方的战斗者是敌人的情况下
  8.       if @active_battler.is_a?(Game_Enemy)
  9.         if @active_battler.restriction == 3 # 改了以下两行...
  10.           target = $game_troop.random_target_enemy
  11.           target = $game_party.random_target_actor if rand(2) == 0
  12.         elsif @active_battler.restriction == 2
  13.           target = $game_party.random_target_actor
  14.         else
  15.           index = @active_battler.current_action.target_index
  16.           target = $game_party.smooth_target_actor(index)
  17.         end
  18.       end
  19.       # 行动方的战斗者是角色的情况下
  20.       if @active_battler.is_a?(Game_Actor)
  21.         if @active_battler.restriction == 3 # 改了以下两行...
  22.           target = $game_troop.random_target_enemy
  23.           target = $game_party.random_target_actor if rand(2) == 0
  24.         elsif @active_battler.restriction == 2
  25.           target = $game_troop.random_target_enemy
  26.         else
  27.           index = @active_battler.current_action.target_index
  28.           target = $game_troop.smooth_target_enemy(index)
  29.         end
  30.       end
  31.       # 设置对像方的战斗者序列
  32.       @target_battlers = [target]
  33.       # 应用通常攻击效果
  34.       for target in @target_battlers
  35.         target.attack_effect(@active_battler)
  36.       end
  37.       return
  38.     end
  39.     # 防御的情况下
  40.     if @active_battler.current_action.basic == 1
  41.       # 帮助窗口显示"防御"
  42.       @help_window.set_text($data_system.words.guard, 1)
  43.       return
  44.     end
  45.     # 逃跑的情况下
  46.     if @active_battler.is_a?(Game_Enemy) and
  47.        @active_battler.current_action.basic == 2
  48.       #  帮助窗口显示"逃跑"
  49.       @help_window.set_text("逃跑", 1)
  50.       # 逃跑
  51.       @active_battler.escape
  52.       return
  53.     end
  54.     # 什么也不做的情况下
  55.     if @active_battler.current_action.basic == 3
  56.       # 清除强制行动对像的战斗者
  57.       $game_temp.forcing_battler = nil
  58.       # 移至步骤 1
  59.       @phase4_step = 1
  60.       return
  61.     end
  62.   end









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