查看: 3807|回复: 1

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

[复制链接]
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 2020-9-14 21:42:22 | 显示全部楼层 |阅读模式

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

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

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

在脚本中的不同地方插入这三句也无用
@party_command_window.close
@party_command_window.unselect
@party_command_window.deactivate
联络作者不果 , 各位大大们能帮忙解決么
  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 - neonblack23@live.com (e-mail) or "neonblack23" on skype         #
  17. ###--------------------------------------------------------------------------###

  18. ###--------------------------------------------------------------------------###
  19. #      Revision information:                                                   #
  20. #  V2.1 - 11.16.2012                                                           #
  21. #   Added grade requirement for drops                                          #
  22. #   Fixed an issue where drop rate was not figured properly                    #
  23. #  V2.0 - Finished 8.11.2012                                                   #
  24. #   Added level up windows                                                     #
  25. #   Created score items and Grade module                                       #
  26. #   Numerous other bugfixes and changes                                        #
  27. #  V1.1b - 6.26.2012                                                           #
  28. #   Fixed an error related to exp gain display                                 #
  29. #  V1.1 - 6.21.2012                                                            #
  30. #   Added rank sprite effect                                                   #
  31. #  V1.0 - 6.19.2012                                                            #
  32. #   Wrote and debugged main script                                             #
  33. ###--------------------------------------------------------------------------###

  34. ###--------------------------------------------------------------------------###
  35. #      Compatibility:                                                          #
  36. #  This script has been tested to work with Yanfly's battle engine (just the   #
  37. #  base engine) and Yami's PCTB.  If you have any issue, let me know and I     #
  38. #  will address them asap.                                                     #
  39. #  Due to the number of new windows, I will only list methods in already       #
  40. #  existing objects here and not any of the newly created objects.             #
  41. #                                                                              #
  42. #  Alias       - BattleManager: setup, play_battle_bgm                         #
  43. #                Game_Battler: execute_damage                                  #
  44. #                Game_Enemy: initialize                                        #
  45. #                Game_Actor: level_up                                          #
  46. #                Scene_Battle: update_pctb_speed, dispose_all_windows,         #
  47. #                              use_item                                        #
  48. #                DataManager: load_database                                    #
  49. #  Overwrites  - BattleManager: process_victory, play_battle_end_me,           #
  50. #                               gain_gold, gain_drop_items, gain_exp           #
  51. #                Game_Troop: make_drop_items                                   #
  52. #                Game_Enemy: make_drop_items                                   #
  53. #                Scene_Battle: update                                          #
  54. #  New Objects - BattleManager: old_levels, old_skills, victory_phase?,        #
  55. #                               skip?, victory_end                             #
  56. #                Game_Troop: check_boss                                        #
  57. #                Game_Actor: gain_exp_cpv, last_level_exp                      #
  58. #                Scene_Battle: close_status_window, exp_window_update,         #
  59. #                              update_window_rates, update_scores,             #
  60. #                              show_victory_windows, create_leveled_windows,   #
  61. #                              pack_and_send, remove_sprite, drop_items        #
  62. #                RPG::UsableItem: karma_modif                                  #
  63. #                RPG::Enemy: add_drops                                         #
  64. #                DataManager: make_extra_drops                                 #
  65. ###--------------------------------------------------------------------------###

  66. ###--------------------------------------------------------------------------###
  67. #      Instructions:                                                           #
  68. #  Place this script in the "Materials" section of the scripts above main.     #
  69. #  This script requires you to set several settings for the script to work     #
  70. #  properly.  The screen modifies the end of battle to allow a victory screen  #
  71. #  to appear.  This script also has several notebox tags that can be added to  #
  72. #  define changes to the grade and one note tag that will allow you to define  #
  73. #  additional monster drops.                                                   #
  74. ###-----                                                                -----###
  75. #                                                                              #
  76. #      敌人备注:                                                   #
  77. #                                                                              #
  78. #   drop[i:1:1:100] 或 drop[i:1:1]                                           #
  79. #               可以为敌人添加额外的掉落物品. 以上两种格式都行  #
  80. #               第一个参数是物品类型,可以是 "i", "a", 或  "w" ,分别代表 "物品",
  81. #               "护甲", 和 "武器".  第二个是物品id.  第三个是掉落几率.       #
  82. #               x分之1的概率,x=1时代表必定掉落,数字越大,掉落率越低.        #
  83. #               最后一个参数是可选的,代表战斗分数要求,胜利后评价的分数必须大于
  84. #               某个数,才会掉落该物品 .   
  85. #
  86. #   score[1]  - 该怪物每死一只,评价分数就加1.         #
  87. #               你可以把1替换为其他数字
  88. #
  89. #   onehit[1]  - 该怪物每被我方技能命中一次,评价分数就加1.  
  90. #                请注意,多段伤害的技能只会触发一次,附加死亡状态的技能不会触发   #
  91. #                在下面你可以设定默认每一次命中会获得的分数,优先级低于本敌人备注.                                                       #
  92. ###-----                                                                -----###
  93. #                                                                              #
  94. #      物品/技能备注:                                            #
  95. #                                                                              #
  96. #   score[+1]  - 使用该物品/技能后评级分数+1,如果是 score[-20] 则分数-20                 #
  97. ###--------------------------------------------------------------------------###

  98. ###--------------------------------------------------------------------------###
  99. #      Config:                                                                 #
  100. #  These are the default values used by several of the functions in the        #
  101. #  script.  You may change these values as you find your game requires in      #
  102. #  order to give the player a better playing experience based on your game.    #
  103. #                                                                              #
  104. module CP       # Do not edit                                                  #
  105. module VICTORY  #  these two lines.                                            #
  106. #                                                                              #
  107. ###-----                                                                -----###
  108. # 跳过评级BGM的开关,开关开启时不会播放评级BGM                                #
  109. SKIP_SWITCH = 5 # 默认 = 5                                                  #
  110. #                                                                              #
  111.           #
  112. USE_MUSIC = false # 是否播放评级BGM 默认 = true                                               #
  113. VICTORY_MUSIC = nil # 评级BGM文件名  默认 = "Scene4"   如果要静音请设定为nil                               #
  114. MSX_VOL = 100 # 音量  默认 = 100                                                  #
  115. MSX_PIT = 100 # 音调  默认 = 100                                                  #
  116. #                                                                              #
  117. # 是否播放数据库里设定战斗胜利ME,true时会在评级BGM之前播放                  #
  118. USE_ME = false # 默认 = false                                               #
  119. #                                                                              #
  120. # exp值槽颜色                                              #
  121. EXP_GAUGE_1 = 30 # 颜色1 默认 = 30                                                #
  122. EXP_GAUGE_2 = 31 # 颜色2 默认 = 31                                                #
  123. EXP_ADDED = 17 # 增长部分的颜色 默认 = 17                                                  #
  124. #                                                                              #
  125. # 是否对调下方左右两个窗口的位置                   #
  126. FLIP_LOWER = false # 默认 = false                                           #
  127. #                                                                              #
  128. # 设定升级后回复hp/mp的模式                                                                   #
  129. #  0 = 升级后不会回复.                       #
  130. #  1 = 升级后根据角色hpmp的增加量,回复部分hpmp.                #
  131. #  2 = 升级后全回复.                 #
  132. HP_HEAL_TYPE = 0 # 升级后hp回复模式  默认 = 0                                                 #
  133. MP_HEAL_TYPE = 0 # 升级后hp回复模式  默认 = 0                                                 #
  134. #                                                                              #
  135. # 设定显示的文字.                                               #
  136. LEVEL_UP = "等级提升!!" # 默认 = "Level Up!!"                               #
  137. SPOILS = "战利品" # 默认 = "Spoils"                                         #
  138. EXP_NAME = "EXP" # 默认 = "EXP"                                             #
  139. DEALT_NAME = "造成伤害" # 默认 = "Dealt"                                       #
  140. RECIEVED_NAME = "受到伤害" # 默认 = "Recieved"                              #
  141. TURNS_NAME = "回合数" # 默认 = "Turns"                                       #
  142. RANK_NAME = "评级" # 默认 = "Rank"                                         #
  143. NO_DROPS = "无战利品" # 默认 = "No drops recieved"                 #
  144. #                                                                              #
  145. ###-----                                                                -----###
  146. # 是否显示升级窗口                                   #
  147. LVL_UP_ENABLE = true # 默认 = true                                          #
  148. #                                                                              #
  149.          #
  150. LVL_SFX = "Item3" # 升级音效 默认 = "Item3" 想静音请设定为nil                                         #
  151. LVL_VOL = 80 # 音量 默认 = 80                                                    #
  152. LVL_PIT = 100 # 音调 默认 = 100                                                  #
  153. #                                                                              #
  154. # 学会技能时显示的文字                    #
  155. NEW_SKILLS = "学会技能:" # 默认 = "Learned:"                                 #
  156. MORE_SKILLS = "和其他 %s 个技能" # 默认 = "And %s more skills"            #
  157. #                                                                              #
  158. ###-----                                                                -----###
  159.                                                              #
  160. USE_IMAGES = false # 是否使用图片替代评级文字 默认 = false                                           #
  161. IMAGE_NAME = "Rank" # 评级图片文件名的前缀 默认 = "Rank" 如果获得评级C
  162. #                   #则会显示 RankC.png
  163. #                                                                              #
  164. #            #
  165. IMAGE_SFX = "Shot2" # 评级音效 默认 = "Shot2"  想静音请设定为nil                                         #
  166. SFX_VOL = 100 # 音量 默认 = 100                                                  #
  167. SFX_PIT = 100 # 音调 默认 = 100                                                  #
  168. #                                                                              #
  169. # 设定评级,必须按从上到下,从小到大的顺序:                                                     #
  170. #    ["评级",  要求分数,  获得exp比率,  获得金钱比率, 获得战利品率,  文字颜色],            #
  171. # 评级 - 请写在双引号里      #
  172. # 要求分数 - 达到该评级需要的最低分数,请确定第一个评级的要求分数为 "0".                                           #
  173. # 获得exp比率 - 默认值为 100 ,如果设定为200,代表获得双倍exp,下面两个比率同理.                                              #
  174. # 获得金钱比率 - 默认值为 100.                                             #
  175. # 获得战利品率 - 默认值为 100,不影响同一物品的掉落次数,仅影响单个物品的掉落概率.                                                  #
  176. # 文字颜色 - 文字颜色,和文本颜色一样.         #
  177. RANKS =[ # Do not edit this line.                                              #

  178.   ["E",   0, 100, 100, 100, 18],
  179.   ["D", 100, 100, 105, 100, 20],
  180.   ["C", 150, 100, 110, 105,  4],
  181.   ["B", 250, 105, 110, 110, 21],
  182.   ["A", 400, 115, 115, 115,  3],
  183.   ["S", 700, 125, 125, 125, 17],
  184.   
  185. ] # Do not edit this line.                                                     #
  186. #                                                                              #
  187. # 设定伤害率对应的获得分数       #
  188. # 给你一个公式:伤害率 = 造成伤害 / 受到伤害 *100%
  189. # 举个栗子,假如玩家受到 140 点伤害,并且造成200点伤害,
  190. # 伤害率 = 200/140*100% = 142 ,对应下表142在100~150之间,此时获得的分数
  191. # 算到较小的区间,所以最终获得的分数为50
  192. #    格式为:                                                         #
  193. #    [伤害率,  获得分数],                                                         #
  194. DAMAGE_POINTS =[ # Do not edit this line.                                      #

  195.   [ 50,  20],
  196.   [ 80,  30],
  197.   [100,  50],
  198.   [150,  75],
  199.   [200, 100],
  200.   [300, 200],

  201. ] # Do not edit this line.                                                     #
  202. #                                                                              #
  203. # 以下是特殊情况会获得的的分数,那一项你不需要就把那一项设定为"0".                   #
  204. #                                                                              #
  205. # 在同一回合中消灭所有敌人.                                #
  206. SINGLE_TURN = 150 # 默认 = 150                                              #
  207. # 消灭boss (请在敌人特性中设定死亡方式为boss. 此分数一场战斗中只会增加一次
  208. # 就算同一敌群有多个boss也一样.      #
  209. BOSS_POINTS = 200 # 默认 = 200                                              #
  210. # 全程无伤                                 #
  211. NO_DAMAGE = 100 # 默认 = 100                                                #
  212. # 战斗结束时全员满HP.                              #
  213. FULL_HP = 50 # 默认 = 50                                                    #
  214. # 一击必杀(只用一个技能就消灭一个敌人),对添加死亡状态的技能无效                #
  215. ONE_HIT = 40 # 默认 = 40                                                    #
  216. ###--------------------------------------------------------------------------###

  217. ###--------------------------------------------------------------------------###
  218. #      A note to scripters:                                                    #
  219. #  As of version 2.0 I have made it possible to add custom score items to be   #
  220. #  used in battle.  These scores are handled by the "Grade" module.  If you    #
  221. #  have created a new score item you want to use, you can add it to the Grade  #
  222. #  module by using the script call "Grade.new_score(:foo, Bar)" where ":foo"   #
  223. #  is the key you will use to access the object and "Bar" is the name of the   #
  224. #  new objects class (in this case, the defining line for the object would be  #
  225. #  "class Bar < Score_Base").  You can then reach this score object at any     #
  226. #  time by using the script call "Grade.score[:foo]".  To see the base score   #
  227. #  object or any of the pre-made score object, scroll down.  The score         #
  228. #  objects have been placed at the top of the script.                          #
  229. ###--------------------------------------------------------------------------###


  230. ###--------------------------------------------------------------------------###
  231. #  The following lines are the actual core code of the script.  While you are  #
  232. #  certainly invited to look, modifying it may result in undesirable results.  #
  233. #  Modify at your own risk!                                                    #
  234. ###--------------------------------------------------------------------------###


  235. end  ## Close the VICTORY module.
  236. end  ## Close the CP module.


  237. ##-----
  238. ## This is a basic score item.  There are 3 main parts to this.  The initialize
  239. ## part which defines each of the score variables to be used at the start, the
  240. ## update score part, which can be used at any time to get the current score
  241. ## the item will add, and the total part, which is used by the Grade module to
  242. ## get the final value.  You can use "attr_accessor" to create values that can
  243. ## be adjusted at any time or you can create methods to adjust different aspects
  244. ## of the score object.
  245. ##-----
  246. class Score_Base  ## A score item.  Holds and adjusts an aspect of score.
  247.   def initialize
  248.     @score = 0  ## Sets the score to 0 at the start.
  249.   end
  250.   
  251.   def update_score  ## Objects used to modify the score.
  252.     return 0
  253.   end
  254.   
  255.   def total  ## Create and return the score.
  256.     update_score
  257.     return @score
  258.   end
  259. end

  260. class Score_Damage < Score_Base
  261.   attr_accessor :dealt
  262.   attr_accessor :recieved
  263.   attr_accessor :onehit
  264.   
  265.   def initialize  ## Holds dealt and recieved damage as well as one hit scores.
  266.     super         ## Creates a score based on dealt and recieved ratio.
  267.     @dealt = 0
  268.     @recieved = 0
  269.     @onehit = 0
  270.   end
  271.   
  272.   def update_score
  273.     res = super
  274.     if @recieved == 0
  275.       CP::VICTORY::DAMAGE_POINTS.each {|point| res += point[1]}
  276.     else
  277.       dr = (@dealt * 100 / @recieved)
  278.       CP::VICTORY::DAMAGE_POINTS.each do |point|
  279.         next if dr < point[0]
  280.         res += point[1]
  281.       end
  282.     end
  283.     res += CP::VICTORY::NO_DAMAGE if @recieved == 0
  284.     res += @onehit
  285.     @score = res
  286.   end
  287. end

  288. class Score_HP < Score_Base
  289.   def initialize  ## Holds the hp at the start of battle.
  290.     super         ## Not technically used, but checks max hp at end of battle.
  291.     @start_hp = get_party_hp
  292.   end
  293.   
  294.   def get_party_hp
  295.     return 0 if $game_party.battle_members.empty?
  296.     result = 0
  297.     $game_party.battle_members.each do |member|
  298.       result += member.hp
  299.     end
  300.     return result
  301.   end
  302.   
  303.   def get_max_hp
  304.     return 0 if $game_party.battle_members.empty?
  305.     result = 0
  306.     $game_party.battle_members.each do |member|
  307.       result += member.mhp
  308.     end
  309.     return result
  310.   end
  311.   
  312.   def update_score
  313.     res = super
  314.     res += CP::VICTORY::FULL_HP if get_party_hp == get_max_hp
  315.     @score = res
  316.   end
  317. end

  318. class Score_Troop < Score_Base
  319.   def update_score  ## Gets score values from the existance of boss monsters
  320.     res = super     ## as well as adding custom scores per monster.
  321.     res += CP::VICTORY::BOSS_POINTS if $game_troop.check_boss
  322.     res += CP::VICTORY::SINGLE_TURN if $game_troop.turn_count == 1
  323.     $game_troop.members.each {|foe| res += foe.add_score}
  324.     @score = res
  325.   end
  326. end

  327. class Score_Skill < Score_Base
  328.   attr_accessor :karma
  329.   
  330.   def initialize
  331.     super
  332.     @karma = 0
  333.   end
  334.   
  335.   def update_score
  336.     res = super
  337.     res += @karma
  338.     @score = res
  339.   end
  340. end

  341. module Grade
  342.   def self.reset  ## Holds score objects, score, and grades.
  343.     @rate = CP::VICTORY::RANKS[0]
  344.     @score = 0
  345.     create_score_items
  346.   end
  347.   
  348.   def self.create_score_items  ## Creates the default score items.
  349.     @score_items = {}
  350.     new_score(:damage, Score_Damage)
  351.     new_score(:hp,     Score_HP)
  352.     new_score(:troop,  Score_Troop)
  353.     new_score(:skill,  Score_Skill)
  354.   end
  355.   
  356.   def self.new_score(key, scr)  ## Adds a custom score item.
  357.     @score_items[key] = scr.new
  358.   end
  359.   
  360.   def self.update_score  ## Creates a score.
  361.     return 0 if @score_items.empty?
  362.     val = 0
  363.     @score_items.each do |key, score|
  364.       val += score.total
  365.     end
  366.     @score = val
  367.   end
  368.   
  369.   def self.update_rate  ## Updates the rank and grade.
  370.     update_score
  371.     rank_top = 0
  372.     CP::VICTORY::RANKS.each do |rank|
  373.       next if rank[1] > @score
  374.       if rank[1] > rank_top
  375.         @rate = rank
  376.         rank_top = rank[1]
  377.       end
  378.     end
  379.   end
  380.   
  381.   def self.score  ## Returns the score.
  382.     return @score
  383.   end
  384.   
  385.   def self.rate(key = nil)  ## Gets bits of all of the rate.
  386.     update_rate
  387.     case key
  388.     when :exp
  389.       return @rate[2]
  390.     when :gold
  391.       return @rate[3]
  392.     when :drop
  393.       return @rate[4]
  394.     else
  395.       return @rate
  396.     end
  397.   end
  398.   
  399.   def self.score_items  ## Gets all score items for usage.
  400.     return @score_items
  401.   end
  402. end

  403. ##-----
  404. ## End of score object.  The rest of the script is below.
  405. ##-----

  406. module CP
  407. module VICTORY
  408. SCORE  = /SCORE\[(\d+)\]/i
  409. KARMA  = /SCORE\[(\+|\-)?(\d+)\]/i
  410. DROPS  = /DROP\[(\w+):(\d+):(\d+):?(\d*)\]/i
  411. ONEHIT = /ONEHIT\[(\d+)\]/i
  412. end  ## Used for added drops.
  413. end

  414. $imported = {} if $imported == nil
  415. $imported["CP_VICTORY"] = 2.1

  416. module BattleManager
  417.   class << self
  418.   
  419.   ## Aliased to add certain new settings to the module.
  420.   alias setup_cp_vict setup unless $@
  421.   def setup(troop_id, can_escape = true, can_lose = false)
  422.     Grade.reset
  423.     setup_cp_vict(troop_id, can_escape, can_lose)
  424.     @victory = false
  425.     @played_bgm = 0
  426.     @old_levels = {}; @old_skills = {}
  427.     $game_party.all_members.each do |actr|
  428.       id = actr.actor_id; lvl = actr.level; skl = actr.skills
  429.       @old_levels[id] = lvl; @old_skills[id] = skl
  430.     end
  431.   end
  432.   
  433.   ## Gets the level or skills of the actors from before battle.
  434.   def old_levels(id); return @old_levels[id]; end
  435.   def old_skills(id); return @old_skills[id]; end
  436.   
  437.   ## Helps determine if the victory screen is active.
  438.   def victory_phase?
  439.     @phase == :victory
  440.   end
  441.   
  442.   ## Determine if all musics should be skipped.
  443.   def skip?
  444.     $game_switches[CP::VICTORY::SKIP_SWITCH]
  445.   end
  446.   
  447.   ## Aliased to skip bgm change if the switch is flipped.
  448.   alias play_battle_bgm_cpv play_battle_bgm unless $@
  449.   def play_battle_bgm
  450.     play_battle_bgm_cpv unless skip?
  451.   end
  452.   
  453.   ## Overwritten for the new victory screen.
  454.   def process_victory
  455.     return if @victory; @victory = true
  456.     $game_system.battle_end_me.play if CP::VICTORY::USE_ME && !skip?
  457.     RPG::BGM.fade(500) unless skip? || CP::VICTORY::USE_ME
  458.     20.times do; Graphics.update; end
  459.     SceneManager.scene.close_status_window
  460.     Audio.return_audio if $imported["CP_CROSSFADE"]
  461.     play_battle_end_me unless skip?  ## Skip the bgm change again.
  462.     @phase = :victory
  463.     SceneManager.scene.show_victory_windows
  464.     exp = gain_exp
  465.     gold = gain_gold
  466.     gain_drop_items
  467.     turns = $game_troop.turn_count
  468.     dlt = Grade.score_items[:damage].dealt
  469.     rcv = Grade.score_items[:damage].recieved
  470.     SceneManager.scene.update_scores(dlt, rcv, turns)
  471.     SceneManager.scene.update_window_rates(exp, gold, Grade.rate[4])
  472.     # <XR> 代入数组,分别显示经验
  473.     SceneManager.scene.exp_window_update(exp)
  474.     return true
  475.   end
  476.   
  477.   ## Added to actually leave battle.
  478.   def victory_end
  479.     RPG::BGM.fade(500) unless skip?
  480.     20.times do; Graphics.update; end
  481.     SceneManager.return
  482.     battle_end(0)
  483.     replay_bgm_and_bgs unless skip? || $BTEST
  484.   end
  485.   
  486.   ## Skipped if music is not made to change.
  487.   def play_battle_end_me
  488.     return if @played_bgm > 1
  489.     @played_bgm += CP::VICTORY::USE_ME ? 1 : 2
  490.     Audio.bgm_stop
  491.     if CP::VICTORY::USE_MUSIC
  492.       mus = CP::VICTORY::VICTORY_MUSIC
  493.       vol = (CP::VICTORY::USE_ME && @played_bgm == 1) ? 0 : CP::VICTORY::MSX_VOL
  494.       pit = CP::VICTORY::MSX_PIT
  495.       RPG::BGM.new(mus, vol, pit).play unless mus.nil?
  496.     else
  497.       $game_system.battle_end_me.play
  498.       replay_bgm_and_bgs unless $BTEST
  499.     end
  500.   end
  501.   
  502.   ## Adjusts the gold rate.
  503.   def gain_gold
  504.     if $game_troop.gold_total > 0
  505.       rate = Grade.rate(:gold)
  506.       gold = $game_troop.gold_total
  507.       gold = gold * rate / 100
  508.       $game_party.gain_gold(gold)
  509.     else
  510.       gold = 0
  511.     end
  512.     return gold
  513.   end
  514.   
  515.   ## Adjusts the drop rate.
  516.   def gain_drop_items
  517.     drops = []
  518.     rate = Grade.rate(:drop)
  519.     $game_troop.make_drop_items(rate).each do |item|
  520.       $game_party.gain_item(item, 1)
  521.       drops.push(item)
  522.     end
  523.     SceneManager.scene.drop_items(drops)
  524.   end
  525.   
  526.   ## Adjusts the exp rate.
  527.   def gain_exp
  528.     rate = Grade.rate(:exp)
  529.     # <XR> 用数组分别记录各自得到的经验
  530.     $game_party.all_members.each do |actor|
  531.       actor.gain_exp_cpv($game_troop.exp_total, rate)
  532.       # <XR>
  533.     end
  534.     # <XR>
  535.     return $game_troop.exp_total * rate / 100
  536.   end

  537.   end
  538. end

  539. class Game_Troop < Game_Unit
  540.   ## Checks if a monster has the boss kill flag set.
  541.   def check_boss
  542.     members.each do |enemy|
  543.       next unless enemy.collapse_type == 1
  544.       return true
  545.     end
  546.     return false
  547.   end
  548.   
  549.   ## Adjusted drop rate.
  550.   def make_drop_items(rate = 100)
  551.     dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items(rate) }
  552.   end
  553. end

  554. class Game_Battler < Game_BattlerBase
  555.   ## Aliased to add damage dealt and recieved to a value for later.
  556.   alias exec_damage_cpv execute_damage unless $@
  557.   def execute_damage(user)
  558.     if @result.hp_damage > 0
  559.       i = [@result.hp_damage, hp].min
  560.       Grade.score_items[:damage].dealt += i if enemy?
  561.       Grade.score_items[:damage].recieved += i if !enemy?
  562.       if hp == mhp && i >= mhp && enemy?
  563.         Grade.score_items[:damage].onehit += @one_hit
  564.       end
  565.     end
  566.     exec_damage_cpv(user)
  567.   end
  568. end

  569. class Game_Enemy < Game_Battler
  570.   attr_accessor :add_score
  571.   attr_accessor :one_hit
  572.   
  573.   ## Gets the default added points for an enemy.
  574.   alias cp_gbv_initialize initialize unless $@
  575.   def initialize(index, enemy_id)
  576.     cp_gbv_initialize(index, enemy_id)
  577.     enemy = $data_enemies[@enemy_id]
  578.     @add_score = enemy.add_score
  579.     @one_hit = enemy.one_hit
  580.   end
  581.   
  582.   ## The actual adjusted drop rate.
  583.   def make_drop_items(rate = 100)
  584.     cpi = rate.to_f / 100
  585.     enemy.drop_items.inject([]) do |r, di|
  586.         if di.kind > 0 && rand * di.denominator < drop_item_rate * cpi
  587.         if Grade.score >= di.req_grade
  588.           r.push(item_object(di.kind, di.data_id))
  589.         else
  590.           r
  591.         end
  592.       else
  593.         r
  594.       end
  595.     end
  596.   end
  597. end

  598. class Game_Actor < Game_Battler
  599.   attr_reader :actor_id
  600.   
  601.   alias cp_gv_level_up level_up unless $@
  602.   def level_up
  603.     tmp1 = mhp
  604.     tmp2 = mmp
  605.     cp_gv_level_up
  606.     heal1 = mhp - tmp1
  607.     heal2 = mmp - tmp2
  608.     case CP::VICTORY::HP_HEAL_TYPE
  609.     when 1; self.hp += heal1
  610.     when 2; self.hp = mhp
  611.     end
  612.     case CP::VICTORY::MP_HEAL_TYPE
  613.     when 1; self.mp += heal2
  614.     when 2; self.mp = mmp
  615.     end
  616.   end
  617.   
  618.   ## Just made a whole new exp event here.  Adjusts the rate.
  619.   def gain_exp_cpv(exp, vic_rate = 100)
  620.     change_exp(self.exp + (exp * vic_rate * final_exp_rate / 100).to_i, false)
  621.   end
  622.   
  623.   ## Determines the exp for the last level.
  624.   def last_level_exp
  625.     return 0 if @level <= 0
  626.     return exp_for_level(@level - 1)
  627.   end
  628. end

  629. class Scene_Battle < Scene_Base
  630.   if $imported["YSA-PCTB"]
  631.   alias cp_bv_fix_yami_pctb update_pctb_speed unless $@
  632.   def update_pctb_speed
  633.     return if BattleManager.victory_phase?
  634.     cp_bv_fix_yami_pctb
  635.   end
  636.   end
  637.   
  638.   ## Overwritten to stop stuff from happening during the victory phase.
  639.   def update
  640.     super
  641.     if BattleManager.in_turn?
  642.       process_event
  643.       process_action
  644.     end
  645.     BattleManager.judge_win_loss unless BattleManager.victory_phase?
  646.     if BattleManager.victory_phase?
  647.       if @victory_score.done and @victory_score.active
  648.         sfx = CP::VICTORY::IMAGE_SFX
  649.         vol = CP::VICTORY::SFX_VOL
  650.         pit = CP::VICTORY::SFX_PIT
  651.         RPG::SE.new(sfx, vol, pit).play unless sfx.nil?
  652.         @victory_score.active = false
  653.         @victory_item.active = true
  654.       end
  655.     end
  656.   end
  657.   
  658.   ## Terminates the sprites and extra windows at the end of battle.
  659.   alias cp_gv_dispose_all_windows dispose_all_windows unless $@
  660.   def dispose_all_windows
  661.     remove_sprite
  662.     cp_gv_dispose_all_windows
  663.   end
  664.   
  665.   ## Applies score loss/gain when using an item/skill.
  666.   alias cp_gv_use_item use_item unless $@
  667.   def use_item
  668.     item = @subject.current_action.item
  669.     Grade.score_items[:skill].karma += item.add_score
  670.     cp_gv_use_item
  671.   end
  672.   
  673.   ## Closes the status window sorta.
  674.   def close_status_window
  675.     instance_variables.each do |varname|
  676.       ivar = instance_variable_get(varname)
  677.       ivar.openness = 0 if ivar.is_a?(Window)
  678.     end
  679.   end
  680.   
  681.   ## The next few call stuff.
  682.   def exp_window_update(exp)
  683.     @victory_main.redraw_exp(exp)
  684.     create_leveled_windows
  685.     pack_and_send
  686.   end
  687.   
  688.   def update_window_rates(exp, gold, item)
  689.     @victory_rank.get_rates(exp, gold)
  690.     @victory_item_top.get_rates(item)
  691.   end
  692.   
  693.   def update_scores(dealt, recieved, turns)
  694.     @victory_score.draw_score(CP::VICTORY::DEALT_NAME, dealt, 0)
  695.     @victory_score.draw_score(CP::VICTORY::RECIEVED_NAME, recieved, 24)
  696.     @victory_score.draw_score(CP::VICTORY::TURNS_NAME, turns, 48)
  697.     @victory_score.rank_stuff
  698.   end
  699.   
  700.   def show_victory_windows
  701.     @victory_main = Window_VictoryMain.new
  702.     @victory_top = Window_VictoryTop.new
  703.     @victory_score = Window_VictoryScore.new
  704.     @victory_rank = Window_VictoryRank.new
  705.     @victory_item_top = Window_VictoryItemTop.new
  706.     @victory_item = Window_VictoryItem.new
  707.     @victory_main.openness = 0
  708.     @victory_top.openness = 0
  709.     @victory_score.openness = 0
  710.     @victory_rank.openness = 0
  711.     @victory_item_top.openness = 0
  712.     @victory_item.openness = 0
  713.     @victory_main.open
  714.     @victory_top.open
  715.     @victory_score.open
  716.     @victory_rank.open
  717.     @victory_item_top.open
  718.     @victory_item.open
  719.     if CP::VICTORY::USE_IMAGES
  720.       @victory_score.active = true
  721.     else
  722.       @victory_item.active = true
  723.     end
  724.   end
  725.   
  726.   def create_leveled_windows
  727.     @leveled = []
  728.     return if @victory_main.leveled.empty?
  729.     @victory_main.leveled.each {|actor| @leveled.push(Window_LvlUp.new(actor))}
  730.     @leveled.each {|wind| wind.visible = false}
  731.   end
  732.   
  733.   def pack_and_send
  734.     ar1 = [@victory_main, @victory_top, @victory_score, @victory_rank,
  735.            @victory_item_top, @victory_item]
  736.     @victory_item.get_windows(ar1, @leveled)
  737.   end
  738.   
  739.   def remove_sprite
  740.     @victory_score.remove_sprite unless @victory_score.nil? || @victory_score.disposed?
  741.     return if @leveled.nil? || @leveled.empty?
  742.     @leveled.each {|wind| wind.dispose}
  743.   end
  744.   
  745.   ## This pushes the drop items to the drop window.
  746.   def drop_items(drops)
  747.     @victory_item.get_drops(drops)
  748.   end
  749. end

  750. ## The main window with the character faces.
  751. class Window_VictoryMain < Window_Selectable
  752.   attr_reader :leveled
  753.   
  754.   def initialize
  755.     super(0, 48, Graphics.width, 152)
  756.     @index = -1
  757.     @leveled = []
  758.     draw_all_items
  759.   end
  760.   
  761.   def draw_all_items
  762.     item_max.times {|i| draw_item(i) }
  763.   end
  764.   
  765.   def redraw_exp(exp)
  766.     #<XR> 以前 exp 是数值,现在是数组,所以改为 exp[i]
  767.     item_max.times {|i| draw_exp(i, exp) }
  768.   end
  769.   
  770.   def draw_item(index)
  771.     actor = $game_party.members[index]
  772.     rect = item_rect(index)
  773.     draw_victory_face(actor, rect)
  774.     draw_actor_exp_info(actor, rect.x, rect.y + 104, rect.width)
  775.   end
  776.   
  777.   def draw_victory_face(actor, orect)
  778.     bitmap = Cache.face(actor.face_name)
  779.     rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
  780.     fx = (orect.width - 96) / 2
  781.     temp_bit = Bitmap.new(orect.width, orect.height)
  782.     temp_bit.blt(fx, 0, bitmap, rect)
  783.     contents.blt(orect.x, orect.y, temp_bit, temp_bit.rect)
  784.   end
  785.   
  786.   def draw_exp(index, exp)
  787.     actor = $game_party.members[index]
  788.     rect = item_rect(index)
  789.     draw_actor_exp_info(actor, rect.x, rect.y + 104, rect.width, exp)
  790.   end
  791.   
  792.   def draw_actor_exp_info(actor, x, y, width, aexp = 0)
  793.     x += (width - 96) / 2
  794.     width = [width, 96].min
  795.     aexr = aexp * actor.exr
  796.     cexp = actor.exp - actor.current_level_exp
  797.     nexp = actor.next_level_exp - actor.current_level_exp
  798.     if cexp - aexr >= 0
  799.       rate = cexp.to_f / nexp
  800.       rate = 1.0 if rate > 1.0
  801.       gc1 = text_color(CP::VICTORY::EXP_ADDED)
  802.       gc2 = text_color(CP::VICTORY::EXP_ADDED)
  803.       draw_gauge(x, y, width, rate, gc1, gc2)
  804.       cexp -= aexr
  805.       rate = cexp.to_f / nexp
  806.       rate = 1.0 if rate > 1.0
  807.       rate = 1.0 if actor.level == actor.max_level
  808.       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1)
  809.       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2)
  810.       draw_gauge_clear(x, y, width, rate, gc1, gc2)
  811.     else
  812.       rate = 1.0
  813.       gc1 = text_color(CP::VICTORY::EXP_ADDED)
  814.       gc2 = text_color(CP::VICTORY::EXP_ADDED)
  815.       draw_gauge(x, y, width, rate, gc1, gc2)
  816.       cexp = actor.exp - actor.last_level_exp - aexr
  817.       nexp = actor.current_level_exp - actor.last_level_exp
  818.       rate = cexp.to_f / nexp
  819.       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1)
  820.       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2)
  821.       draw_gauge_clear(x, y, width, rate, gc1, gc2)
  822.       change_color(normal_color)
  823.       draw_text(x, y, width, line_height, CP::VICTORY::LEVEL_UP, 1)
  824.       @leveled.push(actor)
  825.     end
  826.   end
  827.    
  828.   def draw_gauge_clear(x, y, width, rate, color1, color2)
  829.     fill_w = (width * rate).to_i
  830.     gauge_y = y + line_height - 8
  831.     contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
  832.   end
  833.   
  834.   def item_max
  835.     $game_party.battle_members.size
  836.   end
  837.   
  838.   def item_height
  839.     return 128
  840.   end
  841.   
  842.   def col_max
  843.     $game_party.max_battle_members
  844.   end
  845.   
  846.   def spacing
  847.     return 0
  848.   end
  849. end

  850. ## The window at the top that says victory stuff.
  851. class Window_VictoryTop < Window_Base
  852.   def initialize
  853.     super(0, 0, Graphics.width, 48)
  854.     draw_title
  855.   end
  856.   
  857.   def draw_title
  858.     title = sprintf(Vocab::Victory, $game_party.name)
  859.     change_color(normal_color)
  860.     draw_text(0, 0, contents.width, line_height, title, 1)
  861.   end
  862. end

  863. ## The window that shows rank and score stuff.
  864. class Window_VictoryScore < Window_Base
  865.   attr_accessor :done
  866.   
  867.   def initialize
  868.     side = CP::VICTORY::FLIP_LOWER ? Graphics.width / 2 : 0
  869.     super(side, 200, Graphics.width / 2, Graphics.height - 272)
  870.     @done = false
  871.     setup_image if CP::VICTORY::USE_IMAGES
  872.   end
  873.   
  874.   def update
  875.     super
  876.     unless @rank.nil? or @done or !open?
  877.       @rank.opacity += 25
  878.       @rank.zoom_x -= 0.2
  879.       @rank.zoom_y -= 0.2
  880.       if @rank.zoom_y < 1.0
  881.         @done = true
  882.         @rank.zoom_x = 1.0
  883.         @rank.zoom_y = 1.0
  884.       end
  885.     end
  886.   end
  887.   
  888.   def setup_image
  889.     @rank = Sprite.new
  890.   end
  891.   
  892.   def hide_image
  893.     @rank.visible = false if @rank
  894.   end
  895.   
  896.   def remove_sprite
  897.     @rank.dispose unless @rank.nil?
  898.   end
  899.   
  900.   def draw_score(name, value, y)
  901.     change_color(system_color)
  902.     draw_text(16, y, contents.width-32, 24, name, 0)
  903.     change_color(normal_color)
  904.     draw_text(16, y, contents.width-32, 24, value, 2)
  905.   end
  906.   
  907.   def rank_stuff
  908.     draw_rank
  909.     draw_image if CP::VICTORY::USE_IMAGES
  910.   end
  911.   
  912.   def draw_image
  913.     ranking = CP::VICTORY::IMAGE_NAME + Grade.rate[0]
  914.     @rank.bitmap = Cache.system(ranking)
  915.     @rank.ox = @rank.bitmap.width / 2
  916.     @rank.oy = @rank.bitmap.height / 2
  917.     @rank.opacity = 0
  918.     @rank.zoom_x = 5.0
  919.     @rank.zoom_y = 5.0
  920.     @rank.x = x + width - padding - 16 - @rank.bitmap.width / 2
  921.     @rank.y = y + height - padding - 16
  922.     @rank.z = z + 800
  923.   end
  924.   
  925.   def draw_rank
  926.     color = Grade.rate[5]
  927.     rank = Grade.rate[0]
  928.     change_color(system_color)
  929.     contents.font.size = 32
  930.     fs = contents.font.size
  931.     draw_text(16, contents.height-fs, contents.width-32, fs, CP::VICTORY::RANK_NAME, 0)
  932.     change_color(normal_color) if color.nil?
  933.     change_color(text_color(color)) unless color.nil?
  934.     draw_text(16, contents.height-fs, contents.width-32, fs, rank, 2) unless CP::VICTORY::USE_IMAGES
  935.   end
  936. end

  937. ## The window that shows exp and gold.
  938. class Window_VictoryRank < Window_Base
  939.   def initialize
  940.     side = CP::VICTORY::FLIP_LOWER ? Graphics.width / 2 : 0
  941.     super(side, Graphics.height - 72, Graphics.width / 2, 72)
  942.   end
  943.   
  944.   def get_rates(exp, gold)
  945.     draw_object(Grade.rate[2], CP::VICTORY::EXP_NAME, exp, 0)
  946.     draw_object(Grade.rate[3], Vocab.currency_unit, gold, 24)
  947.   end
  948.   
  949.   def draw_object(rate, name, value, y)
  950.     change_color(normal_color)
  951.     draw_text(16, y, contents.width - 32, 24, value, 0)
  952.     n = contents.text_size(value).width
  953.     change_color(system_color)
  954.     draw_text(n + 20, y, contents.width - n - 36, 24, name, 0)
  955.     change_color(normal_color)
  956.     text = rate.to_s + "%"
  957.     draw_text(16, y, contents.width - 32, 24, text, 2)
  958.   end
  959. end

  960. ## The window that shows drop rate.
  961. class Window_VictoryItemTop < Window_Base
  962.   def initialize
  963.     side = CP::VICTORY::FLIP_LOWER ? 0 : Graphics.width / 2
  964.     super(side, 200, Graphics.width / 2, 48)
  965.   end
  966.   
  967.   def get_rates(rate)
  968.     change_color(system_color)
  969.     draw_text(16, 0, contents.width-32, 24, CP::VICTORY::SPOILS, 0)
  970.     change_color(normal_color)
  971.     text = rate.to_s + "%"
  972.     draw_text(16, 0, contents.width-32, 24, text, 2)
  973.   end
  974. end

  975. ## The window that shows items.  You can scroll through the items in it.
  976. class Window_VictoryItem < Window_Selectable
  977.   def initialize
  978.     side = CP::VICTORY::FLIP_LOWER ? 0 : Graphics.width / 2
  979.     super(side, 248, Graphics.width / 2, Graphics.height - 248)
  980.     @index = 0
  981.   end
  982.   
  983.   def item_max
  984.     @data ? @data.size : 0
  985.   end
  986.   
  987.   def draw_all_items
  988.     return super if item_max > 0
  989.     draw_null
  990.   end
  991.   
  992.   def draw_item(index)
  993.     item = @data[index]
  994.     if item
  995.       rect = item_rect(index)
  996.       rect.width -= 4
  997.       draw_item_name(item, rect.x, rect.y)
  998.       draw_item_number(rect, index)
  999.     end
  1000.   end
  1001.   
  1002.   def draw_null
  1003.     rect = item_rect(0)
  1004.     rect.width -= 4
  1005.     draw_text(rect, CP::VICTORY::NO_DROPS, 1)
  1006.   end
  1007.   
  1008.   def draw_item_number(rect, index)
  1009.     draw_text(rect, sprintf(":%2d", @number[index]), 2)
  1010.   end
  1011.   
  1012.   def get_drops(drops)
  1013.     @data = []
  1014.     @number = []
  1015.     for i in 0...drops.size
  1016.       ind = @data.index(drops[i])
  1017.       if ind.nil?
  1018.         @data.push(drops[i])
  1019.         @number.push(1)
  1020.       else
  1021.         @number[ind] += 1
  1022.       end
  1023.     end
  1024.     self.refresh
  1025.   end
  1026.   
  1027.   def get_windows(ar1, ar2)
  1028.     @done = 0
  1029.     @ar1 = ar1
  1030.     @ar2 = ar2
  1031.   end
  1032.   
  1033.   def process_handling
  1034.     return unless open? && active
  1035.     BattleManager.victory_end if Input.trigger?(:B)
  1036.     check_leveled_up if Input.trigger?(:C)
  1037.   end
  1038.   
  1039.   def check_leveled_up
  1040.     @done = 0 if @done.nil?; @done += 1
  1041.     return BattleManager.victory_end unless CP::VICTORY::LVL_UP_ENABLE
  1042.     return BattleManager.victory_end if @ar2.nil?
  1043.     return BattleManager.victory_end if @done > @ar2.size
  1044.     sfx = CP::VICTORY::LVL_SFX
  1045.     vol = CP::VICTORY::LVL_VOL
  1046.     pit = CP::VICTORY::LVL_PIT
  1047.     RPG::SE.new(sfx, vol, pit).play unless sfx.nil?
  1048.     @ar1.each {|wind| wind.visible = false}
  1049.     @ar2.each {|wind| wind.visible = false}
  1050.     @ar1[2].hide_image
  1051.     @ar2[@done - 1].visible = true
  1052.   end
  1053.   
  1054.   def update
  1055.     super
  1056.     if Audio.bgm_pos != 0
  1057.       BattleManager.play_battle_end_me
  1058.     end
  1059.   end
  1060.   
  1061.   def refresh
  1062.     contents.clear
  1063.     create_contents
  1064.     draw_all_items
  1065.   end
  1066. end

  1067. ## Modifies a skill's score modification when used.
  1068. class RPG::UsableItem < RPG::BaseItem
  1069.   def add_score
  1070.     karma_modif if @add_score.nil?
  1071.     return @add_score
  1072.   end
  1073.   
  1074.   def karma_modif
  1075.     @add_score = 0
  1076.     self.note.split(/[\r\n]+/).each do |line|
  1077.       case line
  1078.       when CP::VICTORY::KARMA
  1079.         @add_score = ($1.to_s + $2.to_s).to_i
  1080.       end
  1081.     end
  1082.   end
  1083. end

  1084. class RPG::Enemy::DropItem
  1085.   def req_grade
  1086.     return @req_grade ? @req_grade : 0
  1087.   end
  1088.   
  1089.   def req_grade=(val)
  1090.     @req_grade = val
  1091.   end
  1092. end

  1093. ## Modifies the enemy's drops from the database.
  1094. class RPG::Enemy < RPG::BaseItem
  1095.   def add_score
  1096.     add_drops if @add_score.nil?
  1097.     return @add_score
  1098.   end
  1099.   
  1100.   def one_hit
  1101.     add_drops if @one_hit.nil?
  1102.     return @one_hit
  1103.   end
  1104.   
  1105.   def drop_items
  1106.     add_drops if @added_drops.nil?
  1107.     return @drop_items
  1108.   end
  1109.   
  1110.   def add_drops
  1111.     @added_drops = true
  1112.     @add_score = 0
  1113.     @one_hit = CP::VICTORY::ONE_HIT
  1114.     self.note.split(/[\r\n]+/).each do |line|
  1115.       case line
  1116.       when CP::VICTORY::DROPS
  1117.         temp = RPG::Enemy::DropItem.new
  1118.         case $1.to_s
  1119.         when "I", "i"
  1120.           temp.kind = 1
  1121.         when "W", "w"
  1122.           temp.kind = 2
  1123.         when "A", "a"
  1124.           temp.kind = 3
  1125.         end
  1126.         temp.data_id = $2.to_i
  1127.         temp.denominator = $3.to_i
  1128.         temp.req_grade = $4.to_i
  1129.         @drop_items.push(temp)
  1130.       when CP::VICTORY::SCORE
  1131.         @add_score = $1.to_i
  1132.       when CP::VICTORY::ONEHIT
  1133.         @one_hit = $1.to_i
  1134.       end
  1135.     end
  1136.   end
  1137. end

  1138. ## Creates windows at the end of the victory screen that display level up stats.
  1139. class Window_LvlUp < Window_Base
  1140.   def initialize(actor)
  1141.     @actor = actor  ## Gets the actor, old level, and new skills.
  1142.     @old_level = BattleManager.old_levels(actor.actor_id)
  1143.     @skills = actor.skills - BattleManager.old_skills(actor.actor_id)
  1144.     create_params  ## Creates all params.  Here for custom params.
  1145.     super(0, 0, box_width, box_height)  ## Creates and moves the box.
  1146.     self.x = (Graphics.width - width) / 2
  1147.     self.y = (Graphics.height - height) / 2
  1148.     refresh
  1149.   end
  1150.   
  1151.   ## Creates the entire list of params.
  1152.   def create_params
  1153.     @params = []
  1154.     8.times do |i|
  1155.       p1 = @actor.class.params[i, @old_level]
  1156.       p2 = @actor.class.params[i, @actor.level]
  1157.       vocab = Vocab.param(i)
  1158.       add_param(vocab, p1, p2)
  1159.     end
  1160.   end
  1161.   
  1162.   ## Adds a param to the list.
  1163.   def add_param(vocab, p1, p2)
  1164.     @params.push([vocab, p1, p2])
  1165.   end
  1166.   
  1167.   ## Width of the box based on whether any new skills were learned.
  1168.   def box_width
  1169.     wd = @skills.empty? ? 240 : 480
  1170.     return wd + standard_padding * 2
  1171.   end
  1172.   
  1173.   ## Height of the box based on total params.
  1174.   def box_height
  1175.     return line_height + 104 + line_height * (@params.size + 1)
  1176.   end
  1177.   
  1178.   ## Refreshed the box contents.
  1179.   def refresh
  1180.     contents.clear
  1181.     draw_header
  1182.     draw_face_area(line_height * 1.5)
  1183.     draw_attr_area(0, line_height * 2 + 104)
  1184.     draw_skill_area(240, line_height * 2 + 104)
  1185.   end
  1186.   
  1187.   ## Draws the level up header.
  1188.   def draw_header
  1189.     x = (contents.width - 240) / 2
  1190.     ml = 0
  1191.     p1 = @old_level
  1192.     p2 = @actor.level
  1193.     ml = contents.text_size(p1).width if contents.text_size(p1).width > ml
  1194.     ml = contents.text_size(p2).width if contents.text_size(p2).width > ml
  1195.     ml += 4
  1196.     mo = 236 - ml
  1197.     change_color(system_color)
  1198.     draw_text(x + 2, 0, mo - ml - 22, line_height, CP::VICTORY::LEVEL_UP, 0)
  1199.     draw_text(x + mo - 22, 0, 22, line_height, "→", 1)
  1200.     change_color(normal_color)
  1201.     draw_text(x + mo - ml - 22, 0, ml, line_height, p1, 2)
  1202.     change_color(power_up_color)
  1203.     draw_text(x + mo, 0, ml, line_height, p2, 2)
  1204.   end
  1205.   
  1206.   ## Draws the params section.
  1207.   def draw_attr_area(x, y)
  1208.     ml = 0
  1209.     @params.each do |p|  ## Find the wides param.
  1210.       ml = contents.text_size(p[1]).width if contents.text_size(p[1]).width > ml
  1211.       ml = contents.text_size(p[2]).width if contents.text_size(p[2]).width > ml
  1212.     end
  1213.     ml += 4  ## Set params box size.
  1214.     mo = 236 - ml  ## Last object's location.
  1215.     @params.each_with_index do |para, i|
  1216.       ylh = y + i * line_height  ## Gets the y location.
  1217.       change_color(system_color)  ## Draws the name and arrow.
  1218.       draw_text(x + 2, ylh, mo - ml - 22, line_height, para[0], 0)
  1219.       draw_text(x + mo - 22, ylh, 22, line_height, "→", 1)
  1220.       change_color(normal_color)  ## Draws the old and new stats.
  1221.       draw_text(x + mo - ml - 22, ylh, ml, line_height, para[1], 2)
  1222.       change_color(para[2] > para[1] ? power_up_color : power_down_color)
  1223.       change_color(normal_color) if para[1] == para[2]
  1224.       draw_text(x + mo, ylh, ml, line_height, para[2], 2)
  1225.     end
  1226.   end
  1227.   
  1228.   def draw_face_area(y)  ## Draws the area with the face, name, and class.
  1229.     xi = (contents.width - 216) / 2
  1230.     draw_actor_name(@actor, xi + 104, y + 0 * line_height)
  1231.     draw_actor_class(@actor, xi + 104, y + 1 * line_height)
  1232.     draw_actor_face(@actor, xi + 4, y + 4)
  1233.   end
  1234.   
  1235.   def draw_skill_area(x, y)  ## Draw skill names.
  1236.     change_color(system_color)  ## First, draw the skill message.
  1237.     draw_text(x + 18, y, 220, line_height, CP::VICTORY::NEW_SKILLS, 1)
  1238.     change_color(normal_color)  ## Next, check if there are too many skills.
  1239.     if @skills.size > @params.size - 1
  1240.       total = @params.size-3
  1241.       total.times do |i|
  1242.         item = @skills[i]  ## Draws only so many skills.
  1243.         draw_item_name(item, x + 18, y + (i + 1) * line_height, true, 220)
  1244.       end  ## Draws the final message.
  1245.       draw_text(x + 18, y + (@params.size - 2) * line_height, 220, line_height,
  1246.                 more_skills, 1)
  1247.     else
  1248.       @skills.each_with_index do |item, i|  ## Draws all skills.
  1249.         draw_item_name(item, x + 18, y + (i + 1) * line_height, true, 220)
  1250.       end
  1251.     end
  1252.   end
  1253.   
  1254.   def more_skills  ## Gets the more skills text.
  1255.     more = @skills.size - @params.size
  1256.     return sprintf(CP::VICTORY::MORE_SKILLS, more)
  1257.   end
  1258. end


  1259. ###--------------------------------------------------------------------------###
  1260. #  End of script.                                                              #
  1261. ###--------------------------------------------------------------------------###
复制代码


Project10.rar (1.41 MB, 下载次数: 41)
附件全局搜索########能看到我改过的地方
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
 楼主| 发表于 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
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部