#============================================================================== # RGSS2_SRPG2拡張 移動不可スキル敵対応 # 2011/09/02公開 # C Winter (http://ccwinter.blog.fc2.com/) #============================================================================== #============================================================================== # ■ Game_Enemy #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● 移動済みユニットの戦闘行動の作成 #-------------------------------------------------------------------------- def make_action_move_end @action.clear return unless movable? available_actions = [] rating_max = 0 for action in enemy.actions next unless conditions_met?(action) if action.kind == 1 next unless skill_can_use?($data_skills[action.skill_id]) end if $data_skills[action.skill_id].nomove? # next if $scene.event != nil #移動不可スキルは含めない end # available_actions.push(action) rating_max = [rating_max, action.rating].max end ratings_total = 0 rating_zero = rating_max - 3 for action in available_actions next if action.rating <= rating_zero ratings_total += action.rating - rating_zero end return if ratings_total == 0 value = rand(ratings_total) for action in available_actions next if action.rating <= rating_zero if value < action.rating - rating_zero @action.kind = action.kind @action.basic = action.basic @action.skill_id = action.skill_id @action.decide_random_target return else value -= action.rating - rating_zero end end end end #============================================================================== # ■ Scene_Srpg #============================================================================== class Scene_Srpg < Scene_Base #-------------------------------------------------------------------------- # ● 敵ターン更新 #update1.004 #update1.008 #update1.009 #-------------------------------------------------------------------------- def update_turn_enemy for event in $game_srpg.alive_enemy_list + $game_srpg.confuse_actor_list @event = event unless @event.action_end or @event.move_end # 移動も行動もまだ #~ unless (@event.action_end or @event.unit.action_end_for_state(false)) or #~ (@event.move_end or @event.unit.move_end_for_state(false)) # 移動も行動もまだ focus_event(@event) @status_window.refresh(@event) wait(20) @event.unit.make_action # 行動の決定 @event.unit.action.set_attack if @event.unit.berserker? # 狂戦士補正 @event.action_end = true if @event.unit.action_end_for_state(false) @event.move_end = true if @event.unit.move_end_for_state(false) end # 移動が終わっていなければ移動する unless @event.move_end or @event.unit.move_end_for_state(false) $game_srpg.scene_state = 101 if @event.move_target != nil ? update_enemy_move_target : update_enemy_move @event.move_end = true Graphics.frame_reset # フレームスキップ対策 return else @event.move_end = true if @event.action_end end end # 行動処理 unless @event.action_end or @event.unit.action_end_for_state(false) if @event.move_end #ユニットが移動済みなら @event.unit.make_action_move_end # else # @event.unit.make_action # end # $game_srpg.scene_state = 102 if @event.unit.action.nothing? # 何もしない場合 @event.action_end = true return end if update_enemy_action @event.action_end = true Graphics.frame_reset # フレームスキップ対策 return end @event.action_end = true return end return unless (@event.action_end or @event.unit.action_end_for_state(false)) and (@event.move_end or @event.unit.move_end_for_state(false)) if @event.action_rest > 0 # 複数回行動の処理 @event.action_rest -= 1 if @event.action_rest > 0 @event.action_end = false @event.move_end = false return end end end $game_srpg.change_turn # 味方ターンへ戻す $game_temp.refresh_status_window = $game_srpg.unit_list[@unit_list_index] end end