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

Project1

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

[已经解决] 技能放第一位

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2150
在线时间
1010 小时
注册时间
2015-10-17
帖子
1283
跳转到指定楼层
1
发表于 2016-1-29 20:31:03 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
问一下,怎样能把技能选项和攻击选项换一个位置,把技能选项放第一位

8888.jpg (76.64 KB, 下载次数: 4)

8888.jpg

Lv3.寻梦者

梦石
0
星屑
1358
在线时间
1295 小时
注册时间
2012-8-4
帖子
749
2
发表于 2016-1-29 22:22:01 | 只看该作者

这是默认的战斗系统,可以参照这个试着去自己修改选项吧
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
12157
在线时间
4435 小时
注册时间
2014-4-11
帖子
5955

开拓者

3
发表于 2016-1-29 22:25:59 | 只看该作者
Scene_Battle 1脚本

找到这里
这里S1对应的是攻击,S2是特技,把他们等号后面的内容交换了。
Scene_Battle 3脚本

找到这里
攻击和特技里面的内容换了

找到这里
把actor_command_window.index == 0改actor_command_window.index == 1

点评

if @actor_command_window.index == 1这里如果不改会有什么效果?  发表于 2016-1-30 11:59
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2150
在线时间
1010 小时
注册时间
2015-10-17
帖子
1283
4
 楼主| 发表于 2016-1-29 22:57:10 | 只看该作者
本帖最后由 fjm 于 2016-1-29 23:05 编辑
夜狠简单 发表于 2016-1-29 22:22
这是默认的战斗系统,可以参照这个试着去自己修改选项吧


多谢,第一位变成技能选项,可中文还是显示攻击,能不能把攻击的字体改成技能,把第二个选项技能的字体改成攻击
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2150
在线时间
1010 小时
注册时间
2015-10-17
帖子
1283
5
 楼主| 发表于 2016-1-29 22:57:41 | 只看该作者
本帖最后由 fjm 于 2016-1-29 23:07 编辑
yang1zhi 发表于 2016-1-29 22:25
Scene_Battle 1脚本

找到这里


多谢,第一位变成了技能选项,可中文还是显示攻击,能不能把第一行攻击的字体改成技能,把第二个选项技能的字体改成攻击

点评

fjm
我用了熊式横版,是不是这个插件的原因呢  发表于 2016-1-30 11:13
你要是有插件脚本,要在插件脚本里改  发表于 2016-1-29 23:59
按我的改不可能名字没变  发表于 2016-1-29 23:58
把你脚本发上来看看  发表于 2016-1-29 23:56
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2150
在线时间
1010 小时
注册时间
2015-10-17
帖子
1283
6
 楼主| 发表于 2016-1-30 11:08:59 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  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.   "待机" => ["bear_s1","bear_s2","bear_s3","bear_s4"],
  42.   "移动" => ["bear_r1","bear_r2","bear_r3","bear_r4"],
  43.   "返回" => ["bear_b1","bear_b2","bear_b3","bear_b4"],
  44.   "受伤" => ["bear_h"],
  45.   "防御" => ["bear_d"],
  46.   "死亡" => ["bear_die1","bear_die2"]
  47.   },
  48.   
  49.   "蜘蛛侠" => {
  50.   "待机" => ["spider_s1"],
  51.   "移动" => ["spider_r1"],
  52.   "返回" => ["spider_b1"],
  53.   "受伤" => ["spider_h"],
  54.   "防御" => ["spider_h"],
  55.   "死亡" => ["spider_die1","spider_die2"]
  56.   },
  57.   
  58.   "桌布侠" => {
  59.   "待机" => ["ghost_s1","ghost_s2","ghost_s3","ghost_s4"],
  60.   "移动" => ["ghost_r1","ghost_r2","ghost_r3","ghost_r4"],
  61.   "返回" => ["ghost_b1","ghost_b2","ghost_b3","ghost_b4"],
  62.   "受伤" => ["ghost_h"],
  63.   "防御" => ["ghost_d"],
  64.   "死亡" => ["ghost_die1","ghost_die2"]
  65.   },

  66.   "山寨大帝" => {
  67.   "待机" => ["qq_s1","qq_s2","qq_s3","qq_s4"],
  68.   "移动" => ["qq_r1","qq_r2","qq_r3","qq_r4"],
  69.   "返回" => ["qq_B1","qq_B2","qq_B3","qq_B4"],
  70.   "受伤" => ["qq_h"],
  71.   "防御" => ["qq_d"],
  72.   "死亡" => ["qq_die1","qq_die2"]
  73.   },
  74.   "女" => {
  75.   "待机" => ["demon_s1","demon_s2","demon_s3","demon_s4"],
  76.   "移动" => ["demon_r1","demon_r2","demon_r3","demon_r4"],
  77.   "返回" => ["demon_b1","demon_b2","demon_b3","demon_b4"],
  78.   "受伤" => ["demon_h"],
  79.   "防御" => ["demon_d"],
  80.   "死亡" => ["demon_die1","demon_die2"]
  81.   },
  82.   
  83.   "狗" => {
  84.   "待机" => ["dog_s1","dog_s2","dog_s3","dog_s4"],
  85.   "移动" => ["dog_r1","dog_r2","dog_r3","dog_r4"],
  86.   "返回" => ["dog_b1","dog_b2","dog_b3","dog_b4"],
  87.   "受伤" => ["dog_h"],
  88.   "防御" => ["dog_h"],
  89.   "死亡" => ["dog_die"]
  90.   },
  91.   
  92.   "弗雷德" => {
  93.   "待机" => ["Fred_s1","Fred_s2","Fred_s3","Fred_s4"],
  94.   "移动" => ["Fred_r1","Fred_r2","Fred_r3","Fred_r4"],
  95.   "返回" => ["Fred_b1","Fred_b2","Fred_b3","Fred_b4"],
  96.   "受伤" => ["Fred_h"],
  97.   "防御" => ["Fred_d"],
  98.   "死亡" => ["Fred_die1","Fred_die2"]
  99.   },
  100. }
  101. end
  102. #至于其它的:

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

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

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

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

  107. #--------------------------------------------------------------------------
  108. #  ● 设定结束
  109. #--------------------------------------------------------------------------










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

  439. class Game_Actor
  440.   def screen_x
  441.     if self.index != nil
  442.       return (640-self.index*50)/2 + 240 + @movex
  443.     else
  444.       return 0
  445.     end
  446.   end
  447.   def screen_y
  448.     return self.index*70+self.height/2 + 140 + @movey #(320-self.index*91+self.height)/2 + 100 + @movey
  449.   end
  450.   def screen_z
  451.     return self.screen_y-self.index * 10
  452.   end
  453. end
  454. class Game_Enemy
  455.   def screen_x
  456.     return $data_troops[@troop_id].members[@member_index].x + @movex
  457.   end
  458.   def screen_y
  459.     return $data_troops[@troop_id].members[@member_index].y + @movey
  460.   end
  461.   def screen_z
  462.     return self.screen_y#+self.height
  463.   end
  464. end

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

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

  1140. class Spriteset_Battle
  1141. alias bearrpg_initialize initialize
  1142.   def initialize
  1143.     @enemy_sprites = []
  1144.     for enemy in $game_troop.enemies.reverse
  1145.       #####修改敌人显示端口,与角色一样。
  1146.       @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
  1147.     end
  1148.     bearrpg_initialize
  1149.   end
  1150. end

  1151. class Arrow_Enemy < Arrow_Base
  1152.   def update
  1153.     super
  1154.     $game_troop.enemies.size.times do
  1155.       break if self.enemy.exist?
  1156.       @index += 1
  1157.       @index %= $game_troop.enemies.size
  1158.     end
  1159.     if Input.repeat?(Input::UP)
  1160.       $game_system.se_play($data_system.cursor_se)
  1161.       $game_troop.enemies.size.times do
  1162.         @index += 1
  1163.         @index %= $game_troop.enemies.size
  1164.         break if self.enemy.exist?
  1165.       end
  1166.     end
  1167.     if Input.repeat?(Input::DOWN)
  1168.       $game_system.se_play($data_system.cursor_se)
  1169.       $game_troop.enemies.size.times do
  1170.         @index += $game_troop.enemies.size - 1
  1171.         @index %= $game_troop.enemies.size
  1172.         break if self.enemy.exist?
  1173.       end
  1174.     end
  1175.     if self.enemy != nil
  1176.       self.x = self.enemy.screen_x
  1177.       self.y = self.enemy.screen_y
  1178.     end
  1179.   end
  1180. end

  1181. class Arrow_Actor < Arrow_Base
  1182.   def update
  1183.     super
  1184.     if Input.repeat?(Input::UP)
  1185.       $game_system.se_play($data_system.cursor_se)
  1186.       @index += 1
  1187.       @index %= $game_party.actors.size
  1188.     end
  1189.     if Input.repeat?(Input::DOWN)
  1190.       $game_system.se_play($data_system.cursor_se)
  1191.       @index += $game_party.actors.size - 1
  1192.       @index %= $game_party.actors.size
  1193.     end
  1194.     if self.actor != nil
  1195.       self.x = self.actor.screen_x
  1196.       self.y = self.actor.screen_y
  1197.     end
  1198.   end
  1199. end

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

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1358
在线时间
1295 小时
注册时间
2012-8-4
帖子
749
7
发表于 2016-1-30 11:55:52 | 只看该作者
你的

Scene_Battle 3


评分

参与人数 1梦石 +1 收起 理由
RyanBern + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2150
在线时间
1010 小时
注册时间
2015-10-17
帖子
1283
8
 楼主| 发表于 2016-1-30 12:31:32 | 只看该作者
夜狠简单 发表于 2016-1-30 11:55
[fold=你的]#==============================================================================
# 本脚本 ...

恩,现在可以了,请教一下改过哪里了,我好学习一下

点评

fjm
恩,非常感谢,弄明白了  发表于 2016-1-30 19:06
和昨晚差不多,只是昨晚的写错了,写成 s2,s1,s2(正确是s3),s4。然后你去改原来的Battle 1处是没用的,因为后面的插件脚本重新用到了  发表于 2016-1-30 16:33
在你发的脚本里面找到一样内容的地方进行修改。  发表于 2016-1-30 12:42
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 15:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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