查看: 3239|回复: 3

[已经解决] 装备扩展+熊式横版战斗的问题

[复制链接]
梦石
0
星屑
50
在线时间
168 小时
注册时间
2007-7-26
回帖
427
发表于 2015-12-13 22:25:17 | 显示全部楼层 |阅读模式
悬赏2星屑已解决
我用的是装备扩展脚本,加入熊式横版战斗,战斗中,攻击出现错误

QQ图片20151213221736.png

脚本指向105行

QQ图片20151213221811.png


熊式横版战斗脚本
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #
  4. # ■ 熊式横版战斗 by 弗雷德   真移位:神思
  5. #==============================================================================
  6. #如果要需要Game_Battler3类的攻击、特技、物品的方法,请移至161-470行
  7. #因为重写过这三个方法,在原方法里改是不会生效的。





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

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

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

  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 = 14
  38.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  39.   BattlerName = {
  40.   "刀盾兵" => {
  41.   "待机" => ["bear_s1","bear_s2","bear_s3","bear_s4"],
  42.   "移动" => ["bear_r1"],
  43.   "返回" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  44.   "受伤" => ["bear_h"],
  45.   "防御" => ["bear_d"],
  46.   "死亡" => ["bear_die1"]
  47.   },
  48.   
  49.   
  50.   "赵云" => {
  51.   "待机" => ["Fred_s1","Fred_s2","Fred_s3","Fred_s4"],
  52.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  53.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  54.   "受伤" => ["Fred_h"],
  55.   "防御" => ["Fred_d"],
  56.   "死亡" => ["Fred_die1"]
  57.   },

  58.   "剑士" => {
  59.   "待机" => ["jianshi_s1","jianshi_s2","jianshi_s3","jianshi_s4","jianshi_s5"],
  60.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  61.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  62.   "受伤" => ["Fred_h"],
  63.   "防御" => ["Fred_d"],
  64.   "死亡" => ["Fred_die1"]
  65.   },
  66.   
  67.   
  68.   
  69.   "刺客" => {
  70.   "待机" => ["刺客_s1","刺客_s4","刺客_s6","刺客_s7"],
  71.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  72.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  73.   "受伤" => ["Fred_h"],
  74.   "防御" => ["Fred_d"],
  75.   "死亡" => ["Fred_die1"]
  76.   },
  77.   
  78.   
  79.   
  80.   "弓手" => {
  81.   "待机" => ["弓手_s1","弓手_s2","弓手_s3","弓手_s4"],
  82.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  83.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  84.   "受伤" => ["Fred_h"],
  85.   "防御" => ["Fred_d"],
  86.   "死亡" => ["Fred_die1"]
  87.   },
  88. }
  89. end
  90. #至于其它的:

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

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

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

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

  95. #--------------------------------------------------------------------------
  96. #  ● 设定结束
  97. #--------------------------------------------------------------------------










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

  427. class Game_Actor
  428.   def screen_x
  429.     if self.index != nil
  430.       return (600-self.index*-10)/2 + 240 + @movex #改坐标X
  431.     else
  432.       return 0
  433.     end
  434.   end
  435.   def screen_y
  436.     return self.index*35+self.height/2 + 120 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  437.   end
  438.   def screen_z
  439.     return self.screen_y-self.index * 10
  440.   end
  441. end
  442. class Game_Enemy
  443.   def screen_x
  444.     return $data_troops[@troop_id].members[@member_index].x + @movex
  445.   end
  446.   def screen_y
  447.     return $data_troops[@troop_id].members[@member_index].y + @movey
  448.   end
  449.   def screen_z
  450.     return self.screen_y#+self.height
  451.   end
  452. end

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

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

  1128. class Spriteset_Battle
  1129. alias bearrpg_initialize initialize
  1130.   def initialize
  1131.     @enemy_sprites = []
  1132.     for enemy in $game_troop.enemies.reverse
  1133.       #####修改敌人显示端口,与角色一样。
  1134.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1135.     end
  1136.     bearrpg_initialize
  1137.   end
  1138. end

  1139. class Arrow_Enemy < Arrow_Base
  1140.   def update
  1141.     super
  1142.     $game_troop.enemies.size.times do
  1143.       break if self.enemy.exist?
  1144.       @index += 1
  1145.       @index %= $game_troop.enemies.size
  1146.     end
  1147.     if Input.repeat?(Input::UP)
  1148.       $game_system.se_play($data_system.cursor_se)
  1149.       $game_troop.enemies.size.times do
  1150.         @index += 1
  1151.         @index %= $game_troop.enemies.size
  1152.         break if self.enemy.exist?
  1153.       end
  1154.     end
  1155.     if Input.repeat?(Input::DOWN)
  1156.       $game_system.se_play($data_system.cursor_se)
  1157.       $game_troop.enemies.size.times do
  1158.         @index += $game_troop.enemies.size - 1
  1159.         @index %= $game_troop.enemies.size
  1160.         break if self.enemy.exist?
  1161.       end
  1162.     end
  1163.     if self.enemy != nil
  1164.       self.x = self.enemy.screen_x
  1165.       self.y = self.enemy.screen_y
  1166.     end
  1167.   end
  1168. end

  1169. class Arrow_Actor < Arrow_Base
  1170.   def update
  1171.     super
  1172.     if Input.repeat?(Input::UP)
  1173.       $game_system.se_play($data_system.cursor_se)
  1174.       @index += 1
  1175.       @index %= $game_party.actors.size
  1176.     end
  1177.     if Input.repeat?(Input::DOWN)
  1178.       $game_system.se_play($data_system.cursor_se)
  1179.       @index += $game_party.actors.size - 1
  1180.       @index %= $game_party.actors.size
  1181.     end
  1182.     if self.actor != nil
  1183.       self.x = self.actor.screen_x
  1184.       self.y = self.actor.screen_y
  1185.     end
  1186.   end
  1187. end

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



装备扩展脚本
  1. #==============================================================================
  2. # ■ Game_Actor
  3. #------------------------------------------------------------------------------
  4. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  5. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  6. #------------------------------------------------------------------------------
  7. #   ※ 关于修改过的地方已经用“自定义装备相关”标出来了,
  8. #      相关的原方法都别名保存起来了,这篇也可以直接的复制过去,
  9. #      避免出错,要放在自己工程的Game_Actor之下。
  10. #==============================================================================

  11. class Game_Actor < Game_Battler
  12.   #--------------------------------------------------------------------------
  13.   # ● 定义实例变量
  14.   #--------------------------------------------------------------------------
  15.   ######### 自定义装备相关 #########
  16.   attr_reader   :帽子_id                  # 帽子 ID
  17.   attr_reader   :护肩_id                  # 护肩 ID
  18.   attr_reader   :服装_id                  # 服装 ID
  19.   attr_reader   :护腕_id                  # 护腕 ID
  20.   attr_reader   :指环_id                  # 指环 ID
  21.   attr_reader   :鞋子_id                  # 鞋子 ID
  22.   attr_reader   :项链_id                  # 项链 ID
  23.   attr_reader   :戒指_id                  # 戒指 ID
  24.   attr_reader   :武器_id                  # 武器 ID
  25.   attr_reader   :披风_id                  # 披风 ID
  26.   attr_reader   :腰带_id                  # 腰带 ID
  27.   attr_reader   :宝物_id                  # 宝物 ID
  28.   ##################################
  29.   #--------------------------------------------------------------------------
  30.   # ● 设置
  31.   #     actor_id : 角色 ID
  32.   #--------------------------------------------------------------------------
  33.   alias sn_151211_setup setup
  34.   def setup(actor_id)
  35.     actor = $data_actors[actor_id]
  36.     @actor_id = actor_id
  37.     @name = actor.name
  38.     @character_name = actor.character_name
  39.     @character_hue = actor.character_hue
  40.     @battler_name = actor.battler_name
  41.     @battler_hue = actor.battler_hue
  42.     @class_id = actor.class_id
  43.     ######### 自定义装备相关 #########
  44.     @帽子_id = actor.帽子_id
  45.     @护肩_id = actor.护肩_id
  46.     @服装_id = actor.服装_id
  47.     @护腕_id = actor.护腕_id
  48.     @指环_id = actor.指环_id
  49.     @鞋子_id = actor.鞋子_id
  50.     @项链_id = actor.项链_id
  51.     @戒指_id = actor.戒指_id
  52.     @武器_id = actor.武器_id
  53.     @披风_id = actor.披风_id
  54.     @腰带_id = actor.腰带_id
  55.     @宝物_id = actor.宝物_id
  56.     ##################################
  57.     @level = actor.initial_level
  58.     @exp_list = Array.new(101)
  59.     make_exp_list
  60.     @exp = @exp_list[@level]
  61.     @skills = []
  62.     @hp = maxhp
  63.     @sp = maxsp
  64.     @states = []
  65.     @states_turn = {}
  66.     @maxhp_plus = 0
  67.     @maxsp_plus = 0
  68.     @str_plus = 0
  69.     @dex_plus = 0
  70.     @agi_plus = 0
  71.     @int_plus = 0
  72.     # 学会特技
  73.     for i in 1..@level
  74.       for j in $data_classes[@class_id].learnings
  75.         if j.level == i
  76.           learn_skill(j.skill_id)
  77.         end
  78.       end
  79.     end
  80.     # 刷新自动状态
  81.     ######### 自定义装备相关 #########
  82.     update_auto_state(nil, $data_armors[@帽子_id ])
  83.     update_auto_state(nil, $data_armors[@护肩_id ])
  84.     update_auto_state(nil, $data_armors[@服装_id ])
  85.     update_auto_state(nil, $data_armors[@护腕_id ])
  86.     update_auto_state(nil, $data_armors[@指环_id ])
  87.     update_auto_state(nil, $data_armors[@鞋子_id ])
  88.     update_auto_state(nil, $data_armors[@项链_id ])
  89.     update_auto_state(nil, $data_armors[@戒指_id ])
  90.     update_auto_state(nil, $data_armors[@武器_id ])
  91.     update_auto_state(nil, $data_armors[@披风_id ])
  92.     update_auto_state(nil, $data_armors[@腰带_id ])
  93.     update_auto_state(nil, $data_armors[@宝物_id ])
  94.     ##################################
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 取得属性修正值
  98.   #     element_id : 属性 ID
  99.   #--------------------------------------------------------------------------
  100.   alias sn_151211_element_rate element_rate
  101.   def element_rate(element_id)
  102.     # 获取对应属性有效度的数值
  103.     table = [0,200,150,100,50,0,-100]
  104.     result = table[$data_classes[@class_id].element_ranks[element_id]]
  105.     # 防具能防御本属性的情况下效果减半
  106.     ######### 自定义装备相关 #########
  107.     for i in [@帽子_id, @护肩_id, @服装_id, @披风_id, @护腕_id,
  108.       @鞋子_id, @项链_id, @戒指_id, @指环_id, @腰带_id, @宝物_id]
  109.       armor = $data_armors[i]
  110.       if armor != nil and armor.guard_element_set.include?(element_id)
  111.         result /= 2
  112.       end
  113.     end
  114.     ##################################
  115.     # 状态能防御本属性的情况下效果减半
  116.     for i in @states
  117.       if $data_states[i].guard_element_set.include?(element_id)
  118.         result /= 2
  119.       end
  120.     end
  121.     # 过程结束
  122.     return result
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 判定防御属性
  126.   #     state_id : 属性 ID
  127.   #--------------------------------------------------------------------------
  128.   alias sn_151211_state_guard? state_guard?
  129.   def state_guard?(state_id)
  130.     ######### 自定义装备相关 #########
  131.     for i in [@帽子_id, @披风_id, @服装_id, @护肩_id, @护腕_id,
  132.       @指环_id, @鞋子_id, @戒指_id, @项链_id, @腰带_id, @宝物_id]
  133.       armor = $data_armors[i]
  134.       if armor != nil
  135.         if armor.guard_state_set.include?(state_id)
  136.           return true
  137.         end
  138.       end
  139.     end
  140.     ##################################
  141.     return false
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 获取普通攻击属性
  145.   #--------------------------------------------------------------------------
  146.   alias sn_151211_element_set element_set
  147.   def element_set
  148.     ######### 自定义装备相关 #########
  149.     weapon = $data_weapons[@武器_id]
  150.     ##################################
  151.     return weapon != nil ? weapon.element_set : []
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 获取普通攻击状态变化 (+)
  155.   #--------------------------------------------------------------------------
  156.   alias sn_151211_plus_state_set plus_state_set
  157.   def plus_state_set
  158.     ######### 自定义装备相关 #########
  159.     weapon = $data_weapons[@武器_id]
  160.     ##################################
  161.     return weapon != nil ? weapon.plus_state_set : []
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 获取普通攻击状态变化 (-)
  165.   #--------------------------------------------------------------------------
  166.   alias sn_151211_minus_state_set minus_state_set
  167.   def minus_state_set
  168.     ######### 自定义装备相关 #########
  169.     weapon = $data_weapons[@武器_id]
  170.     ##################################
  171.     return weapon != nil ? weapon.minus_state_set : []
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 获取各处装备 ######### 自定义装备相关 #########
  175.   #--------------------------------------------------------------------------
  176.   # 左边-------------------------------------------
  177.   def 帽子; return $data_armors[@帽子_id]; end
  178.   def 护肩; return $data_armors[@护肩_id]; end
  179.   def 服装; return $data_armors[@服装_id]; end
  180.   def 披风; return $data_armors[@披风_id]; end
  181.   def 护腕; return $data_armors[@护腕_id]; end
  182.   def 鞋子; return $data_armors[@鞋子_id]; end
  183.   # 右边-------------------------------------------
  184.   def 项链; return $data_armors[@项链_id]; end
  185.   def 戒指; return $data_armors[@戒指_id]; end
  186.   def 指环; return $data_armors[@指环_id]; end
  187.   def 武器; return $data_weapons[@武器_id]; end
  188.   def 腰带; return $data_armors[@腰带_id]; end
  189.   def 宝物; return $data_armors[@宝物_id]; end
  190.   #--------------------------------------------------------------------------
  191.   # ● 获取基本力量
  192.   #--------------------------------------------------------------------------
  193.   alias sn_151211_base_str base_str
  194.   def base_str
  195.     ######### 自定义装备相关 #########
  196.     n = $data_actors[@actor_id].parameters[2, @level]
  197.     n += 帽子 != nil ? 帽子.str_plus : 0
  198.     n += 护肩 != nil ? 护肩.str_plus : 0
  199.     n += 服装 != nil ? 服装.str_plus : 0
  200.     n += 护腕 != nil ? 护腕.str_plus : 0
  201.     n += 指环 != nil ? 指环.str_plus : 0
  202.     n += 鞋子 != nil ? 鞋子.str_plus : 0
  203.     n += 项链 != nil ? 项链.str_plus : 0
  204.     n += 戒指 != nil ? 戒指.str_plus : 0
  205.     n += 武器 != nil ? 武器.str_plus : 0
  206.     n += 披风 != nil ? 披风.str_plus : 0
  207.     n += 腰带 != nil ? 腰带.str_plus : 0
  208.     n += 宝物 != nil ? 宝物.str_plus : 0
  209.     return [[n, 1].max, 999].min
  210.     ##################################
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 获取基本灵巧
  214.   #--------------------------------------------------------------------------
  215.   alias sn_151211_base_dex base_dex
  216.   def base_dex
  217.     ######### 自定义装备相关 #########
  218.     n = $data_actors[@actor_id].parameters[3, @level]
  219.     n += 帽子 != nil ? 帽子.dex_plus : 0
  220.     n += 护肩 != nil ? 护肩.dex_plus : 0
  221.     n += 服装 != nil ? 服装.dex_plus : 0
  222.     n += 护腕 != nil ? 护腕.dex_plus : 0
  223.     n += 指环 != nil ? 指环.dex_plus : 0
  224.     n += 鞋子 != nil ? 鞋子.dex_plus : 0
  225.     n += 项链 != nil ? 项链.dex_plus : 0
  226.     n += 戒指 != nil ? 戒指.dex_plus : 0
  227.     n += 武器 != nil ? 武器.dex_plus : 0
  228.     n += 披风 != nil ? 披风.dex_plus : 0
  229.     n += 腰带 != nil ? 腰带.dex_plus : 0
  230.     n += 宝物 != nil ? 宝物.dex_plus : 0
  231.     return [[n, 1].max, 999].min
  232.     ##################################
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 获取基本速度
  236.   #--------------------------------------------------------------------------
  237.   alias sn_151211_base_agi base_agi
  238.   def base_agi
  239.     ######### 自定义装备相关 #########
  240.     n = $data_actors[@actor_id].parameters[4, @level]
  241.     n += 帽子 != nil ? 帽子.agi_plus : 0
  242.     n += 护肩 != nil ? 护肩.agi_plus : 0
  243.     n += 服装 != nil ? 服装.agi_plus : 0
  244.     n += 护腕 != nil ? 护腕.agi_plus : 0
  245.     n += 指环 != nil ? 指环.agi_plus : 0
  246.     n += 鞋子 != nil ? 鞋子.agi_plus : 0
  247.     n += 项链 != nil ? 项链.agi_plus : 0
  248.     n += 戒指 != nil ? 戒指.agi_plus : 0
  249.     n += 武器 != nil ? 武器.agi_plus : 0
  250.     n += 披风 != nil ? 披风.agi_plus : 0
  251.     n += 腰带 != nil ? 腰带.agi_plus : 0
  252.     n += 宝物 != nil ? 宝物.agi_plus : 0
  253.     return [[n, 1].max, 999].min
  254.     ##################################
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ● 获取基本魔力
  258.   #--------------------------------------------------------------------------
  259.   alias sn_151211_base_int base_int
  260.   def base_int
  261.     ######### 自定义装备相关 #########
  262.     n = $data_actors[@actor_id].parameters[5, @level]
  263.     n += 帽子 != nil ? 帽子.int_plus : 0
  264.     n += 护肩 != nil ? 护肩.int_plus : 0
  265.     n += 服装 != nil ? 服装.int_plus : 0
  266.     n += 护腕 != nil ? 护腕.int_plus : 0
  267.     n += 指环 != nil ? 指环.int_plus : 0
  268.     n += 鞋子 != nil ? 鞋子.int_plus : 0
  269.     n += 项链 != nil ? 项链.int_plus : 0
  270.     n += 戒指 != nil ? 戒指.int_plus : 0
  271.     n += 武器 != nil ? 武器.int_plus : 0
  272.     n += 披风 != nil ? 披风.int_plus : 0
  273.     n += 腰带 != nil ? 腰带.int_plus : 0
  274.     n += 宝物 != nil ? 宝物.int_plus : 0
  275.     return [[n, 1].max, 999].min
  276.     ##################################
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● 获取基本攻击力
  280.   #--------------------------------------------------------------------------
  281.   alias sn_151211_base_atk base_atk
  282.   def base_atk
  283.     ######### 自定义装备相关 #########
  284.     weapon = $data_weapons[@武器_id]
  285.     ##################################
  286.     return weapon != nil ? weapon.atk : 0
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● 获取基本物理防御
  290.   #--------------------------------------------------------------------------
  291.   alias sn_151211_base_pdef base_pdef
  292.   def base_pdef
  293.     ######### 自定义装备相关 #########
  294.     n = 0
  295.     n += 帽子 != nil ? 帽子.pdef : 0
  296.     n += 护肩 != nil ? 护肩.pdef : 0
  297.     n += 服装 != nil ? 服装.pdef : 0
  298.     n += 护腕 != nil ? 护腕.pdef : 0
  299.     n += 指环 != nil ? 指环.pdef : 0
  300.     n += 鞋子 != nil ? 鞋子.pdef : 0
  301.     n += 项链 != nil ? 项链.pdef : 0
  302.     n += 戒指 != nil ? 戒指.pdef : 0
  303.     n += 武器 != nil ? 武器.pdef : 0
  304.     n += 披风 != nil ? 披风.pdef : 0
  305.     n += 腰带 != nil ? 腰带.pdef : 0
  306.     n += 宝物 != nil ? 宝物.pdef : 0
  307.     return n
  308.     ##################################
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 获取基本魔法防御
  312.   #--------------------------------------------------------------------------
  313.   alias sn_151211_base_mdef base_mdef
  314.   def base_mdef
  315.     ######### 自定义装备相关 #########
  316.     n = 0
  317.     n += 帽子 != nil ? 帽子.mdef : 0
  318.     n += 护肩 != nil ? 护肩.mdef : 0
  319.     n += 服装 != nil ? 服装.mdef : 0
  320.     n += 护腕 != nil ? 护腕.mdef : 0
  321.     n += 指环 != nil ? 指环.mdef : 0
  322.     n += 鞋子 != nil ? 鞋子.mdef : 0
  323.     n += 项链 != nil ? 项链.mdef : 0
  324.     n += 戒指 != nil ? 戒指.mdef : 0
  325.     n += 武器 != nil ? 武器.mdef : 0
  326.     n += 披风 != nil ? 披风.mdef : 0
  327.     n += 腰带 != nil ? 腰带.mdef : 0
  328.     n += 宝物 != nil ? 宝物.mdef : 0
  329.     return n
  330.     ##################################
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 获取基本回避修正
  334.   #--------------------------------------------------------------------------
  335.   alias sn_151211_base_eva base_eva
  336.   def base_eva
  337.     ######### 自定义装备相关 #########(这个没有武器的)
  338.     n = 0
  339.     n += 帽子 != nil ? 帽子.eva : 0
  340.     n += 护肩 != nil ? 护肩.eva : 0
  341.     n += 服装 != nil ? 服装.eva : 0
  342.     n += 护腕 != nil ? 护腕.eva : 0
  343.     n += 指环 != nil ? 指环.eva : 0
  344.     n += 鞋子 != nil ? 鞋子.eva : 0
  345.     n += 项链 != nil ? 项链.eva : 0
  346.     n += 戒指 != nil ? 戒指.eva : 0
  347.     n += 披风 != nil ? 披风.eva : 0
  348.     n += 腰带 != nil ? 腰带.eva : 0
  349.     n += 宝物 != nil ? 宝物.eva : 0
  350.     return n
  351.     ##################################
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 普通攻击 获取攻击方动画 ID
  355.   #--------------------------------------------------------------------------
  356.   alias sn_151211_animation1_id animation1_id
  357.   def animation1_id
  358.     ######### 自定义装备相关 #########
  359.     weapon = $data_weapons[@武器_id]
  360.     ##################################
  361.     return weapon != nil ? weapon.animation1_id : 0
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 普通攻击 获取对像方动画 ID
  365.   #--------------------------------------------------------------------------
  366.   alias sn_151211_animation2_id animation2_id
  367.   def animation2_id
  368.     ######### 自定义装备相关 #########
  369.     weapon = $data_weapons[@武器_id]
  370.     ##################################
  371.     return weapon != nil ? weapon.animation2_id : 0
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 装备固定判定
  375.   #     equip_type : 装备类型
  376.   #--------------------------------------------------------------------------
  377.   alias sn_151211_equip_fix? equip_fix?
  378.   def equip_fix?(equip_type)
  379.     ######### 自定义装备相关 #########(位置一一对应)
  380.     case equip_type
  381.     # 左列------------------
  382.       when  0 : return $data_actors[@actor_id].帽子_fix
  383.       when  1 : return $data_actors[@actor_id].护肩_fix
  384.       when  2 : return $data_actors[@actor_id].服装_fix
  385.       when  3 : return $data_actors[@actor_id].披风_fix
  386.       when  4 : return $data_actors[@actor_id].护腕_fix
  387.       when  5 : return $data_actors[@actor_id].鞋子_fix
  388.     # 右列------------------
  389.       when  6 : return $data_actors[@actor_id].项链_fix
  390.       when  7 : return $data_actors[@actor_id].戒指_fix
  391.       when  8 : return $data_actors[@actor_id].指环_fix
  392.       when  9 : return $data_actors[@actor_id].武器_fix
  393.       when 10 : return $data_actors[@actor_id].腰带_fix
  394.       when 11 : return $data_actors[@actor_id].宝物_fix
  395.     end
  396.     return false
  397.     ##################################
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ● 变更装备
  401.   #     equip_type : 装备类型
  402.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  403.   #--------------------------------------------------------------------------
  404.   alias sn_151211_equip equip
  405.   def equip(equip_type, id)
  406.     ######### 自定义装备相关 #########(位置一一对应)
  407.     case equip_type
  408.     # 左列------------------
  409.     when 0  # 帽子
  410.       if id == 0 or $game_party.armor_number(id) > 0
  411.         update_auto_state($data_armors[@帽子_id], $data_armors[id])
  412.         $game_party.gain_armor(@帽子_id, 1)
  413.         @帽子_id = id
  414.         $game_party.lose_armor(id, 1)
  415.       end
  416.     when 1  # 护肩
  417.       if id == 0 or $game_party.armor_number(id) > 0
  418.         update_auto_state($data_armors[@护肩_id], $data_armors[id])
  419.         $game_party.gain_armor(@护肩_id, 1)
  420.         @护肩_id = id
  421.         $game_party.lose_armor(id, 1)
  422.       end
  423.     when 2  # 服装
  424.       if id == 0 or $game_party.armor_number(id) > 0
  425.         update_auto_state($data_armors[@服装_id], $data_armors[id])
  426.         $game_party.gain_armor(@服装_id, 1)
  427.         @服装_id = id
  428.         $game_party.lose_armor(id, 1)
  429.       end
  430.     when 3  # 披风
  431.       if id == 0 or $game_party.armor_number(id) > 0
  432.         update_auto_state($data_armors[@披风_id], $data_armors[id])
  433.         $game_party.gain_armor(@披风_id, 1)
  434.         @披风_id = id
  435.         $game_party.lose_armor(id, 1)
  436.       end
  437.     when 4  # 护腕
  438.       if id == 0 or $game_party.armor_number(id) > 0
  439.         update_auto_state($data_armors[@护腕_id], $data_armors[id])
  440.         $game_party.gain_armor(@护腕_id, 1)
  441.         @护腕_id = id
  442.         $game_party.lose_armor(id, 1)
  443.       end
  444.     when 5  # 鞋子
  445.       if id == 0 or $game_party.armor_number(id) > 0
  446.         update_auto_state($data_armors[@鞋子_id], $data_armors[id])
  447.         $game_party.gain_armor(@鞋子_id, 1)
  448.         @鞋子_id = id
  449.         $game_party.lose_armor(id, 1)
  450.       end
  451.     # 右列------------------
  452.     when 6  # 项链
  453.       if id == 0 or $game_party.armor_number(id) > 0
  454.         update_auto_state($data_armors[@项链_id], $data_armors[id])
  455.         $game_party.gain_armor(@项链_id, 1)
  456.         @项链_id = id
  457.         $game_party.lose_armor(id, 1)
  458.       end
  459.     when 7  # 戒指
  460.       if id == 0 or $game_party.armor_number(id) > 0
  461.         update_auto_state($data_armors[@戒指_id], $data_armors[id])
  462.         $game_party.gain_armor(@戒指_id, 1)
  463.         @戒指_id = id
  464.         $game_party.lose_armor(id, 1)
  465.       end
  466.     when 8  # 指环
  467.       if id == 0 or $game_party.armor_number(id) > 0
  468.         update_auto_state($data_armors[@指环_id], $data_armors[id])
  469.         $game_party.gain_armor(@指环_id, 1)
  470.         @指环_id = id
  471.         $game_party.lose_armor(id, 1)
  472.       end
  473.     when 9  # 武器
  474.       if id == 0 or $game_party.weapon_number(id) > 0
  475.         $game_party.gain_weapon(@武器_id, 1)
  476.         @武器_id = id
  477.         $game_party.lose_weapon(id, 1)
  478.       end
  479.     when 10 # 腰带
  480.       if id == 0 or $game_party.armor_number(id) > 0
  481.         update_auto_state($data_armors[@腰带_id], $data_armors[id])
  482.         $game_party.gain_armor(@腰带_id, 1)
  483.         @腰带_id = id
  484.         $game_party.lose_armor(id, 1)
  485.       end
  486.     when 11 # 宝物
  487.       if id == 0 or $game_party.armor_number(id) > 0
  488.         update_auto_state($data_armors[@宝物_id], $data_armors[id])
  489.         $game_party.gain_armor(@宝物_id, 1)
  490.         @宝物_id = id
  491.         $game_party.lose_armor(id, 1)
  492.       end
  493.     end
  494.     ##################################
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 更改职业 ID
  498.   #     class_id : 新的职业 ID
  499.   #--------------------------------------------------------------------------
  500.   alias sn_151211_class_id class_id=
  501.   def class_id=(class_id)
  502.     ######### 自定义装备相关 #########(位置一一对应)
  503.     if $data_classes[class_id] != nil
  504.       @class_id = class_id
  505.       # 避开无法装备的物品
  506.       # 左列------------------
  507.       unless equippable?($data_armors[@帽子_id])
  508.         equip(0, 0)
  509.       end
  510.       unless equippable?($data_armors[@护肩_id])
  511.         equip(1, 0)
  512.       end
  513.       unless equippable?($data_armors[@服装_id])
  514.         equip(2, 0)
  515.       end
  516.       unless equippable?($data_armors[@披风_id])
  517.         equip(3, 0)
  518.       end
  519.       unless equippable?($data_armors[@护腕_id])
  520.         equip(4, 0)
  521.       end
  522.       unless equippable?($data_armors[@鞋子_id])
  523.         equip(5, 0)
  524.       end
  525.       # 右列------------------
  526.       unless equippable?($data_armors[@项链_id])
  527.         equip(6, 0)
  528.       end
  529.       unless equippable?($data_armors[@戒指_id])
  530.         equip(7, 0)
  531.       end
  532.       unless equippable?($data_armors[@指环_id])
  533.         equip(8, 0)
  534.       end
  535.       unless equippable?($data_weapons[@武器_id])
  536.         equip(9, 0)
  537.       end
  538.       unless equippable?($data_armors[@腰带_id])
  539.         equip(10, 0)
  540.       end
  541.       unless equippable?($data_armors[@宝物_id])
  542.         equip(11, 0)
  543.       end
  544.     end
  545.     ##################################
  546.   end
  547. end
复制代码

最佳答案

查看完整内容

熊式横板这个系统要在数据库里加点东西来着, 自己不改的话,默认就必须要有29和30号属性。 解决办法就是:数据库》系统》(左下角)属性下面的更改最大值》改成30, 然后29号命名》不移动 30号命名》同一水平

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2015-12-13 22:25:18 | 显示全部楼层
熊式横板这个系统要在数据库里加点东西来着,
自己不改的话,默认就必须要有29和30号属性。
解决办法就是:数据库》系统》(左下角)属性下面的更改最大值》改成30,
然后29号命名》不移动
30号命名》同一水平

点评

认可答案  发表于 2015-12-16 22:49
是的,之前有这样弄过,这次搞了菜单搞半天,就忘记了还有数据库里的不移动和半距离  发表于 2015-12-16 22:49
具体可以看看这个战斗系统的范例工程的数据库设定。  发表于 2015-12-14 23:22
回复

使用道具 举报

素材区好人

梦石
5
星屑
12712
在线时间
4359 小时
注册时间
2011-7-21
回帖
2270

超评测参与极短28参与极短27参与极短26参与极短25参与极短24参与极短23参与极短22参与极短21参与

发表于 2015-12-13 23:36:30 | 显示全部楼层
请把工程发上来
回复

使用道具 举报

梦石
0
星屑
50
在线时间
168 小时
注册时间
2007-7-26
回帖
427
 楼主| 发表于 2015-12-16 22:56:54 | 显示全部楼层
cinderelmini 发表于 2015-12-13 22:25
熊式横板这个系统要在数据库里加点东西来着,
自己不改的话,默认就必须要有29和30号属性。
解决办法就是: ...

这是什么意思,商店

QQ图片20151216225541.png

点评

是写了重复的类还是啥……  发表于 2015-12-17 00:05
释放了已经释放的窗口?  发表于 2015-12-17 00:04
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部