查看: 2062|回复: 1

[已经过期] 橫版戰鬥 無法顯示普攻傷害...

[复制链接]
梦石
0
星屑
65
在线时间
141 小时
注册时间
2012-4-29
回帖
32
发表于 2016-11-27 16:39:23 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 str342650 于 2016-11-27 16:46 编辑

請教各位前輩,這個腳本為何普通攻擊時,會沒有顯示傷害0.0.....因為我有更改一下裡面角色設定的位置,所以跟剛下載的腳本不一樣


因為原本的腳本可以顯示...


請大家幫幫忙,可以幫我看看嗎?




新問題2.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 = 28
  38.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  39.   BattlerName = {
  40. "佛瑞德" => {
  41.   "待机" => ["Fred_s1","Fred_s2","Fred_s3","Fred_s4"],
  42.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  43.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  44.   "受伤" => ["Fred_h"],
  45.   "防御" => ["Fred_d"],
  46.   "死亡" => ["Fred_die1","Fred_die2"]
  47.   },
  48.   
  49.   "傑修" => {
  50.   "待机" => ["Poet Jie Xiu1-1","Poet Jie Xiu1-2","Poet Jie Xiu1-2","Poet Jie Xiu1-1"],
  51.   "移动" => ["Poet Jie Xiu1-1"],
  52.   "返回" => ["Poet Jie Xiu1-3"],
  53.   "受伤" => ["Poet Jie Xiu1-1"],
  54.   "防御" => ["Poet Jie Xiu1-1"],
  55.   "死亡" => ["Poet Jie Xiu1-4"]
  56.   },
  57.   
  58.   "娜塔莎" => {
  59.   "待机" => ["Natasha1-1","Natasha1-2","Natasha1-2","Natasha1-1"],
  60.   "移动" => ["Natasha1-1"],
  61.   "返回" => ["Natasha1-3"],
  62.   "受伤" => ["Natasha1-1"],
  63.   "防御" => ["Natasha1-1"],
  64.   "死亡" => ["Natasha1-4"]
  65.   },
  66.   
  67.   "蘿茵" => {
  68.   "待机" => ["Phantom of the Assassin1-1","Phantom of the Assassin1-2","Phantom of the Assassin1-2","Phantom of the Assassin1-1"],
  69.   "移动" => ["Phantom of the Assassin1-1"],
  70.   "返回" => ["Phantom of the Assassin1-3"],
  71.   "受伤" => ["Phantom of the Assassin1-1"],
  72.   "防御" => ["Phantom of the Assassin1-1"],
  73.   "死亡" => ["Phantom of the Assassin1-4"]
  74.   },
  75.   
  76.   "巴特" => {
  77.   "待机" => ["Bart1-1","Bart1-2","Bart1-2","Bart1-1"],
  78.   "移动" => ["Bart1-1"],
  79.   "返回" => ["Bart1-3"],
  80.   "受伤" => ["Bart1-1"],
  81.   "防御" => ["Bart1-1"],
  82.   "死亡" => ["Bart1-4"]
  83.   },
  84.   
  85.   "晴晴" => {
  86.   "待机" => ["Clear1-1","Clear1-2","Clear1-2","Clear1-1"],
  87.   "移动" => ["Clear1-1"],
  88.   "返回" => ["Clear1-3"],
  89.   "受伤" => ["Clear1-1"],
  90.   "防御" => ["Clear1-1"],
  91.   "死亡" => ["Clear1-4"]
  92.   },
  93.   
  94.   "蜘蛛" => {
  95.   "待机" => ["011","012","012","011"],
  96.   "移动" => ["011"],
  97.   "返回" => ["011"],
  98.   "受伤" => ["011"],
  99.   "防御" => ["011"],
  100.   "死亡" => ["015"]
  101.   },
  102.   
  103.   "蜘蛛" => {
  104.   "待机" => ["011","012","012","011"],
  105.   "移动" => ["011"],
  106.   "返回" => ["011"],
  107.   "受伤" => ["011"],
  108.   "防御" => ["011"],
  109.   "死亡" => ["015"]
  110.   },
  111.   
  112.   "蜘蛛" => {
  113.   "待机" => ["011","012","012","011"],
  114.   "移动" => ["011"],
  115.   "返回" => ["011"],
  116.   "受伤" => ["011"],
  117.   "防御" => ["011"],
  118.   "死亡" => ["015"]
  119.   },
  120.   
  121.   "蜘蛛" => {
  122.   "待机" => ["011","012","012","011"],
  123.   "移动" => ["011"],
  124.   "返回" => ["011"],
  125.   "受伤" => ["011"],
  126.   "防御" => ["011"],
  127.   "死亡" => ["015"]
  128.   },
  129.   
  130.   "蜘蛛" => {
  131.   "待机" => ["011","012","012","011"],
  132.   "移动" => ["011"],
  133.   "返回" => ["011"],
  134.   "受伤" => ["011"],
  135.   "防御" => ["011"],
  136.   "死亡" => ["015"]
  137.   },
  138.   
  139.   "蜘蛛" => {
  140.   "待机" => ["011","012","012","011"],
  141.   "移动" => ["011"],
  142.   "返回" => ["011"],
  143.   "受伤" => ["011"],
  144.   "防御" => ["011"],
  145.   "死亡" => ["015"]
  146.   },
  147.   
  148.   "蜘蛛" => {
  149.   "待机" => ["011","012","012","011"],
  150.   "移动" => ["011"],
  151.   "返回" => ["011"],
  152.   "受伤" => ["011"],
  153.   "防御" => ["011"],
  154.   "死亡" => ["015"]
  155.   },
  156.   
  157.   "蜘蛛" => {
  158.   "待机" => ["011","012","012","011"],
  159.   "移动" => ["011"],
  160.   "返回" => ["011"],
  161.   "受伤" => ["011"],
  162.   "防御" => ["011"],
  163.   "死亡" => ["015"]
  164.   },
  165.   
  166.   "蜘蛛" => {
  167.   "待机" => ["011","012","012","011"],
  168.   "移动" => ["011"],
  169.   "返回" => ["011"],
  170.   "受伤" => ["011"],
  171.   "防御" => ["011"],
  172.   "死亡" => ["015"]
  173.   },
  174.   
  175.   "蜘蛛" => {
  176.   "待机" => ["011","012","012","011"],
  177.   "移动" => ["011"],
  178.   "返回" => ["011"],
  179.   "受伤" => ["011"],
  180.   "防御" => ["011"],
  181.   "死亡" => ["015"]
  182.   },
  183.   
  184.   "蜘蛛" => {
  185.   "待机" => ["011","012","012","011"],
  186.   "移动" => ["011"],
  187.   "返回" => ["011"],
  188.   "受伤" => ["011"],
  189.   "防御" => ["011"],
  190.   "死亡" => ["015"]
  191.   },
  192.   
  193.   "蜘蛛" => {
  194.   "待机" => ["011","012","012","011"],
  195.   "移动" => ["011"],
  196.   "返回" => ["011"],
  197.   "受伤" => ["011"],
  198.   "防御" => ["011"],
  199.   "死亡" => ["015"]
  200.   },
  201.   
  202.   "蜘蛛" => {
  203.   "待机" => ["011","012","012","011"],
  204.   "移动" => ["011"],
  205.   "返回" => ["011"],
  206.   "受伤" => ["011"],
  207.   "防御" => ["011"],
  208.   "死亡" => ["015"]
  209.   },
  210.   
  211.   "蜘蛛" => {
  212.   "待机" => ["011","012","012","011"],
  213.   "移动" => ["011"],
  214.   "返回" => ["011"],
  215.   "受伤" => ["011"],
  216.   "防御" => ["011"],
  217.   "死亡" => ["015"]
  218.   },
  219.   
  220.   "蜘蛛" => {
  221.   "待机" => ["011","012","012","011"],
  222.   "移动" => ["011"],
  223.   "返回" => ["011"],
  224.   "受伤" => ["011"],
  225.   "防御" => ["011"],
  226.   "死亡" => ["015"]
  227.   },
  228.   
  229.   "蜘蛛" => {
  230.   "待机" => ["011","012","012","011"],
  231.   "移动" => ["011"],
  232.   "返回" => ["011"],
  233.   "受伤" => ["011"],
  234.   "防御" => ["011"],
  235.   "死亡" => ["015"]
  236.   },
  237.   
  238.   "蜘蛛" => {
  239.   "待机" => ["011","012","012","011"],
  240.   "移动" => ["011"],
  241.   "返回" => ["011"],
  242.   "受伤" => ["011"],
  243.   "防御" => ["011"],
  244.   "死亡" => ["015"]
  245.   },
  246.   
  247.   "測試專用" => {
  248.   "待机" => ["monster01","monster02","monster03","monster04"],
  249.   "移动" => ["monster01"],
  250.   "返回" => ["monster05"],
  251.   "受伤" => ["monster01"],
  252.   "防御" => ["monster01"],
  253.   "死亡" => ["deil"]
  254.   },
  255.   
  256.    "噩夢佛瑞德" => {
  257.   "待机" => ["Fred_s11","Fred_s12","Fred_s13","Fred_s14"],
  258.   "移动" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  259.   "返回" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  260.   "受伤" => ["Fred_h1"],
  261.   "防御" => ["Fred_d1"],
  262.   "死亡" => ["Fred_die11","Fred_die12"]
  263.   },
  264. }
  265. end
  266. #至于其它的:

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

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

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

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

  271. #--------------------------------------------------------------------------
  272. #  ● 设定结束
  273. #--------------------------------------------------------------------------










  274. class Game_Battler
  275.   attr_accessor :movex                    # X坐标修正
  276.   attr_accessor :movey                    # Y坐标修正
  277.   attr_accessor :startactive              # 行为
  278.   attr_accessor :damage_sp                # 精神伤害值
  279.   alias bearrpg_initialize initialize
  280.   def initialize
  281.     bearrpg_initialize
  282.     @damage_sp = 0
  283.     @movex = 0
  284.     @movey = 0
  285.     @startactive = "待机"
  286.   end
  287.   def width #获取战斗图宽
  288.     return RPG::Cache.battler(@battler_name, @battler_hue).width
  289.   end
  290.   def height #获取战斗图高
  291.     return RPG::Cache.battler(@battler_name, @battler_hue).height
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 应用通常攻击效果
  295.   #     attacker : 攻击者 (battler)
  296.   #--------------------------------------------------------------------------
  297.   def attack_effect(attacker)
  298.     # 清除会心一击标志
  299.     self.critical = false
  300.     #######伤害开关初始化##################################################bearrpg
  301.     $damage_hp = false
  302.     $damage_sp = false
  303.     # 第一命中判定
  304.     hit_result = (rand(100) < attacker.hit)
  305.     # 命中的情况下
  306.     if hit_result == true
  307.       # 计算基本伤害
  308.       atk = [attacker.atk - self.pdef / 2, 0].max
  309.       self.damage = atk * (20 + attacker.str) / 20
  310.       # 属性修正
  311.       self.damage *= elements_correct(attacker.element_set)
  312.       self.damage /= 100
  313.       # 伤害符号正确的情况下
  314.       if self.damage > 0
  315.         # 会心一击修正
  316.         if rand(100) < 4 * attacker.dex / self.agi
  317.           self.damage *= 2
  318.           self.critical = true
  319.         end
  320.         # 防御修正
  321.         if self.guarding?
  322.           self.damage /= 2
  323.         end
  324.       end
  325.       $damage_hp = true if self.damage.is_a?(Numeric)
  326.     #  $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  327.       # 分散
  328.       if self.damage.abs > 0
  329.         amp = [self.damage.abs * 15 / 100, 1].max
  330.         self.damage += rand(amp+1) + rand(amp+1) - amp
  331.       end
  332.       # 第二命中判定
  333.       eva = 8 * self.agi / attacker.dex + self.eva
  334.       hit = self.damage < 0 ? 100 : 100 - eva
  335.       hit = self.cant_evade? ? 100 : hit
  336.       hit_result = (rand(100) < hit)
  337.     end
  338.     #####################################bearrpg
  339.     # 命中的情况下
  340.     if hit_result == true
  341.       # 状态冲击解除
  342.       remove_states_shock
  343.       # HP 的伤害计算
  344.       self.hp -= self.damage
  345.       # 状态变化
  346.       @state_changed = false
  347.       states_plus(attacker.plus_state_set)
  348.       states_minus(attacker.minus_state_set)
  349.       if self.damage == 0
  350.            self.damage = "无效" if INVALIDSWITCH >0
  351.          self.critical = false
  352.        end
  353.     # Miss 的情况下
  354.     else
  355.       # 伤害设置为 "Miss"
  356.       self.damage = "Miss"
  357.       # 清除会心一击标志
  358.       self.critical = false
  359.     end
  360.     # 过程结束
  361.     return true
  362.   end
  363.   #############################################bearrpg
  364.   #--------------------------------------------------------------------------
  365.   # ● 应用特技效果
  366.   #     user  : 特技的使用者 (battler)
  367.   #     skill : 特技
  368.   #--------------------------------------------------------------------------
  369.   def skill_effect(user, skill)
  370.     #######伤害开关初始化##################################################bearrpg
  371.     $damage_hp = false
  372.     $damage_sp = false
  373.     # 清除会心一击标志
  374.     self.critical = false
  375.     # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  376.     # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  377.     if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
  378.        ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  379.       # 过程结束
  380.       return false
  381.     end
  382.     # 清除有效标志
  383.     effective = false
  384.     # 公共事件 ID 是有效的情况下,设置为有效标志
  385.     effective |= skill.common_event_id > 0
  386.     # 第一命中判定
  387.     hit = skill.hit
  388.     if skill.atk_f > 0
  389.       hit *= user.hit / 100
  390.     end
  391.     hit_result = (rand(100) < hit)
  392.     # 不确定的特技的情况下设置为有效标志
  393.     effective |= hit < 100
  394.     # 命中的情况下
  395.     if hit_result == true
  396.       # 计算威力
  397.       power = skill.power + user.atk * skill.atk_f / 100
  398.       if power > 0
  399.         power -= self.pdef * skill.pdef_f / 200
  400.         power -= self.mdef * skill.mdef_f / 200
  401.         power = [power, 0].max
  402.       end
  403.       # 计算倍率
  404.       rate = 20
  405.       rate += (user.str * skill.str_f / 100)
  406.       rate += (user.dex * skill.dex_f / 100)
  407.       rate += (user.agi * skill.agi_f / 100)
  408.       rate += (user.int * skill.int_f / 100)
  409.       # 计算基本伤害
  410.       self.damage = power * rate / 20
  411.       # 属性修正
  412.       self.damage *= elements_correct(skill.element_set)
  413.       self.damage /= 100
  414.       # 伤害符号正确的情况下
  415.       if self.damage > 0
  416.         # 防御修正
  417.         if self.guarding?
  418.           self.damage /= 2
  419.         end
  420.       end
  421.       # 分散
  422.       if skill.variance > 0 and self.damage.abs > 0
  423.         amp = [self.damage.abs * skill.variance / 100, 1].max
  424.         self.damage += rand(amp+1) + rand(amp+1) - amp
  425.       end
  426.       # 第二命中判定
  427.       eva = 8 * self.agi / user.dex + self.eva
  428.       hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
  429.       hit = self.cant_evade? ? 100 : hit
  430.       hit_result = (rand(100) < hit)
  431.       # 不确定的特技的情况下设置为有效标志
  432.       effective |= hit < 100
  433.     end
  434.     $damage_hp = true if self.damage.is_a?(Numeric)
  435.    # $damage_sp = true if self.damage_sp != 0 SP伤害数值开关
  436.     # 命中的情况下
  437.     if hit_result == true
  438.       # 威力 0 以外的物理攻击的情况下
  439.       if skill.power != 0 and skill.atk_f > 0
  440.         # 状态冲击解除
  441.         remove_states_shock
  442.         # 设置有效标志
  443.         effective = true
  444.       end
  445.       # HP 的伤害减法运算
  446.       last_hp = self.hp
  447.       self.hp -= self.damage
  448.       effective |= self.hp != last_hp
  449.       # 状态变化
  450.       @state_changed = false
  451.       effective |= states_plus(skill.plus_state_set)
  452.       effective |= states_minus(skill.minus_state_set)
  453.       #############################################bearrpg
  454.       # 威力为 0 的场合
  455.       if skill.power == 0
  456.         # 伤害设置为空的字串
  457.         self.damage = ""
  458.         # 状态没有变化的情况下
  459.         unless @state_changed
  460.           # 伤害设置为 "Miss"
  461.           self.damage = "Miss"
  462.         end
  463.       elsif self.damage == 0
  464.         unless @state_changed
  465.            self.damage = "无效" if INVALIDSWITCH >0
  466.          else
  467.           self.damage = ""
  468.         end
  469.       end
  470.     # Miss 的情况下
  471.     else
  472.       # 伤害设置为 "Miss"
  473.       self.damage = "Miss"
  474.     end
  475.     # 不在战斗中的情况下
  476.     unless $game_temp.in_battle
  477.       # 伤害设置为 nil
  478.       self.damage = nil
  479.     end
  480.     # 过程结束
  481.     return effective
  482.   end
  483.   #############################################bearrpg
  484.   #--------------------------------------------------------------------------
  485.   # ● 应用物品效果
  486.   #     item : 物品
  487.   #--------------------------------------------------------------------------
  488.   def item_effect(item)
  489.     # 清除会心一击标志
  490.     self.critical = false
  491.     # 物品的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
  492.     # 或者物品的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
  493.     if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
  494.        ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  495.       # 过程结束
  496.       return false
  497.     end
  498.     # 清除有效标志
  499.     effective = false
  500.     # 公共事件 ID 是有效的情况下,设置为有效标志
  501.     effective |= item.common_event_id > 0
  502.     # 命中判定
  503.     hit_result = (rand(100) < item.hit)
  504.     # 不确定的特技的情况下设置为有效标志
  505.     effective |= item.hit < 100
  506.     # 命中的情况
  507.     if hit_result == true
  508.       # 计算回复量
  509.       recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
  510.       recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
  511.       if recover_hp < 0
  512.         recover_hp += self.pdef * item.pdef_f / 20
  513.         recover_hp += self.mdef * item.mdef_f / 20
  514.         recover_hp = [recover_hp, 0].min
  515.       end
  516.       # 属性修正
  517.       recover_hp *= elements_correct(item.element_set)
  518.       recover_hp /= 100
  519.       recover_sp *= elements_correct(item.element_set)
  520.       recover_sp /= 100
  521.       # 分散
  522.       if item.variance > 0 and recover_hp.abs > 0
  523.         amp = [recover_hp.abs * item.variance / 100, 1].max
  524.         recover_hp += rand(amp+1) + rand(amp+1) - amp
  525.       end
  526.       if item.variance > 0 and recover_sp.abs > 0
  527.         amp = [recover_sp.abs * item.variance / 100, 1].max
  528.         recover_sp += rand(amp+1) + rand(amp+1) - amp
  529.       end
  530.       # 回复量符号为负的情况下
  531.       if recover_hp < 0
  532.         # 防御修正
  533.         if self.guarding?
  534.           recover_hp /= 2
  535.         end
  536.       end
  537.       # HP 回复量符号的反转、设置伤害值
  538.       self.damage = -recover_hp
  539.       self.damage_sp = -recover_sp  
  540.       # HP 以及 SP 的回复
  541.       last_hp = self.hp
  542.       last_sp = self.sp
  543.       self.hp += recover_hp
  544.       self.sp += recover_sp
  545.       ###################################################################bearrpg
  546.       $damage_hp = true if self.damage.is_a?(Numeric)
  547.       $damage_sp = true if self.damage_sp.is_a?(Numeric) and recover_sp != 0
  548.       ###################################################################bearrpg
  549.       effective |= self.hp != last_hp
  550.       effective |= self.sp != last_sp
  551.       # 状态变化
  552.       @state_changed = false
  553.       effective |= states_plus(item.plus_state_set)
  554.       effective |= states_minus(item.minus_state_set)
  555.       # 能力上升值有效的情况下
  556.       if item.parameter_type > 0 and item.parameter_points != 0
  557.         # 能力值的分支
  558.         case item.parameter_type
  559.         when 1  # MaxHP
  560.           @maxhp_plus += item.parameter_points
  561.         when 2  # MaxSP
  562.           @maxsp_plus += item.parameter_points
  563.         when 3  # 力量
  564.           @str_plus += item.parameter_points
  565.         when 4  # 灵巧
  566.           @dex_plus += item.parameter_points
  567.         when 5  # 速度
  568.           @agi_plus += item.parameter_points
  569.         when 6  # 魔力
  570.           @int_plus += item.parameter_points
  571.         end
  572.         # 设置有效标志
  573.         effective = true
  574.       end
  575.       # HP 回复率与回复量为 0 的情况下
  576.       if item.recover_hp_rate == 0 and item.recover_hp == 0
  577.         # 设置伤害为空的字符串
  578.         self.damage = ""
  579.         # SP 回复率与回复量为 0、能力上升值无效的情况下
  580.         if item.recover_sp_rate == 0 and item.recover_sp == 0 and
  581.            (item.parameter_type == 0 or item.parameter_points == 0)
  582.           # 状态没有变化的情况下
  583.           unless @state_changed
  584.             # 伤害设置为 "Miss"
  585.             self.damage = "Miss"
  586.           end
  587.         end
  588.       end
  589.     # Miss 的情况下
  590.     else
  591.       # 伤害设置为 "Miss"
  592.       self.damage = "Miss"
  593.     end
  594.     # 不在战斗中的情况下
  595.     unless $game_temp.in_battle
  596.       # 伤害设置为 nil
  597.       self.damage = nil
  598.     end
  599.     # 过程结束
  600.     return effective
  601.   end
  602. end

  603. class Game_Actor
  604.   def screen_x
  605.     if self.index != nil
  606.       return (640-self.index*50)/2 + 240 + @movex
  607.     else
  608.       return 0
  609.     end
  610.   end
  611.   def screen_y
  612.     return self.index*70+self.height/2 + 55 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  613.   end
  614.   def screen_z
  615.     return self.screen_y-self.index * 10
  616.   end
  617. end
  618. class Game_Enemy
  619.   def screen_x
  620.     return $data_troops[@troop_id].members[@member_index].x + @movex
  621.   end
  622.   def screen_y
  623.     return $data_troops[@troop_id].members[@member_index].y + @movey
  624.   end
  625.   def screen_z
  626.     return self.screen_y#+self.height
  627.   end
  628. end

  629. class Sprite_Battler
  630.   include Scene_BattleName
  631. end
  632. module RPG
  633. class Sprite < ::Sprite
  634. #==========================================
  635. def initialize(viewport = nil)
  636. super(viewport)
  637. @_whiten_duration = 0
  638. @_appear_duration = 0
  639. @_escape_duration = 0
  640. @_collapse_duration = 0
  641. @_damage_duration = 0
  642. @_animation_duration = 0
  643. @_blink = false  
  644. @flash_shake = 0
  645. @_damage = []  
  646. @_damage_sp = []
  647. @_total_damage = 0
  648. @_total_damage_duration = 0
  649. @p_dam=0
  650. @hits=0
  651. end
  652. def animation_set_sprites(sprites, cell_data, position)
  653.    for i in 0..15
  654.    sprite = sprites[i]
  655.    pattern = cell_data[i, 0]
  656.    if sprite == nil or pattern == nil or pattern == -1
  657.      sprite.visible = false if sprite != nil
  658.      next
  659.    end
  660.    sprite.visible = true
  661.    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  662.    if position == 3
  663.      if self.viewport != nil
  664.        sprite.x = self.viewport.rect.width / 2
  665.        sprite.y = self.viewport.rect.height - 160
  666.      else
  667.        sprite.x = 320
  668.        sprite.y = 240
  669.      end
  670.      else
  671.      sprite.x = self.x - self.ox + self.src_rect.width / 2
  672.      sprite.y = self.y - self.oy + self.src_rect.height / 2
  673.      sprite.y -= self.src_rect.height / 4 if position == 0
  674.      sprite.y += self.src_rect.height / 4 if position == 2
  675.    end
  676.    sprite.x += cell_data[i, 1]
  677.    sprite.y += cell_data[i, 2]
  678.    if $scene.is_a?(Scene_Battle)
  679.    sprite.z = battler.screen_z+20
  680. else
  681.    sprite.z = 9990
  682.    end
  683.    sprite.ox = 96
  684.    sprite.oy = 96
  685.    sprite.zoom_x = cell_data[i, 3] / 100.0
  686.    sprite.zoom_y = cell_data[i, 3] / 100.0
  687.    sprite.angle = cell_data[i, 4]
  688.    sprite.mirror = (cell_data[i, 5] == 1)
  689.    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  690.    sprite.blend_type = cell_data[i, 7]
  691.    end
  692. end
  693. def damage(value, critical)
  694.   dispose_hit
  695.     if value.is_a?(Numeric)
  696.       damage_string = value.abs.to_s
  697.     else
  698.       damage_string = value.to_s
  699.     end
  700.     bitmap = Bitmap.new(300, 150)
  701.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  702.     bitmap.font.size = 32
  703.     if value.is_a?(Numeric)
  704.   # 分割伤害值字符串
  705.       damage_array = damage_string.scan(/./)
  706.       damage_x = 81 - damage_string.size * 9
  707.   # 会心一击标志打开的情况
  708.       if critical and value != "无效"
  709.   # 显示会心一击图画
  710.         cri_bitmap = RPG::Cache.picture("Critital")
  711.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  712.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  713.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  714.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  715.       end
  716.   # 伤害值为负的情况下
  717.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  718.       if value < 0
  719.   # 调用回复数字表
  720.         bitmap.blt(damage_x-14, 32,dmg_bitmap,Rect.new(dmg_bitmap.width/12*10, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  721.       else
  722.   # 调用伤害数字表
  723.         bitmap.blt(damage_x-14, 32, dmg_bitmap,Rect.new(dmg_bitmap.width/12*11, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  724.       end
  725.   # 循环伤害值字符串
  726.       for char in damage_array
  727.         number = char.to_i
  728.   # 显示伤害数字
  729.         bitmap.blt(damage_x, 32, dmg_bitmap,
  730.         Rect.new(number * dmg_bitmap.width/12, 0, dmg_bitmap.width/12, dmg_bitmap.height/2))
  731. #################################################################普通伤害数值
  732.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  733. #################################################################普通伤害数值
  734.       end  
  735.     else
  736.       if value == "Miss"
  737.         miss_dmg = RPG::Cache.picture("miss")
  738.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  739.       elsif value == "无效"
  740.         invalid_dmg = RPG::Cache.picture("invalid")
  741.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  742.       #end
  743.       end
  744.     end
  745. # 伤害值定位
  746.     @_damage_sprite = ::Sprite.new(self.viewport)
  747.     @_damage_sprite.bitmap = bitmap
  748.     @_damage_sprite.ox = 80
  749.     @_damage_sprite.oy = 20
  750.     @_damage_sprite.x = self.x
  751.     @_damage_sprite.y = self.y - self.oy / 2
  752.     @_damage_sprite.z = 3000
  753.     @_damage_duration = 40
  754.     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  755.     make_total_damage(value)
  756.   end
  757. ##################################################################sp伤害数值
  758. def damage_sp(value, critical)
  759.   dispose_hit
  760.     if value.is_a?(Numeric)
  761.       damage_string = value.abs.to_s
  762.     else
  763.       damage_string = value.to_s
  764.     end
  765.     bitmap = Bitmap.new(300, 150)
  766.     bitmap.font.name = ["黑体","华文行楷", "宋体"]
  767.     bitmap.font.size = 32
  768.     if value.is_a?(Numeric)
  769.   # 分割伤害值字符串
  770.       damage_array = damage_string.scan(/./)
  771.       damage_x = 81 - damage_string.size * 9
  772.   # 会心一击标志打开的情况
  773.       if critical and value != "无效"
  774.   # 显示会心一击图画
  775.         cri_bitmap = RPG::Cache.picture("Critital")
  776.         bitmap.blt(damage_x+cri_bitmap.width, cri_bitmap.height*2, cri_bitmap, Rect.new(0, 0, cri_bitmap.width, cri_bitmap.height))
  777.         Audio.se_play("Audio/SE/"+CRIVOICE,100,100) if CRIVOICE != nil and CRIVOICE != ""
  778.         $game_screen.start_flash(Color.new(255, 5, 5, 155), 5) if CRIFLASH >0
  779.         $game_screen.start_shake(2,9,3) if CRISHAKE >0
  780.       end
  781.   # 伤害值为负的情况下
  782.     dmg_bitmap = RPG::Cache.picture("Normal_Damage")
  783.       if value < 0
  784.   # 调用回复数字表
  785.         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))
  786.       else
  787.   # 调用伤害数字表
  788.         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))
  789.       end
  790.   # 循环伤害值字符串
  791.       for char in damage_array
  792.         number = char.to_i
  793.   # 显示伤害数字
  794.         bitmap.blt(damage_x, 32, dmg_bitmap,
  795.         Rect.new(number * dmg_bitmap.width/12, dmg_bitmap.height/2, dmg_bitmap.width/12, dmg_bitmap.height/2))
  796. #################################################################普通伤害数值
  797.         damage_x += dmg_bitmap.width/12 - 4#间距缩小4个像素,可以自行调整
  798. #################################################################普通伤害数值
  799.       end  
  800.     else
  801.       if value == "Miss"
  802.         miss_dmg = RPG::Cache.picture("miss")
  803.         bitmap.blt(miss_dmg.width, 0,miss_dmg, Rect.new(0, 0, miss_dmg.width, miss_dmg.height))
  804.       elsif value == "无效"
  805.         invalid_dmg = RPG::Cache.picture("invalid")
  806.         bitmap.blt(invalid_dmg.width, 0,invalid_dmg, Rect.new(0, 0, invalid_dmg.width,invalid_dmg.height))
  807.       #end
  808.       end
  809.     end
  810. # 伤害值定位
  811.     @_damage_sprite = ::Sprite.new(self.viewport)
  812.     @_damage_sprite.bitmap = bitmap
  813.     @_damage_sprite.ox = 80
  814.     @_damage_sprite.oy = 20
  815.     @_damage_sprite.x = self.x
  816.     @_damage_sprite.y = self.y - self.oy / 2
  817.     @_damage_sprite.z = 3000
  818.     @_damage_duration = 40
  819.     @_damage_sp.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  820.    # make_total_damage(value)
  821.   end  
  822. def hit
  823. # 如果伤害值是数值
  824. # 转为字符串
  825. value=@hits
  826. hits_string = value.to_s
  827. # 初始化位图
  828. bitmap = Bitmap.new(320, 64)
  829. bitmap.font.name = "Arial Black"
  830. bitmap.font.size = 32
  831. # 分割伤害值字符串
  832. hits_array = hits_string.scan(/./)
  833. hits_x = 81 - hits_string.size * 18.1
  834. rect_y = 0
  835. # 循环伤害值字符串
  836. for char in hits_array
  837. number = char.to_i
  838. # 显示伤害数字
  839. combo_num = RPG::Cache.picture("combo_num")
  840. bitmap.blt(hits_x, 0, combo_num,
  841. Rect.new(number * combo_num.width/10, 0, combo_num.width/10, combo_num.height))
  842. #################################################################连击数数值
  843. hits_x += combo_num.width/10 - 3#间距缩小3个像素,可以自行调整
  844. #################################################################连击数数值
  845. end
  846. combo_tx = RPG::Cache.picture("combo_text")
  847. bitmap.blt(hits_x, 0,combo_tx ,
  848. Rect.new(0, 0, combo_tx.width, combo_tx.height))
  849. # 伤害值定位
  850. @_hits_sprite = ::Sprite.new(self.viewport)
  851. @_hits_sprite.bitmap = bitmap
  852. @_hits_sprite.ox = 81
  853. @_hits_sprite.oy = 20
  854. @_hits_sprite.x = 500
  855. @_hits_sprite.y = 100
  856. @_hits_sprite.opacity = HITSWITCH > 0 ? 255 : 0
  857. @_hits_sprite.z = 3000
  858. @_hits_duration = 40
  859. end
  860. #--------------------------------------------------------------------------
  861. # ● 总伤害处理
  862. #--------------------------------------------------------------------------
  863. def make_total_damage(value)
  864. if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE > 0
  865. @_total_damage += value
  866. # 绝对值转为字符串
  867. damage_string = @_total_damage.abs.to_s
  868. else
  869. return
  870. end
  871. # 初始化位图
  872. bitmap = Bitmap.new(350, 150)
  873. bitmap.font.name = "Arial Black"
  874. bitmap.font.size = 32
  875. # 伤害值是数值的情况下
  876. if value.is_a?(Numeric)
  877. # 分割伤害值字符串
  878. damage_array = damage_string.scan(/./)
  879. damage_x = 40 - damage_string.size * 9
  880. # 伤害值为负的情况下
  881. name=RPG::Cache.picture("total_damage")
  882. # 循环伤害值字符串
  883. for char in damage_array
  884. number = char.to_i
  885. # 显示伤害数字
  886. bitmap.blt(damage_x, 0, name,
  887. Rect.new(number * name.width/10, 0, name.width/10, name.height))
  888. #################################################################总伤害数值
  889. damage_x += name.width/10 - 3 #间距缩小3个像素,可以自行调整
  890. #################################################################总伤害数值
  891. end
  892. end
  893. if @_total_damage_sprite.nil?
  894. @_total_damage_sprite = ::Sprite.new(self.viewport)
  895. @_total_damage_sprite.ox = 80
  896. @_total_damage_sprite.oy = 40
  897. @_total_damage_sprite.z = 3000
  898. end
  899. @_total_damage_sprite.bitmap = bitmap
  900. @_total_damage_sprite.zoom_x = 1.0
  901. @_total_damage_sprite.zoom_y = 1.0
  902. @_total_damage_sprite.x = self.x
  903. @_total_damage_sprite.y = self.y - self.oy / 2
  904. @_total_damage_sprite.z = 3001
  905. @_total_damage_duration = 80
  906. #hit数描绘
  907. @hits+=1
  908. if @_total_damage > 0
  909.   hit
  910. end
  911. end
  912. def animation(animation, hit, battler_damage="", battler_damage_sp="",battler_critical=false)
  913. dispose_animation
  914. @battler_damage = battler_damage
  915. @battler_damage_sp = battler_damage_sp
  916. @battler_critical = battler_critical
  917. @_animation = animation
  918. return if @_animation == nil
  919. @_animation_hit = hit
  920. @_animation_duration = @_animation.frame_max
  921. animation_name = @_animation.animation_name
  922. animation_hue = @_animation.animation_hue
  923. bitmap = RPG::Cache.animation(animation_name, animation_hue)
  924. for timing in @_animation.timings
  925. quanzhong = animation_process_timing(timing, @_animation_hit,true)
  926. @all_quanzhong += quanzhong
  927. @_last_frame = timing.frame if quanzhong != 0
  928. end
  929. if @@_reference_count.include?(bitmap)
  930. @@_reference_count[bitmap] += 1
  931. else
  932. @@_reference_count[bitmap] = 1
  933. end  
  934. if $scene.is_a?(Scene_Battle)
  935. if $scene.animation1_id == @battler.animation_id
  936. @battler_damage = ""
  937. @battler_damage_sp = ""
  938. end
  939. end
  940. @_animation_sprites = []
  941. if @_animation.position != 3 or not @@_animations.include?(animation)
  942. for i in 0..15
  943. sprite = ::Sprite.new(self.viewport)
  944. sprite.bitmap = bitmap
  945. sprite.visible = false
  946. @_animation_sprites.push(sprite)
  947. end
  948. unless @@_animations.include?(animation)
  949. @@_animations.push(animation)
  950. end
  951. end
  952. update_animation
  953. end  
  954. def dispose_damage
  955. for damage in @_damage.reverse
  956. damage[0].bitmap.dispose
  957. damage[0].dispose
  958. @_damage.delete(damage)
  959. end
  960. for damage_sp in @_damage_sp.reverse
  961. damage_sp[0].bitmap.dispose
  962. damage_sp[0].dispose
  963. @_damage_sp.delete(damage_sp)
  964. end
  965. @_total_damage = 0
  966. @_last_frame = -1
  967. if @_total_damage_sprite != nil
  968. @_total_damage_duration = 0
  969. @_total_damage_sprite.bitmap.dispose
  970. @_total_damage_sprite.dispose
  971. @_total_damage_sprite = nil
  972. end
  973. end
  974. def dispose_hit
  975. if @_hits_sprite != nil
  976. @_hits_sprite.bitmap.dispose
  977. @_hits_sprite.dispose
  978. @_hits_sprite = nil
  979. end
  980. end
  981. def dispose_animation
  982. @battler_damage = nil
  983. @battler_damage_sp = nil
  984. @battler_critical = nil
  985. @all_quanzhong = 1
  986. @_total_damage = 0
  987. @_last_frame = -1
  988. if @_animation_sprites != nil
  989. sprite = @_animation_sprites[0]
  990. if sprite != nil
  991. @@_reference_count[sprite.bitmap] -= 1
  992. if @@_reference_count[sprite.bitmap] == 0
  993. sprite.bitmap.dispose
  994. end
  995. end
  996. for sprite in @_animation_sprites
  997. sprite.dispose
  998. end
  999. @_animation_sprites = nil
  1000. @_animation = nil
  1001. end
  1002. end
  1003. def update
  1004. super
  1005. if @_whiten_duration > 0
  1006. @_whiten_duration -= 1
  1007. self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  1008. end
  1009. if @_appear_duration > 0
  1010. @_appear_duration -= 1
  1011. self.opacity = (16 - @_appear_duration) * 16
  1012. end
  1013. if @_escape_duration > 0
  1014. @_escape_duration -= 1
  1015. self.opacity = 256 - (32 - @_escape_duration) * 10
  1016. end
  1017. if @_collapse_duration > 0
  1018. @_collapse_duration -= 1
  1019. self.opacity = 256 - (48 - @_collapse_duration) * 6
  1020. end
  1021. if @_damage_duration > 0
  1022. @_damage_duration -= 1
  1023. for damage in @_damage
  1024. damage[0].x = self.x + self.viewport.rect.x -
  1025. self.ox + self.src_rect.width / 2 +
  1026. (40 - damage[1]) * damage[3] / 10
  1027. damage[0].y -= damage[4]+damage[1]/10
  1028. damage[0].opacity = damage[1]*20
  1029. damage[1] -= 1
  1030. if damage[1]==0
  1031. damage[0].bitmap.dispose
  1032. damage[0].dispose
  1033. @_damage.delete(damage)
  1034. next
  1035. end
  1036. end
  1037. for damage_sp in @_damage_sp
  1038. damage_sp[0].x = self.x + self.viewport.rect.x -
  1039. self.ox + self.src_rect.width / 2 +
  1040. (40 - damage_sp[1]) * damage_sp[3] / 10
  1041. damage_sp[0].y -= damage_sp[4]+damage_sp[1]/10
  1042. damage_sp[0].opacity = damage_sp[1]*20
  1043. damage_sp[1] -= 1
  1044. if damage_sp[1]==0
  1045. damage_sp[0].bitmap.dispose
  1046. damage_sp[0].dispose
  1047. @_damage_sp.delete(damage_sp)
  1048. next
  1049. end
  1050. end
  1051. end
  1052. if @_total_damage_duration > 0
  1053. @_total_damage_duration -= 1
  1054. @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  1055. if @_total_damage_sprite.zoom_x > 1.0
  1056. @_total_damage_sprite.zoom_x -= 0.05
  1057. end
  1058. if @_total_damage_sprite.zoom_y > 1.0
  1059. @_total_damage_sprite.zoom_y -= 0.05
  1060. end
  1061. @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  1062. if @_total_damage_duration <= 0
  1063. dispose_hit
  1064. @_total_damage = 0
  1065. @_total_damage_duration = 0
  1066. @_total_damage_sprite.bitmap.dispose
  1067. @_total_damage_sprite.dispose
  1068. @_total_damage_sprite = nil
  1069. end
  1070. end
  1071. #=======================================
  1072.     if @_animation != nil and (Graphics.frame_count % 2 == 0)
  1073.       @_animation_duration -= 1
  1074.       update_animation
  1075.     end
  1076.   if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  1077.       update_loop_animation
  1078.       @_loop_animation_index += 1
  1079.       @_loop_animation_index %= @_loop_animation.frame_max
  1080.     end
  1081.   if @_blink
  1082.     @_blink_count = (@_blink_count + 1) % 32
  1083.       if @_blink_count < 16
  1084.         alpha = (16 - @_blink_count) * 6
  1085.       else
  1086.         alpha = (@_blink_count - 16) * 6
  1087.       end
  1088.       self.color.set(255, 255, 255, alpha)
  1089.     end
  1090.     @@_animations.clear
  1091.   end
  1092. def update_animation
  1093.   if @_animation_duration > 0
  1094.     frame_index = @_animation.frame_max - @_animation_duration
  1095.     cell_data = @_animation.frames[frame_index].cell_data
  1096.     position = @_animation.position
  1097.     animation_set_sprites(@_animation_sprites, cell_data, position)
  1098.       for timing in @_animation.timings
  1099.         if timing.frame == frame_index
  1100.           t = 1.0 * animation_process_timing(timing, @_animation_hit)
  1101.           ts = 1.0 * animation_process_timing(timing, @_animation_hit)
  1102.           if timing.se.name != ""
  1103.             se=timing.se
  1104.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  1105.           end
  1106.           if @battler_damage.is_a?(Numeric) and t != 0
  1107.             if @battler.guarding?
  1108.               @battler.startactive = "防御" if @battler_damage > 0
  1109.            else
  1110.               @battler.startactive = "受伤" if @battler_damage > 0
  1111.             end
  1112.             t *= @battler_damage
  1113.             t /= @all_quanzhong
  1114.             ts *= @battler_damage_sp
  1115.             ts /= @all_quanzhong
  1116.             t = t.to_i
  1117.             ts = ts.to_i
  1118.   if frame_index != @_last_frame
  1119.     @p_dam+= t
  1120.   end
  1121.       if frame_index == @_last_frame
  1122.         t=@battler_damage-@p_dam
  1123.       end
  1124.     if frame_index == @_last_frame
  1125.       @_total_damage = @battler_damage - t
  1126.       @p_dam=0
  1127.     end
  1128.       damage(t,@battler_critical) if $damage_hp == true
  1129.       damage_sp(ts,@battler_critical) if $damage_sp == true
  1130.     if frame_index == @_last_frame
  1131.       @hits=0
  1132.      end
  1133.       elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  1134.         damage(@battler_damage,@battler_critical)
  1135.         damage_sp(@battler_damage_sp,@battler_critical) if $damage_sp == true
  1136.        end
  1137.       end
  1138.       end
  1139.     else
  1140.       dispose_animation
  1141.     end
  1142.   end
  1143. def animation_process_timing(timing, hit,dontflash=false)
  1144.   if (timing.condition == 0) or
  1145.     (timing.condition == 1 and hit == true) or
  1146.     (timing.condition == 2 and hit == false)
  1147.   case timing.flash_scope
  1148.     when 1
  1149.       unless dontflash
  1150.         self.flash(timing.flash_color, timing.flash_duration * 2)
  1151.         if @_total_damage >0
  1152.           @flash_shake_switch = true
  1153.           @flash_shake = 10
  1154.         end
  1155.       end
  1156.       return timing.flash_color.alpha * timing.flash_duration
  1157.     when 2
  1158.       unless dontflash
  1159.         if self.viewport != nil
  1160.           self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  1161.         end
  1162.       end
  1163.       return timing.flash_color.alpha * timing.flash_duration
  1164.     when 3
  1165.       unless dontflash
  1166.         self.flash(nil, timing.flash_duration * 2)
  1167.       end
  1168.         return timing.flash_color.alpha * timing.flash_duration
  1169.       end
  1170.     end
  1171.       return 0
  1172.     end
  1173.   end
  1174. end

  1175. class Sprite_Battler < RPG::Sprite
  1176.   def initialize(viewport, battler = nil)
  1177.     super(viewport)
  1178.     @battler = battler
  1179.     @battler_visible = false
  1180.     @flash_shake_switch = true
  1181.     @number = 0#初始化编号
  1182.   end
  1183.   def update
  1184.     super
  1185.     # 战斗者为 nil 的情况下
  1186.     if @battler == nil
  1187.       self.bitmap = nil
  1188.       loop_animation(nil)
  1189.       return
  1190.     end
  1191.     # 文件名和色相与当前情况有差异的情况下
  1192.     if @battler.battler_name != @battler_name or
  1193.        @battler.battler_hue != @battler_hue
  1194.       # 获取、设置位图
  1195.       @battler_name = @battler.battler_name
  1196.       @battler_hue = @battler.battler_hue
  1197.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1198.       @width = bitmap.width
  1199.       @height = bitmap.height
  1200.       self.ox = @width / 2
  1201.       self.oy = @height
  1202.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  1203.       if @battler.dead? or @battler.hidden
  1204.         self.opacity = 0  if DEADPIC != 1
  1205.       end
  1206.     end
  1207.     ###################################万兽熊最高#########################################
  1208.         if @battler.startactive == "移动" or @battler.startactive == "返回"
  1209.       if Graphics.frame_count % 4 == 0
  1210.         unless BattlerName[@battler.name].nil?
  1211.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1212.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1213.         end
  1214.       end
  1215.     elsif @battler.startactive == "死亡"
  1216.        if Graphics.frame_count % 4 == 0
  1217.         unless BattlerName[@battler.name].nil?
  1218.           if @number +1 <= BattlerName[@battler.name][@battler.startactive].size
  1219.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1220.           @number += 1
  1221.         else
  1222.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][BattlerName[@battler.name][@battler.startactive].size-1], @battler_hue)
  1223.           end
  1224.         end
  1225.       end
  1226.       else
  1227.       if Graphics.frame_count % 10 == 0
  1228.         unless BattlerName[@battler.name].nil?
  1229.           @number = (@number + 1) % BattlerName[@battler.name][@battler.startactive].size
  1230.           self.bitmap = RPG::Cache.battler(BattlerName[@battler.name][@battler.startactive][@number], @battler_hue)
  1231.         end
  1232.       end
  1233.     end
  1234.     #######################################################################################
  1235.     # 动画 ID 与当前的情况有差异的情况下
  1236.     if @battler.damage == nil and
  1237.        @battler.state_animation_id != @state_animation_id
  1238.       @state_animation_id = @battler.state_animation_id
  1239.       loop_animation($data_animations[@state_animation_id])
  1240.     end
  1241.     # 应该被显示的角色的情况下
  1242.    if NACTSWITCH > 0
  1243.     if @battler.is_a?(Game_Actor) and @battler_visible
  1244.       # 不是主状态的时候稍稍降低点透明度
  1245.       if $game_temp.battle_main_phase
  1246.         self.opacity += 3 if self.opacity < 255
  1247.       else
  1248.         self.opacity -= 3 if self.opacity > 207
  1249.       end
  1250.     end
  1251.   end
  1252.     if @battler.blink
  1253.       blink_on
  1254.     else
  1255.       blink_off
  1256.     end
  1257.     unless @battler_visible
  1258.       if not @battler.hidden and not @battler.dead? and
  1259.          (@battler.damage == nil or @battler.damage_pop)
  1260.         appear
  1261.         @battler_visible = true
  1262.       end
  1263.     end
  1264.     if @battler_visible
  1265.       if @battler.hidden
  1266.         $game_system.se_play($data_system.escape_se)
  1267.         escape
  1268.         @battler_visible = false
  1269.       end
  1270.       if @battler.white_flash
  1271.         whiten
  1272.         @battler.white_flash = false   
  1273.       end
  1274.         if @battler.animation_id != 0
  1275.         animation = $data_animations[@battler.animation_id]
  1276.         animation(animation, @battler.animation_hit,@battler.damage,@battler.damage_sp, @battler.critical)
  1277.         @battler.animation_id = 0
  1278.       end
  1279.       if @battler.damage_pop
  1280.         @battler.damage = nil
  1281.         @battler.damage_sp = 0
  1282.         @battler.critical = false
  1283.         @battler.damage_pop = false
  1284.       end
  1285.       if @battler.damage == nil and @battler.dead?
  1286.         if DEADPIC >0
  1287.           @battler.startactive = "死亡"
  1288.           else
  1289.         if @battler.is_a?(Game_Enemy)
  1290.           $game_system.se_play($data_system.enemy_collapse_se)
  1291.         else
  1292.           $game_system.se_play($data_system.actor_collapse_se)
  1293.         end
  1294.         collapse
  1295.         @battler_visible = false
  1296.         end
  1297.       end
  1298.     end
  1299.      self.x = @battler.screen_x
  1300.      self.y = @battler.screen_y
  1301.      self.z = @battler.screen_z
  1302.   end
  1303. end

  1304. class Spriteset_Battle
  1305. alias bearrpg_initialize initialize
  1306.   def initialize
  1307.     @enemy_sprites = []
  1308.     for enemy in $game_troop.enemies.reverse
  1309.       #####修改敌人显示端口,与角色一样。
  1310.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1311.     end
  1312.     bearrpg_initialize
  1313.   end
  1314. end

  1315. class Arrow_Enemy < Arrow_Base
  1316.   def update
  1317.     super
  1318.     $game_troop.enemies.size.times do
  1319.       break if self.enemy.exist?
  1320.       @index += 1
  1321.       @index %= $game_troop.enemies.size
  1322.     end
  1323.     if Input.repeat?(Input::UP)
  1324.       $game_system.se_play($data_system.cursor_se)
  1325.       $game_troop.enemies.size.times do
  1326.         @index += 1
  1327.         @index %= $game_troop.enemies.size
  1328.         break if self.enemy.exist?
  1329.       end
  1330.     end
  1331.     if Input.repeat?(Input::DOWN)
  1332.       $game_system.se_play($data_system.cursor_se)
  1333.       $game_troop.enemies.size.times do
  1334.         @index += $game_troop.enemies.size - 1
  1335.         @index %= $game_troop.enemies.size
  1336.         break if self.enemy.exist?
  1337.       end
  1338.     end
  1339.     if self.enemy != nil
  1340.       self.x = self.enemy.screen_x
  1341.       self.y = self.enemy.screen_y
  1342.     end
  1343.   end
  1344. end

  1345. class Arrow_Actor < Arrow_Base
  1346.   def update
  1347.     super
  1348.     if Input.repeat?(Input::UP)
  1349.       $game_system.se_play($data_system.cursor_se)
  1350.       @index += 1
  1351.       @index %= $game_party.actors.size
  1352.     end
  1353.     if Input.repeat?(Input::DOWN)
  1354.       $game_system.se_play($data_system.cursor_se)
  1355.       @index += $game_party.actors.size - 1
  1356.       @index %= $game_party.actors.size
  1357.     end
  1358.     if self.actor != nil
  1359.       self.x = self.actor.screen_x
  1360.       self.y = self.actor.screen_y
  1361.     end
  1362.   end
  1363. end

  1364. class Scene_Battle
  1365. include Scene_BattleName
  1366. attr_reader :animation1_id
  1367.   def main
  1368.     $game_temp.in_battle = true
  1369.     $game_temp.battle_turn = 0
  1370.     $game_temp.battle_event_flags.clear
  1371.     $game_temp.battle_abort = false
  1372.     $game_temp.battle_main_phase = false
  1373.     $game_temp.battleback_name = $game_map.battleback_name
  1374.     $game_temp.forcing_battler = nil
  1375.     @_move_duration = 0
  1376.     $game_system.battle_interpreter.setup(nil, 0)
  1377.     @troop_id = $game_temp.battle_troop_id
  1378.     $game_troop.setup(@troop_id)
  1379.     s1 = $data_system.words.attack
  1380.     s2 = $data_system.words.skill
  1381.     s3 = $data_system.words.guard
  1382.     s4 = $data_system.words.item
  1383.     @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
  1384.     @actor_command_window.z = 900
  1385.     @actor_command_window.y = 160
  1386.     @actor_command_window.back_opacity = 160
  1387.     @actor_command_window.active = false
  1388.     @actor_command_window.visible = false
  1389.     @party_command_window = Window_PartyCommand.new
  1390.     @party_command_window.z = 910
  1391.     @help_window = Window_Help.new
  1392.     @help_window.back_opacity = 160
  1393.     @help_window.z = 999990
  1394.     @help_window.visible = false
  1395.     @status_window = Window_BattleStatus.new
  1396.     @status_window.z = 930
  1397.     @message_window = Window_Message.new
  1398.     @message_window.z = 940
  1399.     @spriteset = Spriteset_Battle.new
  1400.     @wait_count = 0
  1401.     if $data_system.battle_transition == ""
  1402.       Graphics.transition(20)
  1403.     else
  1404.       Graphics.transition(40, "Graphics/Transitions/" +
  1405.         $data_system.battle_transition)
  1406.     end
  1407.     start_phase1
  1408.     loop do
  1409.       Graphics.update
  1410.       Input.update
  1411.       update
  1412.       if $scene != self
  1413.         break
  1414.       end
  1415.     end
  1416.     $game_map.refresh
  1417.     Graphics.freeze
  1418.     @actor_command_window.dispose
  1419.     @party_command_window.dispose
  1420.     @help_window.dispose
  1421.     @status_window.dispose
  1422.     @message_window.dispose
  1423.     if @skill_window != nil
  1424.       @skill_window.dispose
  1425.     end
  1426.     if @item_window != nil
  1427.       @item_window.dispose
  1428.     end
  1429.     if @result_window != nil
  1430.       @result_window.dispose
  1431.     end
  1432.     @spriteset.dispose
  1433.     if $scene.is_a?(Scene_Title)
  1434.       Graphics.transition
  1435.       Graphics.freeze
  1436.     end
  1437.     if $BTEST and not $scene.is_a?(Scene_Gameover)
  1438.       $scene = nil
  1439.     end
  1440.   end
  1441.   def start_phase1
  1442.     # 转移到回合 1
  1443.     @phase = 1
  1444.     # 清除全体同伴的行动
  1445.     $game_party.clear_actions
  1446.     for actor in $game_party.actors
  1447.      actor.startactive = actor.hp>0? "待机" : "死亡"
  1448.     end
  1449.     # 设置战斗事件
  1450.     setup_battle_event
  1451.   end
  1452.   alias bearrpg_start_phase5 start_phase5
  1453. def start_phase5
  1454.    bearrpg_start_phase5
  1455.     @result_window.z = 999
  1456.     @phase5_wait_count = 100
  1457.   end
  1458.   def start_enemy_select
  1459.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
  1460.     @enemy_arrow.help_window = @help_window
  1461.     @actor_command_window.active = false
  1462.     @actor_command_window.visible = false
  1463.   end
  1464.   alias bearrpg_start_skill_select start_skill_select
  1465.    def start_skill_select
  1466.       bearrpg_start_skill_select
  1467.       @skill_window.z = 999
  1468.     end
  1469.    alias bearrpg_start_item_select start_item_select
  1470.     def start_item_select
  1471.       bearrpg_start_item_select
  1472.       @item_window.z = 999
  1473.     end
  1474.   def move(active_battler, target, ox, oy, 返回标记 = false)
  1475.     ta_x = target[0]
  1476.     ta_y = target[1]
  1477.     if 返回标记
  1478.       active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox) / @_move_duration
  1479.       active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy) / @_move_duration
  1480.     else
  1481.       if @active_battler.is_a?(Game_Enemy)
  1482.         active_battler.movex = (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1483.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1484.       else
  1485.         active_battler.movex =  (active_battler.movex * (@_move_duration - 1) + ta_x.to_f - ox ) / @_move_duration
  1486.         active_battler.movey = (active_battler.movey * (@_move_duration - 1) + ta_y.to_f - oy ) / @_move_duration
  1487.       end
  1488.     end
  1489.   end
  1490.   def update_phase4_step3
  1491.     ####普通攻击的场合############################################################
  1492.     if @active_battler.current_action.basic == 0 and
  1493.       @active_battler.current_action.kind == 0
  1494.       #开始执行移动
  1495.      if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1496.         @active_battler.startactive = "移动"
  1497.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1498.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1499.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1500.         @_move_duration = Move_Duration/2
  1501.        while @_move_duration > 0
  1502.         Graphics.update
  1503.         Input.update
  1504.         @spriteset.update
  1505.         if @target_battlers[0].is_a?(Game_Actor)
  1506.         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]
  1507.         else
  1508.         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]
  1509.         end
  1510.         move(@active_battler, tag, ox, oy)
  1511.         @_move_duration -= 1
  1512.       end
  1513.     else
  1514.       @_move_duration = Move_Duration
  1515.         while @_move_duration > 0
  1516.         Graphics.update
  1517.         Input.update
  1518.         @spriteset.update
  1519.         if @target_battlers[0].is_a?(Game_Actor)
  1520.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width/2,@target_battlers[0].screen_y+1]
  1521.         else
  1522.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1523.         end
  1524.         move(@active_battler, tag, ox, oy)
  1525.         @_move_duration -= 1
  1526.       end
  1527.       end
  1528.     end
  1529.    ####普通攻击的场合############################################################
  1530.     elsif @active_battler.current_action.kind == 1
  1531.     ####使用特技的场合############################################################
  1532.       if not @skill.element_set.include?(UNMOVE)# 如果技能不包含“不移动属性”
  1533.         @active_battler.startactive = "移动"
  1534.         @oldxy = [@active_battler.screen_x,@active_battler.screen_y]
  1535.         ox,oy = @active_battler.screen_x,@active_battler.screen_y
  1536.       if @skill.element_set.include?(HOMOVE)#如果技能不包含“半距离”属性
  1537.         @_move_duration = Move_Duration/2
  1538.        while @_move_duration > 0
  1539.         Graphics.update
  1540.         Input.update
  1541.         @spriteset.update
  1542.         if @target_battlers[0].is_a?(Game_Actor)
  1543.         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]
  1544.         else
  1545.         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]
  1546.         end
  1547.         move(@active_battler, tag, ox, oy)
  1548.         @_move_duration -= 1
  1549.       end
  1550.     else
  1551.       @_move_duration = Move_Duration
  1552.         while @_move_duration > 0
  1553.         Graphics.update
  1554.         Input.update
  1555.         @spriteset.update
  1556.         if @target_battlers[0].is_a?(Game_Actor)
  1557.         tag = [@target_battlers[0].screen_x-@target_battlers[0].width,@target_battlers[0].screen_y+1]
  1558.         else
  1559.         tag = [@target_battlers[0].screen_x+@target_battlers[0].width/1.5,@target_battlers[0].screen_y+2]
  1560.         end
  1561.         move(@active_battler, tag, ox, oy)
  1562.         @_move_duration -= 1
  1563.       end
  1564.       end
  1565.     end
  1566.    #####使用特技的场合##############################################################
  1567. end
  1568. if @active_battler.startactive != "防御"
  1569.     @active_battler.startactive = "待机"
  1570.    end
  1571.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  1572.     if @animation1_id == 0
  1573.       @active_battler.white_flash = true
  1574.     else
  1575.       @active_battler.animation_id = @animation1_id
  1576.       @active_battler.animation_hit = true
  1577.     end
  1578.     for target in @target_battlers
  1579.       if target.guarding? and target.damage.is_a?(Numeric)
  1580.         target.startactive = "防御" if target.damage > 0
  1581.         end
  1582.       target.animation_id = @animation2_id
  1583.       target.animation_hit = (target.damage != "Miss")
  1584.     end
  1585.     # 移至步骤 4
  1586.     @phase4_step = 4
  1587.   end
  1588.   ##############################################################################
  1589.   def update_phase4_step4
  1590.    ###########################万兽熊最高########################################
  1591.     # 对像方动画
  1592.      for target in @target_battlers
  1593.        if target.damage != nil
  1594.          target.damage_pop = true
  1595.        end
  1596.      end
  1597.     # 限制动画长度、最低 8 帧
  1598.   #  @wait_count = 8
  1599.   ##############################################################################
  1600.     # 移至步骤 5
  1601.     @phase4_step = 5
  1602.   end
  1603. ####################万兽熊最高############################
  1604.   def update_phase4_step5
  1605.     # 隐藏帮助窗口
  1606.     @help_window.visible = false
  1607.     if @active_battler.current_action.basic == 0 and
  1608.       @active_battler.current_action.kind == 0
  1609.    ####普通攻击的场合############################################################   
  1610.       #执行返回
  1611.     if not @active_battler.element_rate(UNMOVE)>100# 如果属性“不移动”不大于100
  1612.       @active_battler.startactive = "返回"
  1613.       if @active_battler.element_rate(HOMOVE)>100# 如果属性“半距离”大于100
  1614.       @_move_duration = Move_Duration/2
  1615.       else
  1616.       @_move_duration = Move_Duration   
  1617.       end
  1618.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1619.       @active_battler.screen_y - @active_battler.movey
  1620.       while @_move_duration > 0
  1621.         Graphics.update
  1622.         Input.update
  1623.         @spriteset.update
  1624.         move(@active_battler, @oldxy, ox, oy, true)
  1625.         @_move_duration -= 1
  1626.       end
  1627.     end
  1628.    ####普通攻击的场合############################################################
  1629.     elsif @active_battler.current_action.kind == 1
  1630.       if not @skill.element_set.include?(UNMOVE)#如果技能不包含“不移动”属性
  1631.       @active_battler.startactive = "返回"
  1632.       if @skill.element_set.include?(HOMOVE)#如果技能包含“半距离”属性
  1633.       @_move_duration = Move_Duration/2
  1634.       else
  1635.       @_move_duration = Move_Duration   
  1636.       end
  1637.       ox,oy = @active_battler.screen_x - @active_battler.movex,\
  1638.       @active_battler.screen_y - @active_battler.movey
  1639.       while @_move_duration > 0
  1640.         Graphics.update
  1641.         Input.update
  1642.         @spriteset.update
  1643.         move(@active_battler, @oldxy, ox, oy, true)
  1644.         @_move_duration -= 1
  1645.       end
  1646.     end
  1647.    ####使用特技的场合############################################################
  1648. end
  1649. if @active_battler.startactive != "防御"
  1650.     @active_battler.startactive = "待机"
  1651.    end
  1652.     # 刷新状态窗口
  1653.     @status_window.refresh
  1654.     # 显示伤害
  1655.     for target in @target_battlers
  1656.       target.startactive = "待机"
  1657.       if target.damage != nil
  1658.         target.damage_pop = true
  1659.       end
  1660.     end
  1661.     # 移至步骤 6
  1662.     @phase4_step = 6
  1663.   end
  1664.   def update_phase4_step6
  1665.     # 清除强制行动对像的战斗者
  1666.     $game_temp.forcing_battler = nil
  1667.     @active_battler.movex = 0
  1668.     @active_battler.movey = 0
  1669.     @active_battler.startactive = "待机" if @active_battler.startactive != "死亡"
  1670.     # 公共事件 ID 有效的情况下
  1671.     if @common_event_id > 0
  1672.       # 设置事件
  1673.       common_event = $data_common_events[@common_event_id]
  1674.       $game_system.battle_interpreter.setup(common_event.list, 0)
  1675.     end
  1676.     # 移至步骤 1
  1677.     @phase4_step = 1
  1678.   end
  1679. end
复制代码




原本下載的腳本:



  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 = 28
  38.   #设定人物的单帧图,如果不做设定,将直接使用默认的战斗图。
  39.   BattlerName = {
  40.   "佛雷德" => {
  41.   "待机" => ["Fred_s1","Fred_s2","Fred_s3","Fred_s4"],
  42.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  43.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  44.   "受伤" => ["Fred_h"],
  45.   "防御" => ["Fred_d"],
  46.   "死亡" => ["Fred_die1","Fred_die2"]
  47.   },
  48.   
  49.   "大熊" => {
  50.   "待机" => ["bear_s11","bear_s12","bear_s13","bear_s14"],
  51.   "移动" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  52.   "返回" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  53.   "受伤" => ["bear_h1"],
  54.   "防御" => ["bear_d1"],
  55.   "死亡" => ["bear_die11","bear_die12"]
  56.   },
  57.   
  58.   "蜘蛛" => {
  59.   "待机" => ["spider_s11"],
  60.   "移动" => ["spider_b1"],
  61.   "返回" => ["spider_r1"],
  62.   "受伤" => ["spider_h1"],
  63.   "防御" => ["spider_h1"],
  64.   "死亡" => ["spider_die11","spider_die12"]
  65.   },
  66.   
  67.   "鬼幽靈" => {
  68.   "待机" => ["ghost_s11","ghost_s12","ghost_s13","ghost_s14"],
  69.   "移动" => ["ghost_b1","ghost_b2","ghost_b3","ghost_b4"],
  70.   "返回" => ["ghost_r1","ghost_r2","ghost_r3","ghost_r4"],
  71.   "受伤" => ["ghost_h1"],
  72.   "防御" => ["ghost_d1"],
  73.   "死亡" => ["ghost_die11","ghost_die12"]
  74.   },
  75.   
  76.    "惡佛雷德" => {
  77.   "待机" => ["Fred_s11","Fred_s12","Fred_s13","Fred_s14"],
  78.   "移动" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  79.   "返回" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  80.   "受伤" => ["Fred_h1"],
  81.   "防御" => ["Fred_d1"],
  82.   "死亡" => ["Fred_die11","Fred_die12"]
  83.   },
  84.   
  85.   "惡熊" => {
  86.   "待机" => ["bear_s1","bear_s2","bear_s3","bear_s4"],
  87.   "移动" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  88.   "返回" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  89.   "受伤" => ["bear_h"],
  90.   "防御" => ["bear_d"],
  91.   "死亡" => ["bear_die1","bear_die2"]
  92.   },
  93.   
  94.   "惡蜘蛛" => {
  95.   "待机" => ["spider_s1"],
  96.   "移动" => ["spider_r1"],
  97.   "返回" => ["spider_b1"],
  98.   "受伤" => ["spider_h"],
  99.   "防御" => ["spider_h"],
  100.   "死亡" => ["spider_die1","spider_die2"]
  101.   },
  102.   
  103.   "巨大鬼幽靈" => {
  104.   "待机" => ["ghost_s1","ghost_s2","ghost_s3","ghost_s4"],
  105.   "移动" => ["ghost_r1","ghost_r2","ghost_r3","ghost_r4"],
  106.   "返回" => ["ghost_b1","ghost_b2","ghost_b3","ghost_b4"],
  107.   "受伤" => ["ghost_h"],
  108.   "防御" => ["ghost_d"],
  109.   "死亡" => ["ghost_die1","ghost_die2"]
  110.   },
  111. }
  112. end
  113. #至于其它的:

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

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

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

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

  118. #--------------------------------------------------------------------------
  119. #  ● 设定结束
  120. #--------------------------------------------------------------------------










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

  450. class Game_Actor
  451.   def screen_x
  452.     if self.index != nil
  453.       return (640-self.index*50)/2 + 240 + @movex
  454.     else
  455.       return 0
  456.     end
  457.   end
  458.   def screen_y
  459.     return self.index*70+self.height/2 + 55 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  460.   end
  461.   def screen_z
  462.     return self.screen_y-self.index * 10
  463.   end
  464. end
  465. class Game_Enemy
  466.   def screen_x
  467.     return $data_troops[@troop_id].members[@member_index].x + @movex
  468.   end
  469.   def screen_y
  470.     return $data_troops[@troop_id].members[@member_index].y + @movey
  471.   end
  472.   def screen_z
  473.     return self.screen_y#+self.height
  474.   end
  475. end

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

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

  1151. class Spriteset_Battle
  1152. alias bearrpg_initialize initialize
  1153.   def initialize
  1154.     @enemy_sprites = []
  1155.     for enemy in $game_troop.enemies.reverse
  1156.       #####修改敌人显示端口,与角色一样。
  1157.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1158.     end
  1159.     bearrpg_initialize
  1160.   end
  1161. end

  1162. class Arrow_Enemy < Arrow_Base
  1163.   def update
  1164.     super
  1165.     $game_troop.enemies.size.times do
  1166.       break if self.enemy.exist?
  1167.       @index += 1
  1168.       @index %= $game_troop.enemies.size
  1169.     end
  1170.     if Input.repeat?(Input::UP)
  1171.       $game_system.se_play($data_system.cursor_se)
  1172.       $game_troop.enemies.size.times do
  1173.         @index += 1
  1174.         @index %= $game_troop.enemies.size
  1175.         break if self.enemy.exist?
  1176.       end
  1177.     end
  1178.     if Input.repeat?(Input::DOWN)
  1179.       $game_system.se_play($data_system.cursor_se)
  1180.       $game_troop.enemies.size.times do
  1181.         @index += $game_troop.enemies.size - 1
  1182.         @index %= $game_troop.enemies.size
  1183.         break if self.enemy.exist?
  1184.       end
  1185.     end
  1186.     if self.enemy != nil
  1187.       self.x = self.enemy.screen_x
  1188.       self.y = self.enemy.screen_y
  1189.     end
  1190.   end
  1191. end

  1192. class Arrow_Actor < Arrow_Base
  1193.   def update
  1194.     super
  1195.     if Input.repeat?(Input::UP)
  1196.       $game_system.se_play($data_system.cursor_se)
  1197.       @index += 1
  1198.       @index %= $game_party.actors.size
  1199.     end
  1200.     if Input.repeat?(Input::DOWN)
  1201.       $game_system.se_play($data_system.cursor_se)
  1202.       @index += $game_party.actors.size - 1
  1203.       @index %= $game_party.actors.size
  1204.     end
  1205.     if self.actor != nil
  1206.       self.x = self.actor.screen_x
  1207.       self.y = self.actor.screen_y
  1208.     end
  1209.   end
  1210. end

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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部