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

Project1

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

[已经解决] 用強制战斗行动胜出战斗会在结算画面显示战斗指令的BUG

[复制链接]

Lv5.捕梦者

梦石
0
星屑
24292
在线时间
5047 小时
注册时间
2016-3-8
帖子
1618
跳转到指定楼层
1
发表于 2020-9-14 21:42:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 alexncf125 于 2020-9-14 21:54 编辑

在脚本中的不同地方插入这三句也无用
@party_command_window.close
@party_command_window.unselect
@party_command_window.deactivate
联络作者不果 , 各位大大们能帮忙解決么
RUBY 代码复制
  1. ###--------------------------------------------------------------------------###
  2. #  战斗胜利评级脚本                                                      #
  3. #  Version 2.1e                                                                #
  4. #                                                                              #
  5. #      Credits:                                                                #
  6. #  Original code by: Neon Black                                                #
  7. #  Modified by:                                                                #
  8. #                                                                              #
  9. #  This work is licensed under the Creative Commons Attribution-NonCommercial  #
  10. #  3.0 Unported License. To view a copy of this license, visit                 #
  11. #  [url]http://creativecommons.org/licenses/by-nc/3.0/.[/url]                             #
  12. #  Permissions beyond the scope of this license are available at               #
  13. #  [url]http://cphouseset.wordpress.com/liscense-and-terms-of-use/.[/url]                 #
  14. #                                                                              #
  15. #      Contact:                                                                #
  16. #  NeonBlack - [email protected] (e-mail) or "neonblack23" on skype         #
  17. ###--------------------------------------------------------------------------###
  18.  
  19. ###--------------------------------------------------------------------------###
  20. #      Revision information:                                                   #
  21. #  V2.1 - 11.16.2012                                                           #
  22. #   Added grade requirement for drops                                          #
  23. #   Fixed an issue where drop rate was not figured properly                    #
  24. #  V2.0 - Finished 8.11.2012                                                   #
  25. #   Added level up windows                                                     #
  26. #   Created score items and Grade module                                       #
  27. #   Numerous other bugfixes and changes                                        #
  28. #  V1.1b - 6.26.2012                                                           #
  29. #   Fixed an error related to exp gain display                                 #
  30. #  V1.1 - 6.21.2012                                                            #
  31. #   Added rank sprite effect                                                   #
  32. #  V1.0 - 6.19.2012                                                            #
  33. #   Wrote and debugged main script                                             #
  34. ###--------------------------------------------------------------------------###
  35.  
  36. ###--------------------------------------------------------------------------###
  37. #      Compatibility:                                                          #
  38. #  This script has been tested to work with Yanfly's battle engine (just the   #
  39. #  base engine) and Yami's PCTB.  If you have any issue, let me know and I     #
  40. #  will address them asap.                                                     #
  41. #  Due to the number of new windows, I will only list methods in already       #
  42. #  existing objects here and not any of the newly created objects.             #
  43. #                                                                              #
  44. #  Alias       - BattleManager: setup, play_battle_bgm                         #
  45. #                Game_Battler: execute_damage                                  #
  46. #                Game_Enemy: initialize                                        #
  47. #                Game_Actor: level_up                                          #
  48. #                Scene_Battle: update_pctb_speed, dispose_all_windows,         #
  49. #                              use_item                                        #
  50. #                DataManager: load_database                                    #
  51. #  Overwrites  - BattleManager: process_victory, play_battle_end_me,           #
  52. #                               gain_gold, gain_drop_items, gain_exp           #
  53. #                Game_Troop: make_drop_items                                   #
  54. #                Game_Enemy: make_drop_items                                   #
  55. #                Scene_Battle: update                                          #
  56. #  New Objects - BattleManager: old_levels, old_skills, victory_phase?,        #
  57. #                               skip?, victory_end                             #
  58. #                Game_Troop: check_boss                                        #
  59. #                Game_Actor: gain_exp_cpv, last_level_exp                      #
  60. #                Scene_Battle: close_status_window, exp_window_update,         #
  61. #                              update_window_rates, update_scores,             #
  62. #                              show_victory_windows, create_leveled_windows,   #
  63. #                              pack_and_send, remove_sprite, drop_items        #
  64. #                RPG::UsableItem: karma_modif                                  #
  65. #                RPG::Enemy: add_drops                                         #
  66. #                DataManager: make_extra_drops                                 #
  67. ###--------------------------------------------------------------------------###
  68.  
  69. ###--------------------------------------------------------------------------###
  70. #      Instructions:                                                           #
  71. #  Place this script in the "Materials" section of the scripts above main.     #
  72. #  This script requires you to set several settings for the script to work     #
  73. #  properly.  The screen modifies the end of battle to allow a victory screen  #
  74. #  to appear.  This script also has several notebox tags that can be added to  #
  75. #  define changes to the grade and one note tag that will allow you to define  #
  76. #  additional monster drops.                                                   #
  77. ###-----                                                                -----###
  78. #                                                                              #
  79. #      敌人备注:                                                   #
  80. #                                                                              #
  81. #   drop[i:1:1:100] 或 drop[i:1:1]                                           #
  82. #               可以为敌人添加额外的掉落物品. 以上两种格式都行  #
  83. #               第一个参数是物品类型,可以是 "i", "a", 或  "w" ,分别代表 "物品",
  84. #               "护甲", 和 "武器".  第二个是物品id.  第三个是掉落几率.       #
  85. #               x分之1的概率,x=1时代表必定掉落,数字越大,掉落率越低.        #
  86. #               最后一个参数是可选的,代表战斗分数要求,胜利后评价的分数必须大于
  87. #               某个数,才会掉落该物品 .   
  88. #
  89. #   score[1]  - 该怪物每死一只,评价分数就加1.         #
  90. #               你可以把1替换为其他数字
  91. #
  92. #   onehit[1]  - 该怪物每被我方技能命中一次,评价分数就加1.  
  93. #                请注意,多段伤害的技能只会触发一次,附加死亡状态的技能不会触发   #
  94. #                在下面你可以设定默认每一次命中会获得的分数,优先级低于本敌人备注.                                                       #
  95. ###-----                                                                -----###
  96. #                                                                              #
  97. #      物品/技能备注:                                            #
  98. #                                                                              #
  99. #   score[+1]  - 使用该物品/技能后评级分数+1,如果是 score[-20] 则分数-20                 #
  100. ###--------------------------------------------------------------------------###
  101.  
  102. ###--------------------------------------------------------------------------###
  103. #      Config:                                                                 #
  104. #  These are the default values used by several of the functions in the        #
  105. #  script.  You may change these values as you find your game requires in      #
  106. #  order to give the player a better playing experience based on your game.    #
  107. #                                                                              #
  108. module CP       # Do not edit                                                  #
  109. module VICTORY  #  these two lines.                                            #
  110. #                                                                              #
  111. ###-----                                                                -----###
  112. # 跳过评级BGM的开关,开关开启时不会播放评级BGM                                #
  113. SKIP_SWITCH = 5 # 默认 = 5                                                  #
  114. #                                                                              #
  115.           #
  116. USE_MUSIC = false # 是否播放评级BGM 默认 = true                                               #
  117. VICTORY_MUSIC = nil # 评级BGM文件名  默认 = "Scene4"   如果要静音请设定为nil                               #
  118. MSX_VOL = 100 # 音量  默认 = 100                                                  #
  119. MSX_PIT = 100 # 音调  默认 = 100                                                  #
  120. #                                                                              #
  121. # 是否播放数据库里设定战斗胜利ME,true时会在评级BGM之前播放                  #
  122. USE_ME = false # 默认 = false                                               #
  123. #                                                                              #
  124. # exp值槽颜色                                              #
  125. EXP_GAUGE_1 = 30 # 颜色1 默认 = 30                                                #
  126. EXP_GAUGE_2 = 31 # 颜色2 默认 = 31                                                #
  127. EXP_ADDED = 17 # 增长部分的颜色 默认 = 17                                                  #
  128. #                                                                              #
  129. # 是否对调下方左右两个窗口的位置                   #
  130. FLIP_LOWER = false # 默认 = false                                           #
  131. #                                                                              #
  132. # 设定升级后回复hp/mp的模式                                                                   #
  133. #  0 = 升级后不会回复.                       #
  134. #  1 = 升级后根据角色hpmp的增加量,回复部分hpmp.                #
  135. #  2 = 升级后全回复.                 #
  136. HP_HEAL_TYPE = 0 # 升级后hp回复模式  默认 = 0                                                 #
  137. MP_HEAL_TYPE = 0 # 升级后hp回复模式  默认 = 0                                                 #
  138. #                                                                              #
  139. # 设定显示的文字.                                               #
  140. LEVEL_UP = "等级提升!!" # 默认 = "Level Up!!"                               #
  141. SPOILS = "战利品" # 默认 = "Spoils"                                         #
  142. EXP_NAME = "EXP" # 默认 = "EXP"                                             #
  143. DEALT_NAME = "造成伤害" # 默认 = "Dealt"                                       #
  144. RECIEVED_NAME = "受到伤害" # 默认 = "Recieved"                              #
  145. TURNS_NAME = "回合数" # 默认 = "Turns"                                       #
  146. RANK_NAME = "评级" # 默认 = "Rank"                                         #
  147. NO_DROPS = "无战利品" # 默认 = "No drops recieved"                 #
  148. #                                                                              #
  149. ###-----                                                                -----###
  150. # 是否显示升级窗口                                   #
  151. LVL_UP_ENABLE = true # 默认 = true                                          #
  152. #                                                                              #
  153.          #
  154. LVL_SFX = "Item3" # 升级音效 默认 = "Item3" 想静音请设定为nil                                         #
  155. LVL_VOL = 80 # 音量 默认 = 80                                                    #
  156. LVL_PIT = 100 # 音调 默认 = 100                                                  #
  157. #                                                                              #
  158. # 学会技能时显示的文字                    #
  159. NEW_SKILLS = "学会技能:" # 默认 = "Learned:"                                 #
  160. MORE_SKILLS = "和其他 %s 个技能" # 默认 = "And %s more skills"            #
  161. #                                                                              #
  162. ###-----                                                                -----###
  163.                                                              #
  164. USE_IMAGES = false # 是否使用图片替代评级文字 默认 = false                                           #
  165. IMAGE_NAME = "Rank" # 评级图片文件名的前缀 默认 = "Rank" 如果获得评级C
  166. #                   #则会显示 RankC.png
  167. #                                                                              #
  168. #            #
  169. IMAGE_SFX = "Shot2" # 评级音效 默认 = "Shot2"  想静音请设定为nil                                         #
  170. SFX_VOL = 100 # 音量 默认 = 100                                                  #
  171. SFX_PIT = 100 # 音调 默认 = 100                                                  #
  172. #                                                                              #
  173. # 设定评级,必须按从上到下,从小到大的顺序:                                                     #
  174. #    ["评级",  要求分数,  获得exp比率,  获得金钱比率, 获得战利品率,  文字颜色],            #
  175. # 评级 - 请写在双引号里      #
  176. # 要求分数 - 达到该评级需要的最低分数,请确定第一个评级的要求分数为 "0".                                           #
  177. # 获得exp比率 - 默认值为 100 ,如果设定为200,代表获得双倍exp,下面两个比率同理.                                              #
  178. # 获得金钱比率 - 默认值为 100.                                             #
  179. # 获得战利品率 - 默认值为 100,不影响同一物品的掉落次数,仅影响单个物品的掉落概率.                                                  #
  180. # 文字颜色 - 文字颜色,和文本颜色一样.         #
  181. RANKS =[ # Do not edit this line.                                              #
  182.  
  183.   ["E",   0, 100, 100, 100, 18],
  184.   ["D", 100, 100, 105, 100, 20],
  185.   ["C", 150, 100, 110, 105,  4],
  186.   ["B", 250, 105, 110, 110, 21],
  187.   ["A", 400, 115, 115, 115,  3],
  188.   ["S", 700, 125, 125, 125, 17],
  189.  
  190. ] # Do not edit this line.                                                     #
  191. #                                                                              #
  192. # 设定伤害率对应的获得分数       #
  193. # 给你一个公式:伤害率 = 造成伤害 / 受到伤害 *100%
  194. # 举个栗子,假如玩家受到 140 点伤害,并且造成200点伤害,
  195. # 伤害率 = 200/140*100% = 142 ,对应下表142在100~150之间,此时获得的分数
  196. # 算到较小的区间,所以最终获得的分数为50
  197. #    格式为:                                                         #
  198. #    [伤害率,  获得分数],                                                         #
  199. DAMAGE_POINTS =[ # Do not edit this line.                                      #
  200.  
  201.   [ 50,  20],
  202.   [ 80,  30],
  203.   [100,  50],
  204.   [150,  75],
  205.   [200, 100],
  206.   [300, 200],
  207.  
  208. ] # Do not edit this line.                                                     #
  209. #                                                                              #
  210. # 以下是特殊情况会获得的的分数,那一项你不需要就把那一项设定为"0".                   #
  211. #                                                                              #
  212. # 在同一回合中消灭所有敌人.                                #
  213. SINGLE_TURN = 150 # 默认 = 150                                              #
  214. # 消灭boss (请在敌人特性中设定死亡方式为boss. 此分数一场战斗中只会增加一次
  215. # 就算同一敌群有多个boss也一样.      #
  216. BOSS_POINTS = 200 # 默认 = 200                                              #
  217. # 全程无伤                                 #
  218. NO_DAMAGE = 100 # 默认 = 100                                                #
  219. # 战斗结束时全员满HP.                              #
  220. FULL_HP = 50 # 默认 = 50                                                    #
  221. # 一击必杀(只用一个技能就消灭一个敌人),对添加死亡状态的技能无效                #
  222. ONE_HIT = 40 # 默认 = 40                                                    #
  223. ###--------------------------------------------------------------------------###
  224.  
  225. ###--------------------------------------------------------------------------###
  226. #      A note to scripters:                                                    #
  227. #  As of version 2.0 I have made it possible to add custom score items to be   #
  228. #  used in battle.  These scores are handled by the "Grade" module.  If you    #
  229. #  have created a new score item you want to use, you can add it to the Grade  #
  230. #  module by using the script call "Grade.new_score(:foo, Bar)" where ":foo"   #
  231. #  is the key you will use to access the object and "Bar" is the name of the   #
  232. #  new objects class (in this case, the defining line for the object would be  #
  233. #  "class Bar < Score_Base").  You can then reach this score object at any     #
  234. #  time by using the script call "Grade.score[:foo]".  To see the base score   #
  235. #  object or any of the pre-made score object, scroll down.  The score         #
  236. #  objects have been placed at the top of the script.                          #
  237. ###--------------------------------------------------------------------------###
  238.  
  239.  
  240. ###--------------------------------------------------------------------------###
  241. #  The following lines are the actual core code of the script.  While you are  #
  242. #  certainly invited to look, modifying it may result in undesirable results.  #
  243. #  Modify at your own risk!                                                    #
  244. ###--------------------------------------------------------------------------###
  245.  
  246.  
  247. end  ## Close the VICTORY module.
  248. end  ## Close the CP module.
  249.  
  250.  
  251. ##-----
  252. ## This is a basic score item.  There are 3 main parts to this.  The initialize
  253. ## part which defines each of the score variables to be used at the start, the
  254. ## update score part, which can be used at any time to get the current score
  255. ## the item will add, and the total part, which is used by the Grade module to
  256. ## get the final value.  You can use "attr_accessor" to create values that can
  257. ## be adjusted at any time or you can create methods to adjust different aspects
  258. ## of the score object.
  259. ##-----
  260. class Score_Base  ## A score item.  Holds and adjusts an aspect of score.
  261.   def initialize
  262.     @score = 0  ## Sets the score to 0 at the start.
  263.   end
  264.  
  265.   def update_score  ## Objects used to modify the score.
  266.     return 0
  267.   end
  268.  
  269.   def total  ## Create and return the score.
  270.     update_score
  271.     return @score
  272.   end
  273. end
  274.  
  275. class Score_Damage < Score_Base
  276.   attr_accessor :dealt
  277.   attr_accessor :recieved
  278.   attr_accessor :onehit
  279.  
  280.   def initialize  ## Holds dealt and recieved damage as well as one hit scores.
  281.     super         ## Creates a score based on dealt and recieved ratio.
  282.     @dealt = 0
  283.     @recieved = 0
  284.     @onehit = 0
  285.   end
  286.  
  287.   def update_score
  288.     res = super
  289.     if @recieved == 0
  290.       CP::VICTORY::DAMAGE_POINTS.each {|point| res += point[1]}
  291.     else
  292.       dr = (@dealt * 100 / @recieved)
  293.       CP::VICTORY::DAMAGE_POINTS.each do |point|
  294.         next if dr < point[0]
  295.         res += point[1]
  296.       end
  297.     end
  298.     res += CP::VICTORY::NO_DAMAGE if @recieved == 0
  299.     res += @onehit
  300.     @score = res
  301.   end
  302. end
  303.  
  304. class Score_HP < Score_Base
  305.   def initialize  ## Holds the hp at the start of battle.
  306.     super         ## Not technically used, but checks max hp at end of battle.
  307.     @start_hp = get_party_hp
  308.   end
  309.  
  310.   def get_party_hp
  311.     return 0 if $game_party.battle_members.empty?
  312.     result = 0
  313.     $game_party.battle_members.each do |member|
  314.       result += member.hp
  315.     end
  316.     return result
  317.   end
  318.  
  319.   def get_max_hp
  320.     return 0 if $game_party.battle_members.empty?
  321.     result = 0
  322.     $game_party.battle_members.each do |member|
  323.       result += member.mhp
  324.     end
  325.     return result
  326.   end
  327.  
  328.   def update_score
  329.     res = super
  330.     res += CP::VICTORY::FULL_HP if get_party_hp == get_max_hp
  331.     @score = res
  332.   end
  333. end
  334.  
  335. class Score_Troop < Score_Base
  336.   def update_score  ## Gets score values from the existance of boss monsters
  337.     res = super     ## as well as adding custom scores per monster.
  338.     res += CP::VICTORY::BOSS_POINTS if $game_troop.check_boss
  339.     res += CP::VICTORY::SINGLE_TURN if $game_troop.turn_count == 1
  340.     $game_troop.members.each {|foe| res += foe.add_score}
  341.     @score = res
  342.   end
  343. end
  344.  
  345. class Score_Skill < Score_Base
  346.   attr_accessor :karma
  347.  
  348.   def initialize
  349.     super
  350.     @karma = 0
  351.   end
  352.  
  353.   def update_score
  354.     res = super
  355.     res += @karma
  356.     @score = res
  357.   end
  358. end
  359.  
  360. module Grade
  361.   def self.reset  ## Holds score objects, score, and grades.
  362.     @rate = CP::VICTORY::RANKS[0]
  363.     @score = 0
  364.     create_score_items
  365.   end
  366.  
  367.   def self.create_score_items  ## Creates the default score items.
  368.     @score_items = {}
  369.     new_score(:damage, Score_Damage)
  370.     new_score(:hp,     Score_HP)
  371.     new_score(:troop,  Score_Troop)
  372.     new_score(:skill,  Score_Skill)
  373.   end
  374.  
  375.   def self.new_score(key, scr)  ## Adds a custom score item.
  376.     @score_items[key] = scr.new
  377.   end
  378.  
  379.   def self.update_score  ## Creates a score.
  380.     return 0 if @score_items.empty?
  381.     val = 0
  382.     @score_items.each do |key, score|
  383.       val += score.total
  384.     end
  385.     @score = val
  386.   end
  387.  
  388.   def self.update_rate  ## Updates the rank and grade.
  389.     update_score
  390.     rank_top = 0
  391.     CP::VICTORY::RANKS.each do |rank|
  392.       next if rank[1] > @score
  393.       if rank[1] > rank_top
  394.         @rate = rank
  395.         rank_top = rank[1]
  396.       end
  397.     end
  398.   end
  399.  
  400.   def self.score  ## Returns the score.
  401.     return @score
  402.   end
  403.  
  404.   def self.rate(key = nil)  ## Gets bits of all of the rate.
  405.     update_rate
  406.     case key
  407.     when :exp
  408.       return @rate[2]
  409.     when :gold
  410.       return @rate[3]
  411.     when :drop
  412.       return @rate[4]
  413.     else
  414.       return @rate
  415.     end
  416.   end
  417.  
  418.   def self.score_items  ## Gets all score items for usage.
  419.     return @score_items
  420.   end
  421. end
  422.  
  423. ##-----
  424. ## End of score object.  The rest of the script is below.
  425. ##-----
  426.  
  427. module CP
  428. module VICTORY
  429. SCORE  = /SCORE\[(\d+)\]/i
  430. KARMA  = /SCORE\[(\+|\-)?(\d+)\]/i
  431. DROPS  = /DROP\[(\w+):(\d+):(\d+):?(\d*)\]/i
  432. ONEHIT = /ONEHIT\[(\d+)\]/i
  433. end  ## Used for added drops.
  434. end
  435.  
  436. $imported = {} if $imported == nil
  437. $imported["CP_VICTORY"] = 2.1
  438.  
  439. module BattleManager
  440.   class << self
  441.  
  442.   ## Aliased to add certain new settings to the module.
  443.   alias setup_cp_vict setup unless $@
  444.   def setup(troop_id, can_escape = true, can_lose = false)
  445.     Grade.reset
  446.     setup_cp_vict(troop_id, can_escape, can_lose)
  447.     @victory = false
  448.     @played_bgm = 0
  449.     @old_levels = {}; @old_skills = {}
  450.     $game_party.all_members.each do |actr|
  451.       id = actr.actor_id; lvl = actr.level; skl = actr.skills
  452.       @old_levels[id] = lvl; @old_skills[id] = skl
  453.     end
  454.   end
  455.  
  456.   ## Gets the level or skills of the actors from before battle.
  457.   def old_levels(id); return @old_levels[id]; end
  458.   def old_skills(id); return @old_skills[id]; end
  459.  
  460.   ## Helps determine if the victory screen is active.
  461.   def victory_phase?
  462.     @phase == :victory
  463.   end
  464.  
  465.   ## Determine if all musics should be skipped.
  466.   def skip?
  467.     $game_switches[CP::VICTORY::SKIP_SWITCH]
  468.   end
  469.  
  470.   ## Aliased to skip bgm change if the switch is flipped.
  471.   alias play_battle_bgm_cpv play_battle_bgm unless $@
  472.   def play_battle_bgm
  473.     play_battle_bgm_cpv unless skip?
  474.   end
  475.  
  476.   ## Overwritten for the new victory screen.
  477.   def process_victory
  478.     return if @victory; @victory = true
  479.     $game_system.battle_end_me.play if CP::VICTORY::USE_ME && !skip?
  480.     RPG::BGM.fade(500) unless skip? || CP::VICTORY::USE_ME
  481.     20.times do; Graphics.update; end
  482.     SceneManager.scene.close_status_window
  483.     Audio.return_audio if $imported["CP_CROSSFADE"]
  484.     play_battle_end_me unless skip?  ## Skip the bgm change again.
  485.     @phase = :victory
  486.     SceneManager.scene.show_victory_windows
  487.     exp = gain_exp
  488.     gold = gain_gold
  489.     gain_drop_items
  490.     turns = $game_troop.turn_count
  491.     dlt = Grade.score_items[:damage].dealt
  492.     rcv = Grade.score_items[:damage].recieved
  493.     SceneManager.scene.update_scores(dlt, rcv, turns)
  494.     SceneManager.scene.update_window_rates(exp, gold, Grade.rate[4])
  495.     # <XR> 代入数组,分别显示经验
  496.     SceneManager.scene.exp_window_update(exp)
  497.     return true
  498.   end
  499.  
  500.   ## Added to actually leave battle.
  501.   def victory_end
  502.     RPG::BGM.fade(500) unless skip?
  503.     20.times do; Graphics.update; end
  504.     SceneManager.return
  505.     battle_end(0)
  506.     replay_bgm_and_bgs unless skip? || $BTEST
  507.   end
  508.  
  509.   ## Skipped if music is not made to change.
  510.   def play_battle_end_me
  511.     return if @played_bgm > 1
  512.     @played_bgm += CP::VICTORY::USE_ME ? 1 : 2
  513.     Audio.bgm_stop
  514.     if CP::VICTORY::USE_MUSIC
  515.       mus = CP::VICTORY::VICTORY_MUSIC
  516.       vol = (CP::VICTORY::USE_ME && @played_bgm == 1) ? 0 : CP::VICTORY::MSX_VOL
  517.       pit = CP::VICTORY::MSX_PIT
  518.       RPG::BGM.new(mus, vol, pit).play unless mus.nil?
  519.     else
  520.       $game_system.battle_end_me.play
  521.       replay_bgm_and_bgs unless $BTEST
  522.     end
  523.   end
  524.  
  525.   ## Adjusts the gold rate.
  526.   def gain_gold
  527.     if $game_troop.gold_total > 0
  528.       rate = Grade.rate(:gold)
  529.       gold = $game_troop.gold_total
  530.       gold = gold * rate / 100
  531.       $game_party.gain_gold(gold)
  532.     else
  533.       gold = 0
  534.     end
  535.     return gold
  536.   end
  537.  
  538.   ## Adjusts the drop rate.
  539.   def gain_drop_items
  540.     drops = []
  541.     rate = Grade.rate(:drop)
  542.     $game_troop.make_drop_items(rate).each do |item|
  543.       $game_party.gain_item(item, 1)
  544.       drops.push(item)
  545.     end
  546.     SceneManager.scene.drop_items(drops)
  547.   end
  548.  
  549.   ## Adjusts the exp rate.
  550.   def gain_exp
  551.     rate = Grade.rate(:exp)
  552.     # <XR> 用数组分别记录各自得到的经验
  553.     $game_party.all_members.each do |actor|
  554.       actor.gain_exp_cpv($game_troop.exp_total, rate)
  555.       # <XR>
  556.     end
  557.     # <XR>
  558.     return $game_troop.exp_total * rate / 100
  559.   end
  560.  
  561.   end
  562. end
  563.  
  564. class Game_Troop < Game_Unit
  565.   ## Checks if a monster has the boss kill flag set.
  566.   def check_boss
  567.     members.each do |enemy|
  568.       next unless enemy.collapse_type == 1
  569.       return true
  570.     end
  571.     return false
  572.   end
  573.  
  574.   ## Adjusted drop rate.
  575.   def make_drop_items(rate = 100)
  576.     dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items(rate) }
  577.   end
  578. end
  579.  
  580. class Game_Battler < Game_BattlerBase
  581.   ## Aliased to add damage dealt and recieved to a value for later.
  582.   alias exec_damage_cpv execute_damage unless $@
  583.   def execute_damage(user)
  584.     if @result.hp_damage > 0
  585.       i = [@result.hp_damage, hp].min
  586.       Grade.score_items[:damage].dealt += i if enemy?
  587.       Grade.score_items[:damage].recieved += i if !enemy?
  588.       if hp == mhp && i >= mhp && enemy?
  589.         Grade.score_items[:damage].onehit += @one_hit
  590.       end
  591.     end
  592.     exec_damage_cpv(user)
  593.   end
  594. end
  595.  
  596. class Game_Enemy < Game_Battler
  597.   attr_accessor :add_score
  598.   attr_accessor :one_hit
  599.  
  600.   ## Gets the default added points for an enemy.
  601.   alias cp_gbv_initialize initialize unless $@
  602.   def initialize(index, enemy_id)
  603.     cp_gbv_initialize(index, enemy_id)
  604.     enemy = $data_enemies[@enemy_id]
  605.     @add_score = enemy.add_score
  606.     @one_hit = enemy.one_hit
  607.   end
  608.  
  609.   ## The actual adjusted drop rate.
  610.   def make_drop_items(rate = 100)
  611.     cpi = rate.to_f / 100
  612.     enemy.drop_items.inject([]) do |r, di|
  613.         if di.kind > 0 && rand * di.denominator < drop_item_rate * cpi
  614.         if Grade.score >= di.req_grade
  615.           r.push(item_object(di.kind, di.data_id))
  616.         else
  617.           r
  618.         end
  619.       else
  620.         r
  621.       end
  622.     end
  623.   end
  624. end
  625.  
  626. class Game_Actor < Game_Battler
  627.   attr_reader :actor_id
  628.  
  629.   alias cp_gv_level_up level_up unless $@
  630.   def level_up
  631.     tmp1 = mhp
  632.     tmp2 = mmp
  633.     cp_gv_level_up
  634.     heal1 = mhp - tmp1
  635.     heal2 = mmp - tmp2
  636.     case CP::VICTORY::HP_HEAL_TYPE
  637.     when 1; self.hp += heal1
  638.     when 2; self.hp = mhp
  639.     end
  640.     case CP::VICTORY::MP_HEAL_TYPE
  641.     when 1; self.mp += heal2
  642.     when 2; self.mp = mmp
  643.     end
  644.   end
  645.  
  646.   ## Just made a whole new exp event here.  Adjusts the rate.
  647.   def gain_exp_cpv(exp, vic_rate = 100)
  648.     change_exp(self.exp + (exp * vic_rate * final_exp_rate / 100).to_i, false)
  649.   end
  650.  
  651.   ## Determines the exp for the last level.
  652.   def last_level_exp
  653.     return 0 if @level <= 0
  654.     return exp_for_level(@level - 1)
  655.   end
  656. end
  657.  
  658. class Scene_Battle < Scene_Base
  659.   if $imported["YSA-PCTB"]
  660.   alias cp_bv_fix_yami_pctb update_pctb_speed unless $@
  661.   def update_pctb_speed
  662.     return if BattleManager.victory_phase?
  663.     cp_bv_fix_yami_pctb
  664.   end
  665.   end
  666.  
  667.   ## Overwritten to stop stuff from happening during the victory phase.
  668.   def update
  669.     super
  670.     if BattleManager.in_turn?
  671.       process_event
  672.       process_action
  673.     end
  674.     BattleManager.judge_win_loss unless BattleManager.victory_phase?
  675.     if BattleManager.victory_phase?
  676.       if @victory_score.done and @victory_score.active
  677.         sfx = CP::VICTORY::IMAGE_SFX
  678.         vol = CP::VICTORY::SFX_VOL
  679.         pit = CP::VICTORY::SFX_PIT
  680.         RPG::SE.new(sfx, vol, pit).play unless sfx.nil?
  681.         @victory_score.active = false
  682.         @victory_item.active = true
  683.       end
  684.     end
  685.   end
  686.  
  687.   ## Terminates the sprites and extra windows at the end of battle.
  688.   alias cp_gv_dispose_all_windows dispose_all_windows unless $@
  689.   def dispose_all_windows
  690.     remove_sprite
  691.     cp_gv_dispose_all_windows
  692.   end
  693.  
  694.   ## Applies score loss/gain when using an item/skill.
  695.   alias cp_gv_use_item use_item unless $@
  696.   def use_item
  697.     item = @subject.current_action.item
  698.     Grade.score_items[:skill].karma += item.add_score
  699.     cp_gv_use_item
  700.   end
  701.  
  702.   ## Closes the status window sorta.
  703.   def close_status_window
  704.     instance_variables.each do |varname|
  705.       ivar = instance_variable_get(varname)
  706.       ivar.openness = 0 if ivar.is_a?(Window)
  707.     end
  708.   end
  709.  
  710.   ## The next few call stuff.
  711.   def exp_window_update(exp)
  712.     @victory_main.redraw_exp(exp)
  713.     create_leveled_windows
  714.     pack_and_send
  715.   end
  716.  
  717.   def update_window_rates(exp, gold, item)
  718.     @victory_rank.get_rates(exp, gold)
  719.     @victory_item_top.get_rates(item)
  720.   end
  721.  
  722.   def update_scores(dealt, recieved, turns)
  723.     @victory_score.draw_score(CP::VICTORY::DEALT_NAME, dealt, 0)
  724.     @victory_score.draw_score(CP::VICTORY::RECIEVED_NAME, recieved, 24)
  725.     @victory_score.draw_score(CP::VICTORY::TURNS_NAME, turns, 48)
  726.     @victory_score.rank_stuff
  727.   end
  728.  
  729.   def show_victory_windows
  730.     @victory_main = Window_VictoryMain.new
  731.     @victory_top = Window_VictoryTop.new
  732.     @victory_score = Window_VictoryScore.new
  733.     @victory_rank = Window_VictoryRank.new
  734.     @victory_item_top = Window_VictoryItemTop.new
  735.     @victory_item = Window_VictoryItem.new
  736.     @victory_main.openness = 0
  737.     @victory_top.openness = 0
  738.     @victory_score.openness = 0
  739.     @victory_rank.openness = 0
  740.     @victory_item_top.openness = 0
  741.     @victory_item.openness = 0
  742.     @victory_main.open
  743.     @victory_top.open
  744.     @victory_score.open
  745.     @victory_rank.open
  746.     @victory_item_top.open
  747.     @victory_item.open
  748.     if CP::VICTORY::USE_IMAGES
  749.       @victory_score.active = true
  750.     else
  751.       @victory_item.active = true
  752.     end
  753.   end
  754.  
  755.   def create_leveled_windows
  756.     @leveled = []
  757.     return if @victory_main.leveled.empty?
  758.     @victory_main.leveled.each {|actor| @leveled.push(Window_LvlUp.new(actor))}
  759.     @leveled.each {|wind| wind.visible = false}
  760.   end
  761.  
  762.   def pack_and_send
  763.     ar1 = [@victory_main, @victory_top, @victory_score, @victory_rank,
  764.            @victory_item_top, @victory_item]
  765.     @victory_item.get_windows(ar1, @leveled)
  766.   end
  767.  
  768.   def remove_sprite
  769.     @victory_score.remove_sprite unless @victory_score.nil? || @victory_score.disposed?
  770.     return if @leveled.nil? || @leveled.empty?
  771.     @leveled.each {|wind| wind.dispose}
  772.   end
  773.  
  774.   ## This pushes the drop items to the drop window.
  775.   def drop_items(drops)
  776.     @victory_item.get_drops(drops)
  777.   end
  778. end
  779.  
  780. ## The main window with the character faces.
  781. class Window_VictoryMain < Window_Selectable
  782.   attr_reader :leveled
  783.  
  784.   def initialize
  785.     super(0, 48, Graphics.width, 152)
  786.     @index = -1
  787.     @leveled = []
  788.     draw_all_items
  789.   end
  790.  
  791.   def draw_all_items
  792.     item_max.times {|i| draw_item(i) }
  793.   end
  794.  
  795.   def redraw_exp(exp)
  796.     #<XR> 以前 exp 是数值,现在是数组,所以改为 exp[i]
  797.     item_max.times {|i| draw_exp(i, exp) }
  798.   end
  799.  
  800.   def draw_item(index)
  801.     actor = $game_party.members[index]
  802.     rect = item_rect(index)
  803.     draw_victory_face(actor, rect)
  804.     draw_actor_exp_info(actor, rect.x, rect.y + 104, rect.width)
  805.   end
  806.  
  807.   def draw_victory_face(actor, orect)
  808.     bitmap = Cache.face(actor.face_name)
  809.     rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
  810.     fx = (orect.width - 96) / 2
  811.     temp_bit = Bitmap.new(orect.width, orect.height)
  812.     temp_bit.blt(fx, 0, bitmap, rect)
  813.     contents.blt(orect.x, orect.y, temp_bit, temp_bit.rect)
  814.   end
  815.  
  816.   def draw_exp(index, exp)
  817.     actor = $game_party.members[index]
  818.     rect = item_rect(index)
  819.     draw_actor_exp_info(actor, rect.x, rect.y + 104, rect.width, exp)
  820.   end
  821.  
  822.   def draw_actor_exp_info(actor, x, y, width, aexp = 0)
  823.     x += (width - 96) / 2
  824.     width = [width, 96].min
  825.     aexr = aexp * actor.exr
  826.     cexp = actor.exp - actor.current_level_exp
  827.     nexp = actor.next_level_exp - actor.current_level_exp
  828.     if cexp - aexr >= 0
  829.       rate = cexp.to_f / nexp
  830.       rate = 1.0 if rate > 1.0
  831.       gc1 = text_color(CP::VICTORY::EXP_ADDED)
  832.       gc2 = text_color(CP::VICTORY::EXP_ADDED)
  833.       draw_gauge(x, y, width, rate, gc1, gc2)
  834.       cexp -= aexr
  835.       rate = cexp.to_f / nexp
  836.       rate = 1.0 if rate > 1.0
  837.       rate = 1.0 if actor.level == actor.max_level
  838.       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1)
  839.       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2)
  840.       draw_gauge_clear(x, y, width, rate, gc1, gc2)
  841.     else
  842.       rate = 1.0
  843.       gc1 = text_color(CP::VICTORY::EXP_ADDED)
  844.       gc2 = text_color(CP::VICTORY::EXP_ADDED)
  845.       draw_gauge(x, y, width, rate, gc1, gc2)
  846.       cexp = actor.exp - actor.last_level_exp - aexr
  847.       nexp = actor.current_level_exp - actor.last_level_exp
  848.       rate = cexp.to_f / nexp
  849.       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1)
  850.       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2)
  851.       draw_gauge_clear(x, y, width, rate, gc1, gc2)
  852.       change_color(normal_color)
  853.       draw_text(x, y, width, line_height, CP::VICTORY::LEVEL_UP, 1)
  854.       @leveled.push(actor)
  855.     end
  856.   end
  857.  
  858.   def draw_gauge_clear(x, y, width, rate, color1, color2)
  859.     fill_w = (width * rate).to_i
  860.     gauge_y = y + line_height - 8
  861.     contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
  862.   end
  863.  
  864.   def item_max
  865.     $game_party.battle_members.size
  866.   end
  867.  
  868.   def item_height
  869.     return 128
  870.   end
  871.  
  872.   def col_max
  873.     $game_party.max_battle_members
  874.   end
  875.  
  876.   def spacing
  877.     return 0
  878.   end
  879. end
  880.  
  881. ## The window at the top that says victory stuff.
  882. class Window_VictoryTop < Window_Base
  883.   def initialize
  884.     super(0, 0, Graphics.width, 48)
  885.     draw_title
  886.   end
  887.  
  888.   def draw_title
  889.     title = sprintf(Vocab::Victory, $game_party.name)
  890.     change_color(normal_color)
  891.     draw_text(0, 0, contents.width, line_height, title, 1)
  892.   end
  893. end
  894.  
  895. ## The window that shows rank and score stuff.
  896. class Window_VictoryScore < Window_Base
  897.   attr_accessor :done
  898.  
  899.   def initialize
  900.     side = CP::VICTORY::FLIP_LOWER ? Graphics.width / 2 : 0
  901.     super(side, 200, Graphics.width / 2, Graphics.height - 272)
  902.     @done = false
  903.     setup_image if CP::VICTORY::USE_IMAGES
  904.   end
  905.  
  906.   def update
  907.     super
  908.     unless @rank.nil? or @done or !open?
  909.       @rank.opacity += 25
  910.       @rank.zoom_x -= 0.2
  911.       @rank.zoom_y -= 0.2
  912.       if @rank.zoom_y < 1.0
  913.         @done = true
  914.         @rank.zoom_x = 1.0
  915.         @rank.zoom_y = 1.0
  916.       end
  917.     end
  918.   end
  919.  
  920.   def setup_image
  921.     @rank = Sprite.new
  922.   end
  923.  
  924.   def hide_image
  925.     @rank.visible = false if @rank
  926.   end
  927.  
  928.   def remove_sprite
  929.     @rank.dispose unless @rank.nil?
  930.   end
  931.  
  932.   def draw_score(name, value, y)
  933.     change_color(system_color)
  934.     draw_text(16, y, contents.width-32, 24, name, 0)
  935.     change_color(normal_color)
  936.     draw_text(16, y, contents.width-32, 24, value, 2)
  937.   end
  938.  
  939.   def rank_stuff
  940.     draw_rank
  941.     draw_image if CP::VICTORY::USE_IMAGES
  942.   end
  943.  
  944.   def draw_image
  945.     ranking = CP::VICTORY::IMAGE_NAME + Grade.rate[0]
  946.     @rank.bitmap = Cache.system(ranking)
  947.     @rank.ox = @rank.bitmap.width / 2
  948.     @rank.oy = @rank.bitmap.height / 2
  949.     @rank.opacity = 0
  950.     @rank.zoom_x = 5.0
  951.     @rank.zoom_y = 5.0
  952.     @rank.x = x + width - padding - 16 - @rank.bitmap.width / 2
  953.     @rank.y = y + height - padding - 16
  954.     @rank.z = z + 800
  955.   end
  956.  
  957.   def draw_rank
  958.     color = Grade.rate[5]
  959.     rank = Grade.rate[0]
  960.     change_color(system_color)
  961.     contents.font.size = 32
  962.     fs = contents.font.size
  963.     draw_text(16, contents.height-fs, contents.width-32, fs, CP::VICTORY::RANK_NAME, 0)
  964.     change_color(normal_color) if color.nil?
  965.     change_color(text_color(color)) unless color.nil?
  966.     draw_text(16, contents.height-fs, contents.width-32, fs, rank, 2) unless CP::VICTORY::USE_IMAGES
  967.   end
  968. end
  969.  
  970. ## The window that shows exp and gold.
  971. class Window_VictoryRank < Window_Base
  972.   def initialize
  973.     side = CP::VICTORY::FLIP_LOWER ? Graphics.width / 2 : 0
  974.     super(side, Graphics.height - 72, Graphics.width / 2, 72)
  975.   end
  976.  
  977.   def get_rates(exp, gold)
  978.     draw_object(Grade.rate[2], CP::VICTORY::EXP_NAME, exp, 0)
  979.     draw_object(Grade.rate[3], Vocab.currency_unit, gold, 24)
  980.   end
  981.  
  982.   def draw_object(rate, name, value, y)
  983.     change_color(normal_color)
  984.     draw_text(16, y, contents.width - 32, 24, value, 0)
  985.     n = contents.text_size(value).width
  986.     change_color(system_color)
  987.     draw_text(n + 20, y, contents.width - n - 36, 24, name, 0)
  988.     change_color(normal_color)
  989.     text = rate.to_s + "%"
  990.     draw_text(16, y, contents.width - 32, 24, text, 2)
  991.   end
  992. end
  993.  
  994. ## The window that shows drop rate.
  995. class Window_VictoryItemTop < Window_Base
  996.   def initialize
  997.     side = CP::VICTORY::FLIP_LOWER ? 0 : Graphics.width / 2
  998.     super(side, 200, Graphics.width / 2, 48)
  999.   end
  1000.  
  1001.   def get_rates(rate)
  1002.     change_color(system_color)
  1003.     draw_text(16, 0, contents.width-32, 24, CP::VICTORY::SPOILS, 0)
  1004.     change_color(normal_color)
  1005.     text = rate.to_s + "%"
  1006.     draw_text(16, 0, contents.width-32, 24, text, 2)
  1007.   end
  1008. end
  1009.  
  1010. ## The window that shows items.  You can scroll through the items in it.
  1011. class Window_VictoryItem < Window_Selectable
  1012.   def initialize
  1013.     side = CP::VICTORY::FLIP_LOWER ? 0 : Graphics.width / 2
  1014.     super(side, 248, Graphics.width / 2, Graphics.height - 248)
  1015.     @index = 0
  1016.   end
  1017.  
  1018.   def item_max
  1019.     @data ? @data.size : 0
  1020.   end
  1021.  
  1022.   def draw_all_items
  1023.     return super if item_max > 0
  1024.     draw_null
  1025.   end
  1026.  
  1027.   def draw_item(index)
  1028.     item = @data[index]
  1029.     if item
  1030.       rect = item_rect(index)
  1031.       rect.width -= 4
  1032.       draw_item_name(item, rect.x, rect.y)
  1033.       draw_item_number(rect, index)
  1034.     end
  1035.   end
  1036.  
  1037.   def draw_null
  1038.     rect = item_rect(0)
  1039.     rect.width -= 4
  1040.     draw_text(rect, CP::VICTORY::NO_DROPS, 1)
  1041.   end
  1042.  
  1043.   def draw_item_number(rect, index)
  1044.     draw_text(rect, sprintf(":%2d", @number[index]), 2)
  1045.   end
  1046.  
  1047.   def get_drops(drops)
  1048.     @data = []
  1049.     @number = []
  1050.     for i in 0...drops.size
  1051.       ind = @data.index(drops[i])
  1052.       if ind.nil?
  1053.         @data.push(drops[i])
  1054.         @number.push(1)
  1055.       else
  1056.         @number[ind] += 1
  1057.       end
  1058.     end
  1059.     self.refresh
  1060.   end
  1061.  
  1062.   def get_windows(ar1, ar2)
  1063.     @done = 0
  1064.     @ar1 = ar1
  1065.     @ar2 = ar2
  1066.   end
  1067.  
  1068.   def process_handling
  1069.     return unless open? && active
  1070.     BattleManager.victory_end if Input.trigger?(:B)
  1071.     check_leveled_up if Input.trigger?(:C)
  1072.   end
  1073.  
  1074.   def check_leveled_up
  1075.     @done = 0 if @done.nil?; @done += 1
  1076.     return BattleManager.victory_end unless CP::VICTORY::LVL_UP_ENABLE
  1077.     return BattleManager.victory_end if @ar2.nil?
  1078.     return BattleManager.victory_end if @done > @ar2.size
  1079.     sfx = CP::VICTORY::LVL_SFX
  1080.     vol = CP::VICTORY::LVL_VOL
  1081.     pit = CP::VICTORY::LVL_PIT
  1082.     RPG::SE.new(sfx, vol, pit).play unless sfx.nil?
  1083.     @ar1.each {|wind| wind.visible = false}
  1084.     @ar2.each {|wind| wind.visible = false}
  1085.     @ar1[2].hide_image
  1086.     @ar2[@done - 1].visible = true
  1087.   end
  1088.  
  1089.   def update
  1090.     super
  1091.     if Audio.bgm_pos != 0
  1092.       BattleManager.play_battle_end_me
  1093.     end
  1094.   end
  1095.  
  1096.   def refresh
  1097.     contents.clear
  1098.     create_contents
  1099.     draw_all_items
  1100.   end
  1101. end
  1102.  
  1103. ## Modifies a skill's score modification when used.
  1104. class RPG::UsableItem < RPG::BaseItem
  1105.   def add_score
  1106.     karma_modif if @add_score.nil?
  1107.     return @add_score
  1108.   end
  1109.  
  1110.   def karma_modif
  1111.     @add_score = 0
  1112.     self.note.split(/[\r\n]+/).each do |line|
  1113.       case line
  1114.       when CP::VICTORY::KARMA
  1115.         @add_score = ($1.to_s + $2.to_s).to_i
  1116.       end
  1117.     end
  1118.   end
  1119. end
  1120.  
  1121. class RPG::Enemy::DropItem
  1122.   def req_grade
  1123.     return @req_grade ? @req_grade : 0
  1124.   end
  1125.  
  1126.   def req_grade=(val)
  1127.     @req_grade = val
  1128.   end
  1129. end
  1130.  
  1131. ## Modifies the enemy's drops from the database.
  1132. class RPG::Enemy < RPG::BaseItem
  1133.   def add_score
  1134.     add_drops if @add_score.nil?
  1135.     return @add_score
  1136.   end
  1137.  
  1138.   def one_hit
  1139.     add_drops if @one_hit.nil?
  1140.     return @one_hit
  1141.   end
  1142.  
  1143.   def drop_items
  1144.     add_drops if @added_drops.nil?
  1145.     return @drop_items
  1146.   end
  1147.  
  1148.   def add_drops
  1149.     @added_drops = true
  1150.     @add_score = 0
  1151.     @one_hit = CP::VICTORY::ONE_HIT
  1152.     self.note.split(/[\r\n]+/).each do |line|
  1153.       case line
  1154.       when CP::VICTORY::DROPS
  1155.         temp = RPG::Enemy::DropItem.new
  1156.         case $1.to_s
  1157.         when "I", "i"
  1158.           temp.kind = 1
  1159.         when "W", "w"
  1160.           temp.kind = 2
  1161.         when "A", "a"
  1162.           temp.kind = 3
  1163.         end
  1164.         temp.data_id = $2.to_i
  1165.         temp.denominator = $3.to_i
  1166.         temp.req_grade = $4.to_i
  1167.         @drop_items.push(temp)
  1168.       when CP::VICTORY::SCORE
  1169.         @add_score = $1.to_i
  1170.       when CP::VICTORY::ONEHIT
  1171.         @one_hit = $1.to_i
  1172.       end
  1173.     end
  1174.   end
  1175. end
  1176.  
  1177. ## Creates windows at the end of the victory screen that display level up stats.
  1178. class Window_LvlUp < Window_Base
  1179.   def initialize(actor)
  1180.     @actor = actor  ## Gets the actor, old level, and new skills.
  1181.     @old_level = BattleManager.old_levels(actor.actor_id)
  1182.     @skills = actor.skills - BattleManager.old_skills(actor.actor_id)
  1183.     create_params  ## Creates all params.  Here for custom params.
  1184.     super(0, 0, box_width, box_height)  ## Creates and moves the box.
  1185.     self.x = (Graphics.width - width) / 2
  1186.     self.y = (Graphics.height - height) / 2
  1187.     refresh
  1188.   end
  1189.  
  1190.   ## Creates the entire list of params.
  1191.   def create_params
  1192.     @params = []
  1193.     8.times do |i|
  1194.       p1 = @actor.class.params[i, @old_level]
  1195.       p2 = @actor.class.params[i, @actor.level]
  1196.       vocab = Vocab.param(i)
  1197.       add_param(vocab, p1, p2)
  1198.     end
  1199.   end
  1200.  
  1201.   ## Adds a param to the list.
  1202.   def add_param(vocab, p1, p2)
  1203.     @params.push([vocab, p1, p2])
  1204.   end
  1205.  
  1206.   ## Width of the box based on whether any new skills were learned.
  1207.   def box_width
  1208.     wd = @skills.empty? ? 240 : 480
  1209.     return wd + standard_padding * 2
  1210.   end
  1211.  
  1212.   ## Height of the box based on total params.
  1213.   def box_height
  1214.     return line_height + 104 + line_height * (@params.size + 1)
  1215.   end
  1216.  
  1217.   ## Refreshed the box contents.
  1218.   def refresh
  1219.     contents.clear
  1220.     draw_header
  1221.     draw_face_area(line_height * 1.5)
  1222.     draw_attr_area(0, line_height * 2 + 104)
  1223.     draw_skill_area(240, line_height * 2 + 104)
  1224.   end
  1225.  
  1226.   ## Draws the level up header.
  1227.   def draw_header
  1228.     x = (contents.width - 240) / 2
  1229.     ml = 0
  1230.     p1 = @old_level
  1231.     p2 = @actor.level
  1232.     ml = contents.text_size(p1).width if contents.text_size(p1).width > ml
  1233.     ml = contents.text_size(p2).width if contents.text_size(p2).width > ml
  1234.     ml += 4
  1235.     mo = 236 - ml
  1236.     change_color(system_color)
  1237.     draw_text(x + 2, 0, mo - ml - 22, line_height, CP::VICTORY::LEVEL_UP, 0)
  1238.     draw_text(x + mo - 22, 0, 22, line_height, "→", 1)
  1239.     change_color(normal_color)
  1240.     draw_text(x + mo - ml - 22, 0, ml, line_height, p1, 2)
  1241.     change_color(power_up_color)
  1242.     draw_text(x + mo, 0, ml, line_height, p2, 2)
  1243.   end
  1244.  
  1245.   ## Draws the params section.
  1246.   def draw_attr_area(x, y)
  1247.     ml = 0
  1248.     @params.each do |p|  ## Find the wides param.
  1249.       ml = contents.text_size(p[1]).width if contents.text_size(p[1]).width > ml
  1250.       ml = contents.text_size(p[2]).width if contents.text_size(p[2]).width > ml
  1251.     end
  1252.     ml += 4  ## Set params box size.
  1253.     mo = 236 - ml  ## Last object's location.
  1254.     @params.each_with_index do |para, i|
  1255.       ylh = y + i * line_height  ## Gets the y location.
  1256.       change_color(system_color)  ## Draws the name and arrow.
  1257.       draw_text(x + 2, ylh, mo - ml - 22, line_height, para[0], 0)
  1258.       draw_text(x + mo - 22, ylh, 22, line_height, "→", 1)
  1259.       change_color(normal_color)  ## Draws the old and new stats.
  1260.       draw_text(x + mo - ml - 22, ylh, ml, line_height, para[1], 2)
  1261.       change_color(para[2] > para[1] ? power_up_color : power_down_color)
  1262.       change_color(normal_color) if para[1] == para[2]
  1263.       draw_text(x + mo, ylh, ml, line_height, para[2], 2)
  1264.     end
  1265.   end
  1266.  
  1267.   def draw_face_area(y)  ## Draws the area with the face, name, and class.
  1268.     xi = (contents.width - 216) / 2
  1269.     draw_actor_name(@actor, xi + 104, y + 0 * line_height)
  1270.     draw_actor_class(@actor, xi + 104, y + 1 * line_height)
  1271.     draw_actor_face(@actor, xi + 4, y + 4)
  1272.   end
  1273.  
  1274.   def draw_skill_area(x, y)  ## Draw skill names.
  1275.     change_color(system_color)  ## First, draw the skill message.
  1276.     draw_text(x + 18, y, 220, line_height, CP::VICTORY::NEW_SKILLS, 1)
  1277.     change_color(normal_color)  ## Next, check if there are too many skills.
  1278.     if @skills.size > @params.size - 1
  1279.       total = @params.size-3
  1280.       total.times do |i|
  1281.         item = @skills[i]  ## Draws only so many skills.
  1282.         draw_item_name(item, x + 18, y + (i + 1) * line_height, true, 220)
  1283.       end  ## Draws the final message.
  1284.       draw_text(x + 18, y + (@params.size - 2) * line_height, 220, line_height,
  1285.                 more_skills, 1)
  1286.     else
  1287.       @skills.each_with_index do |item, i|  ## Draws all skills.
  1288.         draw_item_name(item, x + 18, y + (i + 1) * line_height, true, 220)
  1289.       end
  1290.     end
  1291.   end
  1292.  
  1293.   def more_skills  ## Gets the more skills text.
  1294.     more = @skills.size - @params.size
  1295.     return sprintf(CP::VICTORY::MORE_SKILLS, more)
  1296.   end
  1297. end
  1298.  
  1299.  
  1300. ###--------------------------------------------------------------------------###
  1301. #  End of script.                                                              #
  1302. ###--------------------------------------------------------------------------###


Project10.rar (1.41 MB, 下载次数: 41)
附件全局搜索########能看到我改过的地方

Lv5.捕梦者

梦石
0
星屑
24292
在线时间
5047 小时
注册时间
2016-3-8
帖子
1618
2
 楼主| 发表于 2020-9-15 00:39:32 | 只看该作者
本帖最后由 alexncf125 于 2020-9-15 00:42 编辑

没大神在...唯有乱改一通...在这位置加上紅字那几句...貌似就解決了...
class Scene_Battle < Scene_Base
  def update
    super
    if BattleManager.in_turn?
      process_event
      process_action
      if $game_troop.all_dead?
        @status_window.hide
        @party_command_window.close
      end

    end
    BattleManager.judge_win_loss unless BattleManager.victory_phase?
    if BattleManager.victory_phase?
      if @victory_score.done and @victory_score.active
        sfx = CP::VICTORY::IMAGE_SFX
        vol = CP::VICTORY::SFX_VOL
        pit = CP::VICTORY::SFX_PIT
        RPG::SE.new(sfx, vol, pit).play unless sfx.nil?
        @victory_score.active = false
        @victory_item.active = true
      end
    end
  end
end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 10:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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