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

Project1

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

[已经过期] 横版战斗Sideview2.7出现的问题,求教

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2013-12-22
帖子
78
跳转到指定楼层
1
发表于 2013-12-29 13:21:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这是脚本第三部分的,在(战斗x坐标的取得)2020行出现了typeerror
不知道怎么搞的
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Scene_Battle Ver2.7
  3. #------------------------------------------------------------------------------
  4. #  战斗画面的处理的类。
  5. #==============================================================================
  6. class Scene_Battle < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 完毕处理
  9.   #--------------------------------------------------------------------------
  10.   alias terminate_n01 terminate
  11.   def terminate
  12.     terminate_n01
  13.     # 返还二刀流的替换处理
  14.     for member in $game_party.members
  15.       if member.two_swords_change
  16.         member.change_equip_by_id(1, member.weapon_id)
  17.         member.change_equip_by_id(0, 0)
  18.         member.two_swords_change = false
  19.       end  
  20.     end
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 战斗开始的处理
  24.   #--------------------------------------------------------------------------
  25.   alias process_battle_start_n01 process_battle_start
  26.   def process_battle_start
  27.     process_battle_start_n01
  28.     # 如果二刀流让左(下部显示)手武器像右(上部表示)手武器那样没有持有时
  29.     # 在这里强制替换他
  30.     for member in $game_party.members
  31.       if member.weapons[0] == nil and member.weapons[1] != nil
  32.         member.change_equip_by_id(0, member.armor1_id)
  33.         member.change_equip_by_id(1, 0)
  34.         member.two_swords_change = true
  35.       end
  36.     end  
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 更新
  40.   #--------------------------------------------------------------------------
  41.   alias update_n01 update
  42.   def update
  43.     reset_stand_by_action
  44.     super
  45.     update_n01
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 根据事件操作的HP变动再设置角色动画
  49.   #--------------------------------------------------------------------------
  50.   def reset_stand_by_action
  51.     if $game_temp.status_window_refresh
  52.       $game_temp.status_window_refresh = false
  53.       for member in $game_party.members + $game_troop.members
  54.         @spriteset.set_stand_by_action(member.actor?, member.index)
  55.         # 确认自动复活
  56.         resurrection(member) if member.hp == 0
  57.       end  
  58.       @status_window.refresh
  59.     end
  60.   end  
  61.   #--------------------------------------------------------------------------
  62.   # ● 战败的处理
  63.   #--------------------------------------------------------------------------
  64.   alias process_defeat_n01 process_defeat
  65.   def process_defeat
  66.     for member in $game_party.members
  67.       @spriteset.set_stand_by_action(member.actor?, member.index)
  68.     end
  69.     process_defeat_n01
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 帮助窗口的显示
  73.   #--------------------------------------------------------------------------
  74.   def pop_help(obj)
  75.     return if obj.extension.include?("不显示HELP")
  76.     @help_window = Window_Help.new if @help_window == nil
  77.     @help_window.set_text(obj.name, 1)
  78.     @help_window.visible = true
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 显示情报窗口的移动
  82.   #--------------------------------------------------------------------------
  83.   def move1_info_viewport
  84.     @info_viewport.ox = 128
  85.     loop do
  86.       update_basic
  87.       @info_viewport.ox -= 8
  88.       @party_command_window.x -= 8
  89.       @actor_command_window.x += 8
  90.       break if @info_viewport.ox == 64
  91.     end  
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 显示情报窗口的移动
  95.   #--------------------------------------------------------------------------
  96.   def move2_info_viewport
  97.     @info_viewport.ox = 64
  98.     loop do
  99.       update_basic
  100.       @info_viewport.ox -= 8
  101.       @party_command_window.x += 8
  102.       @actor_command_window.x -= 8
  103.       break if @info_viewport.ox == 0
  104.     end  
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 到下个主人公的指令选择
  108.   #--------------------------------------------------------------------------
  109.   alias next_actor_n01 next_actor
  110.   def next_actor
  111.     # 只有能动的角色显示指令动作
  112.     if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  113.       @spriteset.set_action(true, @actor_index,@active_battler.command_a)
  114.     end
  115.     # 最后的角色时、动作结束前等待
  116.     @wait_count = 32 if @actor_index == $game_party.members.size-1
  117.     next_actor_n01
  118.     # 只有能动的角色现实指令动作
  119.     if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  120.       @spriteset.set_action(true, @actor_index,@active_battler.command_b)
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 到前一个角色的指令选择
  125.   #--------------------------------------------------------------------------
  126.   alias prior_actor_n01 prior_actor
  127.   def prior_actor
  128.     # 只有能动的角色显示指令动作
  129.     if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  130.       @active_battler.action.clear
  131.       @spriteset.set_action(true, @actor_index,@active_battler.command_a)
  132.     end
  133.     prior_actor_n01
  134.     # 只有能动的角色显示指令动作
  135.     if @active_battler != nil && @active_battler.inputable? && @active_battler.actor?
  136.       @active_battler.action.clear
  137.       @spriteset.set_action(true, @actor_index,@active_battler.command_b)
  138.     end
  139.   end  
  140.   #--------------------------------------------------------------------------
  141.   # ● 目标选择的开始  ※再定义
  142.   #--------------------------------------------------------------------------
  143.   def start_target_enemy_selection
  144.     start_target_selection
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 目标选择的开始  ※再定义
  148.   #--------------------------------------------------------------------------
  149.   def start_target_actor_selection
  150.     start_target_selection(true)
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 目标选择的开始
  154.   #--------------------------------------------------------------------------
  155.   def start_target_selection(actor = false)
  156.     members = $game_party.members if actor
  157.     members = $game_troop.members unless actor
  158.     # 光标精灵的作成
  159.     @cursor = Sprite.new
  160.     @cursor.bitmap = Cache.character("cursor")
  161.     @cursor.src_rect.set(0, 0, 32, 32)
  162.     @cursor_flame = 0
  163.     @cursor.x = -200
  164.     @cursor.y = -200
  165.     @cursor.ox = @cursor.width
  166.     @cursor.oy = @cursor.height
  167.     # 作成显示目标名的帮助窗口
  168.     @help_window.visible = false if @help_window != nil
  169.     @help_window2 = Window_Help.new if @help_window2 == nil
  170.     # 消除不要的窗口
  171.     @actor_command_window.active = false
  172.     @skill_window.visible = false if @skill_window != nil
  173.     @item_window.visible = false if @item_window != nil
  174.     # 存在的目标为最底号码的对象也想最初那样
  175.     @index = 0
  176.     @max_index = members.size - 1
  177.     # 主人公为站都不能者也可以作为目标来与敌方区分
  178.     unless actor
  179.       members.size.times do
  180.         break if members[@index].exist?
  181.         @index += 1
  182.       end
  183.     end  
  184.     @help_window2.set_text(members[@index].name, 1)
  185.     select_member(actor)
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 目标选择
  189.   #--------------------------------------------------------------------------
  190.   def select_member(actor = false)
  191.     members = $game_party.members if actor
  192.     members = $game_troop.members unless actor
  193.     loop do
  194.       update_basic
  195.       @cursor_flame = 0 if @cursor_flame == 30
  196.       @cursor.src_rect.set(0,  0, 32, 32) if @cursor_flame == 29
  197.       @cursor.src_rect.set(0, 32, 32, 32) if @cursor_flame == 15
  198.       point = @spriteset.set_cursor(actor, @index)
  199.       @cursor.x = point[0]
  200.       @cursor.y = point[1]
  201.       @cursor_flame += 1
  202.       if Input.trigger?(Input::B)
  203.         Sound.play_cancel
  204.         end_target_selection
  205.         break
  206.       elsif Input.trigger?(Input::C)
  207.         Sound.play_decision
  208.         @active_battler.action.target_index = @index
  209.         end_target_selection
  210.         end_skill_selection
  211.         end_item_selection
  212.         next_actor
  213.         break
  214.       end
  215.       if Input.repeat?(Input::LEFT)
  216.         if actor
  217.           cursor_down(members, actor) if $back_attack
  218.           cursor_up(members, actor) unless $back_attack
  219.         else
  220.           cursor_up(members, actor) if $back_attack
  221.           cursor_down(members, actor) unless $back_attack
  222.         end  
  223.       end
  224.       if Input.repeat?(Input::RIGHT)
  225.         if actor
  226.           cursor_up(members, actor) if $back_attack
  227.           cursor_down(members, actor) unless $back_attack
  228.         else
  229.           cursor_down(members, actor) if $back_attack
  230.           cursor_up(members, actor) unless $back_attack
  231.         end
  232.       end
  233.       cursor_up(members, actor) if Input.repeat?(Input::UP)
  234.       cursor_down(members, actor) if Input.repeat?(Input::DOWN)
  235.     end
  236.   end
  237.   #--------------------------------------------------------------------------
  238.   # ● 向前移动光标
  239.   #--------------------------------------------------------------------------
  240.   def cursor_up(members, actor)
  241.     Sound.play_cursor
  242.     members.size.times do
  243.       @index += members.size - 1
  244.       @index %= members.size
  245.       break if actor
  246.       break if members[@index].exist?
  247.     end
  248.     @help_window2.set_text(members[@index].name, 1)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 向后移动光标
  252.   #--------------------------------------------------------------------------
  253.   def cursor_down(members, actor)
  254.     Sound.play_cursor
  255.     members.size.times do
  256.       @index += 1
  257.       @index %= members.size
  258.       break if actor
  259.       break if members[@index].exist? && !actor
  260.     end
  261.     @help_window2.set_text(members[@index].name, 1)
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 目标选择的完毕
  265.   #--------------------------------------------------------------------------
  266.   def end_target_selection
  267.     @actor_command_window.active = true if @actor_command_window.index == 0
  268.     @skill_window.visible = true if @skill_window != nil
  269.     @item_window.visible = true if @item_window != nil
  270.     @cursor.dispose
  271.     @cursor = nil
  272.     if @help_window2 != nil  
  273.       @help_window2.dispose
  274.       @help_window2 = nil
  275.     end
  276.     @help_window.visible = true if @help_window != nil
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● 逃走的处理  ※再定义
  280.   #--------------------------------------------------------------------------
  281.   def process_escape
  282.     @info_viewport.visible = false
  283.     @message_window.visible = true
  284.     text = sprintf(Vocab::EscapeStart, $game_party.name)
  285.     $game_message.texts.push(text)
  286.     if $game_troop.preemptive
  287.       success = true
  288.     else
  289.       success = (rand(100) < @escape_ratio)
  290.     end
  291.     Sound.play_escape
  292.     # 不能动的主人公除外逃走成功动作
  293.     if success
  294.       for actor in $game_party.members
  295.         unless actor.restriction == 4
  296.           @spriteset.set_action(true, actor.index,actor.run_success)
  297.         end
  298.       end  
  299.       wait_for_message
  300.       battle_end(1)
  301.     # 不能动主人公除外逃走失败动作
  302.     else
  303.       for actor in $game_party.members
  304.         unless actor.restriction == 4
  305.           @spriteset.set_action(true, actor.index,actor.run_ng)
  306.         end
  307.       end
  308.       @escape_ratio += 10
  309.       $game_message.texts.push('\.' + Vocab::EscapeFailure)
  310.       wait_for_message
  311.       $game_party.clear_actions
  312.       start_main
  313.     end
  314.   end  
  315.   #--------------------------------------------------------------------------
  316.   # ● 胜利的处理
  317.   #--------------------------------------------------------------------------
  318.   alias process_victory_n01 process_victory
  319.   def process_victory
  320.     @status_window.visible = true
  321.     @message_window.visible = false
  322.     # BOSS击倒为等待加长
  323.     for enemy in $game_troop.members
  324.       break boss_wait = true if enemy.collapse_type == 3
  325.     end
  326.     wait(440) if boss_wait
  327.     wait(N01::WIN_WAIT) unless boss_wait
  328.     # 不能动的主人公除外胜利动作
  329.     for actor in $game_party.members
  330.       unless actor.restriction == 4
  331.         @spriteset.set_action(true, actor.index,actor.win)
  332.       end
  333.     end
  334.     process_victory_n01
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ● 战斗处理的实行开始  ※再定义
  338.   #--------------------------------------------------------------------------
  339.   def start_main
  340.     $game_troop.increase_turn
  341.     @info_viewport.visible = true
  342.     @info_viewport.ox = 0
  343.     @party_command_window.active = false
  344.     @actor_command_window.active = false
  345.     @status_window.index = @actor_index = -1
  346.     @active_battler = nil
  347.     @message_window.clear
  348.     $game_troop.make_actions
  349.     make_action_orders
  350.     # 情报表示窗口的移动
  351.     move1_info_viewport
  352.     # 作成显示技能名的帮助窗口
  353.     @help_window = Window_Help.new
  354.     @help_window.visible = false
  355.     process_battle_event
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● 战斗事件的处理  ※再定义
  359.   #--------------------------------------------------------------------------
  360.   def process_battle_event
  361.     loop do
  362.       return if judge_win_loss
  363.       return if $game_temp.next_scene != nil
  364.       $game_troop.interpreter.update
  365.       $game_troop.setup_battle_event
  366.       @message_window.update
  367.       if $game_message.visible
  368.         @message_window.visible = true
  369.         @status_window.visible = false
  370.       end
  371.       wait_for_message
  372.       @message_window.visible = false
  373.       @status_window.visible = true
  374.       process_action if $game_troop.forcing_battler != nil
  375.       return unless $game_troop.interpreter.running?
  376.       update_basic
  377.     end
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 作成行动顺序
  381.   #--------------------------------------------------------------------------
  382.   alias make_action_orders_n01 make_action_orders
  383.   def make_action_orders
  384.     make_action_orders_n01
  385.     # 确认敌方的行动回数
  386.     for enemy in $game_troop.members
  387.       enemy.act_time = 0
  388.       if enemy.action_time[0] != 1
  389.         action_time = 0
  390.         # 获得确认的回数
  391.         for i in 1...enemy.action_time[0]
  392.           action_time += 1 if rand(100) < enemy.action_time[1]
  393.         end
  394.         enemy.act_time = action_time
  395.         action_time.times do
  396.           enemy_order_time(enemy)
  397.           action_time -= 1
  398.           break if action_time == 0
  399.         end  
  400.         enemy.adj_speed = nil
  401.       end
  402.     end
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 作成敌方的行动回数
  406.   #--------------------------------------------------------------------------
  407.   def enemy_order_time(enemy)
  408.     enemy.make_action_speed2(enemy.action_time[2])
  409.     select_time = 0
  410.     for member in @action_battlers
  411.       select_time += 1
  412.       break @action_battlers.push(enemy) if member.action.speed < enemy.adj_speed
  413.       break @action_battlers.push(enemy) if select_time == @action_battlers.size
  414.     end
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● 战斗行动的实行
  418.   #--------------------------------------------------------------------------
  419.   alias execute_action_n01 execute_action
  420.   def execute_action
  421.     # 技能、物品扩张时如果设定了行动前不清空
  422.     if @active_battler.action.kind != 0
  423.       obj = @active_battler.action.skill if @active_battler.action.kind == 1
  424.       obj = @active_battler.action.item if @active_battler.action.kind == 2
  425.       if obj.extension.include?("行动前不闪光")
  426.         @active_battler.white_flash = false
  427.       end  
  428.     end
  429.     # 角色主动化
  430.     @active_battler.active = true
  431.     execute_action_n01
  432.     # 有技能连发时、行动继续
  433.     if @active_battler.derivation != 0
  434.       @active_battler.action.kind = 1
  435.       @active_battler.action.skill_id = @active_battler.derivation
  436.       @action_battlers.unshift(@active_battler)
  437.     end
  438.     # 有复数行动的敌方时、决定下个行动
  439.     if !@active_battler.actor? && @active_battler.act_time != 0
  440.       @active_battler.make_action
  441.       @active_battler.act_time -= 1
  442.     end
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 回合完毕  ※再定义
  446.   #--------------------------------------------------------------------------
  447.   def turn_end
  448.     for member in $game_party.members + $game_troop.members
  449.       member.clear_action_results
  450.       next unless member.exist?
  451.       member.slip_damage = false
  452.       actor = member.actor?
  453.       damage = 0
  454.       # 确认是否有0回合解除的状态
  455.       for state in member.states
  456.         member.remove_state(state.id) if state.extension.include?("0回合解除")
  457.         # 实行连续伤害 state = [ 对象, 定数, 比例, POP, 战斗不能许可]
  458.         next unless state.extension.include?("连续伤害")
  459.         for ext in state.slip_extension
  460.           if ext[0] == "hp"
  461.             base_damage = ext[1] + member.maxhp * ext[2] / 100
  462.             damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
  463.             slip_pop = ext[3]
  464.             slip_dead = ext[4]
  465.             slip_damage_flug = true
  466.             member.slip_damage = true
  467.           end
  468.         end  
  469.       end
  470.       # 默认的连续伤害
  471.       if member.slip_damage? && member.exist? && !slip_damage_flug
  472.         damage += member.apply_variance(member.maxhp / 10, 10)
  473.         slip_dead = false
  474.         slip_pop = true
  475.         slip_damage_flug = true
  476.         member.slip_damage = true
  477.       end
  478.       damage = member.hp - 1 if damage >= member.hp && slip_dead = false
  479.       member.hp -= damage
  480.       @spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
  481.       member.perform_collapse if member.dead? && member.slip_damage
  482.       member.clear_action_results
  483.     end
  484.     @status_window.refresh
  485.     # HP和MP的定时改变
  486.     wait(55) if slip_damage_flug
  487.     slip_damage_flug = false
  488.     for member in $game_party.members + $game_troop.members
  489.       member.clear_action_results
  490.       next unless member.exist?
  491.       actor = member.actor?
  492.       mp_damage = 0
  493.       for state in member.states
  494.         next unless state.extension.include?("连续伤害")
  495.         for ext in state.slip_extension
  496.           if ext[0] == "mp"
  497.             base_damage = ext[1] + member.maxmp * ext[2] / 100
  498.             mp_damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
  499.             slip_pop = ext[2]
  500.             slip_damage_flug = true
  501.           end
  502.         end
  503.         member.mp_damage = mp_damage
  504.         member.mp -= mp_damage
  505.         @spriteset.set_damage_pop(actor, member.index, mp_damage) if slip_pop
  506.       end   
  507.       member.clear_action_results
  508.     end
  509.     @status_window.refresh
  510.     # 伤害和回復的定时改变
  511.     wait(55) if slip_damage_flug
  512.     # 是否有自动回复
  513.     for member in $game_party.members
  514.       if member.auto_hp_recover and member.exist?
  515.         plus_hp = member.maxhp / 20
  516.         member.hp += plus_hp
  517.         @spriteset.set_damage_pop(true, member.index, plus_hp * -1)
  518.         plus_hp_flug = true
  519.       end
  520.       member.clear_action_results
  521.     end
  522.     @status_window.refresh
  523.     wait(55) if plus_hp_flug
  524.     @help_window.dispose if @help_window != nil
  525.     @help_window = nil
  526.     move2_info_viewport
  527.     $game_troop.turn_ending = true
  528.     $game_troop.preemptive = false
  529.     $game_troop.surprise = false
  530.     process_battle_event
  531.     $game_troop.turn_ending = false
  532.     start_party_command_selection
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● 战斗行动的实行 : 攻击  ※再定义
  536.   #--------------------------------------------------------------------------
  537.   def execute_action_attack
  538.     if @active_battler.actor?
  539.       if @active_battler.weapon_id == 0
  540.         action = @active_battler.non_weapon
  541.         # 行动中不会死的队员全员为不死身化
  542.         immortaling
  543.       else  
  544.         action = $data_weapons[@active_battler.weapon_id].base_action
  545.         # 用赋予战斗不能的武器来分歧不死身设定
  546.         if $data_weapons[@active_battler.weapon_id].state_set.include?(1)
  547.           for member in $game_party.members + $game_troop.members
  548.             next if member.immortal
  549.             next if member.dead?
  550.             member.dying = true
  551.           end
  552.         else
  553.           immortaling
  554.         end
  555.       end  
  556.     else
  557.       if @active_battler.weapon == 0
  558.         action = @active_battler.base_action
  559.         immortaling
  560.       else
  561.         action = $data_weapons[@active_battler.weapon].base_action
  562.         if $data_weapons[@active_battler.weapon].state_set.include?(1)
  563.           for member in $game_party.members + $game_troop.members
  564.             next if member.immortal
  565.             next if member.dead?
  566.             member.dying = true
  567.           end
  568.         else
  569.           immortaling
  570.         end
  571.       end  
  572.     end
  573.     target_decision
  574.     @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
  575.     playing_action
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ● 战斗行动的实行 : 防御  ※再定义
  579.   #--------------------------------------------------------------------------
  580.   def execute_action_guard
  581.     @help_window.set_text("防御", 1)
  582.     @help_window.visible = true
  583.     # 解除角色的主动化
  584.     @active_battler.active = false
  585.     wait(45)
  586.     @help_window.visible = false
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● 战斗行动的实行 : 逃走
  590.   #--------------------------------------------------------------------------
  591.   def execute_action_escape
  592.     @spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
  593.     @help_window.set_text("逃走", 1)
  594.     @help_window.visible = true
  595.     # 解除角色的主动化
  596.     @active_battler.active = false
  597.     @active_battler.escape
  598.     Sound.play_escape
  599.     wait(45)
  600.     @help_window.visible = false
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● 战斗行动的实行 : 待机  ※再定义
  604.   #--------------------------------------------------------------------------
  605.   def execute_action_wait
  606.     # 解除角色的主动化
  607.     @active_battler.active = false
  608.     wait(45)
  609.   end   
  610.   #--------------------------------------------------------------------------
  611.   # ● 战斗行动的实行 : 技能  ※再定义
  612.   #--------------------------------------------------------------------------
  613.   def execute_action_skill
  614.     skill = @active_battler.action.skill
  615.     # 用赋予战斗不能的技能来分歧不死身设定
  616.     if skill.plus_state_set.include?(1)
  617.       for member in $game_party.members + $game_troop.members
  618.         next if member.immortal
  619.         next if member.dead?
  620.         member.dying = true
  621.       end
  622.     else
  623.       # 行动中不会死的队员全员为不死身化
  624.       immortaling
  625.     end
  626.     # 判别技能使用可能
  627.     return unless @active_battler.skill_can_use?(skill)
  628.     # 决定目标
  629.     target_decision(skill)
  630.     # 动作开始
  631.     @spriteset.set_action(@active_battler.actor?, @active_battler.index, skill.base_action)
  632.     # 帮助窗口中显示技能名
  633.     pop_help(skill)
  634.     # 动作中
  635.     playing_action
  636.     # 技能成本消费
  637.     @active_battler.consum_skill_cost(skill)
  638.     # 还原状态窗口
  639.     @status_window.refresh
  640.     # 取得公共事件
  641.     $game_temp.common_event_id = skill.common_event_id
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # ● 战斗行动的实行 : 物品  ※再定义
  645.   #--------------------------------------------------------------------------
  646.   def execute_action_item
  647.     item = @active_battler.action.item
  648.     # 用赋予战斗不能的物品来分歧不死身设定
  649.     if item.plus_state_set.include?(1)
  650.       for member in $game_party.members + $game_troop.members
  651.         next if member.immortal
  652.         next if member.dead?
  653.         member.dying = true
  654.       end
  655.     else
  656.       # 行动中不会死的队员全员为不死身化
  657.       immortaling
  658.     end
  659.     $game_party.consume_item(item)
  660.     target_decision(item)
  661.     @spriteset.set_action(@active_battler.actor?, @active_battler.index, item.base_action)
  662.     pop_help(item)
  663.     playing_action
  664.     $game_temp.common_event_id = item.common_event_id
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ● 决定目标
  668.   #--------------------------------------------------------------------------
  669.   def target_decision(obj = nil)
  670.     @targets = @active_battler.action.make_targets
  671.     # 目标不存在时、动作中断
  672.     if @targets.size == 0
  673.       action = @active_battler.recover_action
  674.       @spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
  675.     end
  676.     if obj != nil
  677.       # 如果默认了设定复数回合攻击时变换成单体目标
  678.       if obj.for_two? or obj.for_three? or obj.dual?
  679.         @targets = [@targets[0]]
  680.       end
  681.       # 随机目标时、选择的一体保持在随机范围
  682.       if obj.extension.include?("随机目标")
  683.         randum_targets = @targets.dup
  684.         @targets = [randum_targets[rand(randum_targets.size)]]
  685.       end
  686.     end
  687.     # 目标情报发送到角色精灵
  688.     @spriteset.set_target(@active_battler.actor?, @active_battler.index, @targets)
  689.   end   
  690.   #--------------------------------------------------------------------------
  691.   # ● 实行动作中
  692.   #--------------------------------------------------------------------------
  693.   def playing_action
  694.     loop do
  695.       update_basic
  696.       # 查看被归纳在主动角色的动作情报
  697.       action = @active_battler.play
  698.       next if action == 0
  699.       @active_battler.play = 0
  700.       if action[0] == "个别处理"
  701.         individual
  702.       elsif action == "击倒许可"
  703.         unimmortaling
  704.       elsif action == "解除主动"
  705.         break action_end
  706.       elsif action == "完毕"
  707.         break action_end
  708.       elsif action[0] == "对象动画"
  709.         damage_action(action[1])
  710.       end
  711.     end  
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 个别处理
  715.   #--------------------------------------------------------------------------
  716.   def individual
  717.     # 保持目标情报
  718.     @individual_target = @targets
  719.     @stand_by_target = @targets.dup
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # ● 击倒禁止
  723.   #--------------------------------------------------------------------------
  724.   def immortaling
  725.     # 赋予全员不死身
  726.     for member in $game_party.members + $game_troop.members
  727.       # 如果不能战斗时跳过处理
  728.       next if member.dead?
  729.       # 有事件等设定不死身创立解除无效的标志
  730.       member.non_dead = true if member.immortal
  731.       member.immortal = true
  732.     end  
  733.   end  
  734.   #--------------------------------------------------------------------------
  735.   # ● 击倒许可
  736.   #--------------------------------------------------------------------------
  737.   def unimmortaling
  738.     # 个别处理中无击败许可
  739.     return if @active_battler.individual
  740.     # 解除全员的不死身化(用事件设定的不死身除外)
  741.     for member in $game_party.members + $game_troop.members
  742.       if member.dying
  743.         member.dying = false
  744.         if member.dead? or member.hp == 0
  745.           member.add_state(1)
  746.           member.perform_collapse
  747.         end
  748.       end
  749.       next if member.non_dead
  750.       next if member.dead?
  751.       member.immortal = false
  752.       member.add_state(1) if member.hp == 0
  753.       member.perform_collapse
  754.     end
  755.     # 在这个时候反映待机动作
  756.     @targets = @stand_by_target if @stand_by_target != nil
  757.     return if @targets == nil or @targets.size == 0
  758.     for target in @targets
  759.       @spriteset.set_stand_by_action(target.actor?, target.index)
  760.       # 确认自动复活
  761.       next unless target.hp == 0
  762.       resurrection(target)
  763.     end  
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # ● 自动复活
  767.   #--------------------------------------------------------------------------
  768.   def resurrection(target)
  769.     for state in target.states
  770.       for ext in state.extension
  771.         name = ext.split('')
  772.         next unless name[0] == "自"
  773.         wait(50)
  774.         name = name.join
  775.         name.slice!("自动复活/")
  776.         target.hp = target.maxhp * name.to_i / 100
  777.         target.remove_state(1)
  778.         target.remove_state(state.id)
  779.         target.animation_id = N01::RESURRECTION
  780.         target.animation_mirror = true if $back_attack
  781.         @status_window.refresh
  782.         wait($data_animations[N01::RESURRECTION].frame_max * 4)
  783.       end  
  784.     end
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # ● 魔法反射・无效
  788.   #--------------------------------------------------------------------------
  789.   def magic_reflection(target, obj)
  790.     return if obj.physical_attack
  791.     for state in target.states
  792.       for ext in state.extension
  793.         name = ext.split('')
  794.         next unless name[0] == "魔"
  795.         if name[2] == "反"
  796.           name = name.join
  797.           name.slice!("魔法反射/")
  798.           target.animation_id = name.to_i
  799.           target.animation_mirror = true if $back_attack
  800.           @reflection = true
  801.         else
  802.           name = name.join
  803.           name.slice!("魔法无效/")
  804.           target.animation_id = name.to_i
  805.           target.animation_mirror = true if $back_attack
  806.           @invalid = true
  807.         end  
  808.       end  
  809.     end
  810.   end
  811.   #--------------------------------------------------------------------------
  812.   # ● 物理反射・无效
  813.   #--------------------------------------------------------------------------
  814.   def physics_reflection(target, obj)
  815.     return if obj != nil && !obj.physical_attack
  816.     for state in target.states
  817.       for ext in state.extension
  818.         name = ext.split('')
  819.         next unless name[0] == "物"
  820.         if name[2] == "反"
  821.           name = name.join
  822.           name.slice!("物理反射/")
  823.           target.animation_id = name.to_i
  824.           target.animation_mirror = true if $back_attack
  825.           @reflection = true
  826.         else
  827.           name = name.join
  828.           name.slice!("物理无效/")
  829.           target.animation_id = name.to_i
  830.           target.animation_mirror = true if $back_attack
  831.           @invalid = true
  832.         end
  833.       end  
  834.     end
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # ● 技能成本吸收
  838.   #--------------------------------------------------------------------------
  839.   def absorb_cost(target, obj)
  840.     for state in target.states
  841.       if state.extension.include?("成本吸收")
  842.         cost = @active_battler.calc_mp_cost(obj)
  843.         # 区分为SP消费和HP消费
  844.         return target.hp += cost if obj.extension.include?("HP消耗")
  845.         return target.mp += cost
  846.       end  
  847.     end
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ● 吸收处理
  851.   #--------------------------------------------------------------------------
  852.   def absorb_attack(obj, target, index, actor)
  853.     absorb = target.hp_damage
  854.     absorb = target.mp_damage if target.mp_damage != 0
  855.     # 目标是复数同时吸收处理
  856.     @wide_attack = true if obj.scope == 2 or obj.scope == 4 or obj.scope == 6 or obj.extension.include?("全区域")
  857.     if @wide_attack && @absorb == nil && @targets.size != 1
  858.       # 返还吸收的部分
  859.       @active_battler.hp -= @active_battler.hp_damage
  860.       @active_battler.mp -= @active_battler.mp_damage
  861.       # 之后加算吸收返还的数值
  862.       @absorb = absorb
  863.       @absorb_target_size = @targets.size - 2
  864.     elsif @absorb != nil && @absorb_target_size > 0
  865.       @active_battler.hp -= @active_battler.hp_damage
  866.       @active_battler.mp -= @active_battler.mp_damage
  867.       @absorb += absorb
  868.       @absorb_target_size -= 1
  869.     # 处理复数目标的最重吸收
  870.     elsif @absorb != nil
  871.       # 返还吸收的部分
  872.       @active_battler.hp -= @active_battler.hp_damage
  873.       @active_battler.mp -= @active_battler.mp_damage
  874.       @absorb += absorb
  875.       # 在这里反映全部吸收部分
  876.       @active_battler.hp_damage = -@absorb
  877.       @active_battler.mp_damage = -@absorb if target.mp_damage != 0
  878.       @active_battler.hp -= @active_battler.hp_damage
  879.       @active_battler.mp -= @active_battler.mp_damage
  880.       # 吸收量是0时吸收者方面的处理
  881.       absorb_action = ["absorb", nil, false] if @absorb == 0
  882.       absorb_action = [nil, nil, false] if @absorb != 0
  883.       @spriteset.set_damage_action(actor, index, absorb_action)
  884.       @active_battler.perform_collapse
  885.       @absorb = nil
  886.       @absorb_target_size = nil
  887.     # 单体吸收的处理
  888.     else
  889.       if N01::ABSORB_DAMAGE
  890.         # 返还吸收的部分
  891.         @active_battler.hp += @active_battler.hp_damage
  892.         @active_battler.mp += @active_battler.mp_damage
  893.         # 反映吸收
  894.         @active_battler.hp_damage = -absorb
  895.         @active_battler.mp_damage = -absorb if target.mp_damage != 0
  896.         @active_battler.hp -= @active_battler.hp_damage
  897.         @active_battler.mp -= @active_battler.mp_damage
  898.       end
  899.       # 吸收量是0时吸收者方面的处理
  900.       absorb_action = ["absorb", nil, false] if absorb == 0
  901.       absorb_action = [nil, nil, false] if absorb != 0
  902.       @spriteset.set_damage_action(actor, index, absorb_action)
  903.       # 逆向吸收时HP为0时
  904.       @absorb_dead = true if @active_battler.hp == 0 && !@active_battler.non_dead
  905.     end
  906.     # 吸收量是0时对象者方面的处理
  907.     return 0 if absorb == 0
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● 动作完毕
  911.   #--------------------------------------------------------------------------
  912.   def action_end
  913.     # 初期化
  914.     @individual_target = nil
  915.     @help_window.visible = false if @help_window != nil && @help_window.visible
  916.     @active_battler.active = false
  917.     @active_battler.clear_action_results
  918.     # 慎重起见解除不死身化
  919.     unimmortaling
  920.     # 被反射时
  921.     if @active_battler.reflex != nil
  922.       if @active_battler.action.skill?
  923.         obj = @active_battler.action.skill
  924.         @active_battler.perfect_skill_effect(@active_battler, obj)
  925.       elsif @active_battler.action.item?
  926.         obj = @active_battler.action.item
  927.         @active_battler.item_effect(@active_battler, obj)
  928.       else
  929.         @active_battler.perfect_attack_effect(@active_battler)
  930.       end
  931.       pop_damage(@active_battler, obj, @active_battler.reflex)
  932.       @active_battler.perform_collapse
  933.       @active_battler.reflex = nil
  934.       wait(N01::COLLAPSE_WAIT)
  935.     end
  936.     #因逆向吸收战斗不能时
  937.     if @absorb_dead
  938.       @active_battler.perform_collapse
  939.       @absorb_dead = false
  940.       wait(N01::COLLAPSE_WAIT)
  941.     end
  942.     # 缩短到下次行动前的等待
  943.     wait(N01::ACTION_WAIT)
  944.   end  
  945.   #--------------------------------------------------------------------------
  946.   # ● 伤害处理
  947.   #--------------------------------------------------------------------------
  948.   def damage_action(action)
  949.     # 单独处理时目标一个一个发出
  950.     @targets = [@individual_target.shift] if @active_battler.individual
  951.     # 技能时
  952.     if @active_battler.action.skill?
  953.       obj = @active_battler.action.skill
  954.       for target in @targets
  955.         return if target == nil
  956.         return if target.dead? && !obj.for_dead_friend?
  957.         # HP为0时战斗不能復活以外不MISS
  958.         target.revival = true if obj.for_dead_friend?
  959.         if target.hp == 0 && !obj.for_dead_friend?
  960.           target.perfect_skill_effect(@active_battler, obj)
  961.         # 确认必中
  962.         elsif obj.extension.include?("必中")
  963.           target.perfect_skill_effect(@active_battler, obj)
  964.         else
  965.           # 确认反射
  966.           magic_reflection(target, obj) unless obj.extension.include?("无视反射")
  967.           physics_reflection(target, obj) unless obj.extension.include?("无视反射")
  968.           # 计算伤害
  969.           target.skill_effect(@active_battler, obj) unless @reflection or @invalid
  970.         end  
  971.         pop_damage(target, obj, action) unless @reflection or @invalid
  972.         # 确认成本吸收
  973.         absorb_cost(target, obj)
  974.         # 获取反射动作
  975.         @active_battler.reflex = action if @reflection
  976.         @reflection = false
  977.         @invalid = false
  978.       end
  979.     # 物品时
  980.     elsif @active_battler.action.item?
  981.       obj = @active_battler.action.item
  982.       for target in @targets
  983.         return if target == nil
  984.         return if target.dead? && !obj.for_dead_friend?
  985.         target.revival = true if obj.for_dead_friend?
  986.         if target.hp == 0 && !obj.for_dead_friend?
  987.           target.perfect_item_effect(@active_battler, obj)
  988.         elsif obj.extension.include?("必中")
  989.           target.perfect_item_effect(@active_battler, obj)
  990.         else
  991.           magic_reflection(target, obj) unless obj.extension.include?("无视反射")
  992.           physics_reflection(target, obj) unless obj.extension.include?("无视反射")
  993.           target.item_effect(@active_battler, obj) unless @reflection or @invalid
  994.         end
  995.         pop_damage(target, obj, action) unless @reflection or @invalid
  996.         @active_battler.reflex = action if @reflection
  997.         @reflection = false
  998.         @invalid = false
  999.       end
  1000.     # 通常攻击时
  1001.     else
  1002.       for target in @targets
  1003.         return if target == nil or target.dead?
  1004.         physics_reflection(target, nil)
  1005.         target.perfect_attack_effect(@active_battler) if target.hp <= 0
  1006.         target.attack_effect(@active_battler) unless target.hp <= 0 or @reflection or @invalid
  1007.         pop_damage(target, nil, action) unless @reflection or @invalid
  1008.         # 获取反射动作
  1009.         @active_battler.reflex = action if @reflection
  1010.         @reflection = false
  1011.         @invalid = false
  1012.       end
  1013.     end
  1014.     # 还原状态窗口
  1015.     @status_window.refresh
  1016.     # 考虑连续性懂得随机目标、立刻选择下个目标
  1017.     return if obj == nil
  1018.     target_decision(obj) if obj.extension.include?("随机目标")
  1019.   end
  1020.   #--------------------------------------------------------------------------
  1021.   # ● 伤害表示  action = [动画ID,反转标志,动作许可]
  1022.   #--------------------------------------------------------------------------
  1023.   def pop_damage(target, obj, action)
  1024.     index = @active_battler.index
  1025.     actor = @active_battler.actor?
  1026.     if obj != nil
  1027.       # 技能或者物品是吸收属性时
  1028.       absorb = absorb_attack(obj, target, index, actor) if obj.absorb_damage
  1029.       action.push(true) if absorb == 0
  1030.       # 扩张设定为伤害动作禁止时
  1031.       action[2] = false if obj.extension.include?("禁止伤害动作")
  1032.     end
  1033.     # 还原对象
  1034.     @spriteset.set_damage_action(target.actor?, target.index, action)
  1035.   end
  1036. end  
  1037. #==============================================================================
  1038. # ■ Game_BattleAction
  1039. #------------------------------------------------------------------------------
  1040. #  战斗行动处理的类。
  1041. #==============================================================================
  1042. class Game_BattleAction
  1043.   #--------------------------------------------------------------------------
  1044.   # ● 判定行动是否有效  ※再定义
  1045.   #--------------------------------------------------------------------------
  1046.   def valid?
  1047.     return false if nothing?                      # 什么都不作
  1048.     return true if @forcing                       # 强制行动中
  1049.     return false unless battler.movable?          # 行动不能
  1050.     if skill?                                     # 技能
  1051.       if battler.derivation != 0
  1052.         battler.derivation = 0
  1053.         return true
  1054.       end  
  1055.       return false unless battler.skill_can_use?(skill)
  1056.     elsif item?                                   # 物品
  1057.       return false unless friends_unit.item_can_use?(item)
  1058.     end
  1059.     return true
  1060.   end
  1061.   #--------------------------------------------------------------------------
  1062.   # ● 作成目标的排列  ※再定义
  1063.   #--------------------------------------------------------------------------
  1064.   def make_targets
  1065.     if attack?
  1066.       return make_attack_targets
  1067.     elsif skill?
  1068.       targets = make_obj_targets(skill)
  1069.       targets = make_obj_targets2(skill, targets) if skill.extension != ["无"]
  1070.       return targets
  1071.     elsif item?
  1072.       targets = make_obj_targets(item)
  1073.       targets = make_obj_targets2(item, targets) if item.extension != ["无"]
  1074.       return targets
  1075.     end
  1076.   end
  1077.   #--------------------------------------------------------------------------
  1078.   # ● 作成技能或是物品的目标的扩张
  1079.   #--------------------------------------------------------------------------
  1080.   def make_obj_targets2(obj, targets)
  1081.     if obj.extension.include?("全区域")
  1082.       targets = []
  1083.       targets += opponents_unit.existing_members
  1084.       targets += friends_unit.existing_members
  1085.     end
  1086.     if obj.extension.include?("自身以外")
  1087.       targets.delete($game_party.members[battler.index]) if battler.actor?
  1088.       targets.delete($game_troop.members[battler.index]) unless battler.actor?
  1089.     end
  1090.     return targets.compact
  1091.   end
  1092. end
  1093. #==============================================================================
  1094. # ■ Sprite_Base
  1095. #------------------------------------------------------------------------------
  1096. #  追加了动画的表示处理的精灵的类。
  1097. #==============================================================================
  1098. class Sprite_Base < Sprite
  1099.   #--------------------------------------------------------------------------
  1100.   # ● 动画的更新 动画追随精灵
  1101.   #--------------------------------------------------------------------------
  1102.   alias update_animation_n01 update_animation
  1103.   def update_animation
  1104.     @animation_ox = x - ox + width / 2
  1105.     @animation_oy = y - oy + height / 2
  1106.     update_animation_n01
  1107.   end
  1108. end  
  1109. #==============================================================================
  1110. # ■ Spriteset_Battle
  1111. #------------------------------------------------------------------------------
  1112. #  整理战斗画面的精灵的类。
  1113. #==============================================================================
  1114. class Spriteset_Battle
  1115.   #--------------------------------------------------------------------------
  1116.   # ● 敌方精灵的作成
  1117.   #--------------------------------------------------------------------------
  1118.   def create_enemies
  1119.     @enemy_sprites = []
  1120.     for i in 0...$game_troop.members.size
  1121.       enemy = $game_troop.members[i]
  1122.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  1123.       # 战斗开始启动动作
  1124.       @enemy_sprites[i].opacity = 0 if $game_troop.members[i].hidden
  1125.       @enemy_sprites[i].first_action if $game_troop.members[i] != nil
  1126.     end
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # ● 主人公精灵的作成
  1130.   #--------------------------------------------------------------------------
  1131.   def create_actors
  1132.     @actor_sprites = []
  1133.     # 准备成员最大数精灵
  1134.     member = N01::MAX_MEMBER
  1135.     for i in 0...member
  1136.       actor = $game_party.members[i]
  1137.       @actor_sprites.push(Sprite_Battler.new(@viewport1, actor))
  1138.       # 战斗开始启动动作
  1139.       @actor_sprites[i].first_action if $game_party.members[i] != nil
  1140.     end
  1141.   end
  1142.   #--------------------------------------------------------------------------
  1143.   # ● 战斗层精灵的作成
  1144.   #--------------------------------------------------------------------------
  1145.   def create_battlefloor
  1146.     @battlefloor_sprite = Sprite.new(@viewport1)
  1147.     @battlefloor_sprite.bitmap = Cache.system("BattleFloor")
  1148.     @battlefloor_sprite.x = N01::FLOOR[0]
  1149.     @battlefloor_sprite.y = N01::FLOOR[1]
  1150.     @battlefloor_sprite.z = N01::FLOOR[2]
  1151.     @battlefloor_sprite.opacity = 128
  1152.     # 偷袭时時、反转层面和背景
  1153.     back_attack
  1154.     if $back_attack
  1155.       @battlefloor_sprite.mirror = true
  1156.       @battleback_sprite.mirror = true
  1157.       $game_troop.surprise = true
  1158.     else  
  1159.       $game_troop.surprise = false
  1160.     end  
  1161.   end  
  1162.   #--------------------------------------------------------------------------
  1163.   # ● 背部攻击
  1164.   #--------------------------------------------------------------------------
  1165.   def back_attack  
  1166.     # 強制背部攻击时标志ON
  1167.     for i in 0...N01::BACK_ATTACK_SWITCH.size
  1168.       return $back_attack = true if $game_switches[N01::BACK_ATTACK_SWITCH[i]]
  1169.     end
  1170.     # 如果没发生偷袭时将中断处理
  1171.     return $back_attack = false unless $game_troop.surprise && N01::BACK_ATTACK
  1172.     # 确认根据装备等背部攻击的无效化
  1173.     for actor in $game_party.members
  1174.       return $back_attack = false if N01::NON_BACK_ATTACK_WEAPONS.include?(actor.weapon_id)
  1175.       return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR1.include?(actor.armor1_id)
  1176.       return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR2.include?(actor.armor2_id)
  1177.       return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR3.include?(actor.armor3_id)
  1178.       return $back_attack = false if N01::NON_BACK_ATTACK_ARMOR4.include?(actor.armor4_id)
  1179.       for i in 0...N01::NON_BACK_ATTACK_SKILLS.size
  1180.         return $back_attack = false if actor.skill_id_learn?(N01::NON_BACK_ATTACK_SKILLS[i])
  1181.       end  
  1182.     end
  1183.     # 发生背部攻击
  1184.     $back_attack = true
  1185.   end
  1186.   #--------------------------------------------------------------------------
  1187.   # ● 主人公精灵的更新  ※再定义
  1188.   #--------------------------------------------------------------------------
  1189.   def update_actors
  1190.     for i in 0...$game_party.members.size
  1191.       if @actor_sprites[i].battler.id != $game_party.members[i].id
  1192.         @actor_sprites[i].battler = $game_party.members[i]
  1193.         @actor_sprites[i].make_battler
  1194.         @actor_sprites[i].first_action
  1195.       end  
  1196.     end  
  1197.     for sprite in @actor_sprites
  1198.       sprite.update
  1199.     end
  1200.   end
  1201.   #--------------------------------------------------------------------------
  1202.   # ● 伤害动作组合 
  1203.   #--------------------------------------------------------------------------  
  1204.   def set_damage_action(actor, index, action)
  1205.     @actor_sprites[index].damage_action(action) if actor
  1206.     @enemy_sprites[index].damage_action(action) unless actor
  1207.   end
  1208.   #--------------------------------------------------------------------------
  1209.   # ● 伤害POP组合 
  1210.   #--------------------------------------------------------------------------  
  1211.   def set_damage_pop(actor, index, damage)
  1212.     @actor_sprites[index].damage_pop(damage) if actor
  1213.     @enemy_sprites[index].damage_pop(damage) unless actor
  1214.   end
  1215.   #--------------------------------------------------------------------------
  1216.   # ● 目标组合
  1217.   #--------------------------------------------------------------------------  
  1218.   def set_target(actor, index, target)
  1219.     @actor_sprites[index].get_target(target) if actor
  1220.     @enemy_sprites[index].get_target(target) unless actor
  1221.   end
  1222.   #--------------------------------------------------------------------------
  1223.   # ● 动作组合
  1224.   #--------------------------------------------------------------------------  
  1225.   def set_action(actor, index, kind)
  1226.     @actor_sprites[index].start_action(kind) if actor
  1227.     @enemy_sprites[index].start_action(kind) unless actor
  1228.   end  
  1229.   #--------------------------------------------------------------------------
  1230.   # ● 待机动作组合
  1231.   #--------------------------------------------------------------------------  
  1232.   def set_stand_by_action(actor, index)
  1233.     @actor_sprites[index].push_stand_by if actor
  1234.     @enemy_sprites[index].push_stand_by unless actor
  1235.   end  
  1236.   #--------------------------------------------------------------------------
  1237.   # ● 光标移动的组合
  1238.   #--------------------------------------------------------------------------  
  1239.   def set_cursor(actor, index)
  1240.     return [@actor_sprites[index].x, @actor_sprites[index].y] if actor
  1241.     return [@enemy_sprites[index].x, @enemy_sprites[index].y] unless actor
  1242.   end
  1243. end
  1244. #==============================================================================
  1245. # ■ Sprite_MoveAnime
  1246. #------------------------------------------------------------------------------
  1247. #  动画飞出用的精灵。
  1248. #==============================================================================
  1249. class Sprite_MoveAnime < Sprite_Base
  1250.   #--------------------------------------------------------------------------
  1251.   # ● 公开变数
  1252.   #--------------------------------------------------------------------------
  1253.   attr_accessor :battler
  1254.   attr_accessor :base_x   # 自身的基本X坐标
  1255.   attr_accessor :base_y   # 自身的基本Y坐标
  1256.   #--------------------------------------------------------------------------
  1257.   # ● 客观初期化
  1258.   #--------------------------------------------------------------------------
  1259.   def initialize(viewport,battler = nil)
  1260.     super(viewport)
  1261.     @battler = battler
  1262.     self.visible = false
  1263.     @base_x = 0
  1264.     @base_y = 0
  1265.     @move_x = 0                # 移动后的X坐标
  1266.     @move_y = 0                # 移动后Y坐标
  1267.     @moving_x = 0              # 1单位相当移动的X坐标
  1268.     @moving_y = 0              # 1单位相当移动的Y坐标
  1269.     @orbit = 0                 # 圆轨道
  1270.     @orbit_plus = 0            # 加算的圆轨道
  1271.     @orbit_time = 0            # 圆轨道计算时间
  1272.     @through = false           # 是否贯通
  1273.     @finish = false            # 移动完毕的标志
  1274.     @time = 0                  # 一动时间
  1275.     @angle = 0                 # 武器的角度
  1276.     @angling = 0               # 1单位相当移动的武器的角度
  1277.   end
  1278.   #--------------------------------------------------------------------------
  1279.   # ● 获取动作
  1280.   #--------------------------------------------------------------------------  
  1281.   def anime_action(id,mirror,distanse_x,distanse_y,type,speed,orbit,weapon,icon_index,icon_weapon)
  1282.     # 算出1单位相当的移动距离
  1283.     @time = speed
  1284.     @moving_x = distanse_x / speed
  1285.     @moving_y = distanse_y / speed
  1286.     # 是否贯通
  1287.     @through = true if type == 1
  1288.     # 获取圆轨道
  1289.     @orbit_plus = orbit
  1290.     @orbit_time = @time
  1291.     # 有无武器图片
  1292.     if weapon != ""
  1293.       action = N01::ANIME[weapon].dup
  1294.       @angle = action[0]
  1295.       end_angle = action[1]
  1296.       time = action[2]
  1297.       # 调出1单位相当的旋转角度
  1298.       @angling = (end_angle - @angle)/ time
  1299.       # 取得开始角度
  1300.       self.angle = @angle
  1301.       # 显示武器图片
  1302.       self.mirror = mirror
  1303.       if icon_weapon
  1304.         self.bitmap = Cache.system("Iconset")
  1305.         self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1306.         self.ox = 12
  1307.         self.oy = 12
  1308.       else
  1309.         self.bitmap = Cache.character(icon_index)
  1310.         self.ox = self.bitmap.width / 2
  1311.         self.oy = self.bitmap.height / 2
  1312.       end  
  1313.       self.visible = true
  1314.       # 显示在角色面前
  1315.       self.z = 1000
  1316.     end  
  1317.     # 最初不动只显示一次
  1318.     self.x = @base_x + @move_x
  1319.     self.y = @base_y + @move_y + @orbit
  1320.     if id != 0
  1321.       animation = $data_animations[id]
  1322.       start_animation(animation, mirror)
  1323.     end
  1324.   end  
  1325.   #--------------------------------------------------------------------------
  1326.   # ● 变化了的移动组合
  1327.   #--------------------------------------------------------------------------  
  1328.   def action_reset
  1329.     @moving_x = @moving_y = @move_x = @move_y = @base_x = @base_y = @orbit = 0
  1330.     @orbit_time = @angling = @angle = 0   
  1331.     @through = self.visible = @finish = false
  1332.     dispose_animation
  1333.   end   
  1334.   #--------------------------------------------------------------------------
  1335.   # ● 贯通完毕
  1336.   #--------------------------------------------------------------------------  
  1337.   def finish?
  1338.     return @finish
  1339.   end
  1340.   #--------------------------------------------------------------------------
  1341.   # ● 单位更新
  1342.   #--------------------------------------------------------------------------
  1343.   def update
  1344.     super
  1345.     # 时间消耗
  1346.     @time -= 1
  1347.     # 时间内指定的移动
  1348.     if @time >= 0
  1349.       @move_x += @moving_x
  1350.       @move_y += @moving_y
  1351.       # 计算圆轨道
  1352.       if @time < @orbit_time / 2
  1353.         @orbit_plus = @orbit_plus * 5 / 4
  1354.       elsif @time == @orbit_time / 2
  1355.         @orbit_plus *= -1
  1356.       else
  1357.         @orbit_plus = @orbit_plus * 2 / 3
  1358.       end  
  1359.       @orbit += @orbit_plus
  1360.     end   
  1361.     # 就算时间完毕如果是贯穿的话也会继续直进
  1362.     @time = 100 if @time < 0 && @through
  1363.     @finish = true if @time < 0 && !@through
  1364.     # 更新精灵的坐标
  1365.     self.x = @base_x + @move_x
  1366.     self.y = @base_y + @move_y + @orbit
  1367.     # 贯穿时、从画面消失的完毕标志ON
  1368.     if self.x < -200 or self.x > 840 or self.y < -200 or self.y > 680
  1369.       @finish = true
  1370.     end
  1371.     # 更新武器图片
  1372.     if self.visible
  1373.       @angle += @angling
  1374.       self.angle = @angle
  1375.     end  
  1376.   end
  1377. end
  1378. #==============================================================================
  1379. # ■ Sprite_Weapon
  1380. #------------------------------------------------------------------------------
  1381. #  显示武器用的精灵。
  1382. #==============================================================================
  1383. class Sprite_Weapon < Sprite_Base
  1384.   #--------------------------------------------------------------------------
  1385.   # ● 公开变数
  1386.   #--------------------------------------------------------------------------
  1387.   attr_accessor :battler
  1388.   #--------------------------------------------------------------------------
  1389.   # ● 客观初始化
  1390.   #--------------------------------------------------------------------------
  1391.   def initialize(viewport,battler = nil)
  1392.     super(viewport)
  1393.     @battler = battler
  1394.     @action = []                     # 武器的动作情报
  1395.     @move_x = 0                      # 移动后的X坐标
  1396.     @move_y = 0                      # 移动后的Y坐标
  1397.     @move_z = 0                      # 移动后的Z坐标
  1398.     @plus_x = 0                      # 略微调整X坐标
  1399.     @plus_y = 0                      # 略微调整Y坐标
  1400.     @angle = 0                       # 武器的旋转角度
  1401.     @zoom_x = 1                      # 武器的横向放大率
  1402.     @zoom_y = 1                      # 武器的纵向放大率
  1403.     @moving_x = 0                    # 1单位相当移动的X坐标
  1404.     @moving_y = 0                    # 1单位相当移动的Y坐标
  1405.     @angling = 0                     # 1单位相当的旋转角度
  1406.     @zooming_x = 1                   # 1单位相当的横向放大率
  1407.     @zooming_y = 1                   # 1单位相当的纵向放大率   
  1408.     @freeze = -1                     # 固定动画用的武器位置
  1409.     @mirroring = false               # 角色是否为反转
  1410.     @time = N01::ANIME_PATTERN + 1   # 更新回数
  1411.     # 获取武器
  1412.     weapon_graphics
  1413.   end
  1414.   #--------------------------------------------------------------------------
  1415.   # ● 解放
  1416.   #--------------------------------------------------------------------------
  1417.   def dispose
  1418.     self.bitmap.dispose if self.bitmap != nil
  1419.     super
  1420.   end
  1421.   #--------------------------------------------------------------------------
  1422.   # ● 获取武器
  1423.   #--------------------------------------------------------------------------  
  1424.   def weapon_graphics(left = false)
  1425.     if @battler.actor?
  1426.       weapon = @battler.weapons[0] unless left
  1427.       weapon = @battler.weapons[1] if left
  1428.     else
  1429.       weapon = $data_weapons[@battler.weapon]
  1430.       # 确认敌方的反转标志
  1431.       @mirroring = true if @battler.action_mirror
  1432.     end
  1433.     # 如果没有武器时处理被取消
  1434.     return if weapon == nil
  1435.     # 如果用ICON时
  1436.     if weapon.graphic == ""
  1437.       icon_index = weapon.icon_index
  1438.       self.bitmap = Cache.system("Iconset")
  1439.       self.src_rect.set(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  1440.       @weapon_width = @weapon_height = 24
  1441.     # 如果有指定ID时、获取不是ICON的图片  
  1442.     else
  1443.       self.bitmap = Cache.character(weapon.graphic)
  1444.       @weapon_width = self.bitmap.width
  1445.       @weapon_height = self.bitmap.height
  1446.     end
  1447.   end
  1448.   #--------------------------------------------------------------------------
  1449.   # ● 获取动画固定时的武器位置
  1450.   #--------------------------------------------------------------------------  
  1451.   def freeze(action)
  1452.     @freeze = action
  1453.   end
  1454.   #--------------------------------------------------------------------------
  1455.   # ● 获取武器动作 freeze
  1456.   #--------------------------------------------------------------------------  
  1457.   def weapon_action(action,loop)
  1458.     # 没有名称时不显示
  1459.     if action == ""
  1460.       self.visible = false
  1461.     # 空手时不显示
  1462.     elsif @weapon_id == 0
  1463.       self.visible = false
  1464.     # 受取武器的动作情报
  1465.     else
  1466.       @action = N01::ANIME[action]
  1467.       act0 = @action[0]
  1468.       act1 = @action[1]
  1469.       act2 = @action[2]
  1470.       act3 = @action[3]
  1471.       act4 = @action[4]
  1472.       act5 = @action[5]
  1473.       act6 = @action[6]
  1474.       act7 = @action[7]
  1475.       act8 = @action[8]
  1476.       act9 = @action[9]
  1477.       act10 = @action[10]
  1478.       # 角色为反转时、X轴的动作也逆转
  1479.       if @mirroring
  1480.         act0 *= -1
  1481.         act3 *= -1
  1482.         act4 *= -1
  1483.         act9 *= -1
  1484.       end
  1485.       # 背部攻击时逆转
  1486.       if $back_attack && N01::BACK_ATTACK
  1487.         act0 *= -1
  1488.         act3 *= -1
  1489.         act4 *= -1
  1490.         act9 *= -1
  1491.       end
  1492.       # 确认角色的动画图片数
  1493.       time = N01::ANIME_PATTERN
  1494.       # 确认Z坐标
  1495.       if act2
  1496.         self.z = @battler.position_z + 1
  1497.       else
  1498.         self.z = @battler.position_z - 1
  1499.       end
  1500.       # 在这里实行反转、如果已经反转就还原
  1501.       if act6
  1502.         if self.mirror
  1503.           self.mirror = false
  1504.         else
  1505.           self.mirror = true
  1506.         end
  1507.       end
  1508.       # 反映角色的反转
  1509.       if @mirroring
  1510.         if self.mirror
  1511.           self.mirror = false
  1512.         else
  1513.           self.mirror = true
  1514.         end
  1515.       end
  1516.       # 背后攻击时逆转
  1517.       if $back_attack && N01::BACK_ATTACK
  1518.         if self.mirror
  1519.           self.mirror = false
  1520.         else
  1521.           self.mirror = true
  1522.         end
  1523.       end  
  1524.       # 计算以动画图片数相除的变化
  1525.       @moving_x = act0 / time
  1526.       @moving_y = act1 / time
  1527.       # 代入最初的角度
  1528.       @angle = act3
  1529.       self.angle = @angle
  1530.       # 计算更新角度
  1531.       @angling = (act4 - act3)/ time
  1532.       # 角度没有被插入时、在这里加算剩余旋转的部分
  1533.       @angle += (act4 - act3) % time
  1534.       # 放大缩小
  1535.       @zooming_x = (1 - act7) / time
  1536.       @zooming_y = (1 - act8) / time
  1537.       # 如果是反转时、逆转反转前的原点
  1538.       if self.mirror
  1539.         case act5
  1540.         when 1 # 左上→到右上
  1541.           act5 = 2
  1542.         when 2 # 右上→到左上
  1543.           act5 = 1
  1544.         when 3 # 左下→到右下
  1545.           act5 = 4
  1546.         when 4 # 右下→到左下
  1547.           act5 = 3
  1548.         end  
  1549.       end   
  1550.       # 设定旋转前的原点
  1551.       case act5
  1552.       when 0 # 中心
  1553.         self.ox = @weapon_width / 2
  1554.         self.oy = @weapon_height / 2
  1555.       when 1 # 左上
  1556.         self.ox = 0
  1557.         self.oy = 0
  1558.       when 2 # 右上
  1559.         self.ox = @weapon_width
  1560.         self.oy = 0
  1561.       when 3 # 左下
  1562.         self.ox = 0
  1563.         self.oy = @weapon_height
  1564.       when 4 # 右下
  1565.         self.ox = @weapon_width
  1566.         self.oy = @weapon_height
  1567.       end  
  1568.       # 略微调整坐标
  1569.       @plus_x = act9
  1570.       @plus_y = act10
  1571.       # 往返循环时标志ON
  1572.       @loop = true if loop == 0
  1573.       # 第一次时0开始、在这时作-1回的动作
  1574.       @angle -= @angling
  1575.       @zoom_x -= @zooming_x
  1576.       @zoom_y -= @zooming_y
  1577.       # 更新精灵的坐标
  1578.       @move_x -= @moving_x
  1579.       @move_y -= @moving_y
  1580.       @move_z = 1000 if act2
  1581.       # 固定动画时、在这时消化动作
  1582.       if @freeze != -1
  1583.         for i in 0..@freeze + 1
  1584.           @angle += @angling
  1585.           @zoom_x += @zooming_x
  1586.           @zoom_y += @zooming_y
  1587.           # 更新精灵的坐标
  1588.           @move_x += @moving_x
  1589.           @move_y += @moving_y
  1590.         end
  1591.         @angling = 0
  1592.         @zooming_x = 0
  1593.         @zooming_y = 0
  1594.         @moving_x = 0
  1595.         @moving_y = 0
  1596.       end
  1597.       # 可视
  1598.       self.visible = true
  1599.     end
  1600.   end  
  1601.   #--------------------------------------------------------------------------
  1602.   # ● 变化后的动作全部组合
  1603.   #--------------------------------------------------------------------------  
  1604.   def action_reset
  1605.     @moving_x = @moving_y = @move_x = @move_y = @plus_x = @plus_y = 0
  1606.     @angling = @zooming_x = @zooming_y = @angle = self.angle = @move_z = 0
  1607.     @zoom_x = @zoom_y = self.zoom_x = self.zoom_y = 1
  1608.     self.mirror = self.visible = @loop = false
  1609.     @freeze = -1
  1610.     @action = []
  1611.     @time = N01::ANIME_PATTERN + 1
  1612.   end
  1613.   #--------------------------------------------------------------------------
  1614.   # ● 作出往返循环
  1615.   #--------------------------------------------------------------------------  
  1616.   def action_loop
  1617.     # 让动作相反
  1618.     @angling *= -1
  1619.     @zooming_x *= -1
  1620.     @zooming_y *= -1
  1621.     @moving_x *= -1
  1622.     @moving_y *= -1
  1623.   end  
  1624.   #--------------------------------------------------------------------------
  1625.   # ● 主人公是反转时、自身也反转
  1626.   #--------------------------------------------------------------------------
  1627.   def mirroring
  1628.     return @mirroring = false if @mirroring
  1629.     @mirroring = true
  1630.   end  
  1631.   #--------------------------------------------------------------------------
  1632.   # ● 只有在主人公动画被更新时武器动作的変化也更新
  1633.   #--------------------------------------------------------------------------
  1634.   def action
  1635.     return if @time <= 0
  1636.     @time -= 1
  1637.     # 旋转、更新放大缩小
  1638.     @angle += @angling
  1639.     @zoom_x += @zooming_x
  1640.     @zoom_y += @zooming_y
  1641.     # 更新精灵的坐标
  1642.     @move_x += @moving_x
  1643.     @move_y += @moving_y
  1644.     # 往返循环时动作反转
  1645.     if @loop && @time == 0
  1646.       @time = N01::ANIME_PATTERN + 1
  1647.       action_loop
  1648.     end
  1649.   end  
  1650.   #--------------------------------------------------------------------------
  1651.   # ● 单位更新
  1652.   #--------------------------------------------------------------------------
  1653.   def update
  1654.     super
  1655.     # 旋转、更新放大缩小
  1656.     self.angle = @angle
  1657.     self.zoom_x = @zoom_x
  1658.     self.zoom_y = @zoom_y
  1659.     # 更新精灵的坐标
  1660.     self.x = @battler.position_x + @move_x + @plus_x
  1661.     self.y = @battler.position_y + @move_y + @plus_y
  1662.     self.z = @battler.position_z + @move_z - 1
  1663.   end
  1664. end
  1665.  
  1666. #==============================================================================
  1667. # ■ Game_Battler (分割定义 1)
  1668. #------------------------------------------------------------------------------
  1669. #  处理角色的类。
  1670. #==============================================================================
  1671. class Game_Battler
  1672.   #--------------------------------------------------------------------------
  1673.   # ● 公开变数
  1674.   #--------------------------------------------------------------------------
  1675.   attr_accessor :hp_damage        # 行动結果: HP 伤害
  1676.   attr_accessor :mp_damage        # 行动結果: MP 伤害
  1677.   attr_accessor :move_x           # X方向的移动修正
  1678.   attr_accessor :move_y           # Y方向的移动修正
  1679.   attr_accessor :move_z           # Z方向的移动修正
  1680.   attr_accessor :jump             # 修正跳跃
  1681.   attr_accessor :active           # 是否主动
  1682.   attr_accessor :non_dead         # 不死身标志
  1683.   attr_accessor :dying            # 即死标志
  1684.   attr_accessor :slip_damage      # 连续伤害标志
  1685.   attr_accessor :derivation       # 技能连发ID
  1686.   attr_accessor :individual       # 技能连发ID
  1687.   attr_accessor :play             # 动作情报
  1688.   attr_accessor :force_action     # 强制动作情报
  1689.   attr_accessor :force_target     # 目标变更情报
  1690.   attr_accessor :revival          # 复活
  1691.   attr_accessor :double_damage    # HPMP两方同时伤害
  1692.   attr_accessor :reflex           # 技能反射情报
  1693.   attr_accessor :absorb           # 技能成本吸收
  1694.   attr_reader   :base_position_x  # 初期配置X坐标
  1695.   attr_reader   :base_position_y  # 初期配置Y坐标   
  1696.   attr_accessor :force_damage     # 事件的伤害
  1697.   #--------------------------------------------------------------------------
  1698.   # ● 客观初期化
  1699.   #--------------------------------------------------------------------------
  1700.   alias initialize_n01 initialize
  1701.   def initialize
  1702.     initialize_n01
  1703.     @move_x = @move_y = @move_z = @plus_y = @jump = @derivation = @play = 0
  1704.     @force_action = @force_target = @base_position_x = @base_position_y = 0
  1705.     @absorb = @act_time = @force_damage = 0
  1706.     @active = @non_dead = @individual = @slip_damage = @revival = false
  1707.     @double_damage = @dying = false
  1708.   end
  1709.   #--------------------------------------------------------------------------
  1710.   # ● 返还最新的状态ID
  1711.   #--------------------------------------------------------------------------
  1712.   def state_id
  1713.     return @states[@states.size - 1]
  1714.   end
  1715.   #--------------------------------------------------------------------------
  1716.   # ● 判定技能的使用可能  ※再定义
  1717.   #--------------------------------------------------------------------------
  1718.   def skill_can_use?(skill)
  1719.     return false unless skill.is_a?(RPG::Skill)
  1720.     return false unless movable?
  1721.     return false if silent? and skill.spi_f > 0
  1722.     if skill.extension.include?("HP消耗")
  1723.       return false if calc_mp_cost(skill) > hp
  1724.     else
  1725.       return false if calc_mp_cost(skill) > mp
  1726.     end
  1727.     if $game_temp.in_battle
  1728.       return skill.battle_ok?
  1729.     else
  1730.       return skill.menu_ok?
  1731.     end
  1732.   end
  1733.   #--------------------------------------------------------------------------
  1734.   # ● 技能的消费 MP 计算  ※再定义
  1735.   #--------------------------------------------------------------------------
  1736.   def calc_mp_cost(skill)
  1737.     if half_mp_cost && !skill.extension.include?("MP消耗减半无效")
  1738.       cost = skill.mp_cost / 2
  1739.     else
  1740.       cost = skill.mp_cost
  1741.     end
  1742.     if skill.extension.include?("%成本MAX")
  1743.       return self.maxhp * cost / 100 if skill.extension.include?("HP消耗")
  1744.       return self.maxmp * cost / 100
  1745.     elsif skill.extension.include?("%成本NOW")
  1746.       return self.hp * cost / 100 if skill.extension.include?("HP消耗")
  1747.       return self.mp * cost / 100
  1748.     end
  1749.     return cost
  1750.   end
  1751.   #--------------------------------------------------------------------------
  1752.   # ● 技能成本消费
  1753.   #--------------------------------------------------------------------------
  1754.   def consum_skill_cost(skill)
  1755.     return false unless skill_can_use?(skill)
  1756.     cost = calc_mp_cost(skill)
  1757.     return self.hp -= cost if skill.extension.include?("HP消耗")
  1758.     return self.mp -= cost
  1759.   end
  1760.   #--------------------------------------------------------------------------
  1761.   # ● 根据通常攻击计算伤害  修正二刀流
  1762.   #--------------------------------------------------------------------------
  1763.   alias make_attack_damage_value_n01 make_attack_damage_value
  1764.   def make_attack_damage_value(attacker)
  1765.     make_attack_damage_value_n01(attacker)
  1766.     # 只有在装备了两把武器时修正有效
  1767.     return unless attacker.actor?
  1768.     return if attacker.weapons[0] == nil
  1769.     return if attacker.weapons[1] == nil
  1770.     @hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[0] / 100
  1771.   end
  1772.   #--------------------------------------------------------------------------
  1773.   # ● 根据技能或者物品来计算伤害 修正二刀流
  1774.   #--------------------------------------------------------------------------
  1775.   alias make_obj_damage_value_n01 make_obj_damage_value
  1776.   def make_obj_damage_value(user, obj)
  1777.     make_obj_damage_value_n01(user, obj)
  1778.     # 只有在装备了两把武器时修正有效
  1779.     return unless user.actor?
  1780.     return if user.weapons[0] == nil
  1781.     return if user.weapons[1] == nil
  1782.     if obj.damage_to_mp  
  1783.       @mp_damage = @mp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害MP
  1784.     else
  1785.       @hp_damage = @hp_damage * N01::TWO_SWORDS_STYLE[1] / 100 # 伤害HP
  1786.     end
  1787.   end
  1788.   #--------------------------------------------------------------------------
  1789.   # ● 使用通常攻击的効果  全部战斗不能,不能绝对回避的处理
  1790.   #--------------------------------------------------------------------------
  1791.   def perfect_attack_effect(attacker)
  1792.     clear_action_results
  1793.     make_attack_damage_value(attacker)            # 计算伤害
  1794.     execute_damage(attacker)                      # 反映伤害
  1795.     apply_state_changes(attacker)                 # 状态变化
  1796.   end
  1797.   #--------------------------------------------------------------------------
  1798.   # ● 使用技能的效果  全部战斗不能,不能绝对回避的处理
  1799.   #--------------------------------------------------------------------------
  1800.   def perfect_skill_effect(user, skill)
  1801.     clear_action_results
  1802.     make_obj_damage_value(user, skill)            # 伤害計算
  1803.     make_obj_absorb_effect(user, skill)           # 吸収効果計算
  1804.     execute_damage(user)                          # 伤害反映
  1805.     apply_state_changes(skill)                    # ステート変化
  1806.   end
  1807.   #--------------------------------------------------------------------------
  1808.   # ● 使用物品的効果  全部战斗不能,不能绝对回避的处理
  1809.   #--------------------------------------------------------------------------
  1810.   def perfect_item_effect(user, item)
  1811.     clear_action_results
  1812.     hp_recovery = calc_hp_recovery(user, item)    # 计算HP的回复量
  1813.     mp_recovery = calc_mp_recovery(user, item)    # 计算MP的回复量
  1814.     make_obj_damage_value(user, item)             # 计算伤害
  1815.     @hp_damage -= hp_recovery                     # 扣除HP的回复量
  1816.     @mp_damage -= mp_recovery                     # 扣除MP的回复量
  1817.     make_obj_absorb_effect(user, item)            # 计算吸收效果
  1818.     execute_damage(user)                          # 反映伤害
  1819.     item_growth_effect(user, item)                # 使用成长效果
  1820.     if item.physical_attack and @hp_damage == 0   # 物理ノー伤害判定
  1821.       return                                    
  1822.     end
  1823.     apply_state_changes(item)                     # 状态变化
  1824.   end
  1825.   #--------------------------------------------------------------------------
  1826.   # ● 伤害的反映
  1827.   #--------------------------------------------------------------------------
  1828.   alias execute_damage_n01 execute_damage
  1829.   def execute_damage(user)
  1830.     execute_damage_n01(user)
  1831.     # 吸収时这里的处理相冲
  1832.     if @absorbed               
  1833.       user.hp_damage = -@hp_damage
  1834.       user.mp_damage = -@mp_damage
  1835.     end
  1836.   end
  1837.   #--------------------------------------------------------------------------
  1838.   # ● 使用技能的効果
  1839.   #--------------------------------------------------------------------------
  1840.   alias skill_effect_n01 skill_effect
  1841.   def skill_effect(user, obj)
  1842.     # 保持变化前的HPMP
  1843.     nowhp = self.hp
  1844.     nowmp = self.mp
  1845.     # 为了计算现在HPMP的威力获取变化前的使用者的HPMP
  1846.     if obj.extension.include?("HP消耗")
  1847.       user_hp = user.hp + user.calc_mp_cost(obj)
  1848.       user_mp = user.mp
  1849.     else  
  1850.       user_hp = user.hp
  1851.       user_mp = user.mp + user.calc_mp_cost(obj)
  1852.     end  
  1853.     # 确认扩张设定
  1854.     check_extension(obj)
  1855.     # 计算伤害
  1856.     skill_effect_n01(user, obj)
  1857.     # 有伤害系的扩张时这里的处理会相冲
  1858.     if @extension
  1859.       self.hp = nowhp
  1860.       self.mp = nowmp
  1861.     end
  1862.     # 攻击未名中时中断处理
  1863.     return if self.evaded or self.missed
  1864.     # 变换伤害属性
  1865.     damage = @hp_damage unless obj.damage_to_mp
  1866.     damage = @mp_damage if obj.damage_to_mp
  1867.     # 比例伤害
  1868.     if @ratio_maxdamage != nil
  1869.       damage = self.maxhp * @ratio_maxdamage / 100 unless obj.damage_to_mp
  1870.       damage = self.maxmp * @ratio_maxdamage / 100 if obj.damage_to_mp
  1871.     end
  1872.     if @ratio_nowdamage != nil
  1873.       damage = self.hp * @ratio_nowdamage / 100 unless obj.damage_to_mp
  1874.       damage = self.mp * @ratio_nowdamage / 100 if obj.damage_to_mp
  1875.     end
  1876.     # 成本威力
  1877.     if @cost_damage
  1878.       cost = user.calc_mp_cost(obj)
  1879.       if obj.extension.include?("HP消耗")
  1880.         damage = damage * cost / user.maxhp
  1881.       else
  1882.         damage = damage * cost / user.maxmp
  1883.       end
  1884.     end
  1885.     # 现在HP威力
  1886.     damage = damage * user_hp / user.maxhp if @nowhp_damage
  1887.     # 现在MP威力
  1888.     damage = damage * user_mp / user.maxmp if @nowmp_damage
  1889.     # 放弃伤害属性的变换
  1890.     @hp_damage = damage unless obj.damage_to_mp
  1891.     @mp_damage = damage if obj.damage_to_mp
  1892.     # 反应扩张
  1893.     if @extension
  1894.       self.hp -= @hp_damage
  1895.       self.mp -= @mp_damage
  1896.     end
  1897.     # 初期化
  1898.     @extension = false
  1899.     @cost_damage = false
  1900.     @nowhp_damage = false
  1901.     @nowmp_damage = false
  1902.     @ratio_maxdamage = nil
  1903.     @ratio_nowdamage = nil
  1904.   end
  1905.   #--------------------------------------------------------------------------
  1906.   # ● 确认扩张设定
  1907.   #--------------------------------------------------------------------------
  1908.   def check_extension(skill)
  1909.     for ext in skill.extension
  1910.       # 成本威力
  1911.       if ext == "成本威力"  
  1912.         @extension = true
  1913.         next @cost_damage = true
  1914.       # 现在HP威力
  1915.       elsif ext == "现HP威力"
  1916.         @extension = true
  1917.         next @nowhp_damage = true
  1918.       # 现在MP威力
  1919.       elsif ext == "现MP威力"
  1920.         @extension = true
  1921.         next @nowmp_damage = true
  1922.       else
  1923.         # 比例伤害
  1924.         name = ext.split('')
  1925.         if name[5] == "M"
  1926.           name = name.join
  1927.           name.slice!("%伤害MAX/")
  1928.           @extension = true
  1929.           next @ratio_maxdamage = name.to_i
  1930.         elsif name[5] == "N"
  1931.           name = name.join
  1932.           name.slice!("%伤害NOW/")
  1933.           @extension = true
  1934.           next @ratio_nowdamage = name.to_i
  1935.         end  
  1936.       end
  1937.     end  
  1938.   end
  1939.   #--------------------------------------------------------------------------
  1940.   # ● 初期配置的変更
  1941.   #--------------------------------------------------------------------------
  1942.   def change_base_position(x, y)
  1943.     @base_position_x = x
  1944.     @base_position_y = y
  1945.   end
  1946.   #--------------------------------------------------------------------------
  1947.   # ● 初期化
  1948.   #--------------------------------------------------------------------------
  1949.   def reset_coordinate
  1950.     @move_x = @move_y = @move_z = @jump = @derivation = 0
  1951.     @active = @non_dead = @individual = false   
  1952.   end
  1953.   #--------------------------------------------------------------------------
  1954.   # ● 使用连续伤害的効果
  1955.   #--------------------------------------------------------------------------
  1956.   def slip_damage_effect
  1957.     if slip_damage? and @hp > 0
  1958.       @hp_damage = apply_variance(maxhp / 10, 10)
  1959.       @hp_damage = @hp - 1 if @hp_damage >= @hp
  1960.       self.hp -= @hp_damage
  1961.     end
  1962.   end
  1963.   #--------------------------------------------------------------------------
  1964.   # ● 事件的伤害POP
  1965.   #--------------------------------------------------------------------------
  1966.   def damage_num(num = nil)
  1967.     return if dead? or !$game_temp.in_battle or num == 0
  1968.     @force_damage = num
  1969.   end
  1970. end  
  1971. #==============================================================================
  1972. # ■ Game_Actor
  1973. #------------------------------------------------------------------------------
  1974. #  处理主人公的类。
  1975. #==============================================================================
  1976. class Game_Actor < Game_Battler
  1977.   #--------------------------------------------------------------------------
  1978.   # ● 公开变数
  1979.   #--------------------------------------------------------------------------
  1980.   attr_accessor :two_swords_change          # 强制替换二刀流的标志
  1981.   #--------------------------------------------------------------------------
  1982.   # ● 根据ID判定技能是否习得
  1983.   #--------------------------------------------------------------------------
  1984.   def skill_id_learn?(skill_id)
  1985.     return @skills.include?(skill_id)
  1986.   end
  1987.   #--------------------------------------------------------------------------
  1988.   # ● 判定技能的使用可能  ※再定义
  1989.   #--------------------------------------------------------------------------
  1990.   def skill_can_use?(skill)
  1991.     return super
  1992.   end
  1993.   #--------------------------------------------------------------------------
  1994.   # ● 图片的变更
  1995.   #--------------------------------------------------------------------------
  1996.   def graphic_change(character_name)
  1997.     @character_name = character_name
  1998.   end
  1999.   #--------------------------------------------------------------------------
  2000.   # ● 击倒的实行 ※再定义
  2001.   #--------------------------------------------------------------------------
  2002.   def perform_collapse
  2003.     Sound.play_actor_collapse if $game_temp.in_battle and dead?
  2004.   end
  2005.   #--------------------------------------------------------------------------
  2006.   # ● 初期配置的取得
  2007.   #--------------------------------------------------------------------------
  2008.   def base_position
  2009.     base = N01::ACTOR_POSITION[self.index]
  2010.     @base_position_x = base[0]
  2011.     @base_position_y = base[1]
  2012.     # バックアタック時はX軸を逆に
  2013.     @base_position_x = Graphics.width - base[0] if $back_attack && N01::BACK_ATTACK
  2014.   end
  2015.   #--------------------------------------------------------------------------
  2016.   # ● 战斗画面 X 坐标的取得
  2017.   #--------------------------------------------------------------------------
  2018.   def position_x
  2019.     return 0 if self.index == nil
  2020.     return @base_position_x + @move_x
  2021.   end
  2022.   #--------------------------------------------------------------------------
  2023.   # ● 战斗画面 Y 坐标的取得
  2024.   #--------------------------------------------------------------------------
  2025.   def position_y
  2026.     return 0 if self.index == nil
  2027.     return @base_position_y + @move_y + @jump
  2028.   end
  2029.   #--------------------------------------------------------------------------
  2030.   # ● 战斗画面 Z 坐标的取得
  2031.   #--------------------------------------------------------------------------
  2032.   def position_z
  2033.     return 0 if self.index == nil
  2034.     return self.index + @base_position_y + @move_y + @move_z - @jump + 200
  2035.   end  
  2036. end
  2037. #==============================================================================
  2038. # ■ Game_Enemy
  2039. #------------------------------------------------------------------------------
  2040. #  处理敌方的类。
  2041. #==============================================================================
  2042. class Game_Enemy < Game_Battler
  2043.   #--------------------------------------------------------------------------
  2044.   # ● 公开变数
  2045.   #--------------------------------------------------------------------------
  2046.   attr_accessor :adj_speed        # 复数会合行动的速度修正
  2047.   attr_accessor :act_time         # 行动数回
  2048.   #--------------------------------------------------------------------------
  2049.   # ● 动作速度的決定 复数回合行动用
  2050.   #--------------------------------------------------------------------------
  2051.   def make_action_speed2(adj)
  2052.     @adj_speed = self.action.speed if @adj_speed == nil
  2053.     @adj_speed = @adj_speed * adj / 100
  2054.   end
  2055.   #--------------------------------------------------------------------------
  2056.   # ● 击倒的实行 ※再定义
  2057.   #--------------------------------------------------------------------------
  2058.   def perform_collapse
  2059.     @force_action = ["N01collapse"] if $game_temp.in_battle and dead?
  2060.   end
  2061.   #--------------------------------------------------------------------------
  2062.   # ● 获取初期配置
  2063.   #--------------------------------------------------------------------------
  2064.   def base_position
  2065.     return if self.index == nil
  2066.     # 确认角色画像的大小修正Y坐标
  2067.     bitmap = Bitmap.new("Graphics/Battlers/" + @battler_name) if !self.anime_on
  2068.     bitmap = Bitmap.new("Graphics/Characters/" + @battler_name) if self.anime_on && N01::WALK_ANIME
  2069.     bitmap = Bitmap.new("Graphics/Characters/" + @battler_name + "_1") if self.anime_on && !N01::WALK_ANIME
  2070.     height = bitmap.height
  2071.     @base_position_x = self.screen_x + self.position_plus[0]
  2072.     @base_position_y = self.screen_y + self.position_plus[1] - height / 3
  2073.     bitmap.dispose
  2074.     # 背后攻击时X轴逆转
  2075.     if $back_attack && N01::BACK_ATTACK
  2076.       @base_position_x = Graphics.width - self.screen_x - self.position_plus[0]
  2077.     end
  2078.   end
  2079.   #--------------------------------------------------------------------------
  2080.   # ● 战斗画面 X 坐标的取得
  2081.   #--------------------------------------------------------------------------
  2082.   def position_x
  2083.     return @base_position_x - @move_x
  2084.   end
  2085.   #--------------------------------------------------------------------------
  2086.   # ● 战斗画面 Y 坐标的取得
  2087.   #--------------------------------------------------------------------------
  2088.   def position_y
  2089.     return @base_position_y + @move_y + @jump
  2090.   end
  2091.   #--------------------------------------------------------------------------
  2092.   # ● 战斗画面 Z 坐标的取得
  2093.   #--------------------------------------------------------------------------
  2094.   def position_z
  2095.     return position_y + @move_z - @jump + 200
  2096.   end
  2097. end
  2098. #==============================================================================
  2099. # ■ Sprite_Damage
  2100. #------------------------------------------------------------------------------
  2101. #  伤害表示的精灵。
  2102. #==============================================================================
  2103. class Sprite_Damage < Sprite_Base
  2104.   #--------------------------------------------------------------------------
  2105.   # ● 公开变数
  2106.   #--------------------------------------------------------------------------
  2107.   attr_accessor :battler
  2108.   #--------------------------------------------------------------------------
  2109.   # ● 客观初期化
  2110.   #--------------------------------------------------------------------------
  2111.   def initialize(viewport,battler = nil)
  2112.     super(viewport)
  2113.     @battler = battler
  2114.     @damage = 0
  2115.     @duration = 0
  2116.     @x = 0
  2117.     @y = 0
  2118.     @z_plus = 0
  2119.     @minus = false
  2120.     @num1 = Sprite.new(viewport)
  2121.     @num2 = Sprite.new(viewport)
  2122.     @num3 = Sprite.new(viewport)
  2123.     @num4 = Sprite.new(viewport)
  2124.     @num5 = Sprite.new(viewport)
  2125.     @num1.visible = false
  2126.     @num2.visible = false
  2127.     @num3.visible = false
  2128.     @num4.visible = false
  2129.     @num5.visible = false
  2130.   end
  2131.   #--------------------------------------------------------------------------
  2132.   # ● 更新
  2133.   #--------------------------------------------------------------------------
  2134.   def update
  2135.     force_damage
  2136.     move_damage(@num5, @pop_time) if @num5.visible
  2137.     move_damage(@num4, @pop_time - 2) if @num4.visible
  2138.     move_damage(@num3, @pop_time - 4) if @num3.visible
  2139.     move_damage(@num2, @pop_time - 6) if @num2.visible
  2140.     move_damage(@num1, @pop_time - 8) if @num1.visible
  2141.     move_window if @window != nil
  2142.     @duration -= 1 if @duration > 0
  2143.   end
  2144.   #--------------------------------------------------------------------------
  2145.   # ● 事件的伤害POP
  2146.   #--------------------------------------------------------------------------
  2147.   def force_damage
  2148.     if @battler.force_damage != 0
  2149.       damage_pop(@battler.force_damage)
  2150.       @battler.hp -= @battler.force_damage
  2151.       @force_damage = true
  2152.       @battler.force_damage = 0
  2153.       $game_temp.status_window_refresh = true
  2154.     end
  2155.   end
  2156.   #--------------------------------------------------------------------------
  2157.   # ● 数値的移动
  2158.   #--------------------------------------------------------------------------
  2159.   def move_damage(num, min)
  2160.     case @duration
  2161.     when min-1..min
  2162.       num.y -= 4
  2163.     when min-3..min-2
  2164.       num.y -= 3
  2165.     when min-6..min-4
  2166.       num.y -= 2
  2167.     when min-14..min-7
  2168.       num.y += 2
  2169.     when min-17..min-15
  2170.       num.y -= 2
  2171.     when min-23..min-18
  2172.       num.y += 1
  2173.     when min-27..min-24
  2174.       num.y -= 1
  2175.     when min-30..min-28
  2176.       num.y += 1
  2177.     when min-33..min-31
  2178.       num.y -= 1
  2179.     when min-36..min-34
  2180.       num.y += 1
  2181.     end
  2182.     next_damage if @battler.double_damage && @duration == min-34
  2183.     num.opacity = 256 - (12 - @duration) * 32
  2184.     num.visible = false if @duration == 0
  2185.     if @force_damage && @duration == 0
  2186.       @force_damage = false
  2187.       @battler.perform_collapse
  2188.     end
  2189.   end
  2190.   #--------------------------------------------------------------------------
  2191.   # ● 文字窗口的移动
  2192.   #--------------------------------------------------------------------------
  2193.   def move_window
  2194.     @window.x -= 6 if @window_time > 0 && @window.x > 0
  2195.     @window_time -= 1
  2196.     if @duration == 0
  2197.       @window.dispose
  2198.       @window = nil
  2199.     end
  2200.   end  
  2201.   #--------------------------------------------------------------------------
  2202.   # ● HPMP两方同时伤害
  2203.   #--------------------------------------------------------------------------
  2204.   def next_damage
  2205.     @battler.hp_damage = 0
  2206.     @battler.double_damage = false
  2207.     damage_pop
  2208.   end
  2209.   #--------------------------------------------------------------------------
  2210.   # ● 准备伤害POP
  2211.   #--------------------------------------------------------------------------
  2212.   def damage_pop(num = nil)
  2213.     reset
  2214.     damage = battler.hp_damage
  2215.     # 抽出状态的变化
  2216.     states = battler.added_states
  2217.     text = ""
  2218.     # MP伤害用文本(HPMP两方同时伤害除外)
  2219.     if !@battler.double_damage && @battler.mp_damage != 0
  2220.       text = N01::POP_MP_DAM if battler.mp_damage > 0
  2221.       text = N01::POP_MP_REC if battler.mp_damage < 0
  2222.       damage = battler.mp_damage
  2223.     end
  2224.     # 连续伤害不显示MP伤害以外的文字
  2225.     if num == nil
  2226.       text = N01::POP_MISS if battler.missed && states == []
  2227.       text = N01::POP_DAMAGE0 if damage == 0 && states == [] && !battler.revival
  2228.       text = N01::POP_EVA if battler.evaded
  2229.       text = N01::POP_CRI if battler.critical
  2230.       for state in states
  2231.         # 无POP设定的状态不显示
  2232.         unless state.extension.include?("无POP")
  2233.           text += " " if text != ""
  2234.           text += state.name
  2235.         end
  2236.       end
  2237.     else
  2238.       damage = num
  2239.     end
  2240.     # 区分伤害和回复
  2241.     @minus = false
  2242.     @minus = true if damage < 0
  2243.     damage = damage.abs
  2244.     # 略微调整POP位置
  2245.     adjust = -16
  2246.     adjust = 16 if $back_attack
  2247.     adjust = 0 if damage == 0
  2248.     @x = battler.position_x + adjust
  2249.     @y = battler.position_y
  2250.     window(text) if text != ""
  2251.     @pop_time = N01::NUM_DURATION
  2252.     # 没有伤害时没有数字的POP
  2253.     return @duration = @pop_time if damage == 0
  2254.     @num_time = -1
  2255.     damage_file(@num1, damage % 10, @pop_time - 7) if damage >= 0
  2256.     damage_file(@num2, (damage % 100)/10, @pop_time - 5) if damage >= 10
  2257.     damage_file(@num3, (damage % 1000)/100, @pop_time - 3) if damage >= 100
  2258.     damage_file(@num4, (damage % 10000)/1000, @pop_time - 1) if damage >= 1000
  2259.     damage_file(@num5, (damage % 100000)/10000, @pop_time + 1) if damage >= 10000
  2260.   end  
  2261.   #--------------------------------------------------------------------------
  2262.   # ● 准备情报窗口
  2263.   #--------------------------------------------------------------------------
  2264.   def window(text)
  2265.     @window = Window_Damage.new(@x - 64, @y - 22)
  2266.     @window.pop_text(text)
  2267.     @window_time = 5
  2268.   end  
  2269.   #--------------------------------------------------------------------------
  2270.   # ● 准备数字画像
  2271.   #--------------------------------------------------------------------------
  2272.   def damage_file(num, cw, dur)
  2273.     num.visible = true
  2274.     # 判別文件
  2275.     file = N01::DAMAGE_GRAPHICS
  2276.     file = N01::RECOVER_GRAPHICS if @minus
  2277.     # 数字
  2278.     num.bitmap = Cache.system(file)
  2279.     @num_time += 1
  2280.     sx = num.bitmap.width / 10
  2281.     num.src_rect.set(cw * sx, 0, sx, num.height)
  2282.     num.x = @x - (num.width + N01::NUM_INTERBAL) * @num_time
  2283.     num.y = @y
  2284.     num.z = 2000 - @num_time
  2285.     @duration = dur
  2286.     @window.x = num.x - @window.width + 64 if @window != nil && N01::NON_DAMAGE_WINDOW
  2287.     @window.x = num.x - @window.width + 26 if @window != nil && !N01::NON_DAMAGE_WINDOW
  2288.     @window.x = 0 if @window != nil && @window.x < 0
  2289.   end
  2290.   #--------------------------------------------------------------------------
  2291.   # ● 伤害组合
  2292.   #--------------------------------------------------------------------------
  2293.   def reset
  2294.     @num5.visible = @num4.visible = @num3.visible = @num2.visible = @num1.visible = false
  2295.     @window.dispose if @window != nil
  2296.     @window = nil
  2297.   end  
  2298.   #--------------------------------------------------------------------------
  2299.   # ● 开放
  2300.   #--------------------------------------------------------------------------
  2301.   def dispose
  2302.     super
  2303.     @num1.dispose
  2304.     @num2.dispose
  2305.     @num3.dispose
  2306.     @num4.dispose
  2307.     @num5.dispose
  2308.     @window.dispose if @window != nil
  2309.   end  
  2310. end
  2311. #==============================================================================
  2312. # ■ Window_Damage
  2313. #------------------------------------------------------------------------------
  2314. #  危机等表示的窗口。
  2315. #==============================================================================
  2316. class Window_Damage < Window_Base
  2317.   #--------------------------------------------------------------------------
  2318.   # ● 客观初期化
  2319.   #--------------------------------------------------------------------------
  2320.   def initialize(x, y)
  2321.     super(x, y, 160, 46)
  2322.     self.opacity = 0 if N01::NON_DAMAGE_WINDOW
  2323.   end
  2324.   #--------------------------------------------------------------------------
  2325.   # ● 窗口内容的作成
  2326.   #--------------------------------------------------------------------------
  2327.   def create_contents
  2328.     self.contents.dispose
  2329.     self.contents = Bitmap.new(width - 32, height - 32)
  2330.   end
  2331.   #--------------------------------------------------------------------------
  2332.   # ● 状态设定
  2333.   #--------------------------------------------------------------------------
  2334.   def pop_text(text, align = 1)
  2335.     self.contents.clear
  2336.     self.width = self.contents.text_size(text).width + 36
  2337.     self.contents = Bitmap.new(width - 32, height - 32)
  2338.     self.contents.font.color = normal_color
  2339.     self.contents.font.size = 16
  2340.     self.contents.draw_text(0,-8, width - 32, 32, text, align)
  2341.   end  
  2342. end  
  2343. #==============================================================================
  2344. # ■ Window_Base
  2345. #------------------------------------------------------------------------------
  2346. #  游戏中处理所有窗口的超级类。
  2347. #==============================================================================
  2348. class Window_Base < Window  
  2349.   #--------------------------------------------------------------------------
  2350.   # ● 状态的描画  ※再定义(反映设定不显示状态ICON)
  2351.   #--------------------------------------------------------------------------
  2352.   def draw_actor_state(actor, x, y, width = 96)
  2353.     count = 0
  2354.     for state in actor.states
  2355.       break if state.extension.include?("不显示ICON")
  2356.       draw_icon(state.icon_index, x + 24 * count, y)
  2357.       count += 1
  2358.       break if (24 * count > width - 24)
  2359.     end
  2360.   end
  2361. end
  2362. #==============================================================================
  2363. # ■ Game_Temp
  2364. #------------------------------------------------------------------------------
  2365. #  不包含存储数据、处理一时数据的类。
  2366. #==============================================================================
  2367. class Game_Temp
  2368.   #--------------------------------------------------------------------------
  2369.   # ● 公开变数
  2370.   #--------------------------------------------------------------------------
  2371.   attr_accessor :status_window_refresh    # 状态窗口的还原标志
  2372.   #--------------------------------------------------------------------------
  2373.   # ● 客观初期化
  2374.   #--------------------------------------------------------------------------
  2375.   alias initialize_n01 initialize
  2376.   def initialize
  2377.     initialize_n01
  2378.     @status_window_refresh = false
  2379.   end
  2380. end  
  2381. #==============================================================================
  2382. # ■ Game_Interpreter
  2383. #------------------------------------------------------------------------------
  2384. #  实行时间指令的解释。
  2385. #==============================================================================
  2386. class Game_Interpreter
  2387.   #--------------------------------------------------------------------------
  2388.   # ● HP 的增减
  2389.   #--------------------------------------------------------------------------
  2390.   def command_311
  2391.     if $game_temp.in_battle
  2392.       value = operate_value(@params[1], @params[2], @params[3])
  2393.       iterate_actor_id(@params[0]) do |actor|
  2394.         next if actor.dead?
  2395.         if @params[4] == false and actor.hp + value <= 0
  2396.           actor.damage_num(actor.hp - 1) # 如果不允许战斗不能时变为1
  2397.         else
  2398.           actor.damage_num(-value)
  2399.         end
  2400.       end
  2401.       return true
  2402.     else
  2403.       value = operate_value(@params[1], @params[2], @params[3])
  2404.       iterate_actor_id(@params[0]) do |actor|
  2405.         next if actor.dead?
  2406.         if @params[4] == false and actor.hp + value <= 0
  2407.           actor.hp = 1    # 如果不允许战斗不能时变为1
  2408.         else
  2409.           actor.hp += value
  2410.         end
  2411.         actor.perform_collapse
  2412.       end
  2413.       if $game_party.all_dead?
  2414.         $game_temp.next_scene = "gameover"
  2415.       end
  2416.       return true
  2417.     end  
  2418.   end
  2419.   #--------------------------------------------------------------------------
  2420.   # ● 敌角色的 HP 增减
  2421.   #--------------------------------------------------------------------------
  2422.   def command_331
  2423.     value = operate_value(@params[1], @params[2], @params[3])
  2424.     iterate_enemy_index(@params[0]) do |enemy|
  2425.       if enemy.hp > 0
  2426.         if @params[4] == false and enemy.hp + value <= 0
  2427.           enemy.damage_num(enemy.hp - 1) # 如果不允许战斗不能时变为1
  2428.         else
  2429.           enemy.damage_num(-value)
  2430.         end
  2431.       end
  2432.     end
  2433.     return true
  2434.   end
  2435. end

Lv4.逐梦者 (版主)

聪仔

梦石
0
星屑
6182
在线时间
3077 小时
注册时间
2013-12-26
帖子
3145
2
发表于 2013-12-29 14:16:37 | 只看该作者
横版脚本本身是没错的,你使用出错那么错误一定在你身上而不在脚本。你给出一个正确的脚本是没有任何作用 的,你如果不给出你修改了什么地方、在什么情况下报错,是没办法解决的...
很多情况下报错的那行并不是错误的所在行......
聪聪全国第三帅...
他们都叫我【人赢聪】
我的RM能力雷达图:

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2013-12-22
帖子
78
3
 楼主| 发表于 2013-12-29 19:24:39 | 只看该作者
正太君 发表于 2013-12-29 14:16
横版脚本本身是没错的,你使用出错那么错误一定在你身上而不在脚本。你给出一个正确的脚本是没有任何作用  ...

我是原原本本的复制脚本的,我没改过什么地方。然后是在战斗准备开始的时候报错,有什么办法能解决的吗?

点评

这就太难了...  发表于 2013-12-29 19:50
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2013-12-22
帖子
78
4
 楼主| 发表于 2013-12-29 21:28:41 | 只看该作者
正太君 发表于 2013-12-29 14:16
横版脚本本身是没错的,你使用出错那么错误一定在你身上而不在脚本。你给出一个正确的脚本是没有任何作用  ...

是不是还要什么类似行走图的东西来激活那个脚本什么的啊?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2013-12-22
帖子
78
5
 楼主| 发表于 2013-12-29 21:38:03 | 只看该作者
正太君 发表于 2013-12-29 14:16
横版脚本本身是没错的,你使用出错那么错误一定在你身上而不在脚本。你给出一个正确的脚本是没有任何作用  ...

对了,就是出现typeerror的警示框的时候
出现了这句英语
cannot convet fixnum into array
翻译是
不能convet fixnum成阵列
这个能解决的吗?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
182 小时
注册时间
2009-4-22
帖子
208
6
发表于 2013-12-29 22:43:02 | 只看该作者
我对照了下我的横版,没发现错误哦,你是不是改了分辨率啊?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2013-12-22
帖子
78
7
 楼主| 发表于 2013-12-29 23:01:11 | 只看该作者
gz29767562 发表于 2013-12-29 22:43
我对照了下我的横版,没发现错误哦,你是不是改了分辨率啊?

分辨率是啥?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2013-12-22
帖子
78
8
 楼主| 发表于 2013-12-30 11:32:56 | 只看该作者
gz29767562 发表于 2013-12-29 22:43
我对照了下我的横版,没发现错误哦,你是不是改了分辨率啊?

分辨率是什么要怎么改QAQ求教
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
182 小时
注册时间
2009-4-22
帖子
208
9
发表于 2013-12-30 13:36:21 | 只看该作者
本帖最后由 gz29767562 于 2013-12-30 22:25 编辑
a65868886 发表于 2013-12-30 11:32
分辨率是什么要怎么改QAQ求教



你下载下我做的吧,才开始画地图,不过大部分层面上的问题解决了,希望对你有帮助,里面也解决了你要的战斗系统。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-16 16:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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