没什么可说的。。。 
工程 
 
脚本 
RUBY 代码 - #==============================================================================
 - # ■ States_Restrict(封系状态)
 - #------------------------------------------------------------------------------
 - #
 - #   * 说明:脚本定义了新的限制,原状态限制作废。
 - #           不建议作为插件使用,最好和其他脚本整合一下(难度很低)。
 - #
 - #  * 命名:英语渣,大家就凑合看吧。
 - #
 - #   * 冲突:重定义了 update_phase4_step2       主回合步骤 2 : 开始行动
 - #           重定义了 make_basic_action_result  生成基本行动结果
 - #           重定义了 make_skill_action_result  生成特技行动结果
 - #           重定义了 make_item_action_result   生成物品行动结果
 - #
 - #==============================================================================
 - module States_Restrict
 -   # - 优先级(按照从低到高的顺序排列)
 -   Priority = []
 -   # * 攻击
 -   Priority[0] = ["B", "A", "C"]
 -   # * 特技
 -   Priority[1] = ["C", "B", "A"]
 -   # * 物品
 -   Priority[2] = ["C", "B", "A"]
 -   # - 设置
 -   A_States_Restrict_To_Attack = [16]  # 不可攻击
 -   B_States_Restrict_To_Attack = []    # 只能普通攻击敌人
 -   C_States_Restrict_To_Attack = [15]  # 只能普通攻击同伴
 -   A_States_Restrict_To_Skill = []     # 不可(使用)技能
 -   B_States_Restrict_To_Skill = [14]   # 只可对敌人(只能使用攻击类技能)
 -   C_States_Restrict_To_Skill = []     # 只可对同伴(只能使用辅助类技能)
 -   A_States_Restrict_To_Item = [13]    # 不可(使用)物品
 -   B_States_Restrict_To_Item = []      # 只可对敌人(只能使用暗器类物品)
 -   C_States_Restrict_To_Item = []      # 只可对同伴(只能使用辅助类物品)
 -   States_Restrict_To_Guard = [16]     # 不可防御
 -   # - 用语(不用管)
 -   A_States_Restrict_To_Attack_Word = "不可攻击"
 -   B_States_Restrict_To_Attack_Word = "只能普通攻击敌人"
 -   C_States_Restrict_To_Attack_Word = "只能普通攻击同伴"
 -   A_States_Restrict_To_Skill_Word = "不可(使用)技能"
 -   B_States_Restrict_To_Skill_Word = "只可对敌人"
 -   C_States_Restrict_To_Skill_Word = "只可对同伴"
 -   A_States_Restrict_To_Item_Word = "不可(使用)物品"
 -   B_States_Restrict_To_Item_Word = "只可对敌人"
 -   C_States_Restrict_To_Item_Word = "只可对同伴"
 -   States_Restrict_To_Guard_Word = "不可防御"
 - end
 - class Game_Battler
 -   def restriction_zhouzhou
 -     command = []
 -     # - 攻击指令
 -     for index inStates_Restrict::Priority[0]
 -       if index == "B"
 -         if(@states & States_Restrict::B_States_Restrict_To_Attack).size > 0
 -           command[0] = States_Restrict::B_States_Restrict_To_Attack_Word
 -         end
 -       elsif index == "A"
 -         if(@states & States_Restrict::A_States_Restrict_To_Attack).size > 0
 -           command[0] = States_Restrict::A_States_Restrict_To_Attack_Word
 -         end
 -       elsif index == "C"
 -         if(@states & States_Restrict::C_States_Restrict_To_Attack).size > 0
 -           command[0] = States_Restrict::C_States_Restrict_To_Attack_Word
 -         end
 -       end
 -     end
 -     # - 特技指令
 -     for index inStates_Restrict::Priority[1]
 -       if index == "C"
 -         if(@states & States_Restrict::C_States_Restrict_To_Skill).size > 0
 -           command[1] = States_Restrict::C_States_Restrict_To_Skill_Word
 -         end
 -       elsif index == "B"
 -         if(@states & States_Restrict::B_States_Restrict_To_Skill).size > 0
 -           command[1] = States_Restrict::B_States_Restrict_To_Skill_Word
 -         end
 -       elsif index == "A"
 -         if(@states & States_Restrict::A_States_Restrict_To_Skill).size > 0
 -           command[1] = States_Restrict::A_States_Restrict_To_Skill_Word
 -         end
 -       end
 -     end
 -     # - 物品指令
 -     for index inStates_Restrict::Priority[2]
 -       if index == "C"
 -         if(@states & States_Restrict::C_States_Restrict_To_Item).size > 0
 -           command[2] = States_Restrict::C_States_Restrict_To_Item_Word
 -         end
 -       elsif index == "B"
 -         if(@states & States_Restrict::B_States_Restrict_To_Item).size > 0
 -           command[2] = States_Restrict::B_States_Restrict_To_Item_Word
 -         end
 -       elsif index == "A"
 -         if(@states & States_Restrict::A_States_Restrict_To_Item).size > 0
 -           command[2] = States_Restrict::A_States_Restrict_To_Item_Word
 -         end
 -       end
 -     end
 -     # - 防御指令
 -     if(@states & States_Restrict::States_Restrict_To_Guard).size > 0
 -       command[3] = States_Restrict::States_Restrict_To_Guard_Word
 -     end
 -     return command
 -   end
 - end
 - # - 参战人数
 - class Game_Party
 -   def exist_size
 -     actor_size = 0
 -     for i in$game_party.actors
 -       actor_size += 1if i.exist?
 -     end
 -     return actor_size
 -   end
 - end
 - class Game_Troop
 -   def exist_size
 -     actor_size = 0
 -     for i in$game_troop.enemies
 -       actor_size += 1if i.exist?
 -     end
 -     return actor_size
 -   end
 - end
 - class Scene_Battle
 -   # - 检查限制
 -   def check_to_restrict
 -     re = @active_battler.restriction_zhouzhou
 -     # - 攻击
 -     if re[0] != nil
 -       # - 限制
 -       if(@active_battler.current_action.kind != 0or
 -         @active_battler.current_action.basic != 0)and
 -         re[0] != States_Restrict::A_States_Restrict_To_Attack_Word
 -         @active_battler.current_action.kind = 0
 -         @active_battler.current_action.basic = 0
 -       # - 无效指令
 -       elsif@active_battler.current_action.kind == 0and
 -         @active_battler.current_action.basic == 0and
 -         re[0] == States_Restrict::A_States_Restrict_To_Attack_Word
 -         # 清除行动强制对像的战斗者
 -         $game_temp.forcing_battler = nil
 -         # 移至步骤 1
 -         @phase4_step = 1
 -         return
 -       end
 -     end
 -     # - 特技
 -     if re[1] != nil
 -       if@active_battler.current_action.kind == 1and
 -         re[1] == States_Restrict::A_States_Restrict_To_Skill_Word
 -         # 清除行动强制对像的战斗者
 -         $game_temp.forcing_battler = nil
 -         # 移至步骤 1
 -         @phase4_step = 1
 -         return
 -       end
 -     end
 -     # - 物品
 -     if re[2] != nil
 -       if@active_battler.current_action.kind == 2and
 -         re[2] == States_Restrict::A_States_Restrict_To_Item_Word
 -         # 清除行动强制对像的战斗者
 -         $game_temp.forcing_battler = nil
 -         # 移至步骤 1
 -         @phase4_step = 1
 -         return
 -       end
 -     end
 -     # - 防御
 -     if re[3] != nil
 -       if@active_battler.current_action.kind == 0and
 -         @active_battler.current_action.basic == 1
 -         # 清除行动强制对像的战斗者
 -         $game_temp.forcing_battler = nil
 -         # 移至步骤 1
 -         @phase4_step = 1
 -         return
 -       end
 -     end
 -   end
 -   #--------------------------------------------------------------------------
 -   # ● 刷新画面 (主回合步骤 2 : 开始行动)
 -   #--------------------------------------------------------------------------
 -   def update_phase4_step2
 -     # 如果不是强制行动
 -     unless@active_battler.current_action.forcing
 -       check_to_restrict
 -     end
 -     # 清除对像战斗者
 -     @target_battlers = []
 -     # 行动种类分支
 -     case@active_battler.current_action.kind
 -     when0  # 基本
 -       make_basic_action_result
 -     when1  # 特技
 -       make_skill_action_result
 -     when2  # 物品
 -       make_item_action_result
 -     end
 -     # 移至步骤 3
 -     if@phase4_step == 2
 -       @phase4_step = 3
 -     end
 -   end
 -   #--------------------------------------------------------------------------
 -   # ● 生成基本行动结果
 -   #--------------------------------------------------------------------------
 -   def make_basic_action_result
 -     # 攻击的情况下
 -     if@active_battler.current_action.basic == 0
 -       re = @active_battler.restriction_zhouzhou[0]
 -       # 设置攻击 ID
 -       @animation1_id = @active_battler.animation1_id
 -       @animation2_id = @active_battler.animation2_id
 -       # 行动方的战斗者是敌人的情况下
 -       if@active_battler.is_a?(Game_Enemy)
 -         # - 普通攻击同伴
 -         if re == States_Restrict::C_States_Restrict_To_Attack_Word
 -           if$game_troop.exist_size > 1
 -             target = $game_troop.random_target_enemy
 -             while target == @active_battler
 -               target = $game_troop.random_target_enemy
 -             end
 -           else
 -             # 清除强制行动对像的战斗者
 -             $game_temp.forcing_battler = nil
 -             # 移至步骤 1
 -             @phase4_step = 1
 -             return
 -           end
 -         # - 普通攻击敌人
 -         elsif re == States_Restrict::B_States_Restrict_To_Attack_Word
 -           target = $game_party.random_target_actor
 -         # - 无限制
 -         elsif re == nil
 -           index = @active_battler.current_action.target_index
 -           target = $game_party.smooth_target_actor(index)
 -         else
 -           return
 -         end
 -       end
 -       # 行动方的战斗者是角色的情况下
 -       if@active_battler.is_a?(Game_Actor)
 -         # - 普通攻击同伴
 -         if re == States_Restrict::C_States_Restrict_To_Attack_Word
 -           if$game_party.exist_size > 1
 -             target = $game_party.random_target_actor
 -             while target == @active_battler
 -               target = $game_party.random_target_actor
 -             end
 -           else
 -             # 清除强制行动对像的战斗者
 -             $game_temp.forcing_battler = nil
 -             # 移至步骤 1
 -             @phase4_step = 1
 -             return
 -           end
 -         # - 普通攻击敌人
 -         elsif re == States_Restrict::B_States_Restrict_To_Attack_Word
 -           target = $game_troop.random_target_enemy
 -         # - 无限制
 -         elsif re == nil
 -           index = @active_battler.current_action.target_index
 -           target = $game_troop.smooth_target_enemy(index)
 -         else
 -           return
 -         end
 -       end
 -       # 设置对像方的战斗者序列
 -       @target_battlers = [target]
 -       # 应用通常攻击效果
 -       for target in@target_battlers
 -         target.attack_effect(@active_battler)
 -       end
 -       return
 -     end
 -     # 防御的情况下
 -     if@active_battler.current_action.basic == 1
 -       # 帮助窗口显示"防御"
 -       @help_window.set_text($data_system.words.guard, 1)
 -       return
 -     end
 -     # 逃跑的情况下
 -     if@active_battler.is_a?(Game_Enemy)and
 -        @active_battler.current_action.basic == 2
 -       #  帮助窗口显示"逃跑"
 -       @help_window.set_text("逃跑", 1)
 -       # 逃跑
 -       @active_battler.escape
 -       return
 -     end
 -     # 什么也不做的情况下
 -     if@active_battler.current_action.basic == 3
 -       # 清除强制行动对像的战斗者
 -       $game_temp.forcing_battler = nil
 -       # 移至步骤 1
 -       @phase4_step = 1
 -       return
 -     end
 -   end
 -   #--------------------------------------------------------------------------
 -   # ● 生成特技行动结果
 -   #--------------------------------------------------------------------------
 -   def make_skill_action_result
 -     re = @active_battler.restriction_zhouzhou[1]
 -     # 获取特技
 -     [url=home.php?mod=space&uid=260100]@skill[/url] = $data_skills[@active_battler.current_action.skill_id]
 -     # 如果不是强制行动
 -     unless@active_battler.current_action.forcing
 -       # 因为 SP 耗尽而无法使用的情况下
 -       unless@active_battler.skill_can_use?(@skill.id)
 -         # 清除强制行动对像的战斗者
 -         $game_temp.forcing_battler = nil
 -         # 移至步骤 1
 -         @phase4_step = 1
 -         return
 -       end
 -     end
 -     # 设置对像侧战斗者
 -     set_target_battlers(@skill.scope)
 -     # - 限制特技
 -     case re
 -     whenStates_Restrict::A_States_Restrict_To_Skill_Word
 -       # 清除强制行动对像的战斗者
 -       $game_temp.forcing_battler = nil
 -       # 移至步骤 1
 -       @phase4_step = 1
 -       return
 -     whenStates_Restrict::B_States_Restrict_To_Skill_Word
 -       if@active_battler.is_a?(Game_Actor)
 -         if@target_battlers[0].is_a?(Game_Actor)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       elsif@active_battler.is_a?(Game_Enemy)
 -         if@target_battlers[0].is_a?(Game_Enemy)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       end
 -     whenStates_Restrict::C_States_Restrict_To_Skill_Word
 -       if@active_battler.is_a?(Game_Actor)
 -         if@target_battlers[0].is_a?(Game_Enemy)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       elsif@active_battler.is_a?(Game_Enemy)
 -         if@target_battlers[0].is_a?(Game_Actor)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       end
 -     end
 -     # 消耗 SP
 -     @active_battler.sp -= @skill.sp_cost
 -     # 刷新状态窗口
 -     @status_window.refresh
 -     # 在帮助窗口显示特技名
 -     @help_window.set_text(@skill.name, 1)
 -     # 设置动画 ID
 -     @animation1_id = @skill.animation1_id
 -     @animation2_id = @skill.animation2_id
 -     # 设置公共事件 ID
 -     @common_event_id = @skill.common_event_id
 -     # 应用特技效果
 -     for target in@target_battlers
 -       target.skill_effect(@active_battler, @skill)
 -     end
 -   end
 -   #--------------------------------------------------------------------------
 -   # ● 生成物品行动结果
 -   #--------------------------------------------------------------------------
 -   def make_item_action_result
 -     re = @active_battler.restriction_zhouzhou[2]
 -     # 获取物品
 -     @item = $data_items[@active_battler.current_action.item_id]
 -     # 因为物品耗尽而无法使用的情况下
 -     unless$game_party.item_can_use?(@item.id)
 -       # 移至步骤 1
 -       @phase4_step = 1
 -       return
 -     end
 -     # 设置对像侧战斗者
 -     set_target_battlers(@item.scope)
 -     # - 限制物品
 -     case re
 -     whenStates_Restrict::A_States_Restrict_To_Item_Word
 -       # 清除强制行动对像的战斗者
 -       $game_temp.forcing_battler = nil
 -       # 移至步骤 1
 -       @phase4_step = 1
 -       return
 -     whenStates_Restrict::B_States_Restrict_To_Item_Word
 -       if@active_battler.is_a?(Game_Actor)
 -         if@target_battlers[0].is_a?(Game_Actor)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       elsif@active_battler.is_a?(Game_Enemy)
 -         if@target_battlers[0].is_a?(Game_Enemy)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       end
 -     whenStates_Restrict::C_States_Restrict_To_Item_Word
 -       if@active_battler.is_a?(Game_Actor)
 -         if@target_battlers[0].is_a?(Game_Enemy)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       elsif@active_battler.is_a?(Game_Enemy)
 -         if@target_battlers[0].is_a?(Game_Actor)
 -           # 清除强制行动对像的战斗者
 -           $game_temp.forcing_battler = nil
 -           # 移至步骤 1
 -           @phase4_step = 1
 -           return
 -         end
 -       end
 -     end
 -     # 消耗品的情况下
 -     if@item.consumable
 -       # 使用的物品减 1
 -       $game_party.lose_item(@item.id, 1)
 -     end
 -     # 在帮助窗口显示物品名
 -     @help_window.set_text(@item.name, 1)
 -     # 设置动画 ID
 -     @animation1_id = @item.animation1_id
 -     @animation2_id = @item.animation2_id
 -     # 设置公共事件 ID
 -     @common_event_id = @item.common_event_id
 -     # 应用物品效果
 -     for target in@target_battlers
 -       target.item_effect(@item)
 -     end
 -   end
 - end
 - #------------------------------------------------------------------------------
 
  复制代码
            本帖来自P1论坛作者恐惧剑刃,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=373273  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。  |