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

Project1

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

[已经过期] 求大神帮我看看我的两个脚本哪里出现问题了

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
50 小时
注册时间
2014-12-12
帖子
16
跳转到指定楼层
1
发表于 2015-1-12 23:40:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
一个是横版战斗 另一个是即时消息 虽然放在一起能用但是战斗的时候即时消息的信息框不见了……(在原工程是会出现的QAQ)新人刚进坑几个月,希望大神能帮我看看 二楼上脚本……
不要迷恋哥,哥只是个传说

Lv1.梦旅人

梦石
0
星屑
55
在线时间
50 小时
注册时间
2014-12-12
帖子
16
2
 楼主| 发表于 2015-1-12 23:44:16 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #
  4. # ■ 熊式横版战斗 by 弗雷德   真移位:神思
  5. #==============================================================================
  6. #如果要需要Game_Battler3类的攻击、特技、物品的方法,请移至161-470行
  7. #因为重写过这三个方法,在原方法里改是不会生效的。





  8. #--------------------------------------------------------------------------
  9. #  ● 设定开始
  10. #--------------------------------------------------------------------------
  11. #伤害为0的时候是否显示无效文字,1为显示,0为不显示。
  12. INVALIDSWITCH = 0

  13. # 是否显示死亡图 1为显示,0为不显示。
  14. DEADPIC = 1

  15. # 是否显示总伤害 1为显示,0为不显示。
  16. SHOW_TOTAL_DAMAGE = 0

  17. # 是否显示连击数值 1为显示,0为不显示。
  18. HITSWITCH = 1

  19. # 是否显示SP伤害数值 1为显示,0为不显示。
  20. SDMGSWITCH = 1

  21. # 不是主状态的时候是否稍稍降低点透明度  1为降低,0为不降低
  22. NACTSWITCH = 0

  23. # 会心一击时的音效,不设置为不使用音效。
  24. CRIVOICE = "Critital_hit"

  25. # 会心一击是否开启画面晃动 1为开启,0为关闭
  26. CRISHAKE = 1

  27. # 会心一击是否开启画面闪烁,1为开启,0为关闭
  28. CRIFLASH = 1

  29. # 攻击时不移动的属性编号 默认为29号 参考数据库的设置
  30. # 比如职业枪兵勾上了29号属性,那么当枪兵使用普通攻击时将不会移动。技能也是如此。
  31. UNMOVE = 29

  32. # 攻击到与敌人同一水平线前的属性编号 默认为30号 参考数据库的设置
  33. HOMOVE = 30

  34. ##################################################################
  35. module Scene_BattleName
  36.   # 设定移动速度
  37.   Move_Duration = 28
  38.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  39.   BattlerName = {
  40.   "熊大王" => {
  41.   "待机" => ["bear_s1","bear_s2","bear_s3","bear_s4"],
  42.   "移动" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  43.   "返回" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  44.   "受伤" => ["bear_h"],
  45.   "防御" => ["bear_d"],
  46.   "死亡" => ["bear_die1","bear_die2"]
  47.   },

  48.   
  49.   "弗雷德" => {
  50.   "待机" => ["Fred_s1","Fred_s2","Fred_s3","Fred_s4"],
  51.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  52.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  53.   "受伤" => ["Fred_h"],
  54.   "防御" => ["Fred_d"],
  55.   "死亡" => ["Fred_die1","Fred_die2"]
  56.   },
  57. }
  58. end
  59. #至于其它的:

  60. #HP伤害数字间距偏移在602行修改。

  61. #SP伤害数字间距偏移在667行修改。

  62. #连击数字间距偏移在713行修改。

  63. #总伤害数字间距偏移在759行修改。

  64. #--------------------------------------------------------------------------
  65. #  ● 设定结束
  66. #--------------------------------------------------------------------------










  67. class Game_Battler
  68.   attr_accessor :movex                    # X坐标修正
  69.   attr_accessor :movey                    # Y坐标修正
  70.   attr_accessor :startactive              # 行为
  71.   attr_accessor :damage_sp                # 精神伤害值
  72.   alias bearrpg_initialize initialize
  73.   def initialize
  74.     bearrpg_initialize
  75.     @damage_sp = 0
  76.     @movex = 0
  77.     @movey = 0
  78.     @startactive = "待机"
  79.   end
  80.   def width #获取战斗图宽
  81.     return RPG::Cache.battler(@battler_name, @battler_hue).width
  82.   end
  83.   def height #获取战斗图高
  84.     return RPG::Cache.battler(@battler_name, @battler_hue).height
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 应用通常攻击效果
  88.   #     attacker : 攻击者 (battler)
  89.   #--------------------------------------------------------------------------
  90.   def attack_effect(attacker)
  91.     # 清除会心一击标志
  92.     self.critical = false
  93.     #######伤害开关初始化##################################################bearrpg
  94.     $damage_hp = false
  95.     $damage_sp = false
  96.     # 第一命中判定
  97.     hit_result = (rand(100) < attacker.hit)
  98.     # 命中的情况下
  99.     if hit_result == true
  100.       # 计算基本伤害
  101.       atk = [attacker.atk - self.pdef / 2, 0].max
  102.       self.damage = atk * (20 + attacker.str) / 20
  103.       # 属性修正
  104.       self.damage *= elements_correct(attacker.element_set)
  105.       self.damage /= 100
  106.       # 伤害符号正确的情况下
  107.       if self.damage > 0
  108.         # 会心一击修正
  109.         if rand(100) < 4 * attacker.dex / self.agi
  110.           self.damage *= 2
  111.           self.critical = true
  112.         end
  113.         # 防御修正
  114.         if self.guarding?
  115.           self.damage /= 2
  116.         end
  117.       end
  118.       $damage_hp = true if self.damage.is_a?(Numeric)
  119.     #  $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  120.       # 分散
  121.       if self.damage.abs > 0
  122.         amp = [self.damage.abs * 15 / 100, 1].max
  123.         self.damage += rand(amp+1) + rand(amp+1) - amp
  124.       end
  125.       # 第二命中判定
  126.       eva = 8 * self.agi / attacker.dex + self.eva
  127.       hit = self.damage < 0 ? 100 : 100 - eva
  128.       hit = self.cant_evade? ? 100 : hit
  129.       hit_result = (rand(100) < hit)
  130.     end
  131.     #####################################bearrpg
  132.     # 命中的情况下
  133.     if hit_result == true
  134.       # 状态冲击解除
  135.       remove_states_shock
  136.       # HP 的伤害计算
  137.       self.hp -= self.damage
  138.       # 状态变化
  139.       @state_changed = false
  140.       states_plus(attacker.plus_state_set)
  141.       states_minus(attacker.minus_state_set)
  142.       if self.damage == 0
  143.            self.damage = "无效" if INVALIDSWITCH >0
  144.          self.critical = false
  145.        end
  146.     # Miss 的情况下
  147.     else
  148.       # 伤害设置为 "Miss"
  149.       self.damage = "Miss"
  150.       # 清除会心一击标志
  151.       self.critical = false
  152.     end
  153.     # 过程结束
  154.     return true
  155.   end
  156.   #############################################bearrpg
  157.   #--------------------------------------------------------------------------
  158.   # ● 应用特技效果
  159.   #     user  : 特技的使用者 (battler)
  160.   #     skill : 特技
  161.   #--------------------------------------------------------------------------
  162.   def skill_effect(user, skill)
  163.     #######伤害开关初始化##################################################bearrpg
  164.     $damage_hp = false
  165.     $damage_sp = false
  166.     # 清除会心一击标志
  167.     self.critical = false
  168.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  169.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  170.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  171.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  172.       # 过程结束
  173.       return false
  174.     end
  175.     # 清除有效标志
  176.     effective = false
  177.     # 公共事件 ID 是有效的情况下,设置为有效标志
  178.     effective |= skill.common_event_id > 0
  179.     # 第一命中判定
  180.     hit = skill.hit
  181.     if skill.atk_f > 0
  182.       hit *= user.hit / 100
  183.     end
  184.     hit_result = (rand(100) < hit)
  185.     # 不确定的特技的情况下设置为有效标志
  186.     effective |= hit < 100
  187.     # 命中的情况下
  188.     if hit_result == true
  189.       # 计算威力
  190.       power = skill.power + user.atk * skill.atk_f / 100
  191.       if power > 0
  192.         power -= self.pdef * skill.pdef_f / 200
  193.         power -= self.mdef * skill.mdef_f / 200
  194.         power = [power, 0].max
  195.       end
  196.       # 计算倍率
  197.       rate = 20
  198.       rate += (user.str * skill.str_f / 100)
  199.       rate += (user.dex * skill.dex_f / 100)
  200.       rate += (user.agi * skill.agi_f / 100)
  201.       rate += (user.int * skill.int_f / 100)
  202.       # 计算基本伤害
  203.       self.damage = power * rate / 20
  204.       # 属性修正
  205.       self.damage *= elements_correct(skill.element_set)
  206.       self.damage /= 100
  207.       # 伤害符号正确的情况下
  208.       if self.damage > 0
  209.         # 防御修正
  210.         if self.guarding?
  211.           self.damage /= 2
  212.         end
  213.       end
  214.       # 分散
  215.       if skill.variance > 0 and self.damage.abs > 0
  216.         amp = [self.damage.abs * skill.variance / 100, 1].max
  217.         self.damage += rand(amp+1) + rand(amp+1) - amp
  218.       end
  219.       # 第二命中判定
  220.       eva = 8 * self.agi / user.dex + self.eva
  221.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  222.       hit = self.cant_evade? ? 100 : hit
  223.       hit_result = (rand(100) < hit)
  224.       # 不确定的特技的情况下设置为有效标志
  225.       effective |= hit < 100
  226.     end
  227.     $damage_hp = true if self.damage.is_a?(Numeric)
  228.    # $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  229.     # 命中的情况下
  230.     if hit_result == true
  231.       # 威力 0 以外的物理攻击的情况下
  232.       if skill.power != 0 and skill.atk_f > 0
  233.         # 状态冲击解除
  234.         remove_states_shock
  235.         # 设置有效标志
  236.         effective = true
  237.       end
  238.       # HP 的伤害减法运算
  239.       last_hp = self.hp
  240.       self.hp -= self.damage
  241.       effective |= self.hp != last_hp
  242.       # 状态变化
  243.       @state_changed = false
  244.       effective |= states_plus(skill.plus_state_set)
  245.       effective |= states_minus(skill.minus_state_set)
  246.       #############################################bearrpg
  247.       # 威力为 0 的场合
  248.       if skill.power == 0
  249.         # 伤害设置为空的字串
  250.         self.damage = ""
  251.         # 状态没有变化的情况下
  252.         unless @state_changed
  253.           # 伤害设置为 "Miss"
  254.           self.damage = "Miss"
  255.         end
  256.       elsif self.damage == 0
  257.         unless @state_changed
  258.            self.damage = "无效" if INVALIDSWITCH >0
  259.          else
  260.           self.damage = ""
  261.         end
  262.       end
  263.     # Miss 的情况下
  264.     else
  265.       # 伤害设置为 "Miss"
  266.       self.damage = "Miss"
  267.     end
  268.     # 不在战斗中的情况下
  269.     unless $game_temp.in_battle
  270.       # 伤害设置为 nil
  271.       self.damage = nil
  272.     end
  273.     # 过程结束
  274.     return effective
  275.   end
  276.   #############################################bearrpg
  277.   #--------------------------------------------------------------------------
  278.   # ● 应用物品效果
  279.   #     item : 物品
  280.   #--------------------------------------------------------------------------
  281.   def item_effect(item)
  282.     # 清除会心一击标志
  283.     self.critical = false
  284.     # 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  285.     # 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  286.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  287.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  288.       # 过程结束
  289.       return false
  290.     end
  291.     # 清除有效标志
  292.     effective = false
  293.     # 公共事件 ID 是有效的情况下,设置为有效标志
  294.     effective |= item.common_event_id > 0
  295.     # 命中判定
  296.     hit_result = (rand(100) < item.hit)
  297.     # 不确定的特技的情况下设置为有效标志
  298.     effective |= item.hit < 100
  299.     # 命中的情况
  300.     if hit_result == true
  301.       # 计算回复量
  302.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  303.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  304.       if recover_hp < 0
  305.         recover_hp += self.pdef * item.pdef_f / 20
  306.         recover_hp += self.mdef * item.mdef_f / 20
  307.         recover_hp = [recover_hp, 0].min
  308.       end
  309.       # 属性修正
  310.       recover_hp *= elements_correct(item.element_set)
  311.       recover_hp /= 100
  312.       recover_sp *= elements_correct(item.element_set)
  313.       recover_sp /= 100
  314.       # 分散
  315.       if item.variance > 0 and recover_hp.abs > 0
  316.         amp = [recover_hp.abs * item.variance / 100, 1].max
  317.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  318.       end
  319.       if item.variance > 0 and recover_sp.abs > 0
  320.         amp = [recover_sp.abs * item.variance / 100, 1].max
  321.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  322.       end
  323.       # 回复量符号为负的情况下
  324.       if recover_hp < 0
  325.         # 防御修正
  326.         if self.guarding?
  327.           recover_hp /= 2
  328.         end
  329.       end
  330.       # HP 回复量符号的反转、设置伤害值
  331.       self.damage = -recover_hp
  332.       self.damage_sp = -recover_sp  
  333.       # HP 以及 SP 的回复
  334.       last_hp = self.hp
  335.       last_sp = self.sp
  336.       self.hp += recover_hp
  337.       self.sp += recover_sp
  338.       ###################################################################bearrpg
  339.       $damage_hp = true if self.damage.is_a?(Numeric)
  340.       $damage_sp = true if self.damage_sp.is_a?(Numeric) and recover_sp != 0
  341.       ###################################################################bearrpg
  342.       effective |= self.hp != last_hp
  343.       effective |= self.sp != last_sp
  344.       # 状态变化
  345.       @state_changed = false
  346.       effective |= states_plus(item.plus_state_set)
  347.       effective |= states_minus(item.minus_state_set)
  348.       # 能力上升值有效的情况下
  349.       if item.parameter_type > 0 and item.parameter_points != 0
  350.         # 能力值的分支
  351.         case item.parameter_type
  352.         when 1  # MaxHP
  353.           @maxhp_plus += item.parameter_points
  354.         when 2  # MaxSP
  355.           @maxsp_plus += item.parameter_points
  356.         when 3  # 力量
  357.           @str_plus += item.parameter_points
  358.         when 4  # 灵巧
  359.           @dex_plus += item.parameter_points
  360.         when 5  # 速度
  361.           @agi_plus += item.parameter_points
  362.         when 6  # 魔力
  363.           @int_plus += item.parameter_points
  364.         end
  365.         # 设置有效标志
  366.         effective = true
  367.       end
  368.       # HP 回复率与回复量为 0 的情况下
  369.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  370.         # 设置伤害为空的字符串
  371.         self.damage = ""
  372.         # SP 回复率与回复量为 0、能力上升值无效的情况下
  373.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  374.            (item.parameter_type == 0 or item.parameter_points == 0)
  375.           # 状态没有变化的情况下
  376.           unless @state_changed
  377.             # 伤害设置为 "Miss"
  378.             self.damage = "Miss"
  379.           end
  380.         end
  381.       end
  382.     # Miss 的情况下
  383.     else
  384.       # 伤害设置为 "Miss"
  385.       self.damage = "Miss"
  386.     end
  387.     # 不在战斗中的情况下
  388.     unless $game_temp.in_battle
  389.       # 伤害设置为 nil
  390.       self.damage = nil
  391.     end
  392.     # 过程结束
  393.     return effective
  394.   end
  395. end

  396. class Game_Actor
  397.   def screen_x
  398.     if self.index != nil
  399.       return (640-self.index*50)/2 + 240 + @movex
  400.     else
  401.       return 0
  402.     end
  403.   end
  404.   def screen_y
  405.     return self.index*70+self.height/2 + 140 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  406.   end
  407.   def screen_z
  408.     return self.screen_y-self.index * 10
  409.   end
  410. end
  411. class Game_Enemy
  412.   def screen_x
  413.     return $data_troops[@troop_id].members[@member_index].x + @movex
  414.   end
  415.   def screen_y
  416.     return $data_troops[@troop_id].members[@member_index].y + @movey
  417.   end
  418.   def screen_z
  419.     return self.screen_y#+self.height
  420.   end
  421. end

  422. class Sprite_Battler
  423.   include Scene_BattleName
  424. end
  425. module RPG
  426. class Sprite < ::Sprite
  427. #==========================================
  428. def initialize(viewport = nil)
  429. super(viewport)
  430. @_whiten_duration = 0
  431. @_appear_duration = 0
  432. @_escape_duration = 0
  433. @_collapse_duration = 0
  434. @_damage_duration = 0
  435. @_animation_duration = 0
  436. @_blink = false  
  437. @flash_shake = 0
  438. @_damage = []  
  439. @_damage_sp = []
  440. @_total_damage = 0
  441. @_total_damage_duration = 0
  442. @p_dam=0
  443. @hits=0
  444. end
  445. def animation_set_sprites(sprites, cell_data, position)
  446.    for i in 0..15
  447.    sprite = sprites[i]
  448.    pattern = cell_data[i, 0]
  449.    if sprite == nil or pattern == nil or pattern == -1
  450.      sprite.visible = false if sprite != nil
  451.      next
  452.    end
  453.    sprite.visible = true
  454.    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  455.    if position == 3
  456.      if self.viewport != nil
  457.        sprite.x = self.viewport.rect.width / 2
  458.        sprite.y = self.viewport.rect.height - 160
  459.      else
  460.        sprite.x = 320
  461.        sprite.y = 240
  462.      end
  463.      else
  464.      sprite.x = self.x - self.ox + self.src_rect.width / 2
  465.      sprite.y = self.y - self.oy + self.src_rect.height / 2
  466.      sprite.y -= self.src_rect.height / 4 if position == 0
  467.      sprite.y += self.src_rect.height / 4 if position == 2
  468.    end
  469.    sprite.x += cell_data[i, 1]
  470.    sprite.y += cell_data[i, 2]
  471.    if $scene.is_a?(Scene_Battle)
  472.    sprite.z = battler.screen_z+20
  473. else
  474.    sprite.z = 9990
  475.    end
  476.    sprite.ox = 96
  477.    sprite.oy = 96
  478.    sprite.zoom_x = cell_data[i, 3] / 100.0
  479.    sprite.zoom_y = cell_data[i, 3] / 100.0
  480.    sprite.angle = cell_data[i, 4]
  481.    sprite.mirror = (cell_data[i, 5] == 1)
  482.    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  483.    sprite.blend_type = cell_data[i, 7]
  484.    end
  485. end
  486. def damage(value, critical)
  487.   dispose_hit
  488.     if value.is_a?(Numeric)
  489.       damage_string = value.abs.to_s
  490.     else
  491.       damage_string = value.to_s
  492.     end
  493.     bitmap = Bitmap.new(300, 150)
  494.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  495.     bitmap.font.size = 32
  496.     if value.is_a?(Numeric)
  497.   # 分割伤害值字符串
  498.       damage_array = damage_string.scan(/./)
  499.       damage_x = 81 - damage_string.size * 9
  500.   # 会心一击标志打开的情况
  501.       if critical and value != "无效"
  502.   # 显示会心一击图画
  503.         cri_bitmap = RPG::Cache.picture("Critital")
  504.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  505.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  506.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  507.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  508.       end
  509.   # 伤害值为负的情况下
  510.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  511.       if value < 0
  512.   # 调用回复数字表
  513.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  514.       else
  515.   # 调用伤害数字表
  516.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  517.       end
  518.   # 循环伤害值字符串
  519.       for char in damage_array
  520.         number = char.to_i
  521.   # 显示伤害数字
  522.         bitmap.blt(damage_x, 32, dmg_bitmap,
  523.         Rect.new(number * dmg_bitmap.width/12, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  524. #################################################################普通伤害数值
  525.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  526. #################################################################普通伤害数值
  527.       end  
  528.     else
  529.       if value == "Miss"
  530.         miss_dmg = RPG::Cache.picture("miss")
  531.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  532.       elsif value == "无效"
  533.         invalid_dmg = RPG::Cache.picture("invalid")
  534.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  535.       #end
  536.       end
  537.     end
  538. # 伤害值定位
  539.     @_damage_sprite = ::Sprite.new(self.viewport)
  540.     @_damage_sprite.bitmap = bitmap
  541.     @_damage_sprite.ox = 80
  542.     @_damage_sprite.oy = 20
  543.     @_damage_sprite.x = self.x
  544.     @_damage_sprite.y = self.y - self.oy / 2
  545.     @_damage_sprite.z = 3000
  546.     @_damage_duration = 40
  547.     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  548.     make_total_damage(value)
  549.   end
  550. ##################################################################sp伤害数值
  551. def damage_sp(value, critical)
  552.   dispose_hit
  553.     if value.is_a?(Numeric)
  554.       damage_string = value.abs.to_s
  555.     else
  556.       damage_string = value.to_s
  557.     end
  558.     bitmap = Bitmap.new(300, 150)
  559.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  560.     bitmap.font.size = 32
  561.     if value.is_a?(Numeric)
  562.   # 分割伤害值字符串
  563.       damage_array = damage_string.scan(/./)
  564.       damage_x = 81 - damage_string.size * 9
  565.   # 会心一击标志打开的情况
  566.       if critical and value != "无效"
  567.   # 显示会心一击图画
  568.         cri_bitmap = RPG::Cache.picture("Critital")
  569.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  570.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  571.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  572.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  573.       end
  574.   # 伤害值为负的情况下
  575.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  576.       if value < 0
  577.   # 调用回复数字表
  578.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  579.       else
  580.   # 调用伤害数字表
  581.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  582.       end
  583.   # 循环伤害值字符串
  584.       for char in damage_array
  585.         number = char.to_i
  586.   # 显示伤害数字
  587.         bitmap.blt(damage_x, 32, dmg_bitmap,
  588.         Rect.new(number * dmg_bitmap.width/12, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  589. #################################################################普通伤害数值
  590.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  591. #################################################################普通伤害数值
  592.       end  
  593.     else
  594.       if value == "Miss"
  595.         miss_dmg = RPG::Cache.picture("miss")
  596.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  597.       elsif value == "无效"
  598.         invalid_dmg = RPG::Cache.picture("invalid")
  599.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  600.       #end
  601.       end
  602.     end
  603. # 伤害值定位
  604.     @_damage_sprite = ::Sprite.new(self.viewport)
  605.     @_damage_sprite.bitmap = bitmap
  606.     @_damage_sprite.ox = 80
  607.     @_damage_sprite.oy = 20
  608.     @_damage_sprite.x = self.x
  609.     @_damage_sprite.y = self.y - self.oy / 2
  610.     @_damage_sprite.z = 3000
  611.     @_damage_duration = 40
  612.     @_damage_sp.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  613.    # make_total_damage(value)
  614.   end  
  615. def hit
  616. # 如果伤害值是数值
  617. # 转为字符串
  618. value=@hits
  619. hits_string = value.to_s
  620. # 初始化位图
  621. bitmap = Bitmap.new(320, 64)
  622. bitmap.font.name = "Arial Black"
  623. bitmap.font.size = 32
  624. # 分割伤害值字符串
  625. hits_array = hits_string.scan(/./)
  626. hits_x = 81 - hits_string.size * 18.1
  627. rect_y = 0
  628. # 循环伤害值字符串
  629. for char in hits_array
  630. number = char.to_i
  631. # 显示伤害数字
  632. combo_num = RPG::Cache.picture("combo_num")
  633. bitmap.blt(hits_x, 0, combo_num,
  634. Rect.new(number * combo_num.width/10, 0, combo_num.width/10, combo_num.height))
  635. #################################################################连击数数值
  636. hits_x += combo_num.width/10 - 3#间距缩小3个像素,可以自行调整
  637. #################################################################连击数数值
  638. end
  639. combo_tx = RPG::Cache.picture("combo_text")
  640. bitmap.blt(hits_x, 0,combo_tx ,
  641. Rect.new(0, 0, combo_tx.width, combo_tx.height))
  642. # 伤害值定位
  643. @_hits_sprite = ::Sprite.new(self.viewport)
  644. @_hits_sprite.bitmap = bitmap
  645. @_hits_sprite.ox = 81
  646. @_hits_sprite.oy = 20
  647. @_hits_sprite.x = 500
  648. @_hits_sprite.y = 100
  649. @_hits_sprite.opacity = HITSWITCH > 0 ? 255 : 0
  650. @_hits_sprite.z = 3000
  651. @_hits_duration = 40
  652. end
  653. #--------------------------------------------------------------------------
  654. # ● 总伤害处理
  655. #--------------------------------------------------------------------------
  656. def make_total_damage(value)
  657. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  658. @_total_damage += value
  659. # 绝对值转为字符串
  660. damage_string = @_total_damage.abs.to_s
  661. else
  662. return
  663. end
  664. # 初始化位图
  665. bitmap = Bitmap.new(350, 150)
  666. bitmap.font.name = "Arial Black"
  667. bitmap.font.size = 32
  668. # 伤害值是数值的情况下
  669. if value.is_a?(Numeric)
  670. # 分割伤害值字符串
  671. damage_array = damage_string.scan(/./)
  672. damage_x = 40 - damage_string.size * 9
  673. # 伤害值为负的情况下
  674. name=RPG::Cache.picture("total_damage")
  675. # 循环伤害值字符串
  676. for char in damage_array
  677. number = char.to_i
  678. # 显示伤害数字
  679. bitmap.blt(damage_x, 0, name,
  680. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  681. #################################################################总伤害数值
  682. damage_x += name.width/10 - 5 #间距缩小3个像素,可以自行调整
  683. #################################################################总伤害数值
  684. end
  685. end
  686. if @_total_damage_sprite.nil?
  687. @_total_damage_sprite = ::Sprite.new(self.viewport)
  688. @_total_damage_sprite.ox = 80
  689. @_total_damage_sprite.oy = 40
  690. @_total_damage_sprite.z = 3000
  691. end
  692. @_total_damage_sprite.bitmap = bitmap
  693. @_total_damage_sprite.zoom_x = 1.0
  694. @_total_damage_sprite.zoom_y = 1.0
  695. @_total_damage_sprite.x = self.x
  696. @_total_damage_sprite.y = self.y - self.oy / 2
  697. @_total_damage_sprite.z = 3001
  698. @_total_damage_duration = 80
  699. #hit数描绘
  700. @hits+=1
  701. if @_total_damage > 0
  702.   hit
  703. end
  704. end
  705. def animation(animation, hit, battler_damage="", battler_damage_sp="",battler_critical=false)
  706. dispose_animation
  707. @battler_damage = battler_damage
  708. @battler_damage_sp = battler_damage_sp
  709. @battler_critical = battler_critical
  710. @_animation = animation
  711. return if @_animation == nil
  712. @_animation_hit = hit
  713. @_animation_duration = @_animation.frame_max
  714. animation_name = @_animation.animation_name
  715. animation_hue = @_animation.animation_hue
  716. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  717. for timing in @_animation.timings
  718. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  719. @all_quanzhong += quanzhong
  720. @_last_frame = timing.frame if quanzhong != 0
  721. end
  722. if @@_reference_count.include?(bitmap)
  723. @@_reference_count[bitmap] += 1
  724. else
  725. @@_reference_count[bitmap] = 1
  726. end  
  727. if $scene.is_a?(Scene_Battle)
  728. if $scene.animation1_id == @battler.animation_id
  729. @battler_damage = ""
  730. @battler_damage_sp = ""
  731. end
  732. end
  733. @_animation_sprites = []
  734. if @_animation.position != 3 or not @@_animations.include?(animation)
  735. for i in 0..15
  736. sprite = ::Sprite.new(self.viewport)
  737. sprite.bitmap = bitmap
  738. sprite.visible = false
  739. @_animation_sprites.push(sprite)
  740. end
  741. unless @@_animations.include?(animation)
  742. @@_animations.push(animation)
  743. end
  744. end
  745. update_animation
  746. end  
  747. def dispose_damage
  748. for damage in @_damage.reverse
  749. damage[0].bitmap.dispose
  750. damage[0].dispose
  751. @_damage.delete(damage)
  752. end
  753. for damage_sp in @_damage_sp.reverse
  754. damage_sp[0].bitmap.dispose
  755. damage_sp[0].dispose
  756. @_damage_sp.delete(damage_sp)
  757. end
  758. @_total_damage = 0
  759. @_last_frame = -1
  760. if @_total_damage_sprite != nil
  761. @_total_damage_duration = 0
  762. @_total_damage_sprite.bitmap.dispose
  763. @_total_damage_sprite.dispose
  764. @_total_damage_sprite = nil
  765. end
  766. end
  767. def dispose_hit
  768. if @_hits_sprite != nil
  769. @_hits_sprite.bitmap.dispose
  770. @_hits_sprite.dispose
  771. @_hits_sprite = nil
  772. end
  773. end
  774. def dispose_animation
  775. @battler_damage = nil
  776. @battler_damage_sp = nil
  777. @battler_critical = nil
  778. @all_quanzhong = 1
  779. @_total_damage = 0
  780. @_last_frame = -1
  781. if @_animation_sprites != nil
  782. sprite = @_animation_sprites[0]
  783. if sprite != nil
  784. @@_reference_count[sprite.bitmap] -= 1
  785. if @@_reference_count[sprite.bitmap] == 0
  786. sprite.bitmap.dispose
  787. end
  788. end
  789. for sprite in @_animation_sprites
  790. sprite.dispose
  791. end
  792. @_animation_sprites = nil
  793. @_animation = nil
  794. end
  795. end
  796. def update
  797. super
  798. if @_whiten_duration > 0
  799. @_whiten_duration -= 1
  800. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  801. end
  802. if @_appear_duration > 0
  803. @_appear_duration -= 1
  804. self.opacity = (16 - @_appear_duration) * 16
  805. end
  806. if @_escape_duration > 0
  807. @_escape_duration -= 1
  808. self.opacity = 256 - (32 - @_escape_duration) * 10
  809. end
  810. if @_collapse_duration > 0
  811. @_collapse_duration -= 1
  812. self.opacity = 256 - (48 - @_collapse_duration) * 6
  813. end
  814. if @_damage_duration > 0
  815. @_damage_duration -= 1
  816. for damage in @_damage
  817. damage[0].x = self.x + self.viewport.rect.x -
  818. self.ox + self.src_rect.width / 2 +
  819. (40 - damage[1]) * damage[3] / 10
  820. damage[0].y -= damage[4]+damage[1]/10
  821. damage[0].opacity = damage[1]*20
  822. damage[1] -= 1
  823. if damage[1]==0
  824. damage[0].bitmap.dispose
  825. damage[0].dispose
  826. @_damage.delete(damage)
  827. next
  828. end
  829. end
  830. for damage_sp in @_damage_sp
  831. damage_sp[0].x = self.x + self.viewport.rect.x -
  832. self.ox + self.src_rect.width / 2 +
  833. (40 - damage_sp[1]) * damage_sp[3] / 10
  834. damage_sp[0].y -= damage_sp[4]+damage_sp[1]/10
  835. damage_sp[0].opacity = damage_sp[1]*20
  836. damage_sp[1] -= 1
  837. if damage_sp[1]==0
  838. damage_sp[0].bitmap.dispose
  839. damage_sp[0].dispose
  840. @_damage_sp.delete(damage_sp)
  841. next
  842. end
  843. end
  844. end
  845. if @_total_damage_duration > 0
  846. @_total_damage_duration -= 1
  847. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  848. if @_total_damage_sprite.zoom_x > 1.0
  849. @_total_damage_sprite.zoom_x -= 0.05
  850. end
  851. if @_total_damage_sprite.zoom_y > 1.0
  852. @_total_damage_sprite.zoom_y -= 0.05
  853. end
  854. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  855. if @_total_damage_duration <= 0
  856. dispose_hit
  857. @_total_damage = 0
  858. @_total_damage_duration = 0
  859. @_total_damage_sprite.bitmap.dispose
  860. @_total_damage_sprite.dispose
  861. @_total_damage_sprite = nil
  862. end
  863. end
  864. #=======================================
  865.     if @_animation != nil and (Graphics.frame_count % 2 == 0)
  866.       @_animation_duration -= 1
  867.       update_animation
  868.     end
  869.   if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  870.       update_loop_animation
  871.       @_loop_animation_index += 1
  872.       @_loop_animation_index %= @_loop_animation.frame_max
  873.     end
  874.   if @_blink
  875.     @_blink_count = (@_blink_count + 1) % 32
  876.       if @_blink_count < 16
  877.         alpha = (16 - @_blink_count) * 6
  878.       else
  879.         alpha = (@_blink_count - 16) * 6
  880.       end
  881.       self.color.set(255, 255, 255, alpha)
  882.     end
  883.     @@_animations.clear
  884.   end
  885. def update_animation
  886.   if @_animation_duration > 0
  887.     frame_index = @_animation.frame_max - @_animation_duration
  888.     cell_data = @_animation.frames[frame_index].cell_data
  889.     position = @_animation.position
  890.     animation_set_sprites(@_animation_sprites, cell_data, position)
  891.       for timing in @_animation.timings
  892.         if timing.frame == frame_index
  893.           t = 1.0 * animation_process_timing(timing, @_animation_hit)
  894.           ts = 1.0 * animation_process_timing(timing, @_animation_hit)
  895.           if timing.se.name != ""
  896.             se=timing.se
  897.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  898.           end
  899.           if @battler_damage.is_a?(Numeric) and t != 0
  900.             if @battler.guarding?
  901.               @battler.startactive = "防御" if @battler_damage > 0
  902.            else
  903.               @battler.startactive = "受伤" if @battler_damage > 0
  904.             end
  905.             t *= @battler_damage
  906.             t /= @all_quanzhong
  907.             ts *= @battler_damage_sp
  908.             ts /= @all_quanzhong
  909.             t = t.to_i
  910.             ts = ts.to_i
  911.   if frame_index != @_last_frame
  912.     @p_dam+= t
  913.   end
  914.       if frame_index == @_last_frame
  915.         t=@battler_damage-@p_dam
  916.       end
  917.     if frame_index == @_last_frame
  918.       @_total_damage = @battler_damage - t
  919.       @p_dam=0
  920.     end
  921.       damage(t,@battler_critical) if $damage_hp == true
  922.       damage_sp(ts,@battler_critical) if $damage_sp == true
  923.     if frame_index == @_last_frame
  924.       @hits=0
  925.      end
  926.       elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  927.         damage(@battler_damage,@battler_critical)
  928.         damage_sp(@battler_damage_sp,@battler_critical) if $damage_sp == true
  929.        end
  930.       end
  931.       end
  932.     else
  933.       dispose_animation
  934.     end
  935.   end
  936. def animation_process_timing(timing, hit,dontflash=false)
  937.   if (timing.condition == 0) or
  938.     (timing.condition == 1 and hit == true) or
  939.     (timing.condition == 2 and hit == false)
  940.   case timing.flash_scope
  941.     when 1
  942.       unless dontflash
  943.         self.flash(timing.flash_color, timing.flash_duration * 2)
  944.         if @_total_damage >0
  945.           @flash_shake_switch = true
  946.           @flash_shake = 10
  947.         end
  948.       end
  949.       return timing.flash_color.alpha * timing.flash_duration
  950.     when 2
  951.       unless dontflash
  952.         if self.viewport != nil
  953.           self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  954.         end
  955.       end
  956.       return timing.flash_color.alpha * timing.flash_duration
  957.     when 3
  958.       unless dontflash
  959.         self.flash(nil, timing.flash_duration * 2)
  960.       end
  961.         return timing.flash_color.alpha * timing.flash_duration
  962.       end
  963.     end
  964.       return 0
  965.     end
  966.   end
  967. end

  968. class Sprite_Battler < RPG::Sprite
  969.   def initialize(viewport, battler = nil)
  970.     super(viewport)
  971.     @battler = battler
  972.     @battler_visible = false
  973.     @flash_shake_switch = true
  974.     @number = 0#初始化编号
  975.   end
  976.   def update
  977.     super
  978.     # 战斗者为 nil 的情况下
  979.     if @battler == nil
  980.       self.bitmap = nil
  981.       loop_animation(nil)
  982.       return
  983.     end
  984.     # 文件名和色相与当前情况有差异的情况下
  985.     if @battler.battler_name != @battler_name or
  986.        @battler.battler_hue != @battler_hue
  987.       # 获取、设置位图
  988.       @battler_name = @battler.battler_name
  989.       @battler_hue = @battler.battler_hue
  990.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  991.       @width = bitmap.width
  992.       @height = bitmap.height
  993.       self.ox = @width / 2
  994.       self.oy = @height
  995.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  996.       if @battler.dead? or @battler.hidden
  997.         self.opacity = 0  if DEADPIC != 1
  998.       end
  999.     end
  1000.     ###################################万兽熊最高#########################################
  1001.         if @battler.startactive == "移动" or @battler.startactive == "返回"
  1002.       if Graphics.frame_count % 4 == 0
  1003.         unless BattlerName[@battler.name].nil?
  1004.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1005.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1006.         end
  1007.       end
  1008.     elsif @battler.startactive == "死亡"
  1009.        if Graphics.frame_count % 4 == 0
  1010.         unless BattlerName[@battler.name].nil?
  1011.           if @number +1 <= BattlerName[@battler.name][@battler.startactive].size
  1012.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1013.           @number += 1
  1014.         else
  1015.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][BattlerName[@battler.name][@battler.startactive].size-1], @battler_hue)
  1016.           end
  1017.         end
  1018.       end
  1019.       else
  1020.       if Graphics.frame_count % 10 == 0
  1021.         unless BattlerName[@battler.name].nil?
  1022.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1023.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1024.         end
  1025.       end
  1026.     end
  1027.     #######################################################################################
  1028.     # 动画 ID 与当前的情况有差异的情况下
  1029.     if @battler.damage == nil and
  1030.        @battler.state_animation_id != @state_animation_id
  1031.       @state_animation_id = @battler.state_animation_id
  1032.       loop_animation($data_animations[@state_animation_id])
  1033.     end
  1034.     # 应该被显示的角色的情况下
  1035.    if NACTSWITCH > 0
  1036.     if @battler.is_a?(Game_Actor) and @battler_visible
  1037.       # 不是主状态的时候稍稍降低点透明度
  1038.       if $game_temp.battle_main_phase
  1039.         self.opacity += 3 if self.opacity < 255
  1040.       else
  1041.         self.opacity -= 3 if self.opacity > 207
  1042.       end
  1043.     end
  1044.   end
  1045.     if @battler.blink
  1046.       blink_on
  1047.     else
  1048.       blink_off
  1049.     end
  1050.     unless @battler_visible
  1051.       if not @battler.hidden and not @battler.dead? and
  1052.          (@battler.damage == nil or @battler.damage_pop)
  1053.         appear
  1054.         @battler_visible = true
  1055.       end
  1056.     end
  1057.     if @battler_visible
  1058.       if @battler.hidden
  1059.         $game_system.se_play($data_system.escape_se)
  1060.         escape
  1061.         @battler_visible = false
  1062.       end
  1063.       if @battler.white_flash
  1064.         whiten
  1065.         @battler.white_flash = false   
  1066.       end
  1067.         if @battler.animation_id != 0
  1068.         animation = $data_animations[@battler.animation_id]
  1069.         animation(animation, @battler.animation_hit,@battler.damage,@battler.damage_sp, @battler.critical)
  1070.         @battler.animation_id = 0
  1071.       end
  1072.       if @battler.damage_pop
  1073.         @battler.damage = nil
  1074.         @battler.damage_sp = 0
  1075.         @battler.critical = false
  1076.         @battler.damage_pop = false
  1077.       end
  1078.       if @battler.damage == nil and @battler.dead?
  1079.         if DEADPIC >0
  1080.           @battler.startactive = "死亡"
  1081.           else
  1082.         if @battler.is_a?(Game_Enemy)
  1083.           $game_system.se_play($data_system.enemy_collapse_se)
  1084.         else
  1085.           $game_system.se_play($data_system.actor_collapse_se)
  1086.         end
  1087.         collapse
  1088.         @battler_visible = false
  1089.         end
  1090.       end
  1091.     end
  1092.      self.x = @battler.screen_x
  1093.      self.y = @battler.screen_y
  1094.      self.z = @battler.screen_z
  1095.   end
  1096. end

  1097. class Spriteset_Battle
  1098. alias bearrpg_initialize initialize
  1099.   def initialize
  1100.     @enemy_sprites = []
  1101.     for enemy in $game_troop.enemies.reverse
  1102.       #####修改敌人显示端口,与角色一样。
  1103.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1104.     end
  1105.     bearrpg_initialize
  1106.   end
  1107. end

  1108. class Arrow_Enemy < Arrow_Base
  1109.   def update
  1110.     super
  1111.     $game_troop.enemies.size.times do
  1112.       break if self.enemy.exist?
  1113.       @index += 1
  1114.       @index %= $game_troop.enemies.size
  1115.     end
  1116.     if Input.repeat?(Input::UP)
  1117.       $game_system.se_play($data_system.cursor_se)
  1118.       $game_troop.enemies.size.times do
  1119.         @index += 1
  1120.         @index %= $game_troop.enemies.size
  1121.         break if self.enemy.exist?
  1122.       end
  1123.     end
  1124.     if Input.repeat?(Input::DOWN)
  1125.       $game_system.se_play($data_system.cursor_se)
  1126.       $game_troop.enemies.size.times do
  1127.         @index += $game_troop.enemies.size - 1
  1128.         @index %= $game_troop.enemies.size
  1129.         break if self.enemy.exist?
  1130.       end
  1131.     end
  1132.     if self.enemy != nil
  1133.       self.x = self.enemy.screen_x
  1134.       self.y = self.enemy.screen_y
  1135.     end
  1136.   end
  1137. end

  1138. class Arrow_Actor < Arrow_Base
  1139.   def update
  1140.     super
  1141.     if Input.repeat?(Input::UP)
  1142.       $game_system.se_play($data_system.cursor_se)
  1143.       @index += 1
  1144.       @index %= $game_party.actors.size
  1145.     end
  1146.     if Input.repeat?(Input::DOWN)
  1147.       $game_system.se_play($data_system.cursor_se)
  1148.       @index += $game_party.actors.size - 1
  1149.       @index %= $game_party.actors.size
  1150.     end
  1151.     if self.actor != nil
  1152.       self.x = self.actor.screen_x
  1153.       self.y = self.actor.screen_y
  1154.     end
  1155.   end
  1156. end

  1157. class Scene_Battle
  1158. include Scene_BattleName
  1159. attr_reader :animation1_id
  1160.   def main
  1161.     $game_temp.in_battle = true
  1162.     $game_temp.battle_turn = 0
  1163.     $game_temp.battle_event_flags.clear
  1164.     $game_temp.battle_abort = false
  1165.     $game_temp.battle_main_phase = false
  1166.     $game_temp.battleback_name = $game_map.battleback_name
  1167.     $game_temp.forcing_battler = nil
  1168.     @_move_duration = 0
  1169.     $game_system.battle_interpreter.setup(nil, 0)
  1170.     @troop_id = $game_temp.battle_troop_id
  1171.     $game_troop.setup(@troop_id)
  1172.     s1 = $data_system.words.attack
  1173.     s2 = $data_system.words.skill
  1174.     s3 = $data_system.words.guard
  1175.     s4 = $data_system.words.item
  1176.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1177.     @actor_command_window.z = 900
  1178.     @actor_command_window.y = 160
  1179.     @actor_command_window.back_opacity = 160
  1180.     @actor_command_window.active = false
  1181.     @actor_command_window.visible = false
  1182.     @party_command_window = Window_PartyCommand.new
  1183.     @party_command_window.z = 910
  1184.     @help_window = Window_Help.new
  1185.     @help_window.back_opacity = 160
  1186.     @help_window.z = 920
  1187.     @help_window.visible = false
  1188.     @status_window = Window_BattleStatus.new
  1189.     @status_window.z = 930
  1190.     @message_window = Window_Message.new
  1191.     @message_window.z = 940
  1192.     @spriteset = Spriteset_Battle.new
  1193.     @wait_count = 0
  1194.     if $data_system.battle_transition == ""
  1195.       Graphics.transition(20)
  1196.     else
  1197.       Graphics.transition(40, "Graphics/Transitions/" +
  1198.         $data_system.battle_transition)
  1199.     end
  1200.     start_phase1
  1201.     loop do
  1202.       Graphics.update
  1203.       Input.update
  1204.       update
  1205.       if $scene != self
  1206.         break
  1207.       end
  1208.     end
  1209.     $game_map.refresh
  1210.     Graphics.freeze
  1211.     @actor_command_window.dispose
  1212.     @party_command_window.dispose
  1213.     @help_window.dispose
  1214.     @status_window.dispose
  1215.     @message_window.dispose
  1216.     if @skill_window != nil
  1217.       @skill_window.dispose
  1218.     end
  1219.     if @item_window != nil
  1220.       @item_window.dispose
  1221.     end
  1222.     if @result_window != nil
  1223.       @result_window.dispose
  1224.     end
  1225.     @spriteset.dispose
  1226.     if $scene.is_a?(Scene_Title)
  1227.       Graphics.transition
  1228.       Graphics.freeze
  1229.     end
  1230.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1231.       $scene = nil
  1232.     end
  1233.   end
  1234.   def start_phase1
  1235.     # 转移到回合 1
  1236.     @phase = 1
  1237.     # 清除全体同伴的行动
  1238.     $game_party.clear_actions
  1239.     for actor in $game_party.actors
  1240.      actor.startactive = actor.hp>0? "待机" : "死亡"
  1241.     end
  1242.     # 设置战斗事件
  1243.     setup_battle_event
  1244.   end
  1245.   alias bearrpg_start_phase5 start_phase5
  1246. def start_phase5
  1247.    bearrpg_start_phase5
  1248.     @result_window.z = 999
  1249.     @phase5_wait_count = 100
  1250.   end
  1251.   def start_enemy_select
  1252.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  1253.     @enemy_arrow.help_window = @help_window
  1254.     @actor_command_window.active = false
  1255.     @actor_command_window.visible = false
  1256.   end
  1257.   alias bearrpg_start_skill_select start_skill_select
  1258.    def start_skill_select
  1259.       bearrpg_start_skill_select
  1260.       @skill_window.z = 999
  1261.     end
  1262.    alias bearrpg_start_item_select start_item_select
  1263.     def start_item_select
  1264.       bearrpg_start_item_select
  1265.       @item_window.z = 999
  1266.     end
  1267.   def move(active_battler, target, ox, oy, 返回标记 = false)
  1268.     ta_x = target[0]
  1269.     ta_y = target[1]
  1270.     if 返回标记
  1271.       active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox) / @_move_duration
  1272.       active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy) / @_move_duration
  1273.     else
  1274.       if @active_battler.is_a?(Game_Enemy)
  1275.         active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1276.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1277.       else
  1278.         active_battler.movex =  (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1279.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1280.       end
  1281.     end
  1282.   end
  1283.   def update_phase4_step3
  1284.     ####普通攻击的场合############################################################
  1285.     if @active_battler.current_action.basic == 0 and
  1286.       @active_battler.current_action.kind == 0
  1287.       #开始执行移动
  1288.      if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1289.         @active_battler.startactive = "移动"
  1290.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1291.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1292.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1293.         @_move_duration = Move_Duration/2
  1294.        while @_move_duration > 0
  1295.         Graphics.update
  1296.         Input.update
  1297.         @spriteset.update
  1298.         if @target_battlers[0].is_a?(Game_Actor)
  1299.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width-(@target_battlers[0].screen_x-ox).abs/2.abs,@target_battlers[0].screen_y+1]
  1300.         else
  1301.         tag = [(@target_battlers[0].screen_x+@target_battlers[0].width/1.5)+(@target_battlers[0].screen_x-ox).abs/2,@target_battlers[0].screen_y+2]
  1302.         end
  1303.         move(@active_battler, tag, ox, oy)
  1304.         @_move_duration -= 1
  1305.       end
  1306.     else
  1307.       @_move_duration = Move_Duration
  1308.         while @_move_duration > 0
  1309.         Graphics.update
  1310.         Input.update
  1311.         @spriteset.update
  1312.         if @target_battlers[0].is_a?(Game_Actor)
  1313.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width/2,@target_battlers[0].screen_y+1]
  1314.         else
  1315.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1316.         end
  1317.         move(@active_battler, tag, ox, oy)
  1318.         @_move_duration -= 1
  1319.       end
  1320.       end
  1321.     end
  1322.    ####普通攻击的场合############################################################
  1323.     elsif @active_battler.current_action.kind == 1
  1324.     ####使用特技的场合############################################################
  1325.       if not @skill.element_set.include?(UNMOVE)# 如果技能不包含“不移动属性”
  1326.         @active_battler.startactive = "移动"
  1327.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1328.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1329.       if @skill.element_set.include?(HOMOVE)#如果技能不包含“半距离”属性
  1330.         @_move_duration = Move_Duration/2
  1331.        while @_move_duration > 0
  1332.         Graphics.update
  1333.         Input.update
  1334.         @spriteset.update
  1335.         if @target_battlers[0].is_a?(Game_Actor)
  1336.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width-(@target_battlers[0].screen_x-ox).abs/2.abs,@target_battlers[0].screen_y+1]
  1337.         else
  1338.         tag = [(@target_battlers[0].screen_x+@target_battlers[0].width/1.5)+(@target_battlers[0].screen_x-ox).abs/2,@target_battlers[0].screen_y+2]
  1339.         end
  1340.         move(@active_battler, tag, ox, oy)
  1341.         @_move_duration -= 1
  1342.       end
  1343.     else
  1344.       @_move_duration = Move_Duration
  1345.         while @_move_duration > 0
  1346.         Graphics.update
  1347.         Input.update
  1348.         @spriteset.update
  1349.         if @target_battlers[0].is_a?(Game_Actor)
  1350.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width,@target_battlers[0].screen_y+1]
  1351.         else
  1352.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1353.         end
  1354.         move(@active_battler, tag, ox, oy)
  1355.         @_move_duration -= 1
  1356.       end
  1357.       end
  1358.     end
  1359.    #####使用特技的场合##############################################################
  1360. end
  1361. if @active_battler.startactive != "防御"
  1362.     @active_battler.startactive = "待机"
  1363.    end
  1364.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  1365.     if @animation1_id == 0
  1366.       @active_battler.white_flash = true
  1367.     else
  1368.       @active_battler.animation_id = @animation1_id
  1369.       @active_battler.animation_hit = true
  1370.     end
  1371.     for target in @target_battlers
  1372.       if target.guarding? and target.damage.is_a?(Numeric)
  1373.         target.startactive = "防御" if target.damage > 0
  1374.         end
  1375.       target.animation_id = @animation2_id
  1376.       target.animation_hit = (target.damage != "Miss")
  1377.     end
  1378.     # 移至步骤 4
  1379.     @phase4_step = 4
  1380.   end
  1381.   ##############################################################################
  1382.   def update_phase4_step4
  1383.    ###########################万兽熊最高########################################
  1384.     # 对像方动画
  1385.      for target in @target_battlers
  1386.        if target.damage != nil
  1387.          target.damage_pop = true
  1388.        end
  1389.      end
  1390.     # 限制动画长度、最低 8 帧
  1391.   #  @wait_count = 8
  1392.   ##############################################################################
  1393.     # 移至步骤 5
  1394.     @phase4_step = 5
  1395.   end
  1396. ####################万兽熊最高############################
  1397.   def update_phase4_step5
  1398.     # 隐藏帮助窗口
  1399.     @help_window.visible = false
  1400.     if @active_battler.current_action.basic == 0 and
  1401.       @active_battler.current_action.kind == 0
  1402.    ####普通攻击的场合############################################################   
  1403.       #执行返回
  1404.     if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1405.       @active_battler.startactive = "返回"
  1406.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1407.       @_move_duration = Move_Duration/2
  1408.       else
  1409.       @_move_duration = Move_Duration   
  1410.       end
  1411.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1412.       @active_battler.screen_y - @active_battler.movey
  1413.       while @_move_duration > 0
  1414.         Graphics.update
  1415.         Input.update
  1416.         @spriteset.update
  1417.         move(@active_battler, @oldxy, ox, oy, true)
  1418.         @_move_duration -= 1
  1419.       end
  1420.     end
  1421.    ####普通攻击的场合############################################################
  1422.     elsif @active_battler.current_action.kind == 1
  1423.       if not @skill.element_set.include?(UNMOVE)#如果技能不包含“不移动”属性
  1424.       @active_battler.startactive = "返回"
  1425.       if @skill.element_set.include?(HOMOVE)#如果技能包含“半距离”属性
  1426.       @_move_duration = Move_Duration/2
  1427.       else
  1428.       @_move_duration = Move_Duration   
  1429.       end
  1430.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1431.       @active_battler.screen_y - @active_battler.movey
  1432.       while @_move_duration > 0
  1433.         Graphics.update
  1434.         Input.update
  1435.         @spriteset.update
  1436.         move(@active_battler, @oldxy, ox, oy, true)
  1437.         @_move_duration -= 1
  1438.       end
  1439.     end
  1440.    ####使用特技的场合############################################################
  1441. end
  1442. if @active_battler.startactive != "防御"
  1443.     @active_battler.startactive = "待机"
  1444.    end
  1445.     # 刷新状态窗口
  1446.     @status_window.refresh
  1447.     # 显示伤害
  1448.     for target in @target_battlers
  1449.       target.startactive = "待机"
  1450.       if target.damage != nil
  1451.         target.damage_pop = true
  1452.       end
  1453.     end
  1454.     # 移至步骤 6
  1455.     @phase4_step = 6
  1456.   end
  1457.   def update_phase4_step6
  1458.     # 清除强制行动对像的战斗者
  1459.     $game_temp.forcing_battler = nil
  1460.     @active_battler.movex = 0
  1461.     @active_battler.movey = 0
  1462.     @active_battler.startactive = "待机" if @active_battler.startactive != "死亡"
  1463.     # 公共事件 ID 有效的情况下
  1464.     if @common_event_id > 0
  1465.       # 设置事件
  1466.       common_event = $data_common_events[@common_event_id]
  1467.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1468.     end
  1469.     # 移至步骤 1
  1470.     @phase4_step = 1
  1471.   end
  1472. end
复制代码
这是熊大的横版……
不要迷恋哥,哥只是个传说
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
50 小时
注册时间
2014-12-12
帖子
16
3
 楼主| 发表于 2015-1-12 23:45:44 | 只看该作者
  1. #------------------制作by bluefool,转载请保留------------------
  2. module Blue
  3.   #这个是控制显示最近的多少条信息的,当超出一屏能显示的值的话可通过先按一下shift
  4.   #然后用上下翻看内容。再按一次shift则解除激活
  5.   Blue_max = 12
  6.   #这个填写进如游戏时生成的系统语言,
  7.   INTRO = "欢迎进入游戏!"
  8.   #战斗画面时即时消息窗口的x坐标
  9.   BATAM_X = 0
  10.   #战斗画面时即时消息窗口的y坐标
  11.   BATAM_Y = 90
  12.   #用于清空hash表,可以不管它,但不要让Blue_max大于它,当然,它的值也可以改变
  13.   NAM_MAX = 50
  14.   #主要传递信息参数为函数$am,参见脚本内容
  15. end
  16. #-------------------------------------------
  17. class Scene_Load < Scene_File
  18.   #--------------------------------------------------------------------------
  19.   # ● 确定时的处理
  20.   #--------------------------------------------------------------------------
  21.   def on_decision(filename)
  22.     # 文件不存在的情况下
  23.     unless FileTest.exist?(filename)
  24.       # 演奏冻结 SE
  25.       $game_system.se_play($data_system.buzzer_se)
  26.       return
  27.     end
  28.     # 演奏读档 SE
  29.     $game_system.se_play($data_system.load_se)
  30.     # 写入存档数据
  31.     file = File.open(filename, "rb")
  32.     read_save_data(file)
  33.     file.close
  34.     # 还原 BGM、BGS
  35.     $game_system.bgm_play($game_system.playing_bgm)
  36.     $game_system.bgs_play($game_system.playing_bgs)
  37.     # 刷新地图 (执行并行事件)
  38.     $a = {}
  39.     $game_map.update
  40.     # 切换到地图画面
  41.     $scene = Scene_Map.new
  42.   end
  43. end  
  44. class Game_Player < Game_Character
  45.   def update
  46.     # 本地变量记录移动信息
  47.     last_moving = moving?
  48.     # 移动中、事件执行中、强制移动路线中、
  49.     # 信息窗口一个也不显示的时候
  50.     unless moving? or $game_system.map_interpreter.running? or
  51.            @move_route_forcing or $game_temp.message_window_showing or $ccc == 1
  52.       case Input.dir4
  53.       when 2
  54.         move_down
  55.       when 4
  56.         move_left
  57.       when 6
  58.         move_right
  59.       when 8
  60.         move_up
  61.       end
  62.     end
  63.     # 本地变量记忆坐标
  64.     last_real_x = @real_x
  65.     last_real_y = @real_y
  66.     super
  67.     # 角色向下移动、画面上的位置在中央下方的情况下
  68.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  69.       # 画面向下卷动
  70.       $game_map.scroll_down(@real_y - last_real_y)
  71.     end
  72.     # 角色向左移动、画面上的位置在中央左方的情况下
  73.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  74.       # 画面向左卷动
  75.       $game_map.scroll_left(last_real_x - @real_x)
  76.     end
  77.     # 角色向右移动、画面上的位置在中央右方的情况下
  78.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  79.       # 画面向右卷动
  80.       $game_map.scroll_right(@real_x - last_real_x)
  81.     end
  82.     # 角色向上移动、画面上的位置在中央上方的情况下
  83.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  84.       # 画面向上卷动
  85.       $game_map.scroll_up(last_real_y - @real_y)
  86.     end
  87.     # 不在移动中的情况下
  88.     unless moving?
  89.       # 上次主角移动中的情况
  90.       if last_moving
  91.         # 与同位置的事件接触就判定为事件启动
  92.         result = check_event_trigger_here([1,2])
  93.         # 没有可以启动的事件的情况下
  94.         if result == false
  95.           # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  96.           unless $DEBUG and Input.press?(Input::CTRL)
  97.             # 遇敌计数下降
  98.             if @encounter_count > 0
  99.               @encounter_count -= 1
  100.             end
  101.           end
  102.         end
  103.       end
  104.       # 按下 C 键的情况下
  105.       if Input.trigger?(Input::C)
  106.         # 判定为同位置以及正面的事件启动
  107.         check_event_trigger_here([0])
  108.         check_event_trigger_there([0,1,2])
  109.       end
  110.     end
  111.   end
  112. end  
  113. #==============================================================================
  114. # ■ Scene_Title
  115. #------------------------------------------------------------------------------
  116. #  处理标题画面的类。
  117. #==============================================================================

  118. class Scene_Title
  119.   #--------------------------------------------------------------------------
  120.   # ● 命令 : 新游戏
  121.   #--------------------------------------------------------------------------
  122.   def command_new_game
  123.     # 演奏确定 SE
  124.     $game_system.se_play($data_system.decision_se)
  125.     # 停止 BGM
  126.     Audio.bgm_stop
  127.     # 重置测量游戏时间用的画面计数器
  128.     Graphics.frame_count = 0
  129.     # 生成各种游戏对像
  130.     $game_temp          = Game_Temp.new
  131.     $game_system        = Game_System.new
  132.     $game_switches      = Game_Switches.new
  133.     $game_variables     = Game_Variables.new
  134.     $game_self_switches = Game_SelfSwitches.new
  135.     $game_screen        = Game_Screen.new
  136.     $game_actors        = Game_Actors.new
  137.     $game_party         = Game_Party.new
  138.     $game_troop         = Game_Troop.new
  139.     $game_map           = Game_Map.new
  140.     $game_player        = Game_Player.new
  141.     # 设置初期同伴位置
  142.     $game_party.setup_starting_members
  143.     # 设置初期位置的地图
  144.     $game_map.setup($data_system.start_map_id)
  145.     # 主角向初期位置移动
  146.     $game_player.moveto($data_system.start_x, $data_system.start_y)
  147.     # 刷新主角
  148.     $game_player.refresh
  149.     # 执行地图设置的 BGM 与 BGS 的自动切换
  150.     $game_map.autoplay
  151.     # 刷新地图 (执行并行事件)
  152.     $game_map.update
  153.     $a = {}
  154.     $am = Blue::INTRO
  155.     $ccc = 0
  156.     # 切换地图画面
  157.     $scene = Scene_Map.new
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● 命令 : 继续
  161.   #--------------------------------------------------------------------------
  162.   def command_continue
  163.     # 继续无效的情况下
  164.     unless @continue_enabled
  165.       # 演奏无效 SE
  166.       $game_system.se_play($data_system.buzzer_se)
  167.       return
  168.     end
  169.     # 演奏确定 SE
  170.     $game_system.se_play($data_system.decision_se)
  171.     # 切换到读档画面
  172.     $scene = Scene_Load.new
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ● 命令 : 退出
  176.   #--------------------------------------------------------------------------
  177.   def command_shutdown
  178.     # 演奏确定 SE
  179.     $game_system.se_play($data_system.decision_se)
  180.     # BGM、BGS、ME 的淡入淡出
  181.     Audio.bgm_fade(800)
  182.     Audio.bgs_fade(800)
  183.     Audio.me_fade(800)
  184.     # 退出
  185.     $scene = nil
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 战斗测试
  189.   #--------------------------------------------------------------------------
  190.   def battle_test
  191.     # 载入数据库 (战斗测试用)
  192.     $data_actors        = load_data("Data/BT_Actors.rxdata")
  193.     $data_classes       = load_data("Data/BT_Classes.rxdata")
  194.     $data_skills        = load_data("Data/BT_Skills.rxdata")
  195.     $data_items         = load_data("Data/BT_Items.rxdata")
  196.     $data_weapons       = load_data("Data/BT_Weapons.rxdata")
  197.     $data_armors        = load_data("Data/BT_Armors.rxdata")
  198.     $data_enemies       = load_data("Data/BT_Enemies.rxdata")
  199.     $data_troops        = load_data("Data/BT_Troops.rxdata")
  200.     $data_states        = load_data("Data/BT_States.rxdata")
  201.     $data_animations    = load_data("Data/BT_Animations.rxdata")
  202.     $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
  203.     $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
  204.     $data_system        = load_data("Data/BT_System.rxdata")
  205.     # 重置测量游戏时间用的画面计数器
  206.     Graphics.frame_count = 0
  207.     # 生成各种游戏对像
  208.     $game_temp          = Game_Temp.new
  209.     $game_system        = Game_System.new
  210.     $game_switches      = Game_Switches.new
  211.     $game_variables     = Game_Variables.new
  212.     $game_self_switches = Game_SelfSwitches.new
  213.     $game_screen        = Game_Screen.new
  214.     $game_actors        = Game_Actors.new
  215.     $game_party         = Game_Party.new
  216.     $game_troop         = Game_Troop.new
  217.     $game_map           = Game_Map.new
  218.     $game_player        = Game_Player.new
  219.     $a = {0=>"进入战斗测试."}
  220.     # 设置战斗测试用同伴
  221.     $game_party.setup_battle_test_members
  222.     # 设置队伍 ID、可以逃走标志、战斗背景
  223.     $game_temp.battle_troop_id = $data_system.test_troop_id
  224.     $game_temp.battle_can_escape = true
  225.     $game_map.battleback_name = $data_system.battleback_name
  226.     # 演奏战斗开始 BGM
  227.     $game_system.se_play($data_system.battle_start_se)
  228.     # 演奏战斗 BGM
  229.     $game_system.bgm_play($game_system.battle_bgm)
  230.     # 切换到战斗画面
  231.     $scene = Scene_Battle.new
  232.   end
  233. end
  234. #-------------------------------------------------------
  235. class Scene_Map
  236.   #--------------------------------------------------------------------------
  237.   # ● 主处理
  238.   #--------------------------------------------------------------------------
  239.   def main
  240.     @spriteset = Spriteset_Map.new
  241.     @message_window = Window_Message.new
  242.     @down_window = Window_Down.new
  243.     ####################################修改!
  244.     @v = Viewport.new(0,460,320,20)
  245.     @v.color.set(0,0,0,100)
  246.     @tf = Type_Field.new(@v,"",16)
  247.     ####################################修改!
  248.     Graphics.transition
  249.     # 主循环
  250.     loop do
  251.       Graphics.update
  252.       Input.update
  253.       update
  254.       if $scene != self
  255.         break
  256.       end
  257.     end
  258.     Graphics.freeze
  259.     @spriteset.dispose
  260.     @message_window.dispose
  261.     @down_window.dispose
  262.     ############
  263.     @v.dispose
  264.     @tf.dispose
  265.     ###############
  266.     if $scene.is_a?(Scene_Title)
  267.       Graphics.transition
  268.       Graphics.freeze
  269.     end
  270.     @am_size = $a.size
  271.   end
  272.   #---------------------
  273.   def bluefool_sort
  274.     if $am != nil
  275.        if $a.size > Blue::NAM_MAX
  276.           a_temp = {}
  277.           j = 0
  278.           for i in ($a.size - Blue::Blue_max)...$a.size
  279.             a_temp[j] = $a[i]
  280.             j += 1
  281.           end  
  282.          $a = a_temp
  283.        end  
  284.        if $am.length < 54
  285.           $a[$a.size] = $am
  286.         else
  287.           while $am.length > 53
  288.             i = 53
  289.             while (/\W/ =~ $am[i-3,3]) != nil
  290.               i -= 1
  291.             end
  292.             $a[$a.size] = $am[0,i]
  293.             $am = $am[i ,$am.length - i]
  294.           end
  295.           $a[$a.size] = $am
  296.        end
  297.        $am = nil
  298.     end
  299.   end  
  300.   #--------------------------------------------------------------------------
  301.   # ● 刷新画面
  302.   #--------------------------------------------------------------------------
  303.   def update
  304.     # 循环
  305.     loop do
  306.       # 按照地图、实例、主角的顺序刷新
  307.       # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动
  308.       #  的机会的重要因素)
  309.       $game_map.update
  310.       $game_system.map_interpreter.update
  311.       $game_player.update
  312.       # 系统 (计时器)、画面刷新
  313.       $game_system.update
  314.       $game_screen.update
  315.       # 如果主角在场所移动中就中断循环
  316.       unless $game_temp.player_transferring
  317.         break
  318.       end
  319.       # 执行场所移动
  320.       transfer_player
  321.       # 处理过渡中的情况下、中断循环
  322.       if $game_temp.transition_processing
  323.         break
  324.       end
  325.     end
  326.     # 刷新活动块
  327.     @spriteset.update
  328.     # 刷新信息窗口
  329.     ###########################此处有修改!###########################
  330.     # 输入法测试
  331.     @tf.update
  332.     if RInput.trigger?(RInput::ENTER) and Input.press?(Input::CTRL)
  333.       if (text = @tf.get_text)  != ""
  334.               if (text = @tf.get_text)  == "help"
  335.                 $game_switches[1]=true
  336.               end
  337.               if (text = @tf.get_text)  == "cheat"
  338.                 $game_switches[2]=true
  339.               end
  340.         $am = $game_actors[1].name+": " [email protected]_text
  341.         $game_map.need_refresh = true
  342.         $scene = Scene_Map.new
  343.       end
  344.     end
  345.       ################################################################
  346.     @message_window.update
  347.     # 游戏结束的情况下
  348.     if $game_temp.gameover
  349.       # 切换的游戏结束画面
  350.       $scene = Scene_Gameover.new
  351.       return
  352.     end
  353.     # 返回标题画面的情况下
  354.     if $game_temp.to_title
  355.       # 切换到标题画面
  356.       $scene = Scene_Title.new
  357.       return
  358.     end
  359.     # 处理过渡中的情况下
  360.     if $game_temp.transition_processing
  361.       # 清除过渡处理中标志
  362.       $game_temp.transition_processing = false
  363.       # 执行过渡
  364.       if $game_temp.transition_name == ""
  365.         Graphics.transition(20)
  366.       else
  367.         Graphics.transition(40, "Graphics/Transitions/" +
  368.           $game_temp.transition_name)
  369.       end
  370.     end
  371.     # 显示信息窗口中的情况下
  372.     if $game_temp.message_window_showing
  373.       return
  374.     end
  375.     # 遇敌计数为 0 且、且遇敌列表不为空的情况下
  376.     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
  377.       # 不是在事件执行中或者禁止遇敌中
  378.       unless $game_system.map_interpreter.running? or
  379.              $game_system.encounter_disabled
  380.         # 确定队伍
  381.         n = rand($game_map.encounter_list.size)
  382.         troop_id = $game_map.encounter_list[n]
  383.         # 队伍有效的话
  384.         if $data_troops[troop_id] != nil
  385.           # 设置调用战斗标志
  386.           $game_temp.battle_calling = true
  387.           $game_temp.battle_troop_id = troop_id
  388.           $game_temp.battle_can_escape = true
  389.           $game_temp.battle_can_lose = false
  390.           $game_temp.battle_proc = nil
  391.         end
  392.       end
  393.     end
  394.     #---------------------------------------------
  395.     bluefool_sort
  396.     if @am_size != $a.size
  397.        @down_window.refresh
  398.        if $a != nil and $a.size < Blue::Blue_max + 1
  399.         @down_window.index = $a.size/2 - 1
  400.         elsif $a != nil and $a.size > Blue::Blue_max
  401.         @down_window.index = Blue::Blue_max/2 - 1
  402.        end  
  403.        @am_size = $a.size
  404.     end  
  405.    # if Input.trigger?(Input::A)
  406.    #   if @down_window.active == false
  407.    #     @down_window.active = true
  408.    #     $ccc = 1
  409.    #   else
  410.    #    @down_window.active = false
  411.    #     $ccc = 0
  412.    #  end  
  413.    # end
  414.    # if Input.trigger?(Input::DOWN)#输入DOWN键的情况
  415.    #   if @down_window.active == true and @down_window.index < (@down_window.item_max-1)/2
  416.    #     @down_window.index += 1
  417.    #   end  
  418.    # end  
  419.    # if Input.trigger?(Input::UP)#输入UP键的情况
  420.    #   if @down_window.active == true and @down_window.index > 0
  421.    #     @down_window.index -= 1
  422.    #   end  
  423.    # end  
  424.     #----------------------------------------------
  425.     # 按下 B 键的情况下
  426.     if Input.trigger?(Input::B)
  427.       # 不是在事件执行中或菜单禁止中
  428.       unless $game_system.map_interpreter.running? or
  429.              $game_system.menu_disabled
  430.         # 设置菜单调用标志以及 SE 演奏
  431.         $game_temp.menu_calling = true
  432.         $game_temp.menu_beep = true
  433.       end
  434.     end
  435.     # 调试模式为 ON 并且按下 F9 键的情况下
  436.     if $DEBUG and Input.press?(Input::F9)
  437.       # 设置调用调试标志
  438.       $game_temp.debug_calling = true
  439.     end
  440.     # 不在主角移动中的情况下
  441.     unless $game_player.moving?
  442.       # 执行各种画面的调用
  443.       if $game_temp.battle_calling
  444.         call_battle
  445.       elsif $game_temp.shop_calling
  446.         call_shop
  447.       elsif $game_temp.name_calling
  448.         call_name
  449.       elsif $game_temp.menu_calling
  450.         call_menu
  451.       elsif $game_temp.save_calling
  452.         call_save
  453.       elsif $game_temp.debug_calling
  454.         call_debug
  455.       end
  456.     end
  457.   end
  458. end
  459. class Game_Battler
  460.   def bluefool_sort
  461.       if $am != nil
  462.         if $am.length < 54
  463.            $a[$a.size] = $am
  464.         else
  465.            while $am.length > 53
  466.              i = 53
  467.              while (/\W/ =~ $am[i-3,3]) != nil
  468.               i -= 1
  469.              end
  470.              $a[$a.size] = $am[0,i]
  471.              $am = $am[i ,$am.length - i]
  472.            end
  473.            $a[$a.size] = $am
  474.         end
  475.        $am = nil
  476.       end
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 应用连续伤害效果
  480.   #--------------------------------------------------------------------------
  481.   def slip_damage_effect
  482.     # 设置伤害
  483.     self.damage = self.maxhp / 10
  484.     # 分散
  485.     if self.damage.abs > 0
  486.       amp = [self.damage.abs * 15 / 100, 1].max
  487.       self.damage += rand(amp+1) + rand(amp+1) - amp
  488.     end
  489.     # HP 的伤害减法运算
  490.     self.hp -= self.damage
  491.     if self.damage > 0
  492.       $am = "异常状态使#{self.name}受到了#{self.damage}点伤害."
  493.     elsif self.damage < 0
  494.       $am = "异常状态使#{self.name}恢复了#{self.damage.abs}点#{$data_system.words.hp}"
  495.     end
  496.     bluefool_sort
  497.     # 过程结束
  498.     return true
  499.   end
  500.   #--------------------------------------------------------------------------
  501.   # ● 应用通常攻击效果
  502.   #     attacker : 攻击者 (battler)
  503.   #--------------------------------------------------------------------------
  504.   def attack_effect(attacker)
  505.     # 清除会心一击标志
  506.     self.critical = false
  507.     # 第一命中判定
  508.     hit_result = (rand(100) < attacker.hit)
  509.     # 命中的情况下
  510.     if hit_result == true
  511.       # 计算基本伤害
  512.       atk = [attacker.atk - self.pdef / 2, 0].max
  513.       self.damage = atk * (20 + attacker.str) / 20
  514.       # 属性修正
  515.       self.damage *= elements_correct(attacker.element_set)
  516.       self.damage /= 100
  517.       # 伤害符号正确的情况下
  518.       if self.damage > 0
  519.         # 会心一击修正
  520.         if rand(100) < 4 * attacker.dex / self.agi
  521.           self.damage *= 2
  522.           self.critical = true
  523.         end
  524.         # 防御修正
  525.         if self.guarding?
  526.           self.damage /= 2
  527.         end
  528.       end
  529.       # 分散
  530.       if self.damage.abs > 0
  531.         amp = [self.damage.abs * 15 / 100, 1].max
  532.         self.damage += rand(amp+1) + rand(amp+1) - amp
  533.       end
  534.       # 第二命中判定
  535.       eva = 8 * self.agi / attacker.dex + self.eva
  536.       hit = self.damage < 0 ? 100 : 100 - eva
  537.       hit = self.cant_evade? ? 100 : hit
  538.       hit_result = (rand(100) < hit)
  539.     end
  540.     # 命中的情况下
  541.     if hit_result == true
  542.       # 状态冲击解除
  543.       remove_states_shock
  544.       # HP 的伤害计算
  545.       self.hp -= self.damage
  546.       $am = "#{attacker.name}对#{self.name}造成了#{self.damage}伤害."
  547.       bluefool_sort
  548.       # 状态变化
  549.       @state_changed = false
  550.       states_plus(attacker.plus_state_set)
  551.       states_minus(attacker.minus_state_set)
  552.     # Miss 的情况下
  553.     else
  554.       # 伤害设置为 "Miss"
  555.       self.damage = "Miss"
  556.       $am = "#{attacker.name}击空了."
  557.       bluefool_sort
  558.       # 清除会心一击标志
  559.       self.critical = false
  560.     end
  561.     # 过程结束
  562.     return true
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # ● 应用特技效果
  566.   #     user  : 特技的使用者 (battler)
  567.   #     skill : 特技
  568.   #--------------------------------------------------------------------------
  569.   def skill_effect(user, skill)
  570.     # 清除会心一击标志
  571.     self.critical = false
  572.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  573.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  574.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  575.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  576.       # 过程结束
  577.       return false
  578.     end
  579.     # 清除有效标志
  580.     effective = false
  581.     # 公共事件 ID 是有效的情况下,设置为有效标志
  582.     effective |= skill.common_event_id > 0
  583.     # 第一命中判定
  584.     hit = skill.hit
  585.     if skill.atk_f > 0
  586.       hit *= user.hit / 100
  587.     end
  588.     hit_result = (rand(100) < hit)
  589.     # 不确定的特技的情况下设置为有效标志
  590.     effective |= hit < 100
  591.     # 命中的情况下
  592.     if hit_result == true
  593.       # 计算威力
  594.       power = skill.power + user.atk * skill.atk_f / 100
  595.       if power > 0
  596.         power -= self.pdef * skill.pdef_f / 200
  597.         power -= self.mdef * skill.mdef_f / 200
  598.         power = [power, 0].max
  599.       end
  600.       # 计算倍率
  601.       rate = 20
  602.       rate += (user.str * skill.str_f / 100)
  603.       rate += (user.dex * skill.dex_f / 100)
  604.       rate += (user.agi * skill.agi_f / 100)
  605.       rate += (user.int * skill.int_f / 100)
  606.       # 计算基本伤害
  607.       self.damage = power * rate / 20
  608.       # 属性修正
  609.       self.damage *= elements_correct(skill.element_set)
  610.       self.damage /= 100
  611.       # 伤害符号正确的情况下
  612.       if self.damage > 0
  613.         # 防御修正
  614.         if self.guarding?
  615.           self.damage /= 2
  616.         end
  617.       end
  618.       # 分散
  619.       if skill.variance > 0 and self.damage.abs > 0
  620.         amp = [self.damage.abs * skill.variance / 100, 1].max
  621.         self.damage += rand(amp+1) + rand(amp+1) - amp
  622.       end
  623.       # 第二命中判定
  624.       eva = 8 * self.agi / user.dex + self.eva
  625.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  626.       hit = self.cant_evade? ? 100 : hit
  627.       hit_result = (rand(100) < hit)
  628.       # 不确定的特技的情况下设置为有效标志
  629.       effective |= hit < 100
  630.     end
  631.     # 命中的情况下
  632.     if hit_result == true
  633.       # 威力 0 以外的物理攻击的情况下
  634.       if skill.power != 0 and skill.atk_f > 0
  635.         # 状态冲击解除
  636.         remove_states_shock
  637.         # 设置有效标志
  638.         effective = true
  639.       end
  640.       # HP 的伤害减法运算
  641.       last_hp = self.hp
  642.       self.hp -= self.damage
  643.         if self.damage > 0
  644.          $am = "#{user.name}对#{self.name}造成了#{self.damage}伤害."
  645.          elsif self.damage < 0
  646.           if user == self
  647.            $am = "#{user.name}恢复了自己#{self.damage.abs}点#{$data_system.words.hp}."
  648.            else
  649.            $am = "#{user.name}恢复了#{self.name}#{self.damage.abs}点#{$data_system.words.hp}."
  650.           end
  651.         end
  652.       bluefool_sort
  653.       effective |= self.hp != last_hp
  654.       # 状态变化
  655.       @state_changed = false
  656.       effective |= states_plus(skill.plus_state_set)
  657.       effective |= states_minus(skill.minus_state_set)
  658.       # 威力为 0 的场合
  659.       if skill.power == 0
  660.         # 伤害设置为空的字串
  661.         self.damage = ""
  662.         # 状态没有变化的情况下
  663.         unless @state_changed
  664.           # 伤害设置为 "Miss"
  665.           self.damage = "Miss"
  666.           $am = "#{user.name}没有击中."
  667.           bluefool_sort
  668.         end
  669.       end
  670.     # Miss 的情况下
  671.     else
  672.       # 伤害设置为 "Miss"
  673.       self.damage = "Miss"
  674.       $am = "#{user.name}没有击中."
  675.       bluefool_sort
  676.     end
  677.     # 不在战斗中的情况下
  678.     unless $game_temp.in_battle
  679.       # 伤害设置为 nil
  680.       self.damage = nil
  681.     end
  682.     # 过程结束
  683.     return effective
  684.   end
  685. end
  686. class Scene_Battle
  687.   #--------------------------------------------------------------------------
  688.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  689.   #--------------------------------------------------------------------------
  690.   def update_phase4_step1
  691.     # 隐藏帮助窗口
  692.     @help_window.visible = false
  693.     # 判定胜败
  694.     if judge
  695.       # 胜利或者失败的情况下 : 过程结束
  696.       return
  697.     end
  698.     # 强制行动的战斗者不存在的情况下
  699.     if $game_temp.forcing_battler == nil
  700.       # 设置战斗事件
  701.       setup_battle_event
  702.       # 执行战斗事件中的情况下
  703.       if $game_system.battle_interpreter.running?
  704.         return
  705.       end
  706.     end
  707.     # 强制行动的战斗者存在的情况下
  708.     if $game_temp.forcing_battler != nil
  709.       # 在头部添加后移动
  710.       @action_battlers.delete($game_temp.forcing_battler)
  711.       @action_battlers.unshift($game_temp.forcing_battler)
  712.     end
  713.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  714.     if @action_battlers.size == 0
  715.       # 开始同伴命令回合
  716.       start_phase2
  717.       return
  718.     end
  719.     # 初始化动画 ID 和公共事件 ID
  720.     @animation1_id = 0
  721.     @animation2_id = 0
  722.     @common_event_id = 0
  723.     # 未行动的战斗者移动到序列的头部
  724.     @active_battler = @action_battlers.shift
  725.     # 如果已经在战斗之外的情况下
  726.     if @active_battler.index == nil
  727.       return
  728.     end
  729.     # 连续伤害
  730.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  731.       @active_battler.slip_damage_effect
  732.       @active_battler.damage_pop = true
  733.       @down_window.refresh
  734.     end
  735.     # 自然解除状态
  736.     @active_battler.remove_states_auto
  737.     # 刷新状态窗口
  738.     @status_window.refresh
  739.     # 移至步骤 2
  740.     @phase4_step = 2
  741.   end
  742.   #--------------------------------------------------------------------------
  743.   # ● 开始结束战斗回合
  744.   #--------------------------------------------------------------------------
  745.   def start_phase5
  746.     # 转移到回合 5
  747.     @phase = 5
  748.     # 演奏战斗结束 ME
  749.     $game_system.me_play($game_system.battle_end_me)
  750.     # 还原为战斗开始前的 BGM
  751.     $game_system.bgm_play($game_temp.map_bgm)
  752.     # 初始化 EXP、金钱、宝物
  753.     exp = 0
  754.     gold = 0
  755.     treasures = []
  756.     # 循环
  757.     for enemy in $game_troop.enemies
  758.       # 敌人不是隐藏状态的情况下
  759.       unless enemy.hidden
  760.         # 获得 EXP、增加金钱
  761.         exp += enemy.exp
  762.         gold += enemy.gold
  763.         # 出现宝物判定
  764.         if rand(100) < enemy.treasure_prob
  765.           if enemy.item_id > 0
  766.             treasures.push($data_items[enemy.item_id])
  767.           end
  768.           if enemy.weapon_id > 0
  769.             treasures.push($data_weapons[enemy.weapon_id])
  770.           end
  771.           if enemy.armor_id > 0
  772.             treasures.push($data_armors[enemy.armor_id])
  773.           end
  774.         end
  775.       end
  776.     end
  777.     # 限制宝物数为 6 个
  778.     treasures = treasures[0..5]
  779.     # 获得 EXP
  780.     for i in 0...$game_party.actors.size
  781.       actor = $game_party.actors[i]
  782.       if actor.cant_get_exp? == false
  783.         last_level = actor.level
  784.         actor.exp += exp
  785.         if actor.level > last_level
  786.           @status_window.level_up(i)
  787.         end
  788.       end
  789.     end
  790.     # 获得金钱
  791.     $game_party.gain_gold(gold)
  792.     $am = "获得#{exp}经验,#{gold}#{$data_system.words.gold}"
  793.     bluefool_sort
  794.     @down_window.refresh
  795.     # 获得宝物
  796.     for item in treasures
  797.       case item
  798.       when RPG::Item
  799.         $game_party.gain_item(item.id, 1)
  800.         $am = "获得#{$data_items[item.id].name}"
  801.         bluefool_sort
  802.       when RPG::Weapon
  803.         $game_party.gain_weapon(item.id, 1)
  804.         $am = "获得#{$data_weapons[item.id].name}"
  805.         bluefool_sort
  806.       when RPG::Armor
  807.         $game_party.gain_armor(item.id, 1)
  808.         $am = "获得#{$data_armors[item.id].name}"
  809.         bluefool_sort
  810.       end
  811.       @down_window.refresh
  812.     end
  813.     # 生成战斗结果窗口
  814.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  815.     # 设置等待计数
  816.     @phase5_wait_count = 100
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # ● 生成基本行动结果
  820.   #--------------------------------------------------------------------------
  821.   def make_basic_action_result
  822.     # 攻击的情况下
  823.     if @active_battler.current_action.basic == 0
  824.       # 设置攻击 ID
  825.       @animation1_id = @active_battler.animation1_id
  826.       @animation2_id = @active_battler.animation2_id
  827.       # 行动方的战斗者是敌人的情况下
  828.       if @active_battler.is_a?(Game_Enemy)
  829.         if @active_battler.restriction == 3
  830.           target = $game_troop.random_target_enemy
  831.         elsif @active_battler.restriction == 2
  832.           target = $game_party.random_target_actor
  833.         else
  834.           index = @active_battler.current_action.target_index
  835.           target = $game_party.smooth_target_actor(index)
  836.         end
  837.       end
  838.       # 行动方的战斗者是角色的情况下
  839.       if @active_battler.is_a?(Game_Actor)
  840.         if @active_battler.restriction == 3
  841.           target = $game_party.random_target_actor
  842.         elsif @active_battler.restriction == 2
  843.           target = $game_troop.random_target_enemy
  844.         else
  845.           index = @active_battler.current_action.target_index
  846.           target = $game_troop.smooth_target_enemy(index)
  847.         end
  848.       end
  849.       # 设置对像方的战斗者序列
  850.       @target_battlers = [target]
  851.       for target in @target_battlers
  852.         $am = "#{@active_battler.name}对#{target.name}发起了进攻!"
  853.         bluefool_sort
  854.         target.attack_effect(@active_battler)
  855.       end
  856.       return
  857.     end
  858.     # 防御的情况下
  859.     if @active_battler.current_action.basic == 1
  860.       @help_window.set_text($data_system.words.guard, 1)
  861.       $am = "#{@active_battler.name}选择了防御."
  862.       bluefool_sort
  863.       return
  864.     end
  865.     # 逃跑的情况下
  866.     if @active_battler.is_a?(Game_Enemy) and
  867.        @active_battler.current_action.basic == 2
  868.       #  帮助窗口显示"逃跑"
  869.       @help_window.set_text("逃跑", 1)
  870.       # 逃跑
  871.       @active_battler.escape
  872.       return
  873.     end
  874.     # 什么也不做的情况下
  875.     if @active_battler.current_action.basic == 3
  876.       # 清除强制行动对像的战斗者
  877.       $game_temp.forcing_battler = nil
  878.       # 移至步骤 1
  879.       @phase4_step = 1
  880.       return
  881.     end
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ● 生成特技行动结果
  885.   #--------------------------------------------------------------------------
  886.   def make_skill_action_result
  887.     # 获取特技
  888.     [url=home.php?mod=space&uid=260100]@skill[/url] = $data_skills[@active_battler.current_action.skill_id]
  889.     # 如果不是强制行动
  890.     unless @active_battler.current_action.forcing
  891.       # 因为 SP 耗尽而无法使用的情况下
  892.       unless @active_battler.skill_can_use?(@skill.id)
  893.         # 清除强制行动对像的战斗者
  894.         $game_temp.forcing_battler = nil
  895.         # 移至步骤 1
  896.         @phase4_step = 1
  897.         return
  898.       end
  899.     end
  900.     # 消耗 SP
  901.     @active_battler.sp -= @skill.sp_cost
  902.     # 刷新状态窗口
  903.     @status_window.refresh
  904.     # 在帮助窗口显示特技名
  905.     @help_window.set_text(@skill.name, 1)
  906.     # 设置动画 ID
  907.     @animation1_id = @skill.animation1_id
  908.     @animation2_id = @skill.animation2_id
  909.     # 设置公共事件 ID
  910.     @common_event_id = @skill.common_event_id
  911.     # 设置对像侧战斗者
  912.     set_target_battlers(@skill.scope)
  913.     # 应用特技效果
  914.     for target in @target_battlers
  915.       case @skill.scope
  916.       when 1  
  917.        $am = "#{@active_battler.name}使用#{@skill.name}攻击#{target.name}!"
  918.       when 2  
  919.        $am = "#{@active_battler.name}使用#{@skill.name}攻击#{target.name}!"
  920.       when 7  
  921.         $am = "#{@active_battler.name}对自己使用#{@skill.name}."
  922.       else
  923.         if target == @active_battler
  924.           $am = "#{@active_battler.name}对自己使用#{@skill.name}."
  925.           else
  926.           $am = "#{@active_battler.name}对#{target.name}使用#{@skill.name}."
  927.         end  
  928.       end
  929.       bluefool_sort
  930.       target.skill_effect(@active_battler, @skill)
  931.     end
  932.   end
  933.   #--------------------------------------------------------------------------
  934.   # ● 生成物品行动结果
  935.   #--------------------------------------------------------------------------
  936.   def make_item_action_result
  937.     # 获取物品
  938.     @item = $data_items[@active_battler.current_action.item_id]
  939.     # 因为物品耗尽而无法使用的情况下
  940.     unless $game_party.item_can_use?(@item.id)
  941.       # 移至步骤 1
  942.       @phase4_step = 1
  943.       return
  944.     end
  945.     # 消耗品的情况下
  946.     if @item.consumable
  947.       # 使用的物品减 1
  948.       $game_party.lose_item(@item.id, 1)
  949.     end
  950.     # 在帮助窗口显示物品名
  951.     @help_window.set_text(@item.name, 1)
  952.     # 设置动画 ID
  953.     @animation1_id = @item.animation1_id
  954.     @animation2_id = @item.animation2_id
  955.     # 设置公共事件 ID
  956.     @common_event_id = @item.common_event_id
  957.     # 确定对像
  958.     index = @active_battler.current_action.target_index
  959.     target = $game_party.smooth_target_actor(index)
  960.     # 设置对像侧战斗者
  961.     set_target_battlers(@item.scope)
  962.     # 应用物品效果
  963.     for target in @target_battlers
  964.       target.item_effect(@item)
  965.       if target == @active_battler
  966.         $am = "#{@active_battler.name}对自己使用了#{@item.name}"
  967.        else
  968.         $am = "#{@active_battler.name}对#{target.name}使用了#{@item.name}"
  969.       end
  970.       bluefool_sort
  971.     end
  972.   end
  973.   #--------------------------------------------------------------------------
  974.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  975.   #--------------------------------------------------------------------------
  976.   def update_phase4_step4
  977.     # 对像方动画
  978.     for target in @target_battlers
  979.       target.animation_id = @animation2_id
  980.       target.animation_hit = (target.damage != "Miss")
  981.     end
  982.     @down_window.refresh
  983.     @wait_count = 8
  984.     # 移至步骤 5
  985.     @phase4_step = 5
  986.   end
  987.   def bluefool_sort
  988.       if $am != nil
  989.        if $a.size > Blue::NAM_MAX
  990.           a_temp = {}
  991.           j = 0
  992.           for i in ($a.size - Blue::Blue_max)...$a.size
  993.             a_temp[j] = $a[i]
  994.             j += 1
  995.           end  
  996.          $a = a_temp
  997.        end  
  998.         if $am.length < 54
  999.            $a[$a.size] = $am
  1000.         else
  1001.            while $am.length > 53
  1002.              i = 53
  1003.              while (/\W/ =~ $am[i-3,3]) != nil
  1004.               i -= 1
  1005.              end
  1006.              $a[$a.size] = $am[0,i]
  1007.              $am = $am[i ,$am.length - i]
  1008.            end
  1009.            $a[$a.size] = $am
  1010.         end
  1011.        $am = nil
  1012.       end
  1013.   end
  1014.   def main
  1015.     $am = "队伍进入战斗!"
  1016.     bluefool_sort
  1017.     $game_temp.in_battle = true
  1018.     $game_temp.battle_turn = 0
  1019.     $game_temp.battle_event_flags.clear
  1020.     $game_temp.battle_abort = false
  1021.     $game_temp.battle_main_phase = false
  1022.     $game_temp.battleback_name = $game_map.battleback_name
  1023.     $game_temp.forcing_battler = nil
  1024.     $game_system.battle_interpreter.setup(nil, 0)
  1025.     @troop_id = $game_temp.battle_troop_id
  1026.     $game_troop.setup(@troop_id)
  1027.     #生成角色命令窗口
  1028.     s1 = $data_system.words.attack
  1029.     s2 = $data_system.words.skill
  1030.     s3 = $data_system.words.guard
  1031.     s4 = $data_system.words.item
  1032.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1033.     @actor_command_window.y = 160
  1034.     @actor_command_window.back_opacity = 160
  1035.     @actor_command_window.active = false
  1036.     @actor_command_window.visible = false
  1037.     # 生成其它窗口
  1038.     @party_command_window = Window_PartyCommand.new
  1039.     @help_window = Window_Help.new
  1040.     @help_window.back_opacity = 160
  1041.     @help_window.visible = false
  1042.     @status_window = Window_BattleStatus.new
  1043.     @message_window = Window_Message.new
  1044.     @down_window = Window_Down.new
  1045.     @down_window.y = Blue::BATAM_Y
  1046.     @down_window.z = @actor_command_window.z - 10
  1047.     # 生成活动块
  1048.     @spriteset = Spriteset_Battle.new
  1049.     # 初始化等待计数
  1050.     @wait_count = 0
  1051.     # 执行过渡
  1052.     if $data_system.battle_transition == ""
  1053.       Graphics.transition(20)
  1054.     else
  1055.       Graphics.transition(40, "Graphics/Transitions/" +
  1056.         $data_system.battle_transition)
  1057.     end
  1058.     # 开始自由战斗回合
  1059.     start_phase1
  1060.     # 主循环
  1061.     loop do
  1062.       Graphics.update
  1063.       Input.update
  1064.       update
  1065.       if $scene != self
  1066.         break
  1067.       end
  1068.     end
  1069.     # 刷新地图
  1070.     $game_map.refresh
  1071.     # 准备过渡
  1072.     Graphics.freeze
  1073.     # 释放窗口
  1074.     @actor_command_window.dispose
  1075.     @party_command_window.dispose
  1076.     @help_window.dispose
  1077.     @status_window.dispose
  1078.     @message_window.dispose
  1079.     @down_window.dispose
  1080.     $am = "战斗结束"
  1081.     bluefool_sort
  1082.     if @skill_window != nil
  1083.       @skill_window.dispose
  1084.     end
  1085.     if @item_window != nil
  1086.       @item_window.dispose
  1087.     end
  1088.     if @result_window != nil
  1089.       @result_window.dispose
  1090.     end
  1091.     # 释放活动块
  1092.     @spriteset.dispose
  1093.     # 标题画面切换中的情况
  1094.     if $scene.is_a?(Scene_Title)
  1095.       # 淡入淡出画面
  1096.       Graphics.transition
  1097.       Graphics.freeze
  1098.     end
  1099.     # 战斗测试或者游戏结束以外的画面切换中的情况
  1100.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1101.       $scene = nil
  1102.     end
  1103.   end
  1104. end
  1105. #---------------------------------------------------------
  1106. class Interpreter
  1107.   def bluefool_sort
  1108.       if $am != nil
  1109.        if $a.size > Blue::NAM_MAX
  1110.           a_temp = {}
  1111.           j = 0
  1112.           for i in ($a.size - Blue::Blue_max)...$a.size
  1113.             a_temp[j] = $a[i]
  1114.             j += 1
  1115.           end  
  1116.          $a = a_temp
  1117.        end  
  1118.         if $am.length < 54
  1119.            $a[$a.size] = $am
  1120.         else
  1121.            while $am.length > 53
  1122.              i = 53
  1123.              while (/\W/ =~ $am[i-3,3]) != nil
  1124.               i -= 1
  1125.              end
  1126.              $a[$a.size] = $am[0,i]
  1127.              $am = $am[i ,$am.length - i]
  1128.            end
  1129.            $a[$a.size] = $am
  1130.         end
  1131.        $am = nil
  1132.       end
  1133.   end
  1134.   def command_101
  1135.     if $game_temp.message_text != nil
  1136.       return false
  1137.     end
  1138.     # 设置信息结束后待机和返回调用标志
  1139.     @message_waiting = true
  1140.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  1141.     # message_text 设置为 1 行
  1142.     $game_temp.message_text = @list[@index].parameters[0] + "\n"
  1143.     if (@list[@index].parameters[0]).split(/\\/)[1] != nil
  1144.      $am = @list[@index].parameters[0].split(/\\/)[0]
  1145.      else
  1146.      $am = @list[@index].parameters[0]
  1147.     end  
  1148.     bluefool_sort
  1149.     line_count = 1
  1150.     # 循环
  1151.     loop do
  1152.       # 下一个事件指令为文章两行以上的情况
  1153.       if @list[@index+1].code == 401
  1154.         # message_text 添加到第 2 行以下
  1155.         $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
  1156.         $am = @list[@index+1].parameters[0]
  1157.         bluefool_sort
  1158.         line_count += 1
  1159.       # 事件指令不在文章两行以下的情况
  1160.       else
  1161.         # 下一个事件指令为显示选择项的情况下
  1162.         if @list[@index+1].code == 102
  1163.           # 如果选择项能收纳在画面里
  1164.           if @list[@index+1].parameters[0].size <= 4 - line_count
  1165.             # 推进索引
  1166.             @index += 1
  1167.             # 设置选择项
  1168.             $game_temp.choice_start = line_count
  1169.             setup_choices(@list[@index].parameters)
  1170.           end
  1171.         # 下一个事件指令为处理输入数值的情况下
  1172.         elsif @list[@index+1].code == 103
  1173.           # 如果数值输入窗口能收纳在画面里
  1174.           if line_count < 4
  1175.             # 推进索引
  1176.             @index += 1
  1177.             # 设置输入数值
  1178.             $game_temp.num_input_start = line_count
  1179.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  1180.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  1181.           end
  1182.         end
  1183.         # 继续
  1184.         return true
  1185.       end
  1186.       # 推进索引
  1187.       @index += 1
  1188.     end
  1189.   end
  1190.   def command_125
  1191.     value = operate_value(@parameters[0], @parameters[1], @parameters[2])
  1192.     $game_party.gain_gold(value)
  1193.     if value >= 0
  1194.       $am = "#{$game_party.actors[0].name}得到了#{value}#{$data_system.words.gold}"
  1195.     else
  1196.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}#{$data_system.words.gold}"
  1197.     end  
  1198.     bluefool_sort
  1199.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1200.     return true
  1201.   end
  1202.   def command_126
  1203.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  1204.     # 增减物品
  1205.     $game_party.gain_item(@parameters[0], value)
  1206.     if value >= 0
  1207.       $am = "#{$game_party.actors[0].name}得到了#{value.abs.to_s}个#{$data_items[@parameters[0]].name}"
  1208.     else
  1209.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}个#{$data_items[@parameters[0]].name}"
  1210.     end
  1211.     bluefool_sort
  1212.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1213.     return true
  1214.   end
  1215.   def command_127
  1216.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  1217.     # 增减武器
  1218.     $game_party.gain_weapon(@parameters[0], value)
  1219.     if value >= 0
  1220.       $am = "#{$game_party.actors[0].name}得到了#{value.abs.to_s}个#{$data_weapons[@parameters[0]].name}"
  1221.     else
  1222.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}个#{$data_weapons[@parameters[0]].name}"
  1223.     end
  1224.     bluefool_sort
  1225.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1226.     return true
  1227.   end
  1228.   def command_128
  1229.     value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  1230.     # 增减防具
  1231.     $game_party.gain_armor(@parameters[0], value)
  1232.     if value >= 0
  1233.       $am = "#{$game_party.actors[0].name}得到了#{value.abs.to_s}个#{$data_armors[@parameters[0]].name}"
  1234.     else
  1235.       $am = "#{$game_party.actors[0].name}失去了#{value.abs.to_s}个#{$data_armors[@parameters[0]].name}"
  1236.     end
  1237.     bluefool_sort
  1238.     Audio.se_play("Audio/SE/"+"006-System06",100,100)
  1239.     return true
  1240.   end
  1241.   def command_129
  1242.     # 获取角色
  1243.     actor = $game_actors[@parameters[0]]
  1244.     # 角色有效的情况下
  1245.     if actor != nil
  1246.       # 操作分支
  1247.       if @parameters[1] == 0
  1248.         if @parameters[2] == 1
  1249.           $game_actors[@parameters[0]].setup(@parameters[0])
  1250.         end
  1251.         $game_party.add_actor(@parameters[0])
  1252.         Audio.me_play("Audio/ME/"+"002-Victory02",100,100)
  1253.         $am = "#{$game_actors[@parameters[0]].name}加入队伍!"
  1254.         bluefool_sort
  1255.       else
  1256.         $game_party.remove_actor(@parameters[0])
  1257.         Audio.me_play("Audio/ME/"+"015-Mystery01",100,100)
  1258.         $am = "#{$game_actors[@parameters[0]].name}离开队伍!"
  1259.         bluefool_sort
  1260.       end
  1261.     end
  1262.     # 继续
  1263.     return true
  1264.   end
  1265.   #-------------------------
  1266. end
  1267. #==============================================================================
  1268. # ■ Window_Down
  1269. #------------------------------------------------------------------------------
  1270. #   信息窗口。
  1271. #==============================================================================

  1272. class Window_Down < Window_Selectable
  1273.   #--------------------------------------------------------------------------
  1274.   # ● 初始化对像
  1275.   #--------------------------------------------------------------------------
  1276.   def initialize
  1277.     super(0, 240, 330, 240)
  1278.     @column_max = 1
  1279.     self.opacity = 0
  1280.     if $a != nil and $a.size < 21
  1281.       self.index = $a.size/2
  1282.       elsif $a != nil and $a.size > 20
  1283.       self.index = 9
  1284.     end  
  1285.     refresh
  1286.     self.active = false
  1287.   end
  1288.   #--------------------------------------------------------------------------
  1289.   # ● 刷新
  1290.   #--------------------------------------------------------------------------
  1291.   def refresh
  1292.     if self.contents != nil
  1293.       self.contents.dispose
  1294.       self.contents = nil
  1295.     end
  1296.     if $a != nil and $a.size < Blue::Blue_max + 1
  1297.       @item_max = $a.size
  1298.       elsif $a != nil and $a.size > Blue::Blue_max
  1299.       @item_max = Blue::Blue_max
  1300.     end  
  1301.     if @item_max > 0
  1302.       self.contents = Bitmap.new(width - 32, row_max * 16)
  1303.       for i in 0...@item_max
  1304.          draw_item(i)
  1305.       end
  1306.     end
  1307.   end
  1308.   def item_max
  1309.     return @item_max
  1310.   end  
  1311.   #--------------------------------------------------------------------------
  1312.   # ● 描绘项目
  1313.   #     index : 项目编号
  1314.   #--------------------------------------------------------------------------
  1315.   def draw_item(index)
  1316.     if $a.size < Blue::Blue_max + 1
  1317.      item = $a[index]
  1318.      else
  1319.      item = $a[index + $a.size - Blue::Blue_max]
  1320.     end
  1321.     x = 0
  1322.     y = index * 16
  1323.     self.contents.font.size = 14
  1324.     self.contents.font.color = Color.new(-170,-170,-170,255)
  1325.     self.contents.draw_text(x + 6, y + 1, self.contents.text_size(item).width, 16, item, 0)
  1326.     self.contents.font.color = normal_color
  1327.     self.contents.draw_text(x + 5, y, self.contents.text_size(item).width, 16, item, 0)
  1328.   end
  1329.   #--------------------------------------
  1330.   #  ● 刷新光标
  1331.   #--------------------------------------
  1332.   def update_cursor_rect
  1333.     # 光标位置不满 0 的情况下
  1334.     if @index < 0
  1335.       self.cursor_rect.empty
  1336.       return
  1337.     end
  1338.     # 获取当前的行
  1339.     row = @index / @column_max
  1340.     # 当前行被显示开头行前面的情况下
  1341.     if row < self.top_row
  1342.       # 从当前行向开头行滚动
  1343.       self.top_row = row
  1344.     end
  1345.     # 当前行被显示末尾行之后的情况下
  1346.     if row > self.top_row + (self.page_row_max - 1)
  1347.       # 从当前行向末尾滚动
  1348.       self.top_row = row - (self.page_row_max - 1)
  1349.     end
  1350.     # 计算光标的宽
  1351.     cursor_width = self.width / @column_max - 32
  1352.     cursor_width = 0
  1353.     # 计算光标坐标
  1354.     x = @index % @column_max * (cursor_width + 32)
  1355.     y = @index / @column_max * 32 - self.oy
  1356.     # 更新国标矩形
  1357.     self.cursor_rect.set(x, y, cursor_width, 16)
  1358.   end
  1359. end
复制代码
这是即时消息……
不要迷恋哥,哥只是个传说
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
50 小时
注册时间
2014-12-12
帖子
16
4
 楼主| 发表于 2015-1-12 23:47:15 | 只看该作者
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 11:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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