设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2734|回复: 1
打印 上一主题 下一主题

[已经解决] 技能几率连击

[复制链接]

Lv1.梦旅人

梦石
0
星屑
65
在线时间
77 小时
注册时间
2015-6-18
帖子
32
跳转到指定楼层
1
发表于 2015-7-4 12:43:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x

比方说我希望使用这个技能后有不同的几率出现2~4次的连击情况。
当然每次连击的伤害都是固定。
看了很多的脚本都和我想的有一定的差别。

Lv3.寻梦者

梦石
0
星屑
1120
在线时间
381 小时
注册时间
2010-10-9
帖子
386

开拓者

2
发表于 2015-7-6 17:29:21 | 只看该作者
大概写了一个,很可能和其他与战斗有关的脚本发生冲突。
  1. #==============================================================================
  2. # ■ Scene_Battle (分割定义 4)
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的类。
  5. #==============================================================================

  6. $skill_slip = []
  7. #===============================================================================
  8. $skill_slip[57] = {}
  9. $skill_slip[57][2] = 90
  10. $skill_slip[57][3] = 10
  11. #技能的连击个数与概率的关系
  12. #连击个数包括了第一击
  13. #$skill_slip[57][2] = 90就表示57号技能发出两次连击的概率是九十
  14. #概率相加可以大于100,但是会达不到效果。
  15. #===============================================================================
  16. $skill_slip_text = "连击"
  17. #如果一个技能以连击形式发动,就会在技能名后面加上这两个字。
  18. #===============================================================================
  19. class Scene_Battle
  20.   #--------------------------------------------------------------------------
  21.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  22.   #--------------------------------------------------------------------------
  23.   def update_phase4_step1
  24.     # 隐藏帮助窗口
  25.     @help_window.visible = false
  26.     # 判定胜败
  27.     if judge
  28.       # 胜利或者失败的情况下 : 过程结束
  29.       return
  30.     end
  31.     # 强制行动的战斗者不存在的情况下
  32.     if $game_temp.forcing_battler == nil
  33.       # 设置战斗事件
  34.       setup_battle_event
  35.       # 执行战斗事件中的情况下
  36.       if $game_system.battle_interpreter.running?
  37.         return
  38.       end
  39.     end
  40.     # 强制行动的战斗者存在的情况下
  41.     if $game_temp.forcing_battler != nil
  42.       # 在头部添加后移动
  43.       @action_battlers.delete($game_temp.forcing_battler)
  44.       @action_battlers.unshift($game_temp.forcing_battler)
  45.     end
  46.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  47.     if @action_battlers.size == 0
  48.       # 开始同伴命令回合
  49.       start_phase2
  50.       return
  51.     end
  52.     # 初始化动画 ID 和公共事件 ID
  53.     @animation1_id = 0
  54.     @animation2_id = 0
  55.     @common_event_id = 0
  56.     # 未行动的战斗者移动到序列的头部
  57.     @active_battler = @action_battlers.shift
  58.     # 如果已经在战斗之外的情况下
  59.     if @active_battler.index == nil
  60.       return
  61.     end
  62.     # 连续伤害
  63.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  64.       @active_battler.slip_damage_effect
  65.       @active_battler.damage_pop = true
  66.     end
  67.     # 自然解除状态
  68.     @active_battler.remove_states_auto
  69.     # 刷新状态窗口
  70.     @status_window.refresh
  71.     # 移至步骤 2
  72.     @phase4_step = 2
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  76.   #--------------------------------------------------------------------------
  77.   def update_phase4_step2
  78.     # 如果不是强制行动
  79.     unless @active_battler.current_action.forcing
  80.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  81.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  82.         # 设置行动为攻击
  83.         @active_battler.current_action.kind = 0
  84.         @active_battler.current_action.basic = 0
  85.       end
  86.       # 限制为 [不能行动] 的情况下
  87.       if @active_battler.restriction == 4
  88.         # 清除行动强制对像的战斗者
  89.         $game_temp.forcing_battler = nil
  90.         # 移至步骤 1
  91.         @phase4_step = 1
  92.         return
  93.       end
  94.     end
  95.     # 清除对像战斗者
  96.     @target_battlers = []
  97.     # 行动种类分支
  98.     case @active_battler.current_action.kind
  99.     when 0  # 基本
  100.       make_basic_action_result
  101.     when 1  # 特技
  102.       id = @active_battler.current_action.skill_id
  103.       if $skill_slip[id] != nil
  104.        rate = []
  105.        poss = rand(100)
  106.        amount = 0
  107.        for i in $skill_slip[id].keys
  108.          for s in amount...(amount + $skill_slip[id][i])
  109.            rate[s] = i
  110.            end
  111.          amount += $skill_slip[id][i]
  112.        end
  113.        if rate[poss] != nil
  114.         @skill_slip_count = rate[poss] - 1
  115.         @active_battler.sp -= @skill.sp_cost
  116.       else
  117.         @skill_slip_count = 0
  118.       end
  119.     else
  120.         @skill_slip_count = 0
  121.      end      
  122.       make_skill_action_result
  123.     when 2  # 物品
  124.       make_item_action_result
  125.     end
  126.     # 移至步骤 3
  127.     if @phase4_step == 2
  128.       @phase4_step = 3
  129.     end
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 生成特技行动结果
  133.   #--------------------------------------------------------------------------
  134.   def make_skill_action_result
  135.     # 获取特技
  136.     @skill = $data_skills[@active_battler.current_action.skill_id]
  137.     # 如果不是强制行动
  138.     unless @active_battler.current_action.forcing
  139.       # 因为 SP 耗尽而无法使用的情况下
  140.       unless @active_battler.skill_can_use?(@skill.id)
  141.         # 清除强制行动对像的战斗者
  142.         $game_temp.forcing_battler = nil
  143.         # 移至步骤 1
  144.         @phase4_step = 1
  145.         return
  146.       end
  147.     end
  148.     # 消耗 SP
  149.     @active_battler.sp -= @skill.sp_cost if @skill_slip_count == 0
  150.     # 刷新状态窗口
  151.     @status_window.refresh
  152.     # 在帮助窗口显示特技名
  153.     if @skill_slip_count == 0
  154.     @help_window.set_text(@skill.name, 1)
  155.        else
  156.      @help_window.set_text(@skill.name+ $skill_slip_text, 1)
  157.      end
  158.     # 设置动画 ID
  159.     @animation1_id = @skill.animation1_id
  160.     @animation2_id = @skill.animation2_id
  161.     # 设置公共事件 ID
  162.     @common_event_id = @skill.common_event_id
  163.     # 设置对像侧战斗者
  164.     set_target_battlers(@skill.scope)
  165.     # 应用特技效果
  166.     for target in @target_battlers
  167.       target.skill_effect(@active_battler, @skill)
  168.     end
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  172.   #--------------------------------------------------------------------------
  173.   def update_phase4_step6
  174.     # 清除强制行动对像的战斗者
  175.     $game_temp.forcing_battler = nil
  176.     # 公共事件 ID 有效的情况下
  177.     if @common_event_id > 0
  178.       # 设置事件
  179.       common_event = $data_common_events[@common_event_id]
  180.       $game_system.battle_interpreter.setup(common_event.list, 0)
  181.     end
  182.     if @skill_slip_count == 0
  183.     # 移至步骤 1
  184.     @phase4_step = 1
  185.     else
  186.      make_skill_action_result
  187.      @skill_slip_count -= 1
  188.      @phase4_step = 3
  189.     end
  190.   end
  191. end
复制代码

点评

估计和其它脚本撞了,勉强靠设置公共事件的方式间接解决了,还是非常大大的感谢脚本=w=  发表于 2015-7-7 13:03

评分

参与人数 1星屑 +90 收起 理由
RyanBern + 90 塞糖

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-23 03:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表