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

Project1

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

半自动即时战斗= =

 关闭 [复制链接]

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

跳转到指定楼层
1
发表于 2008-1-9 03:53:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
截图:


  1. #====================================================
  2. # 制作:夜无边

  3. # 版本:1。01

  4. # 冲突可能:未知,战斗类的脚本都可能。有问题请联系本人:

  5. # QQ:315339915 MSN: [email][email protected][/email]

  6. # 说明:把本脚本插入MAIN之前,平时战斗按C就可以呼出菜单。

  7. # 附注:本脚本附带了一个画血条的draw_meter,是从别人的脚本里截取出来的= =
  8. # 但我自己也忘记了具体是哪个脚本……于是向该作者表示感谢……(OJZ)

  9. # 关于蓄力速度的计算方法,默认是速度(agi)和一个固定值的反比。
  10. # 如有更好的方法请告诉我……
  11. #====================================================

  12. module LVQING
  13.   ATTACK=0 #在无法使用特技或道具时是否使用0普通攻击/1防御/2什么也不做
  14.   
  15.   SPEED=1 #蓄劲速度比例,1为平时,0~1变快(不能为0),大于1变慢
  16.   
  17.   # 回合的计算方式,0为按人数计算,每人行动完毕算一回合,1为按时间算,
  18.   # 固定循环了某一祯数为一回合,循环数在下边TIME设定。
  19.   # 主要是为了方便设置战斗事件和考虑不能行动的状态。
  20.   TURN=1
  21.   TIME=100
  22.   
  23.   #这个最好不要改,是设定一次攻击之后,隔多少祯才能再按出菜单来。
  24.   # 为0的话会有问题的……不然自己试试就明白了= =bb
  25.   INPUT=20
  26. end
  27. #====================================================

  28. class Game_Battler
  29.   attr_accessor :ct
  30.   attr_accessor :maxct
  31.   def initialize
  32.     @battler_name = ""
  33.     @battler_hue = 0
  34.     @hp = 0
  35.     @sp = 0
  36.     @states = []
  37.     @states_turn = {}
  38.     @maxhp_plus = 0
  39.     @maxsp_plus = 0
  40.     @str_plus = 0
  41.     @dex_plus = 0
  42.     @agi_plus = 0
  43.     @int_plus = 0
  44.     @hidden = false
  45.     @immortal = false
  46.     @damage_pop = false
  47.     @damage = nil
  48.     @critical = false
  49.     @animation_id = 0
  50.     @animation_hit = false
  51.     @white_flash = false
  52.     @blink = false
  53.     @current_action = Game_BattleAction.new
  54.     @ct=0
  55.     @maxct=0
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 获取 MaxCT
  59.   #--------------------------------------------------------------------------
  60.   def maxct
  61.     n=10000
  62.     return n
  63.   end
  64.   #--------------------------------------------------------------------------
  65. end
  66. class Window_Base < Window

  67.   #--------------------------------------------------------------------------
  68.   # ○ ゲージを描画
  69.   #--------------------------------------------------------------------------
  70.   def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
  71.     color=Color.new(128, 128, 128, 128)
  72.     color1 = Color.new(192, 192, 192, 255)
  73.     self.contents.fill_rect(x, y, width, height, color1)
  74.     self.contents.fill_rect(x+1,y+1, width-1*2, height-1*2, color)
  75.     now = now > max ? max : now
  76.     percentage = max != 0 ? (width-2) * now / max.to_f : 0
  77.     if start_color == end_color
  78.       self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
  79.     else
  80.       for i in 1..percentage
  81.         r = start_color.red + (end_color.red - start_color.red) / percentage * i
  82.         g = start_color.green + (end_color.green - start_color.green) / percentage * i
  83.         b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
  84.         a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
  85.         self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
  86.       end
  87.     end
  88.   end
  89. end
  90. #==============================================================================
  91. # ■ Scene_Battle (分割定义 1)
  92. #------------------------------------------------------------------------------
  93. #  处理战斗画面的类。
  94. #==============================================================================

  95. class Scene_Battle

  96.   #--------------------------------------------------------------------------
  97.   # ● 主处理
  98.   #--------------------------------------------------------------------------
  99.   def main
  100.     @jjudge=LVQING::INPUT
  101.     @st=0
  102.     # 初始化战斗用的各种暂时数据
  103.     $game_temp.in_battle = true
  104.     $game_temp.battle_turn = 0
  105.     $game_temp.battle_event_flags.clear
  106.     $game_temp.battle_abort = false
  107.     $game_temp.battle_main_phase = false
  108.     $game_temp.battleback_name = $game_map.battleback_name
  109.     $game_temp.forcing_battler = nil
  110.     #-----------------------------------
  111.     # 初始化战斗用事件解释器
  112.     $game_system.battle_interpreter.setup(nil, 0)
  113.     # 准备队伍
  114.     @active_actor
  115.     @action_battlers=[]
  116.     @troop_id = $game_temp.battle_troop_id
  117.     $game_troop.setup(@troop_id)
  118.     # 生成角色命令窗口
  119.     s1 = $data_system.words.attack
  120.     s2 = $data_system.words.skill
  121.     s3 = $data_system.words.guard
  122.     s4 = $data_system.words.item
  123.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,"逃跑"])
  124.     @actor_command_window.y = 128
  125.     @actor_command_window.active = false
  126.     @actor_command_window.visible = false
  127.     # 生成其它窗口
  128.     @help_window = Window_Help.new
  129.     @help_window.back_opacity = 160
  130.     @help_window.visible = false
  131.     @status_window = Window_BattleStatus.new
  132.     @message_window = Window_Message.new
  133.       for battler in $game_party.actors
  134.         battler.ct=rand(100)
  135.       end
  136.       for battler in $game_troop.enemies
  137.         battler.ct=rand(100)
  138.       end
  139.     # 生成活动块
  140.     @spriteset = Spriteset_Battle.new
  141.     # 初始化等待计数
  142.     @wait_count = 0
  143.     # 执行过渡
  144.     if $data_system.battle_transition == ""
  145.       Graphics.transition(20)
  146.     else
  147.       Graphics.transition(40, "Graphics/Transitions/" +
  148.         $data_system.battle_transition)
  149.     end
  150.     # 开始自由战斗回合
  151.     start_phase1
  152.     # 主循环
  153.     loop do
  154.       # 刷新游戏画面
  155.       Graphics.update
  156.       # 刷新输入信息
  157.       Input.update
  158.       # 刷新画面
  159.       update
  160.       # 如果画面切换的话就中断循环
  161.       if $scene != self
  162.         break
  163.       end
  164.     end
  165.     # 刷新地图
  166.     $game_map.refresh
  167.     # 准备过渡
  168.     Graphics.freeze
  169.     @actor_command_window.dispose
  170.     @help_window.dispose
  171.     @status_window.dispose
  172.     @message_window.dispose
  173.     if @skill_window != nil
  174.       @skill_window.dispose
  175.     end
  176.     if @item_window != nil
  177.       @item_window.dispose
  178.     end
  179.     if @result_window != nil
  180.       @result_window.dispose
  181.     end
  182.     # 释放活动块
  183.     @spriteset.dispose
  184.     # 标题画面切换中的情况
  185.     if $scene.is_a?(Scene_Title)
  186.       # 淡入淡出画面
  187.       Graphics.transition
  188.       Graphics.freeze
  189.     end
  190.     # 战斗测试或者游戏结束以外的画面切换中的情况
  191.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  192.       $scene = nil
  193.     end
  194.   end

  195.   #--------------------------------------------------------------------------
  196.   # ● 刷新画面
  197.   #--------------------------------------------------------------------------
  198.   def update
  199.     # 执行战斗事件中的情况下
  200.     if $game_system.battle_interpreter.running?
  201.       # 刷新解释器
  202.       $game_system.battle_interpreter.update
  203.       # 强制行动的战斗者不存在的情况下
  204.       if $game_temp.forcing_battler == nil
  205.         # 执行战斗事件结束的情况下
  206.         unless $game_system.battle_interpreter.running?
  207.           # 继续战斗的情况下、再执行战斗事件的设置
  208.           unless judge
  209.             setup_battle_event
  210.           end
  211.         end
  212.         # 如果不是结束战斗回合的情况下
  213.         if @phase != 5
  214.           # 刷新状态窗口
  215.           @status_window.refresh
  216.         end
  217.       end
  218.     end
  219.     # 系统 (计时器)、刷新画面
  220.     $game_system.update
  221.     $game_screen.update
  222.     # 计时器为 0 的情况下
  223.     if $game_system.timer_working and $game_system.timer == 0
  224.       # 中断战斗
  225.       $game_temp.battle_abort = true
  226.     end
  227.     # 刷新窗口
  228.     @help_window.update
  229.     #@party_command_window.update
  230.     @actor_command_window.update
  231.     @status_window.update
  232.     @message_window.update
  233.     # 刷新活动块
  234.     @spriteset.update
  235.     # 处理过渡中的情况下
  236.     if $game_temp.transition_processing
  237.       # 清除处理过渡中标志
  238.       $game_temp.transition_processing = false
  239.       # 执行过渡
  240.       if $game_temp.transition_name == ""
  241.         Graphics.transition(20)
  242.       else
  243.         Graphics.transition(40, "Graphics/Transitions/" +
  244.           $game_temp.transition_name)
  245.       end
  246.     end
  247.     # 显示信息窗口中的情况下
  248.     if $game_temp.message_window_showing
  249.       return
  250.     end
  251.     # 显示效果中的情况下
  252.     if @spriteset.effect?
  253.       return
  254.     end
  255.     # 游戏结束的情况下
  256.     if $game_temp.gameover
  257.       # 切换到游戏结束画面
  258.       $scene = Scene_Gameover.new
  259.       return
  260.     end
  261.     # 返回标题画面的情况下
  262.     if $game_temp.to_title
  263.       # 切换到标题画面
  264.       $scene = Scene_Title.new
  265.       return
  266.     end
  267.     # 中断战斗的情况下
  268.     if $game_temp.battle_abort
  269.       # 还原为战斗前的 BGM
  270.       $game_system.bgm_play($game_temp.map_bgm)
  271.       # 战斗结束
  272.       battle_end(1)
  273.       return
  274.     end
  275.     # 等待中的情况下
  276.     if @wait_count > 0
  277.       # 减少等待计数
  278.       @wait_count -= 1
  279.       return
  280.     end
  281.     # 强制行动的角色存在、
  282.     # 并且战斗事件正在执行的情况下
  283.     if $game_temp.forcing_battler == nil and
  284.       $game_system.battle_interpreter.running?
  285.       return
  286.     end
  287.     update_ct
  288.     # 回合分支
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● 刷新CT
  292.   #--------------------------------------------------------------------------
  293.   def judge_ct
  294.     return @actor_command_window.visible == false && @phase !=3 && @phase != 5 && @phase != 4 && @item_window == nil && @skill_window == nil
  295.   end

  296.   def update_ct
  297.     case @phase
  298.         when 0
  299.           if @jjudge <20
  300.             @jjudge += 1
  301.           end
  302.         when 1  # 自由战斗回合
  303.           update_phase1
  304.         when 3  # 角色命令回合
  305.           update_phase3
  306.         when 4
  307.           update_phase4
  308.         when 5  # 战斗结束回合
  309.           update_phase5
  310.         end
  311.     if judge_ct
  312.       for i in 0...$game_party.actors.size
  313.       actor = $game_party.actors[i]
  314.         if actor.movable? && !actor.dead?
  315.           if actor.ct < 10000
  316.           actor.ct += actor.agi/LVQING::SPEED
  317.           else
  318.           @active_actor=actor
  319.           @action_battlers.push(@active_actor)
  320.           actor.ct=0
  321.               # 搜索全页的战斗事件
  322.             for index in 0...$data_troops[@troop_id].pages.size
  323.               # 获取事件页
  324.               page = $data_troops[@troop_id].pages[index]
  325.               # 本页的范围是 [回合] 的情况下
  326.               if page.span == 1
  327.                 # 设置已经执行标志
  328.                 $game_temp.battle_event_flags[index] = false
  329.               end
  330.             end
  331.           end
  332.           @status_window.refresh_ct(actor)
  333.         end
  334.       end
  335.       for i in 0...$game_troop.enemies.size
  336.         enemy = $game_troop.enemies[i]
  337.         if enemy.movable? && !enemy.dead?
  338.           if enemy.ct < 10000
  339.             enemy.ct += enemy.agi/LVQING::SPEED
  340.           else         
  341.             @active_actor=enemy
  342.             @action_battlers.push(@active_actor)
  343.             enemy.ct=0
  344.                 # 搜索全页的战斗事件
  345.             for index in 0...$data_troops[@troop_id].pages.size
  346.               # 获取事件页
  347.               page = $data_troops[@troop_id].pages[index]
  348.               # 本页的范围是 [回合] 的情况下
  349.               if page.span == 1
  350.                 # 设置已经执行标志
  351.                 $game_temp.battle_event_flags[index] = false
  352.               end
  353.             end
  354.           end
  355.         end
  356.       end

  357.           # 自然解除状态
  358.     #==========================================
  359.     if LVQING::TURN == 1
  360.     #@active_battler.remove_states_auto
  361.     if @st < LVQING::TIME
  362.       @st+=1
  363.     else
  364.       $game_temp.battle_turn += 1
  365.       for battler in $game_party.actors
  366.          battler.remove_states_auto
  367.       end
  368.       for battler in $game_troop.enemies
  369.          battler.remove_states_auto
  370.        end
  371.        @st=0
  372.      end
  373.     end
  374.     #==========================================
  375.       if @action_battlers != []
  376.         start_phase4
  377.       end
  378.       if Input.trigger?(Input::C) && judge_ct && (@jjudge == LVQING::INPUT)
  379.         start_phase3
  380.       end
  381.     end
  382.   end
  383. #======================scene_battle2===============================
  384.   def start_phase1
  385.     # 转移到回合 1
  386.     @phase = 1
  387.     # 清除全体同伴的行动
  388.     $game_party.clear_actions
  389.     # 设置战斗事件
  390.     setup_battle_event
  391.   end
  392.   def update_phase1
  393.     # 胜败判定
  394.     if judge
  395.       # 胜利或者失败的情况下 : 过程结束
  396.       return
  397.     end
  398.     # 开始同伴命令回合
  399.     start_phase3
  400.   end
  401.   def update_phase2_escape
  402.     # 计算敌人速度的平均值
  403.     enemies_agi = 0
  404.     enemies_number = 0
  405.     for enemy in $game_troop.enemies
  406.       if enemy.exist?
  407.         enemies_agi += enemy.agi
  408.         enemies_number += 1
  409.       end
  410.     end
  411.     if enemies_number > 0
  412.       enemies_agi /= enemies_number
  413.     end
  414.     # 计算角色速度的平均值
  415.     actors_agi = 0
  416.     actors_number = 0
  417.     for actor in $game_party.actors
  418.       if actor.exist?
  419.         actors_agi += actor.agi
  420.         actors_number += 1
  421.       end
  422.     end
  423.     if actors_number > 0
  424.       actors_agi /= actors_number
  425.     end
  426.     # 逃跑成功判定
  427.     success = rand(100) < 50 * actors_agi / enemies_agi
  428.     # 成功逃跑的情况下
  429.     if success
  430.       # 演奏逃跑 SE
  431.       $game_system.se_play($data_system.escape_se)
  432.       $game_system.bgm_play($game_temp.map_bgm)
  433.       # 战斗结束
  434.       battle_end(1)
  435.     # 逃跑失败的情况下
  436.       else
  437.       # 清除全体同伴的行动
  438.       # 开始主回合
  439.       @actor_command_window.visible=false
  440.       @actor_command_window.active=false
  441.     end
  442.   end
  443.   def phase3_setup_command_window
  444.     # 角色指令窗口无效化
  445.     @actor_command_window.active = true
  446.     @actor_command_window.visible = true
  447.     # 设置角色指令窗口的位置
  448.     @actor_command_window.x = @actor_index * 160
  449.     # 设置索引为 0
  450.     @actor_command_window.index = 0
  451.   end

  452.   def start_phase3
  453.     @phase = 3
  454.     @actor_index = -1
  455.     @active_battler = nil
  456.     phase3_next_actor
  457.   end
  458.   def phase3_next_actor
  459.     # 循环
  460.     begin
  461.       # 角色的明灭效果 OFF
  462.       if @active_battler != nil
  463.         @active_battler.blink = false
  464.       end
  465.       # 最后的角色的情况
  466.       if @actor_index == $game_party.actors.size-1
  467.         @jjudge=0
  468.         @actor_command_window.active = false
  469.         @actor_command_window.visible = false
  470.         @actor_index=-1
  471.         @phase = 0
  472.         return
  473.       end
  474.       # 推进角色索引
  475.       @actor_index += 1
  476.       @active_battler = $game_party.actors[@actor_index]
  477.       @active_battler.blink = true
  478.     # 如果角色是在无法接受指令的状态就再试
  479.     end until @active_battler.inputable?
  480.     # 设置角色的命令窗口
  481.     phase3_setup_command_window
  482.   end
  483.   def phase3_prior_actor
  484.     # 循环
  485.     begin
  486.       # 角色的明灭效果 OFF
  487.       if @active_battler != nil
  488.         @active_battler.blink = false
  489.       end
  490.       # 最初的角色的情况下
  491.       if @actor_index == 0
  492.           @actor_command_window.visible=false
  493.           @actor_command_window.active=false
  494.           @phase=0
  495.         return
  496.       end
  497.       # 返回角色索引
  498.       @actor_index -= 1
  499.       @active_battler = $game_party.actors[@actor_index]
  500.       @active_battler.blink = true
  501.     # 如果角色是在无法接受指令的状态就再试
  502.     end until @active_battler.inputable?
  503.     # 设置角色的命令窗口
  504.     phase3_setup_command_window
  505.   end
  506.   def phase3_setup_command_window
  507.     # 角色指令窗口无效化
  508.     @actor_command_window.active = true
  509.     @actor_command_window.visible = true
  510.     # 设置角色指令窗口的位置
  511.     @actor_command_window.x = 240
  512.     # 设置索引为 0
  513.     @actor_command_window.index = 0
  514.   end
  515. end
  516. class Scene_Battle
  517.   def start_phase4
  518.     # 转移到回合 4
  519.     @phase = 4
  520.     # 回合数计数
  521.     # 搜索全页的战斗事件
  522.     for index in 0...$data_troops[@troop_id].pages.size
  523.       # 获取事件页
  524.       page = $data_troops[@troop_id].pages[index]
  525.       # 本页的范围是 [回合] 的情况下
  526.       if page.span == 1
  527.         # 设置已经执行标志
  528.         $game_temp.battle_event_flags[index] = false
  529.       end
  530.     end
  531.     # 设置角色为非选择状态
  532.     @actor_index = -1
  533.     @active_battler = nil
  534.     @actor_command_window.active = false
  535.     @actor_command_window.visible = false
  536.     # 设置主回合标志
  537.     $game_temp.battle_main_phase = true
  538.     # 生成敌人行动
  539.     for enemy in $game_troop.enemies
  540.       enemy.make_action
  541.     end
  542.     #-----------------------------------------
  543.     # 生成行动顺序
  544.     # 移动到步骤 1
  545.     @phase4_step = 1
  546.     #----------------------------------------
  547.   end
  548.   def update_phase4_step1
  549.     # 隐藏帮助窗口
  550.     @help_window.visible = false
  551.     # 判定胜败
  552.     if judge
  553.       # 胜利或者失败的情况下 : 过程结束
  554.       return
  555.     end
  556.     # 强制行动的战斗者不存在的情况下
  557.     if $game_temp.forcing_battler == nil
  558.       # 设置战斗事件
  559.       setup_battle_event
  560.       # 执行战斗事件中的情况下
  561.       if $game_system.battle_interpreter.running?
  562.         return
  563.       end
  564.     end
  565.     # 强制行动的战斗者存在的情况下
  566.     if $game_temp.forcing_battler != nil
  567.       # 在头部添加后移动
  568.       @action_battlers.delete($game_temp.forcing_battler)
  569.       @action_battlers.unshift($game_temp.forcing_battler)
  570.     end
  571.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  572.     if @action_battlers.size == 0
  573.       @phase=0
  574.       return
  575.     end
  576.     # 初始化动画 ID 和公共事件 ID
  577.     @animation1_id = 0
  578.     @animation2_id = 0
  579.     @common_event_id = 0
  580.     # 未行动的战斗者移动到序列的头部
  581.     @active_battler = @action_battlers.shift
  582.     # 如果已经在战斗之外的情况下
  583.     if @active_battler.index == nil
  584.       return
  585.     end
  586.     # 连续伤害
  587.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  588.       @active_battler.slip_damage_effect
  589.       @active_battler.damage_pop = true
  590.     end
  591.     # 自然解除状态
  592.     #==========================================
  593.     if LVQING::TURN == 0
  594.     $game_temp.battle_turn += 1
  595.     #@active_battler.remove_states_auto
  596.     if @st < $game_party.actors.size+$game_troop.enemies.size
  597.       @st+=1
  598.     else
  599.       for battler in $game_party.actors
  600.          battler.remove_states_auto
  601.       end
  602.       for battler in $game_troop.enemies
  603.          battler.remove_states_auto
  604.        end
  605.        @st=0
  606.      end
  607.     end
  608.     #==========================================

  609.     # 刷新状态窗口
  610.     @status_window.refresh
  611.     # 移至步骤 2
  612.     @phase4_step = 2
  613.   end

  614.   def make_skill_action_result
  615.     # 获取特技
  616.     @skill = $data_skills[@active_battler.current_action.skill_id]
  617.     # 如果不是强制行动
  618.     unless @active_battler.current_action.forcing
  619.       # 因为 SP 耗尽而无法使用的情况下
  620.       unless @active_battler.skill_can_use?(@skill.id)
  621.         # 清除强制行动对像的战斗者
  622. #-------------------------------------------------

  623.     if LVQING::ATTACK==0
  624.         @active_battler.current_action.kind = 0
  625.         @active_battler.current_action.basic = 0
  626.         make_basic_action_result
  627.         return
  628.       end
  629.     if LVQING::ATTACK==1
  630.       @active_battler.current_action.kind = 0
  631.       @active_battler.current_action.basic =1
  632.       # 帮助窗口显示"防御"
  633.       @help_window.set_text($data_system.words.guard, 1)
  634.       @phase4_step=1
  635.       return
  636.     end
  637.     if LVQING::ATTACK==2
  638.       $game_temp.forcing_battler = nil
  639.         # 移至步骤 1
  640.       @phase4_step = 1
  641.       return
  642.     end
  643. #-------------------------------------------------   
  644.     end
  645.     end
  646.     # 消耗 SP
  647.     @active_battler.sp -= @skill.sp_cost
  648.     # 刷新状态窗口
  649.     @status_window.refresh
  650.     # 在帮助窗口显示特技名
  651.     @help_window.set_text(@skill.name, 1)
  652.     # 设置动画 ID
  653.     @animation1_id = @skill.animation1_id
  654.     @animation2_id = @skill.animation2_id
  655.     # 设置公共事件 ID
  656.     @common_event_id = @skill.common_event_id
  657.     # 设置对像侧战斗者
  658.     set_target_battlers(@skill.scope)
  659.     # 应用特技效果
  660.     for target in @target_battlers
  661.       target.skill_effect(@active_battler, @skill)
  662.     end
  663.   end
  664.   def make_item_action_result
  665.     # 获取物品
  666.     @item = $data_items[@active_battler.current_action.item_id]
  667.     # 因为物品耗尽而无法使用的情况下
  668.     unless $game_party.item_can_use?(@item.id)
  669. #-------------------------------------------------

  670.       if LVQING::ATTACK==0
  671.           @active_battler.current_action.kind = 0
  672.           @active_battler.current_action.basic = 0
  673.           make_basic_action_result
  674.           return
  675.         end
  676.       if LVQING::ATTACK==1
  677.         @active_battler.current_action.kind = 0
  678.         @active_battler.current_action.basic =1
  679.         # 帮助窗口显示"防御"
  680.         @help_window.set_text($data_system.words.guard, 1)
  681.         @phase4_step=1
  682.         return
  683.       end
  684.       if LVQING::ATTACK==2
  685.         $game_temp.forcing_battler = nil
  686.           # 移至步骤 1
  687.         @phase4_step = 1
  688.         return
  689.       end
  690. #-------------------------------------------------
  691.     end
  692.     if @item.consumable
  693.       $game_party.lose_item(@item.id, 1)
  694.     end
  695.     @help_window.set_text(@item.name, 1)
  696.     @animation1_id = @item.animation1_id
  697.     @animation2_id = @item.animation2_id
  698.     @common_event_id = @item.common_event_id
  699.     index = @active_battler.current_action.target_index
  700.     target = $game_party.smooth_target_actor(index)
  701.     set_target_battlers(@item.scope)
  702.     for target in @target_battlers
  703.       target.item_effect(@item)
  704.     end
  705.   end
  706. end

  707. #----------------------------------------------------
  708. class Window_BattleStatus < Window_Base
  709.   def refresh
  710.     self.contents.clear
  711.     @item_max = $game_party.actors.size
  712.     for i in 0...$game_party.actors.size
  713.       actor = $game_party.actors[i]
  714.       actor_x = i * 160 + 4
  715.       draw_actor_name(actor, actor_x, 0)
  716.       draw_actor_hp(actor, actor_x, 22, 120)
  717.       draw_actor_sp(actor, actor_x, 44, 120)
  718.       @ct_color1 = Color.new(255,160,255,255)
  719.       @ct_color2 = Color.new(145,100,255,255)
  720.       draw_meter(actor.ct, actor.maxct, actor_x, 102, 108, 12, @ct_color1, @ct_color2)
  721.       if @level_up_flags[i]
  722.         self.contents.font.color = normal_color
  723.         self.contents.draw_text(actor_x, 72, 120, 32, "LEVEL UP!")
  724.       else
  725.         draw_actor_state(actor, actor_x,72)
  726.       end
  727.       #--------------------------------
  728.     end
  729.   end
  730.   def refresh_ct(actor)
  731.     actor_x = actor.index * 160 + 4
  732.     draw_meter(actor.ct, actor.maxct, actor_x, 102, 108, 12,  @ct_color1, @ct_color2)
  733.   end
  734. end
复制代码


              [本贴由 御灵 于 2008-1-24 23:07:36 进行了编辑]
我的Lofter:http://nightoye.lofter.com/

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

2
 楼主| 发表于 2008-1-9 03:53:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
截图:


  1. #====================================================
  2. # 制作:夜无边

  3. # 版本:1。01

  4. # 冲突可能:未知,战斗类的脚本都可能。有问题请联系本人:

  5. # QQ:315339915 MSN: [email][email protected][/email]

  6. # 说明:把本脚本插入MAIN之前,平时战斗按C就可以呼出菜单。

  7. # 附注:本脚本附带了一个画血条的draw_meter,是从别人的脚本里截取出来的= =
  8. # 但我自己也忘记了具体是哪个脚本……于是向该作者表示感谢……(OJZ)

  9. # 关于蓄力速度的计算方法,默认是速度(agi)和一个固定值的反比。
  10. # 如有更好的方法请告诉我……
  11. #====================================================

  12. module LVQING
  13.   ATTACK=0 #在无法使用特技或道具时是否使用0普通攻击/1防御/2什么也不做
  14.   
  15.   SPEED=1 #蓄劲速度比例,1为平时,0~1变快(不能为0),大于1变慢
  16.   
  17.   # 回合的计算方式,0为按人数计算,每人行动完毕算一回合,1为按时间算,
  18.   # 固定循环了某一祯数为一回合,循环数在下边TIME设定。
  19.   # 主要是为了方便设置战斗事件和考虑不能行动的状态。
  20.   TURN=1
  21.   TIME=100
  22.   
  23.   #这个最好不要改,是设定一次攻击之后,隔多少祯才能再按出菜单来。
  24.   # 为0的话会有问题的……不然自己试试就明白了= =bb
  25.   INPUT=20
  26. end
  27. #====================================================

  28. class Game_Battler
  29.   attr_accessor :ct
  30.   attr_accessor :maxct
  31.   def initialize
  32.     @battler_name = ""
  33.     @battler_hue = 0
  34.     @hp = 0
  35.     @sp = 0
  36.     @states = []
  37.     @states_turn = {}
  38.     @maxhp_plus = 0
  39.     @maxsp_plus = 0
  40.     @str_plus = 0
  41.     @dex_plus = 0
  42.     @agi_plus = 0
  43.     @int_plus = 0
  44.     @hidden = false
  45.     @immortal = false
  46.     @damage_pop = false
  47.     @damage = nil
  48.     @critical = false
  49.     @animation_id = 0
  50.     @animation_hit = false
  51.     @white_flash = false
  52.     @blink = false
  53.     @current_action = Game_BattleAction.new
  54.     @ct=0
  55.     @maxct=0
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 获取 MaxCT
  59.   #--------------------------------------------------------------------------
  60.   def maxct
  61.     n=10000
  62.     return n
  63.   end
  64.   #--------------------------------------------------------------------------
  65. end
  66. class Window_Base < Window

  67.   #--------------------------------------------------------------------------
  68.   # ○ ゲージを描画
  69.   #--------------------------------------------------------------------------
  70.   def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
  71.     color=Color.new(128, 128, 128, 128)
  72.     color1 = Color.new(192, 192, 192, 255)
  73.     self.contents.fill_rect(x, y, width, height, color1)
  74.     self.contents.fill_rect(x+1,y+1, width-1*2, height-1*2, color)
  75.     now = now > max ? max : now
  76.     percentage = max != 0 ? (width-2) * now / max.to_f : 0
  77.     if start_color == end_color
  78.       self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
  79.     else
  80.       for i in 1..percentage
  81.         r = start_color.red + (end_color.red - start_color.red) / percentage * i
  82.         g = start_color.green + (end_color.green - start_color.green) / percentage * i
  83.         b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
  84.         a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
  85.         self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
  86.       end
  87.     end
  88.   end
  89. end
  90. #==============================================================================
  91. # ■ Scene_Battle (分割定义 1)
  92. #------------------------------------------------------------------------------
  93. #  处理战斗画面的类。
  94. #==============================================================================

  95. class Scene_Battle

  96.   #--------------------------------------------------------------------------
  97.   # ● 主处理
  98.   #--------------------------------------------------------------------------
  99.   def main
  100.     @jjudge=LVQING::INPUT
  101.     @st=0
  102.     # 初始化战斗用的各种暂时数据
  103.     $game_temp.in_battle = true
  104.     $game_temp.battle_turn = 0
  105.     $game_temp.battle_event_flags.clear
  106.     $game_temp.battle_abort = false
  107.     $game_temp.battle_main_phase = false
  108.     $game_temp.battleback_name = $game_map.battleback_name
  109.     $game_temp.forcing_battler = nil
  110.     #-----------------------------------
  111.     # 初始化战斗用事件解释器
  112.     $game_system.battle_interpreter.setup(nil, 0)
  113.     # 准备队伍
  114.     @active_actor
  115.     @action_battlers=[]
  116.     @troop_id = $game_temp.battle_troop_id
  117.     $game_troop.setup(@troop_id)
  118.     # 生成角色命令窗口
  119.     s1 = $data_system.words.attack
  120.     s2 = $data_system.words.skill
  121.     s3 = $data_system.words.guard
  122.     s4 = $data_system.words.item
  123.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,"逃跑"])
  124.     @actor_command_window.y = 128
  125.     @actor_command_window.active = false
  126.     @actor_command_window.visible = false
  127.     # 生成其它窗口
  128.     @help_window = Window_Help.new
  129.     @help_window.back_opacity = 160
  130.     @help_window.visible = false
  131.     @status_window = Window_BattleStatus.new
  132.     @message_window = Window_Message.new
  133.       for battler in $game_party.actors
  134.         battler.ct=rand(100)
  135.       end
  136.       for battler in $game_troop.enemies
  137.         battler.ct=rand(100)
  138.       end
  139.     # 生成活动块
  140.     @spriteset = Spriteset_Battle.new
  141.     # 初始化等待计数
  142.     @wait_count = 0
  143.     # 执行过渡
  144.     if $data_system.battle_transition == ""
  145.       Graphics.transition(20)
  146.     else
  147.       Graphics.transition(40, "Graphics/Transitions/" +
  148.         $data_system.battle_transition)
  149.     end
  150.     # 开始自由战斗回合
  151.     start_phase1
  152.     # 主循环
  153.     loop do
  154.       # 刷新游戏画面
  155.       Graphics.update
  156.       # 刷新输入信息
  157.       Input.update
  158.       # 刷新画面
  159.       update
  160.       # 如果画面切换的话就中断循环
  161.       if $scene != self
  162.         break
  163.       end
  164.     end
  165.     # 刷新地图
  166.     $game_map.refresh
  167.     # 准备过渡
  168.     Graphics.freeze
  169.     @actor_command_window.dispose
  170.     @help_window.dispose
  171.     @status_window.dispose
  172.     @message_window.dispose
  173.     if @skill_window != nil
  174.       @skill_window.dispose
  175.     end
  176.     if @item_window != nil
  177.       @item_window.dispose
  178.     end
  179.     if @result_window != nil
  180.       @result_window.dispose
  181.     end
  182.     # 释放活动块
  183.     @spriteset.dispose
  184.     # 标题画面切换中的情况
  185.     if $scene.is_a?(Scene_Title)
  186.       # 淡入淡出画面
  187.       Graphics.transition
  188.       Graphics.freeze
  189.     end
  190.     # 战斗测试或者游戏结束以外的画面切换中的情况
  191.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  192.       $scene = nil
  193.     end
  194.   end

  195.   #--------------------------------------------------------------------------
  196.   # ● 刷新画面
  197.   #--------------------------------------------------------------------------
  198.   def update
  199.     # 执行战斗事件中的情况下
  200.     if $game_system.battle_interpreter.running?
  201.       # 刷新解释器
  202.       $game_system.battle_interpreter.update
  203.       # 强制行动的战斗者不存在的情况下
  204.       if $game_temp.forcing_battler == nil
  205.         # 执行战斗事件结束的情况下
  206.         unless $game_system.battle_interpreter.running?
  207.           # 继续战斗的情况下、再执行战斗事件的设置
  208.           unless judge
  209.             setup_battle_event
  210.           end
  211.         end
  212.         # 如果不是结束战斗回合的情况下
  213.         if @phase != 5
  214.           # 刷新状态窗口
  215.           @status_window.refresh
  216.         end
  217.       end
  218.     end
  219.     # 系统 (计时器)、刷新画面
  220.     $game_system.update
  221.     $game_screen.update
  222.     # 计时器为 0 的情况下
  223.     if $game_system.timer_working and $game_system.timer == 0
  224.       # 中断战斗
  225.       $game_temp.battle_abort = true
  226.     end
  227.     # 刷新窗口
  228.     @help_window.update
  229.     #@party_command_window.update
  230.     @actor_command_window.update
  231.     @status_window.update
  232.     @message_window.update
  233.     # 刷新活动块
  234.     @spriteset.update
  235.     # 处理过渡中的情况下
  236.     if $game_temp.transition_processing
  237.       # 清除处理过渡中标志
  238.       $game_temp.transition_processing = false
  239.       # 执行过渡
  240.       if $game_temp.transition_name == ""
  241.         Graphics.transition(20)
  242.       else
  243.         Graphics.transition(40, "Graphics/Transitions/" +
  244.           $game_temp.transition_name)
  245.       end
  246.     end
  247.     # 显示信息窗口中的情况下
  248.     if $game_temp.message_window_showing
  249.       return
  250.     end
  251.     # 显示效果中的情况下
  252.     if @spriteset.effect?
  253.       return
  254.     end
  255.     # 游戏结束的情况下
  256.     if $game_temp.gameover
  257.       # 切换到游戏结束画面
  258.       $scene = Scene_Gameover.new
  259.       return
  260.     end
  261.     # 返回标题画面的情况下
  262.     if $game_temp.to_title
  263.       # 切换到标题画面
  264.       $scene = Scene_Title.new
  265.       return
  266.     end
  267.     # 中断战斗的情况下
  268.     if $game_temp.battle_abort
  269.       # 还原为战斗前的 BGM
  270.       $game_system.bgm_play($game_temp.map_bgm)
  271.       # 战斗结束
  272.       battle_end(1)
  273.       return
  274.     end
  275.     # 等待中的情况下
  276.     if @wait_count > 0
  277.       # 减少等待计数
  278.       @wait_count -= 1
  279.       return
  280.     end
  281.     # 强制行动的角色存在、
  282.     # 并且战斗事件正在执行的情况下
  283.     if $game_temp.forcing_battler == nil and
  284.       $game_system.battle_interpreter.running?
  285.       return
  286.     end
  287.     update_ct
  288.     # 回合分支
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● 刷新CT
  292.   #--------------------------------------------------------------------------
  293.   def judge_ct
  294.     return @actor_command_window.visible == false && @phase !=3 && @phase != 5 && @phase != 4 && @item_window == nil && @skill_window == nil
  295.   end

  296.   def update_ct
  297.     case @phase
  298.         when 0
  299.           if @jjudge <20
  300.             @jjudge += 1
  301.           end
  302.         when 1  # 自由战斗回合
  303.           update_phase1
  304.         when 3  # 角色命令回合
  305.           update_phase3
  306.         when 4
  307.           update_phase4
  308.         when 5  # 战斗结束回合
  309.           update_phase5
  310.         end
  311.     if judge_ct
  312.       for i in 0...$game_party.actors.size
  313.       actor = $game_party.actors[i]
  314.         if actor.movable? && !actor.dead?
  315.           if actor.ct < 10000
  316.           actor.ct += actor.agi/LVQING::SPEED
  317.           else
  318.           @active_actor=actor
  319.           @action_battlers.push(@active_actor)
  320.           actor.ct=0
  321.               # 搜索全页的战斗事件
  322.             for index in 0...$data_troops[@troop_id].pages.size
  323.               # 获取事件页
  324.               page = $data_troops[@troop_id].pages[index]
  325.               # 本页的范围是 [回合] 的情况下
  326.               if page.span == 1
  327.                 # 设置已经执行标志
  328.                 $game_temp.battle_event_flags[index] = false
  329.               end
  330.             end
  331.           end
  332.           @status_window.refresh_ct(actor)
  333.         end
  334.       end
  335.       for i in 0...$game_troop.enemies.size
  336.         enemy = $game_troop.enemies[i]
  337.         if enemy.movable? && !enemy.dead?
  338.           if enemy.ct < 10000
  339.             enemy.ct += enemy.agi/LVQING::SPEED
  340.           else         
  341.             @active_actor=enemy
  342.             @action_battlers.push(@active_actor)
  343.             enemy.ct=0
  344.                 # 搜索全页的战斗事件
  345.             for index in 0...$data_troops[@troop_id].pages.size
  346.               # 获取事件页
  347.               page = $data_troops[@troop_id].pages[index]
  348.               # 本页的范围是 [回合] 的情况下
  349.               if page.span == 1
  350.                 # 设置已经执行标志
  351.                 $game_temp.battle_event_flags[index] = false
  352.               end
  353.             end
  354.           end
  355.         end
  356.       end

  357.           # 自然解除状态
  358.     #==========================================
  359.     if LVQING::TURN == 1
  360.     #@active_battler.remove_states_auto
  361.     if @st < LVQING::TIME
  362.       @st+=1
  363.     else
  364.       $game_temp.battle_turn += 1
  365.       for battler in $game_party.actors
  366.          battler.remove_states_auto
  367.       end
  368.       for battler in $game_troop.enemies
  369.          battler.remove_states_auto
  370.        end
  371.        @st=0
  372.      end
  373.     end
  374.     #==========================================
  375.       if @action_battlers != []
  376.         start_phase4
  377.       end
  378.       if Input.trigger?(Input::C) && judge_ct && (@jjudge == LVQING::INPUT)
  379.         start_phase3
  380.       end
  381.     end
  382.   end
  383. #======================scene_battle2===============================
  384.   def start_phase1
  385.     # 转移到回合 1
  386.     @phase = 1
  387.     # 清除全体同伴的行动
  388.     $game_party.clear_actions
  389.     # 设置战斗事件
  390.     setup_battle_event
  391.   end
  392.   def update_phase1
  393.     # 胜败判定
  394.     if judge
  395.       # 胜利或者失败的情况下 : 过程结束
  396.       return
  397.     end
  398.     # 开始同伴命令回合
  399.     start_phase3
  400.   end
  401.   def update_phase2_escape
  402.     # 计算敌人速度的平均值
  403.     enemies_agi = 0
  404.     enemies_number = 0
  405.     for enemy in $game_troop.enemies
  406.       if enemy.exist?
  407.         enemies_agi += enemy.agi
  408.         enemies_number += 1
  409.       end
  410.     end
  411.     if enemies_number > 0
  412.       enemies_agi /= enemies_number
  413.     end
  414.     # 计算角色速度的平均值
  415.     actors_agi = 0
  416.     actors_number = 0
  417.     for actor in $game_party.actors
  418.       if actor.exist?
  419.         actors_agi += actor.agi
  420.         actors_number += 1
  421.       end
  422.     end
  423.     if actors_number > 0
  424.       actors_agi /= actors_number
  425.     end
  426.     # 逃跑成功判定
  427.     success = rand(100) < 50 * actors_agi / enemies_agi
  428.     # 成功逃跑的情况下
  429.     if success
  430.       # 演奏逃跑 SE
  431.       $game_system.se_play($data_system.escape_se)
  432.       $game_system.bgm_play($game_temp.map_bgm)
  433.       # 战斗结束
  434.       battle_end(1)
  435.     # 逃跑失败的情况下
  436.       else
  437.       # 清除全体同伴的行动
  438.       # 开始主回合
  439.       @actor_command_window.visible=false
  440.       @actor_command_window.active=false
  441.     end
  442.   end
  443.   def phase3_setup_command_window
  444.     # 角色指令窗口无效化
  445.     @actor_command_window.active = true
  446.     @actor_command_window.visible = true
  447.     # 设置角色指令窗口的位置
  448.     @actor_command_window.x = @actor_index * 160
  449.     # 设置索引为 0
  450.     @actor_command_window.index = 0
  451.   end

  452.   def start_phase3
  453.     @phase = 3
  454.     @actor_index = -1
  455.     @active_battler = nil
  456.     phase3_next_actor
  457.   end
  458.   def phase3_next_actor
  459.     # 循环
  460.     begin
  461.       # 角色的明灭效果 OFF
  462.       if @active_battler != nil
  463.         @active_battler.blink = false
  464.       end
  465.       # 最后的角色的情况
  466.       if @actor_index == $game_party.actors.size-1
  467.         @jjudge=0
  468.         @actor_command_window.active = false
  469.         @actor_command_window.visible = false
  470.         @actor_index=-1
  471.         @phase = 0
  472.         return
  473.       end
  474.       # 推进角色索引
  475.       @actor_index += 1
  476.       @active_battler = $game_party.actors[@actor_index]
  477.       @active_battler.blink = true
  478.     # 如果角色是在无法接受指令的状态就再试
  479.     end until @active_battler.inputable?
  480.     # 设置角色的命令窗口
  481.     phase3_setup_command_window
  482.   end
  483.   def phase3_prior_actor
  484.     # 循环
  485.     begin
  486.       # 角色的明灭效果 OFF
  487.       if @active_battler != nil
  488.         @active_battler.blink = false
  489.       end
  490.       # 最初的角色的情况下
  491.       if @actor_index == 0
  492.           @actor_command_window.visible=false
  493.           @actor_command_window.active=false
  494.           @phase=0
  495.         return
  496.       end
  497.       # 返回角色索引
  498.       @actor_index -= 1
  499.       @active_battler = $game_party.actors[@actor_index]
  500.       @active_battler.blink = true
  501.     # 如果角色是在无法接受指令的状态就再试
  502.     end until @active_battler.inputable?
  503.     # 设置角色的命令窗口
  504.     phase3_setup_command_window
  505.   end
  506.   def phase3_setup_command_window
  507.     # 角色指令窗口无效化
  508.     @actor_command_window.active = true
  509.     @actor_command_window.visible = true
  510.     # 设置角色指令窗口的位置
  511.     @actor_command_window.x = 240
  512.     # 设置索引为 0
  513.     @actor_command_window.index = 0
  514.   end
  515. end
  516. class Scene_Battle
  517.   def start_phase4
  518.     # 转移到回合 4
  519.     @phase = 4
  520.     # 回合数计数
  521.     # 搜索全页的战斗事件
  522.     for index in 0...$data_troops[@troop_id].pages.size
  523.       # 获取事件页
  524.       page = $data_troops[@troop_id].pages[index]
  525.       # 本页的范围是 [回合] 的情况下
  526.       if page.span == 1
  527.         # 设置已经执行标志
  528.         $game_temp.battle_event_flags[index] = false
  529.       end
  530.     end
  531.     # 设置角色为非选择状态
  532.     @actor_index = -1
  533.     @active_battler = nil
  534.     @actor_command_window.active = false
  535.     @actor_command_window.visible = false
  536.     # 设置主回合标志
  537.     $game_temp.battle_main_phase = true
  538.     # 生成敌人行动
  539.     for enemy in $game_troop.enemies
  540.       enemy.make_action
  541.     end
  542.     #-----------------------------------------
  543.     # 生成行动顺序
  544.     # 移动到步骤 1
  545.     @phase4_step = 1
  546.     #----------------------------------------
  547.   end
  548.   def update_phase4_step1
  549.     # 隐藏帮助窗口
  550.     @help_window.visible = false
  551.     # 判定胜败
  552.     if judge
  553.       # 胜利或者失败的情况下 : 过程结束
  554.       return
  555.     end
  556.     # 强制行动的战斗者不存在的情况下
  557.     if $game_temp.forcing_battler == nil
  558.       # 设置战斗事件
  559.       setup_battle_event
  560.       # 执行战斗事件中的情况下
  561.       if $game_system.battle_interpreter.running?
  562.         return
  563.       end
  564.     end
  565.     # 强制行动的战斗者存在的情况下
  566.     if $game_temp.forcing_battler != nil
  567.       # 在头部添加后移动
  568.       @action_battlers.delete($game_temp.forcing_battler)
  569.       @action_battlers.unshift($game_temp.forcing_battler)
  570.     end
  571.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  572.     if @action_battlers.size == 0
  573.       @phase=0
  574.       return
  575.     end
  576.     # 初始化动画 ID 和公共事件 ID
  577.     @animation1_id = 0
  578.     @animation2_id = 0
  579.     @common_event_id = 0
  580.     # 未行动的战斗者移动到序列的头部
  581.     @active_battler = @action_battlers.shift
  582.     # 如果已经在战斗之外的情况下
  583.     if @active_battler.index == nil
  584.       return
  585.     end
  586.     # 连续伤害
  587.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  588.       @active_battler.slip_damage_effect
  589.       @active_battler.damage_pop = true
  590.     end
  591.     # 自然解除状态
  592.     #==========================================
  593.     if LVQING::TURN == 0
  594.     $game_temp.battle_turn += 1
  595.     #@active_battler.remove_states_auto
  596.     if @st < $game_party.actors.size+$game_troop.enemies.size
  597.       @st+=1
  598.     else
  599.       for battler in $game_party.actors
  600.          battler.remove_states_auto
  601.       end
  602.       for battler in $game_troop.enemies
  603.          battler.remove_states_auto
  604.        end
  605.        @st=0
  606.      end
  607.     end
  608.     #==========================================

  609.     # 刷新状态窗口
  610.     @status_window.refresh
  611.     # 移至步骤 2
  612.     @phase4_step = 2
  613.   end

  614.   def make_skill_action_result
  615.     # 获取特技
  616.     @skill = $data_skills[@active_battler.current_action.skill_id]
  617.     # 如果不是强制行动
  618.     unless @active_battler.current_action.forcing
  619.       # 因为 SP 耗尽而无法使用的情况下
  620.       unless @active_battler.skill_can_use?(@skill.id)
  621.         # 清除强制行动对像的战斗者
  622. #-------------------------------------------------

  623.     if LVQING::ATTACK==0
  624.         @active_battler.current_action.kind = 0
  625.         @active_battler.current_action.basic = 0
  626.         make_basic_action_result
  627.         return
  628.       end
  629.     if LVQING::ATTACK==1
  630.       @active_battler.current_action.kind = 0
  631.       @active_battler.current_action.basic =1
  632.       # 帮助窗口显示"防御"
  633.       @help_window.set_text($data_system.words.guard, 1)
  634.       @phase4_step=1
  635.       return
  636.     end
  637.     if LVQING::ATTACK==2
  638.       $game_temp.forcing_battler = nil
  639.         # 移至步骤 1
  640.       @phase4_step = 1
  641.       return
  642.     end
  643. #-------------------------------------------------   
  644.     end
  645.     end
  646.     # 消耗 SP
  647.     @active_battler.sp -= @skill.sp_cost
  648.     # 刷新状态窗口
  649.     @status_window.refresh
  650.     # 在帮助窗口显示特技名
  651.     @help_window.set_text(@skill.name, 1)
  652.     # 设置动画 ID
  653.     @animation1_id = @skill.animation1_id
  654.     @animation2_id = @skill.animation2_id
  655.     # 设置公共事件 ID
  656.     @common_event_id = @skill.common_event_id
  657.     # 设置对像侧战斗者
  658.     set_target_battlers(@skill.scope)
  659.     # 应用特技效果
  660.     for target in @target_battlers
  661.       target.skill_effect(@active_battler, @skill)
  662.     end
  663.   end
  664.   def make_item_action_result
  665.     # 获取物品
  666.     @item = $data_items[@active_battler.current_action.item_id]
  667.     # 因为物品耗尽而无法使用的情况下
  668.     unless $game_party.item_can_use?(@item.id)
  669. #-------------------------------------------------

  670.       if LVQING::ATTACK==0
  671.           @active_battler.current_action.kind = 0
  672.           @active_battler.current_action.basic = 0
  673.           make_basic_action_result
  674.           return
  675.         end
  676.       if LVQING::ATTACK==1
  677.         @active_battler.current_action.kind = 0
  678.         @active_battler.current_action.basic =1
  679.         # 帮助窗口显示"防御"
  680.         @help_window.set_text($data_system.words.guard, 1)
  681.         @phase4_step=1
  682.         return
  683.       end
  684.       if LVQING::ATTACK==2
  685.         $game_temp.forcing_battler = nil
  686.           # 移至步骤 1
  687.         @phase4_step = 1
  688.         return
  689.       end
  690. #-------------------------------------------------
  691.     end
  692.     if @item.consumable
  693.       $game_party.lose_item(@item.id, 1)
  694.     end
  695.     @help_window.set_text(@item.name, 1)
  696.     @animation1_id = @item.animation1_id
  697.     @animation2_id = @item.animation2_id
  698.     @common_event_id = @item.common_event_id
  699.     index = @active_battler.current_action.target_index
  700.     target = $game_party.smooth_target_actor(index)
  701.     set_target_battlers(@item.scope)
  702.     for target in @target_battlers
  703.       target.item_effect(@item)
  704.     end
  705.   end
  706. end

  707. #----------------------------------------------------
  708. class Window_BattleStatus < Window_Base
  709.   def refresh
  710.     self.contents.clear
  711.     @item_max = $game_party.actors.size
  712.     for i in 0...$game_party.actors.size
  713.       actor = $game_party.actors[i]
  714.       actor_x = i * 160 + 4
  715.       draw_actor_name(actor, actor_x, 0)
  716.       draw_actor_hp(actor, actor_x, 22, 120)
  717.       draw_actor_sp(actor, actor_x, 44, 120)
  718.       @ct_color1 = Color.new(255,160,255,255)
  719.       @ct_color2 = Color.new(145,100,255,255)
  720.       draw_meter(actor.ct, actor.maxct, actor_x, 102, 108, 12, @ct_color1, @ct_color2)
  721.       if @level_up_flags[i]
  722.         self.contents.font.color = normal_color
  723.         self.contents.draw_text(actor_x, 72, 120, 32, "LEVEL UP!")
  724.       else
  725.         draw_actor_state(actor, actor_x,72)
  726.       end
  727.       #--------------------------------
  728.     end
  729.   end
  730.   def refresh_ct(actor)
  731.     actor_x = actor.index * 160 + 4
  732.     draw_meter(actor.ct, actor.maxct, actor_x, 102, 108, 12,  @ct_color1, @ct_color2)
  733.   end
  734. end
复制代码


              [本贴由 御灵 于 2008-1-24 23:07:36 进行了编辑]
我的Lofter:http://nightoye.lofter.com/

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2006-9-23
帖子
145
3
发表于 2008-1-9 04:46:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

4
 楼主| 发表于 2008-1-9 04:58:25 | 只看该作者
应该可以吧= =
我目前也在研究一些特效=A=
不过你具体要什么样的

P.S 我很囧的发现...这个脚本里的命令窗口不能改位置||||||而且还没发现比较好的解决办法...||||||虽然只是个小问题.....
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
6 小时
注册时间
2007-12-18
帖子
214
5
发表于 2008-1-9 07:35:29 | 只看该作者
发现BUG.....

SPEED=1 #蓄劲速度比例,1为平时,小于1为慢,大于1为快


大于1会变慢.选0会出BUG.选-1无法蓄劲....汗.就是说选1是最快的- -
能不能再快一点 ```
回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

6
 楼主| 发表于 2008-1-9 08:01:46 | 只看该作者
对。。我写错了,大于1会变慢……
负数肯定会出现BUG……因为这是个比例,你选0.5试试

另,我的感觉是角色30级你就来不及按键了= =bbb
还是设置慢点好……要不我再改改变成按照全场参战人员的平均AGI来设置速度……
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
6 小时
注册时间
2007-12-18
帖子
214
7
发表于 2008-1-9 08:45:41 | 只看该作者
原来等级影响速度啊- -
回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

8
 楼主| 发表于 2008-1-9 09:12:50 | 只看该作者
不是等级是角色的速度属性有影响……
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
6 小时
注册时间
2007-12-18
帖子
214
9
发表于 2008-1-9 12:00:45 | 只看该作者
貌似怪的攻击速度是固定的?
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
55
在线时间
0 小时
注册时间
2008-1-3
帖子
1512
10
发表于 2008-1-9 19:39:01 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-23 07:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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