- ###--------------------------------------------------------------------------### 
 
- #  战斗胜利评级脚本                                                      # 
 
- #  Version 2.1e                                                                # 
 
- #                                                                              # 
 
- #      Credits:                                                                # 
 
- #  Original code by: Neon Black                                                # 
 
- #  Modified by:                                                                # 
 
- #                                                                              # 
 
- #  This work is licensed under the Creative Commons Attribution-NonCommercial  # 
 
- #  3.0 Unported License. To view a copy of this license, visit                 # 
 
- #  [url]http://creativecommons.org/licenses/by-nc/3.0/.[/url]                             # 
 
- #  Permissions beyond the scope of this license are available at               # 
 
- #  [url]http://cphouseset.wordpress.com/liscense-and-terms-of-use/.[/url]                 # 
 
- #                                                                              # 
 
- #      Contact:                                                                # 
 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #      Revision information:                                                   # 
 
- #  V2.1 - 11.16.2012                                                           # 
 
- #   Added grade requirement for drops                                          # 
 
- #   Fixed an issue where drop rate was not figured properly                    # 
 
- #  V2.0 - Finished 8.11.2012                                                   # 
 
- #   Added level up windows                                                     # 
 
- #   Created score items and Grade module                                       # 
 
- #   Numerous other bugfixes and changes                                        # 
 
- #  V1.1b - 6.26.2012                                                           # 
 
- #   Fixed an error related to exp gain display                                 # 
 
- #  V1.1 - 6.21.2012                                                            # 
 
- #   Added rank sprite effect                                                   # 
 
- #  V1.0 - 6.19.2012                                                            # 
 
- #   Wrote and debugged main script                                             # 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #      Compatibility:                                                          # 
 
- #  This script has been tested to work with Yanfly's battle engine (just the   # 
 
- #  base engine) and Yami's PCTB.  If you have any issue, let me know and I     # 
 
- #  will address them asap.                                                     # 
 
- #  Due to the number of new windows, I will only list methods in already       # 
 
- #  existing objects here and not any of the newly created objects.             # 
 
- #                                                                              # 
 
- #  Alias       - BattleManager: setup, play_battle_bgm                         # 
 
- #                Game_Battler: execute_damage                                  # 
 
- #                Game_Enemy: initialize                                        # 
 
- #                Game_Actor: level_up                                          # 
 
- #                Scene_Battle: update_pctb_speed, dispose_all_windows,         # 
 
- #                              use_item                                        # 
 
- #                DataManager: load_database                                    # 
 
- #  Overwrites  - BattleManager: process_victory, play_battle_end_me,           # 
 
- #                               gain_gold, gain_drop_items, gain_exp           # 
 
- #                Game_Troop: make_drop_items                                   # 
 
- #                Game_Enemy: make_drop_items                                   # 
 
- #                Scene_Battle: update                                          # 
 
- #  New Objects - BattleManager: old_levels, old_skills, victory_phase?,        # 
 
- #                               skip?, victory_end                             # 
 
- #                Game_Troop: check_boss                                        # 
 
- #                Game_Actor: gain_exp_cpv, last_level_exp                      # 
 
- #                Scene_Battle: close_status_window, exp_window_update,         # 
 
- #                              update_window_rates, update_scores,             # 
 
- #                              show_victory_windows, create_leveled_windows,   # 
 
- #                              pack_and_send, remove_sprite, drop_items        # 
 
- #                RPG::UsableItem: karma_modif                                  # 
 
- #                RPG::Enemy: add_drops                                         # 
 
- #                DataManager: make_extra_drops                                 # 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #      Instructions:                                                           # 
 
- #  Place this script in the "Materials" section of the scripts above main.     # 
 
- #  This script requires you to set several settings for the script to work     # 
 
- #  properly.  The screen modifies the end of battle to allow a victory screen  # 
 
- #  to appear.  This script also has several notebox tags that can be added to  # 
 
- #  define changes to the grade and one note tag that will allow you to define  # 
 
- #  additional monster drops.                                                   # 
 
- ###-----                                                                -----### 
 
- #                                                                              # 
 
- #      敌人备注:                                                   # 
 
- #                                                                              # 
 
- #   drop[i:1:1:100] 或 drop[i:1:1]                                           # 
 
- #               可以为敌人添加额外的掉落物品. 以上两种格式都行  # 
 
- #               第一个参数是物品类型,可以是 "i", "a", 或  "w" ,分别代表 "物品", 
 
- #               "护甲", 和 "武器".  第二个是物品id.  第三个是掉落几率.       # 
 
- #               x分之1的概率,x=1时代表必定掉落,数字越大,掉落率越低.        # 
 
- #               最后一个参数是可选的,代表战斗分数要求,胜利后评价的分数必须大于 
 
- #               某个数,才会掉落该物品 .    
 
- # 
 
- #   score[1]  - 该怪物每死一只,评价分数就加1.         # 
 
- #               你可以把1替换为其他数字 
 
- # 
 
- #   onehit[1]  - 该怪物每被我方技能命中一次,评价分数就加1.   
 
- #                请注意,多段伤害的技能只会触发一次,附加死亡状态的技能不会触发   # 
 
- #                在下面你可以设定默认每一次命中会获得的分数,优先级低于本敌人备注.                                                       # 
 
- ###-----                                                                -----### 
 
- #                                                                              # 
 
- #      物品/技能备注:                                            # 
 
- #                                                                              # 
 
- #   score[+1]  - 使用该物品/技能后评级分数+1,如果是 score[-20] 则分数-20                 # 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #      Config:                                                                 # 
 
- #  These are the default values used by several of the functions in the        # 
 
- #  script.  You may change these values as you find your game requires in      # 
 
- #  order to give the player a better playing experience based on your game.    # 
 
- #                                                                              # 
 
- module CP       # Do not edit                                                  # 
 
- module VICTORY  #  these two lines.                                            # 
 
- #                                                                              # 
 
- ###-----                                                                -----### 
 
- # 跳过评级BGM的开关,开关开启时不会播放评级BGM                                # 
 
- SKIP_SWITCH = 5 # 默认 = 5                                                  # 
 
- #                                                                              # 
 
-           # 
 
- USE_MUSIC = false # 是否播放评级BGM 默认 = true                                               # 
 
- VICTORY_MUSIC = "" # 评级BGM文件名  默认 = "Scene4"   如果要静音请设定为nil                               # 
 
- MSX_VOL = 100 # 音量  默认 = 100                                                  # 
 
- MSX_PIT = 100 # 音调  默认 = 100                                                  # 
 
- #                                                                              # 
 
- # 是否播放数据库里设定战斗胜利ME,true时会在评级BGM之前播放                  # 
 
- USE_ME = false # 默认 = false                                               # 
 
- #                                                                              # 
 
- # exp值槽颜色                                              # 
 
- EXP_GAUGE_1 = 30 # 颜色1 默认 = 30                                                # 
 
- EXP_GAUGE_2 = 31 # 颜色2 默认 = 31                                                # 
 
- EXP_ADDED = 17 # 增长部分的颜色 默认 = 17                                                  # 
 
- #                                                                              # 
 
- # 是否对调下方左右两个窗口的位置                   # 
 
- FLIP_LOWER = false # 默认 = false                                           # 
 
- #                                                                              # 
 
- # 设定升级后回复hp/mp的模式                                                                   # 
 
- #  0 = 升级后不会回复.                       # 
 
- #  1 = 升级后根据角色hpmp的增加量,回复部分hpmp.                # 
 
- #  2 = 升级后全回复.                 # 
 
- HP_HEAL_TYPE = 0 # 升级后hp回复模式  默认 = 0                                                 # 
 
- MP_HEAL_TYPE = 0 # 升级后hp回复模式  默认 = 0                                                 # 
 
- #                                                                              # 
 
- # 设定显示的文字.                                               # 
 
- LEVEL_UP = "等级提升!!" # 默认 = "Level Up!!"                               # 
 
- SPOILS = "战利品" # 默认 = "Spoils"                                         # 
 
- EXP_NAME = "EXP" # 默认 = "EXP"                                             # 
 
- DEALT_NAME = "造成伤害" # 默认 = "Dealt"                                       # 
 
- RECIEVED_NAME = "受到伤害" # 默认 = "Recieved"                              # 
 
- TURNS_NAME = "回合数" # 默认 = "Turns"                                       # 
 
- RANK_NAME = "评级" # 默认 = "Rank"                                         # 
 
- NO_DROPS = "无战利品" # 默认 = "No drops recieved"                 # 
 
- #                                                                              # 
 
- ###-----                                                                -----### 
 
- # 是否显示升级窗口                                   # 
 
- LVL_UP_ENABLE = true # 默认 = true                                          # 
 
- #                                                                              # 
 
-          # 
 
- LVL_SFX = "Item3" # 升级音效 默认 = "Item3" 想静音请设定为nil                                         # 
 
- LVL_VOL = 80 # 音量 默认 = 80                                                    # 
 
- LVL_PIT = 100 # 音调 默认 = 100                                                  # 
 
- #                                                                              # 
 
- # 学会技能时显示的文字                    # 
 
- NEW_SKILLS = "学会技能:" # 默认 = "Learned:"                                 # 
 
- MORE_SKILLS = "和其他 %s 个技能" # 默认 = "And %s more skills"            # 
 
- #                                                                              # 
 
- ###-----                                                                -----### 
 
-                                                              # 
 
- USE_IMAGES = false # 是否使用图片替代评级文字 默认 = false                                           # 
 
- IMAGE_NAME = "Rank" # 评级图片文件名的前缀 默认 = "Rank" 如果获得评级C 
 
- #                   #则会显示 RankC.png 
 
- #                                                                              # 
 
- #            # 
 
- IMAGE_SFX = "Shot2" # 评级音效 默认 = "Shot2"  想静音请设定为nil                                         # 
 
- SFX_VOL = 100 # 音量 默认 = 100                                                  # 
 
- SFX_PIT = 100 # 音调 默认 = 100                                                  # 
 
- #                                                                              # 
 
- # 设定评级,必须按从上到下,从小到大的顺序:                                                     # 
 
- #    ["评级",  要求分数,  获得exp比率,  获得金钱比率, 获得战利品率,  文字颜色],            # 
 
- # 评级 - 请写在双引号里      # 
 
- # 要求分数 - 达到该评级需要的最低分数,请确定第一个评级的要求分数为 "0".                                           # 
 
- # 获得exp比率 - 默认值为 100 ,如果设定为200,代表获得双倍exp,下面两个比率同理.                                              # 
 
- # 获得金钱比率 - 默认值为 100.                                             # 
 
- # 获得战利品率 - 默认值为 100,不影响同一物品的掉落次数,仅影响单个物品的掉落概率.                                                  # 
 
- # 文字颜色 - 文字颜色,和文本颜色一样.         # 
 
- RANKS =[ # Do not edit this line.                                              # 
 
-   
 
-   ["E",   0, 100, 100, 100, 18], 
 
-   ["D", 100, 100, 105, 100, 20], 
 
-   ["C", 150, 100, 110, 105,  4], 
 
-   ["B", 250, 105, 110, 110, 21], 
 
-   ["A", 400, 115, 115, 115,  3], 
 
-   ["S", 700, 125, 125, 125, 17], 
 
-   
 
- ] # Do not edit this line.                                                     # 
 
- #                                                                              # 
 
- # 设定伤害率对应的获得分数       # 
 
- # 给你一个公式:伤害率 = 造成伤害 / 受到伤害 *100% 
 
- # 举个栗子,假如玩家受到 140 点伤害,并且造成200点伤害, 
 
- # 伤害率 = 200/140*100% = 142 ,对应下表142在100~150之间,此时获得的分数 
 
- # 算到较小的区间,所以最终获得的分数为50 
 
- #    格式为:                                                         # 
 
- #    [伤害率,  获得分数],                                                         # 
 
- DAMAGE_POINTS =[ # Do not edit this line.                                      # 
 
-   
 
-   [ 50,  20], 
 
-   [ 80,  30], 
 
-   [100,  50], 
 
-   [150,  75], 
 
-   [200, 100], 
 
-   [300, 200], 
 
-   
 
- ] # Do not edit this line.                                                     # 
 
- #                                                                              # 
 
- # 以下是特殊情况会获得的的分数,那一项你不需要就把那一项设定为"0".                   # 
 
- #                                                                              # 
 
- # 在同一回合中消灭所有敌人.                                # 
 
- SINGLE_TURN = 150 # 默认 = 150                                              # 
 
- # 消灭boss (请在敌人特性中设定死亡方式为boss. 此分数一场战斗中只会增加一次  
 
- # 就算同一敌群有多个boss也一样.      # 
 
- BOSS_POINTS = 200 # 默认 = 200                                              # 
 
- # 全程无伤                                 # 
 
- NO_DAMAGE = 100 # 默认 = 100                                                # 
 
- # 战斗结束时全员满HP.                              # 
 
- FULL_HP = 50 # 默认 = 50                                                    # 
 
- # 一击必杀(只用一个技能就消灭一个敌人),对添加死亡状态的技能无效                # 
 
- ONE_HIT = 40 # 默认 = 40                                                    # 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #      A note to scripters:                                                    # 
 
- #  As of version 2.0 I have made it possible to add custom score items to be   # 
 
- #  used in battle.  These scores are handled by the "Grade" module.  If you    # 
 
- #  have created a new score item you want to use, you can add it to the Grade  # 
 
- #  module by using the script call "Grade.new_score(:foo, Bar)" where ":foo"   # 
 
- #  is the key you will use to access the object and "Bar" is the name of the   # 
 
- #  new objects class (in this case, the defining line for the object would be  # 
 
- #  "class Bar < Score_Base").  You can then reach this score object at any     # 
 
- #  time by using the script call "Grade.score[:foo]".  To see the base score   # 
 
- #  object or any of the pre-made score object, scroll down.  The score         # 
 
- #  objects have been placed at the top of the script.                          # 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #  The following lines are the actual core code of the script.  While you are  # 
 
- #  certainly invited to look, modifying it may result in undesirable results.  # 
 
- #  Modify at your own risk!                                                    # 
 
- ###--------------------------------------------------------------------------### 
 
-   
 
-   
 
- end  ## Close the VICTORY module. 
 
- end  ## Close the CP module. 
 
-   
 
-   
 
- ##----- 
 
- ## This is a basic score item.  There are 3 main parts to this.  The initialize 
 
- ## part which defines each of the score variables to be used at the start, the 
 
- ## update score part, which can be used at any time to get the current score 
 
- ## the item will add, and the total part, which is used by the Grade module to 
 
- ## get the final value.  You can use "attr_accessor" to create values that can 
 
- ## be adjusted at any time or you can create methods to adjust different aspects 
 
- ## of the score object. 
 
- ##----- 
 
- class Score_Base  ## A score item.  Holds and adjusts an aspect of score. 
 
-   def initialize 
 
-     @score = 0  ## Sets the score to 0 at the start. 
 
-   end 
 
-   
 
-   def update_score  ## Objects used to modify the score. 
 
-     return 0 
 
-   end 
 
-   
 
-   def total  ## Create and return the score. 
 
-     update_score 
 
-     return @score 
 
-   end 
 
- end 
 
-   
 
- class Score_Damage < Score_Base 
 
-   attr_accessor :dealt 
 
-   attr_accessor :recieved 
 
-   attr_accessor :onehit 
 
-   
 
-   def initialize  ## Holds dealt and recieved damage as well as one hit scores. 
 
-     super         ## Creates a score based on dealt and recieved ratio. 
 
-     @dealt = 0 
 
-     @recieved = 0 
 
-     @onehit = 0 
 
-   end 
 
-   
 
-   def update_score 
 
-     res = super 
 
-     if @recieved == 0 
 
-       CP::VICTORY::DAMAGE_POINTS.each {|point| res += point[1]} 
 
-     else 
 
-       dr = (@dealt * 100 / @recieved) 
 
-       CP::VICTORY::DAMAGE_POINTS.each do |point| 
 
-         next if dr < point[0] 
 
-         res += point[1] 
 
-       end 
 
-     end 
 
-     res += CP::VICTORY::NO_DAMAGE if @recieved == 0 
 
-     res += @onehit 
 
-     @score = res 
 
-   end 
 
- end 
 
-   
 
- class Score_HP < Score_Base 
 
-   def initialize  ## Holds the hp at the start of battle. 
 
-     super         ## Not technically used, but checks max hp at end of battle. 
 
-     @start_hp = get_party_hp 
 
-   end 
 
-   
 
-   def get_party_hp 
 
-     return 0 if $game_party.battle_members.empty? 
 
-     result = 0 
 
-     $game_party.battle_members.each do |member| 
 
-       result += member.hp 
 
-     end 
 
-     return result 
 
-   end 
 
-   
 
-   def get_max_hp 
 
-     return 0 if $game_party.battle_members.empty? 
 
-     result = 0 
 
-     $game_party.battle_members.each do |member| 
 
-       result += member.mhp 
 
-     end 
 
-     return result 
 
-   end 
 
-   
 
-   def update_score 
 
-     res = super 
 
-     res += CP::VICTORY::FULL_HP if get_party_hp == get_max_hp 
 
-     @score = res 
 
-   end 
 
- end 
 
-   
 
- class Score_Troop < Score_Base 
 
-   def update_score  ## Gets score values from the existance of boss monsters 
 
-     res = super     ## as well as adding custom scores per monster. 
 
-     res += CP::VICTORY::BOSS_POINTS if $game_troop.check_boss 
 
-     res += CP::VICTORY::SINGLE_TURN if $game_troop.turn_count == 1 
 
-     $game_troop.members.each {|foe| res += foe.add_score} 
 
-     @score = res 
 
-   end 
 
- end 
 
-   
 
- class Score_Skill < Score_Base 
 
-   attr_accessor :karma 
 
-   
 
-   def initialize 
 
-     super 
 
-     @karma = 0 
 
-   end 
 
-   
 
-   def update_score 
 
-     res = super 
 
-     res += @karma 
 
-     @score = res 
 
-   end 
 
- end 
 
-   
 
- module Grade 
 
-   def self.reset  ## Holds score objects, score, and grades. 
 
-     @rate = CP::VICTORY::RANKS[0] 
 
-     @score = 0 
 
-     create_score_items 
 
-   end 
 
-   
 
-   def self.create_score_items  ## Creates the default score items. 
 
-     @score_items = {} 
 
-     new_score(:damage, Score_Damage) 
 
-     new_score(:hp,     Score_HP) 
 
-     new_score(:troop,  Score_Troop) 
 
-     new_score(:skill,  Score_Skill) 
 
-   end 
 
-   
 
-   def self.new_score(key, scr)  ## Adds a custom score item. 
 
-     @score_items[key] = scr.new 
 
-   end 
 
-   
 
-   def self.update_score  ## Creates a score. 
 
-     return 0 if @score_items.empty? 
 
-     val = 0 
 
-     @score_items.each do |key, score| 
 
-       val += score.total 
 
-     end 
 
-     @score = val 
 
-   end 
 
-   
 
-   def self.update_rate  ## Updates the rank and grade. 
 
-     update_score 
 
-     rank_top = 0 
 
-     CP::VICTORY::RANKS.each do |rank| 
 
-       next if rank[1] > @score 
 
-       if rank[1] > rank_top 
 
-         @rate = rank 
 
-         rank_top = rank[1] 
 
-       end 
 
-     end 
 
-   end 
 
-   
 
-   def self.score  ## Returns the score. 
 
-     return @score 
 
-   end 
 
-   
 
-   def self.rate(key = nil)  ## Gets bits of all of the rate. 
 
-     update_rate 
 
-     case key 
 
-     when :exp 
 
-       return @rate[2] 
 
-     when :gold 
 
-       return @rate[3] 
 
-     when :drop 
 
-       return @rate[4] 
 
-     else 
 
-       return @rate 
 
-     end 
 
-   end 
 
-   
 
-   def self.score_items  ## Gets all score items for usage. 
 
-     return @score_items 
 
-   end 
 
- end 
 
-   
 
- ##----- 
 
- ## End of score object.  The rest of the script is below. 
 
- ##----- 
 
-   
 
- module CP 
 
- module VICTORY 
 
- SCORE  = /SCORE\[(\d+)\]/i 
 
- KARMA  = /SCORE\[(\+|\-)?(\d+)\]/i 
 
- DROPS  = /DROP\[(\w+):(\d+):(\d+):?(\d*)\]/i 
 
- ONEHIT = /ONEHIT\[(\d+)\]/i 
 
- end  ## Used for added drops. 
 
- end 
 
-   
 
- $imported = {} if $imported == nil 
 
- $imported["CP_VICTORY"] = 2.1 
 
-   
 
- module BattleManager 
 
-   class << self 
 
-   
 
-   ## Aliased to add certain new settings to the module. 
 
-   alias setup_cp_vict setup unless $@ 
 
-   def setup(troop_id, can_escape = true, can_lose = false) 
 
-     Grade.reset 
 
-     setup_cp_vict(troop_id, can_escape, can_lose) 
 
-     @victory = false 
 
-     @played_bgm = 0 
 
-     @old_levels = {}; @old_skills = {} 
 
-     $game_party.all_members.each do |actr| 
 
-       id = actr.actor_id; lvl = actr.level; skl = actr.skills 
 
-       @old_levels[id] = lvl; @old_skills[id] = skl 
 
-     end 
 
-   end 
 
-   
 
-   ## Gets the level or skills of the actors from before battle. 
 
-   def old_levels(id); return @old_levels[id]; end 
 
-   def old_skills(id); return @old_skills[id]; end 
 
-   
 
-   ## Helps determine if the victory screen is active. 
 
-   def victory_phase? 
 
-     @phase == :victory 
 
-   end 
 
-   
 
-   ## Determine if all musics should be skipped. 
 
-   def skip? 
 
-     $game_switches[CP::VICTORY::SKIP_SWITCH] 
 
-   end 
 
-   
 
-   ## Aliased to skip bgm change if the switch is flipped. 
 
-   alias play_battle_bgm_cpv play_battle_bgm unless $@ 
 
-   def play_battle_bgm 
 
-     play_battle_bgm_cpv unless skip? 
 
-   end 
 
-   
 
-   ## Overwritten for the new victory screen. 
 
-   def process_victory 
 
-     return if @victory; @victory = true 
 
-     $game_system.battle_end_me.play if CP::VICTORY::USE_ME && !skip? 
 
-     RPG::BGM.fade(500) unless skip? || CP::VICTORY::USE_ME 
 
-     20.times do; Graphics.update; end 
 
-     SceneManager.scene.close_status_window 
 
-     Audio.return_audio if $imported["CP_CROSSFADE"] 
 
-     play_battle_end_me unless skip?  ## Skip the bgm change again. 
 
-     @phase = :victory 
 
-     SceneManager.scene.show_victory_windows 
 
-     exp = gain_exp 
 
-     gold = gain_gold 
 
-     gain_drop_items 
 
-     turns = $game_troop.turn_count 
 
-     dlt = Grade.score_items[:damage].dealt 
 
-     rcv = Grade.score_items[:damage].recieved 
 
-     SceneManager.scene.update_scores(dlt, rcv, turns) 
 
-     SceneManager.scene.update_window_rates(exp, gold, Grade.rate[4]) 
 
-     SceneManager.scene.exp_window_update(exp) 
 
-     return true 
 
-   end 
 
-   
 
-   ## Added to actually leave battle. 
 
-   def victory_end 
 
-     RPG::BGM.fade(500) unless skip? 
 
-     20.times do; Graphics.update; end 
 
-     SceneManager.return 
 
-     battle_end(0) 
 
-     replay_bgm_and_bgs unless skip? || $BTEST 
 
-   end 
 
-   
 
-   ## Skipped if music is not made to change. 
 
-   def play_battle_end_me 
 
-     return if @played_bgm > 1 
 
-     @played_bgm += CP::VICTORY::USE_ME ? 1 : 2 
 
-     Audio.bgm_stop 
 
-     if CP::VICTORY::USE_MUSIC 
 
-       mus = CP::VICTORY::VICTORY_MUSIC 
 
-       vol = (CP::VICTORY::USE_ME && @played_bgm == 1) ? 0 : CP::VICTORY::MSX_VOL 
 
-       pit = CP::VICTORY::MSX_PIT 
 
-       RPG::BGM.new(mus, vol, pit).play unless mus.nil? 
 
-     else 
 
-       $game_system.battle_end_me.play 
 
-       replay_bgm_and_bgs unless $BTEST 
 
-     end 
 
-   end 
 
-   
 
-   ## Adjusts the gold rate. 
 
-   def gain_gold 
 
-     if $game_troop.gold_total > 0 
 
-       rate = Grade.rate(:gold) 
 
-       gold = $game_troop.gold_total 
 
-       gold = gold * rate / 100 
 
-       $game_party.gain_gold(gold) 
 
-     else 
 
-       gold = 0 
 
-     end 
 
-     return gold 
 
-   end 
 
-   
 
-   ## Adjusts the drop rate. 
 
-   def gain_drop_items 
 
-     drops = [] 
 
-     rate = Grade.rate(:drop) 
 
-     $game_troop.make_drop_items(rate).each do |item| 
 
-       $game_party.gain_item(item, 1) 
 
-       drops.push(item) 
 
-     end 
 
-     SceneManager.scene.drop_items(drops) 
 
-   end 
 
-   
 
-   ## Adjusts the exp rate. 
 
-   def gain_exp 
 
-     rate = Grade.rate(:exp) 
 
-     $game_party.all_members.each do |actor| 
 
-       actor.gain_exp_cpv(actor.xr_exp, rate) 
 
- #~       actor.gain_exp_cpv($game_troop.exp_total, rate) 
 
-     end 
 
-     return $game_troop.exp_total * rate / 100 
 
-   end 
 
-   
 
-   end 
 
- end 
 
-   
 
- class Game_Troop < Game_Unit 
 
-   ## Checks if a monster has the boss kill flag set. 
 
-   def check_boss 
 
-     members.each do |enemy| 
 
-       next unless enemy.collapse_type == 1 
 
-       return true 
 
-     end 
 
-     return false 
 
-   end 
 
-   
 
-   ## Adjusted drop rate. 
 
-   def make_drop_items(rate = 100) 
 
-     dead_members.inject([]) {|r, enemy| r += enemy.make_drop_items(rate) } 
 
-   end 
 
- end 
 
-   
 
- class Game_Battler < Game_BattlerBase 
 
-   ## Aliased to add damage dealt and recieved to a value for later. 
 
-   alias exec_damage_cpv execute_damage unless $@ 
 
-   def execute_damage(user) 
 
-     if @result.hp_damage > 0 
 
-       i = [@result.hp_damage, hp].min 
 
-       Grade.score_items[:damage].dealt += i if enemy? 
 
-       Grade.score_items[:damage].recieved += i if !enemy? 
 
-       if hp == mhp && i >= mhp && enemy? 
 
-         Grade.score_items[:damage].onehit += @one_hit 
 
-       end 
 
-     end 
 
-     exec_damage_cpv(user) 
 
-   end 
 
- end 
 
-   
 
- class Game_Enemy < Game_Battler 
 
-   attr_accessor :add_score 
 
-   attr_accessor :one_hit 
 
-   
 
-   ## Gets the default added points for an enemy. 
 
-   alias cp_gbv_initialize initialize unless $@ 
 
-   def initialize(index, enemy_id) 
 
-     cp_gbv_initialize(index, enemy_id) 
 
-     enemy = $data_enemies[@enemy_id] 
 
-     @add_score = enemy.add_score 
 
-     @one_hit = enemy.one_hit 
 
-   end 
 
-   
 
-   ## The actual adjusted drop rate. 
 
-   def make_drop_items(rate = 100) 
 
-     cpi = rate.to_f / 100 
 
-     enemy.drop_items.inject([]) do |r, di| 
 
-       if di.kind > 0 && rand * di.denominator < drop_item_rate * cpi 
 
-         if Grade.score >= di.req_grade 
 
-           r.push(item_object(di.kind, di.data_id)) 
 
-         else 
 
-           r 
 
-         end 
 
-       else 
 
-         r 
 
-       end 
 
-     end 
 
-   end 
 
- end 
 
-   
 
- class Game_Actor < Game_Battler 
 
-   attr_reader :actor_id 
 
-   
 
-   alias cp_gv_level_up level_up unless $@ 
 
-   def level_up 
 
-     tmp1 = mhp 
 
-     tmp2 = mmp 
 
-     cp_gv_level_up 
 
-     heal1 = mhp - tmp1 
 
-     heal2 = mmp - tmp2 
 
-     case CP::VICTORY::HP_HEAL_TYPE 
 
-     when 1; self.hp += heal1 
 
-     when 2; self.hp = mhp 
 
-     end 
 
-     case CP::VICTORY::MP_HEAL_TYPE 
 
-     when 1; self.mp += heal2 
 
-     when 2; self.mp = mmp 
 
-     end 
 
-   end 
 
-   
 
-   ## Just made a whole new exp event here.  Adjusts the rate. 
 
-   def gain_exp_cpv(exp, vic_rate = 100) 
 
-     change_exp(self.exp + (exp * vic_rate * final_exp_rate / 100).to_i, false) 
 
-   end 
 
-   
 
-   ## Determines the exp for the last level. 
 
-   def last_level_exp 
 
-     return 0 if @level <= 0 
 
-     return exp_for_level(@level - 1) 
 
-   end 
 
- end 
 
-   
 
- class Scene_Battle < Scene_Base 
 
-   if $imported["YSA-PCTB"] 
 
-   alias cp_bv_fix_yami_pctb update_pctb_speed unless $@ 
 
-   def update_pctb_speed 
 
-     return if BattleManager.victory_phase? 
 
-     cp_bv_fix_yami_pctb 
 
-   end 
 
-   end 
 
-   
 
-   ## Overwritten to stop stuff from happening during the victory phase. 
 
-   def update 
 
-     super 
 
-     if BattleManager.in_turn? 
 
-       process_event 
 
-       process_action 
 
-     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 
 
-   
 
-   ## Terminates the sprites and extra windows at the end of battle. 
 
-   alias cp_gv_dispose_all_windows dispose_all_windows unless $@ 
 
-   def dispose_all_windows 
 
-     remove_sprite 
 
-     cp_gv_dispose_all_windows 
 
-   end 
 
-   
 
-   ## Applies score loss/gain when using an item/skill. 
 
-   alias cp_gv_use_item use_item unless $@ 
 
-   def use_item 
 
-     item = @subject.current_action.item 
 
-     Grade.score_items[:skill].karma += item.add_score 
 
-     cp_gv_use_item 
 
-   end 
 
-   
 
-   ## Closes the status window sorta. 
 
-   def close_status_window 
 
-     instance_variables.each do |varname| 
 
-       ivar = instance_variable_get(varname) 
 
-       ivar.openness = 0 if ivar.is_a?(Window) 
 
-     end 
 
-   end 
 
-   
 
-   ## The next few call stuff. 
 
-   def exp_window_update(exp) 
 
-     @victory_main.redraw_exp(exp) 
 
-     create_leveled_windows 
 
-     pack_and_send 
 
-   end 
 
-   
 
-   def update_window_rates(exp, gold, item) 
 
-     @victory_rank.get_rates(exp, gold) 
 
-     @victory_item_top.get_rates(item) 
 
-   end 
 
-   
 
-   def update_scores(dealt, recieved, turns) 
 
-     @victory_score.draw_score(CP::VICTORY::DEALT_NAME, dealt, 0) 
 
-     @victory_score.draw_score(CP::VICTORY::RECIEVED_NAME, recieved, 24) 
 
-     @victory_score.draw_score(CP::VICTORY::TURNS_NAME, turns, 48) 
 
-     @victory_score.rank_stuff 
 
-   end 
 
-   
 
-   def show_victory_windows 
 
-     @victory_main = Window_VictoryMain.new 
 
-     @victory_top = Window_VictoryTop.new 
 
-     @victory_score = Window_VictoryScore.new 
 
-     @victory_rank = Window_VictoryRank.new 
 
-     @victory_item_top = Window_VictoryItemTop.new 
 
-     @victory_item = Window_VictoryItem.new 
 
-     @victory_main.openness = 0 
 
-     @victory_top.openness = 0 
 
-     @victory_score.openness = 0 
 
-     @victory_rank.openness = 0 
 
-     @victory_item_top.openness = 0 
 
-     @victory_item.openness = 0 
 
-     @victory_main.open 
 
-     @victory_top.open 
 
-     @victory_score.open 
 
-     @victory_rank.open 
 
-     @victory_item_top.open 
 
-     @victory_item.open 
 
-     if CP::VICTORY::USE_IMAGES 
 
-       @victory_score.active = true 
 
-     else 
 
-       @victory_item.active = true 
 
-     end 
 
-   end 
 
-   
 
-   def create_leveled_windows 
 
-     @leveled = [] 
 
-     return if @victory_main.leveled.empty? 
 
-     @victory_main.leveled.each {|actor| @leveled.push(Window_LvlUp.new(actor))} 
 
-     @leveled.each {|wind| wind.visible = false} 
 
-   end 
 
-   
 
-   def pack_and_send 
 
-     ar1 = [@victory_main, @victory_top, @victory_score, @victory_rank, 
 
-            @victory_item_top, @victory_item] 
 
-     @victory_item.get_windows(ar1, @leveled) 
 
-   end 
 
-   
 
-   def remove_sprite 
 
-     @victory_score.remove_sprite unless @victory_score.nil? || @victory_score.disposed? 
 
-     return if @leveled.nil? || @leveled.empty? 
 
-     @leveled.each {|wind| wind.dispose} 
 
-   end 
 
-   
 
-   ## This pushes the drop items to the drop window. 
 
-   def drop_items(drops) 
 
-     @victory_item.get_drops(drops) 
 
-   end 
 
- end 
 
-   
 
- ## The main window with the character faces. 
 
- class Window_VictoryMain < Window_Selectable 
 
-   attr_reader :leveled 
 
-   
 
-   def initialize 
 
-     super(0, 48, Graphics.width, 152) 
 
-     @index = -1 
 
-     @leveled = [] 
 
-     draw_all_items 
 
-   end 
 
-   
 
-   def draw_all_items 
 
-     item_max.times {|i| draw_item(i) } 
 
-   end 
 
-   
 
-   def redraw_exp(exp) 
 
-     item_max.times {|i| draw_exp(i, exp) } 
 
-   end 
 
-   
 
-   def draw_item(index) 
 
-     actor = $game_party.members[index] 
 
-     rect = item_rect(index) 
 
-     draw_victory_face(actor, rect) 
 
-     draw_actor_exp_info(actor, rect.x, rect.y + 104, rect.width) 
 
-   end 
 
-   
 
-   def draw_victory_face(actor, orect) 
 
-     bitmap = Cache.face(actor.face_name) 
 
-     rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96) 
 
-     fx = (orect.width - 96) / 2 
 
-     temp_bit = Bitmap.new(orect.width, orect.height) 
 
-     temp_bit.blt(fx, 0, bitmap, rect) 
 
-     contents.blt(orect.x, orect.y, temp_bit, temp_bit.rect) 
 
-   end 
 
-   
 
-   def draw_exp(index, exp) 
 
-     actor = $game_party.members[index] 
 
-     rect = item_rect(index) 
 
-     draw_actor_exp_info(actor, rect.x, rect.y + 104, rect.width, exp) 
 
-   end 
 
-   
 
-   def draw_actor_exp_info(actor, x, y, width, aexp = 0) 
 
-     x += (width - 96) / 2 
 
-     width = [width, 96].min 
 
-     aexr = aexp * actor.exr 
 
-     cexp = actor.exp - actor.current_level_exp 
 
-     nexp = actor.next_level_exp - actor.current_level_exp 
 
-     if cexp - aexr >= 0 
 
-       rate = cexp.to_f / nexp 
 
-       rate = 1.0 if rate > 1.0 
 
-       gc1 = text_color(CP::VICTORY::EXP_ADDED) 
 
-       gc2 = text_color(CP::VICTORY::EXP_ADDED) 
 
-       draw_gauge(x, y, width, rate, gc1, gc2) 
 
-       cexp -= aexr 
 
-       rate = cexp.to_f / nexp 
 
-       rate = 1.0 if rate > 1.0 
 
-       rate = 1.0 if actor.level == actor.max_level 
 
-       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1) 
 
-       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2) 
 
-       draw_gauge_clear(x, y, width, rate, gc1, gc2) 
 
-     else 
 
-       rate = 1.0 
 
-       gc1 = text_color(CP::VICTORY::EXP_ADDED) 
 
-       gc2 = text_color(CP::VICTORY::EXP_ADDED) 
 
-       draw_gauge(x, y, width, rate, gc1, gc2) 
 
-       cexp = actor.exp - actor.last_level_exp - aexr 
 
-       nexp = actor.current_level_exp - actor.last_level_exp 
 
-       rate = cexp.to_f / nexp 
 
-       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1) 
 
-       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2) 
 
-       draw_gauge_clear(x, y, width, rate, gc1, gc2) 
 
-       change_color(normal_color) 
 
-       draw_text(x, y, width, line_height, CP::VICTORY::LEVEL_UP, 1) 
 
-       @leveled.push(actor) 
 
-     end 
 
-   end 
 
-   
 
-   def draw_gauge_clear(x, y, width, rate, color1, color2) 
 
-     fill_w = (width * rate).to_i 
 
-     gauge_y = y + line_height - 8 
 
-     contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2) 
 
-   end 
 
-   
 
-   def item_max 
 
-     $game_party.battle_members.size 
 
-   end 
 
-   
 
-   def item_height 
 
-     return 128 
 
-   end 
 
-   
 
-   def col_max 
 
-     $game_party.max_battle_members 
 
-   end 
 
-   
 
-   def spacing 
 
-     return 0 
 
-   end 
 
- end 
 
-   
 
- ## The window at the top that says victory stuff. 
 
- class Window_VictoryTop < Window_Base 
 
-   def initialize 
 
-     super(0, 0, Graphics.width, 48) 
 
-     draw_title 
 
-   end 
 
-   
 
-   def draw_title 
 
-     title = sprintf(Vocab::Victory, $game_party.name) 
 
-     change_color(normal_color) 
 
-     draw_text(0, 0, contents.width, line_height, title, 1) 
 
-   end 
 
- end 
 
-   
 
- ## The window that shows rank and score stuff. 
 
- class Window_VictoryScore < Window_Base 
 
-   attr_accessor :done 
 
-   
 
-   def initialize 
 
-     side = CP::VICTORY::FLIP_LOWER ? Graphics.width / 2 : 0 
 
-     super(side, 200, Graphics.width / 2, Graphics.height - 272) 
 
-     @done = false 
 
-     setup_image if CP::VICTORY::USE_IMAGES 
 
-   end 
 
-   
 
-   def update 
 
-     super 
 
-     unless @rank.nil? or @done or !open? 
 
-       @rank.opacity += 25 
 
-       @rank.zoom_x -= 0.2 
 
-       @rank.zoom_y -= 0.2 
 
-       if @rank.zoom_y < 1.0 
 
-         @done = true  
 
-         @rank.zoom_x = 1.0 
 
-         @rank.zoom_y = 1.0 
 
-       end 
 
-     end 
 
-   end 
 
-   
 
-   def setup_image 
 
-     @rank = Sprite.new 
 
-   end 
 
-   
 
-   def hide_image 
 
-     @rank.visible = false if @rank 
 
-   end 
 
-   
 
-   def remove_sprite 
 
-     @rank.dispose unless @rank.nil? 
 
-   end 
 
-   
 
-   def draw_score(name, value, y) 
 
-     change_color(system_color) 
 
-     draw_text(16, y, contents.width-32, 24, name, 0) 
 
-     change_color(normal_color) 
 
-     draw_text(16, y, contents.width-32, 24, value, 2) 
 
-   end 
 
-   
 
-   def rank_stuff 
 
-     draw_rank 
 
-     draw_image if CP::VICTORY::USE_IMAGES 
 
-   end 
 
-   
 
-   def draw_image 
 
-     ranking = CP::VICTORY::IMAGE_NAME + Grade.rate[0] 
 
-     @rank.bitmap = Cache.system(ranking) 
 
-     @rank.ox = @rank.bitmap.width / 2 
 
-     @rank.oy = @rank.bitmap.height / 2 
 
-     @rank.opacity = 0 
 
-     @rank.zoom_x = 5.0 
 
-     @rank.zoom_y = 5.0 
 
-     @rank.x = x + width - padding - 16 - @rank.bitmap.width / 2 
 
-     @rank.y = y + height - padding - 16 
 
-     @rank.z = z + 800 
 
-   end 
 
-   
 
-   def draw_rank 
 
-     color = Grade.rate[5] 
 
-     rank = Grade.rate[0] 
 
-     change_color(system_color) 
 
-     contents.font.size = 32 
 
-     fs = contents.font.size 
 
-     draw_text(16, contents.height-fs, contents.width-32, fs, CP::VICTORY::RANK_NAME, 0) 
 
-     change_color(normal_color) if color.nil? 
 
-     change_color(text_color(color)) unless color.nil? 
 
-     draw_text(16, contents.height-fs, contents.width-32, fs, rank, 2) unless CP::VICTORY::USE_IMAGES 
 
-   end 
 
- end 
 
-   
 
- ## The window that shows exp and gold. 
 
- class Window_VictoryRank < Window_Base 
 
-   def initialize 
 
-     side = CP::VICTORY::FLIP_LOWER ? Graphics.width / 2 : 0 
 
-     super(side, Graphics.height - 72, Graphics.width / 2, 72) 
 
-   end 
 
-   
 
-   def get_rates(exp, gold) 
 
-     draw_object(Grade.rate[2], CP::VICTORY::EXP_NAME, exp, 0) 
 
-     draw_object(Grade.rate[3], Vocab.currency_unit, gold, 24) 
 
-   end 
 
-   
 
-   def draw_object(rate, name, value, y) 
 
-     change_color(normal_color) 
 
-     draw_text(16, y, contents.width - 32, 24, value, 0) 
 
-     n = contents.text_size(value).width 
 
-     change_color(system_color) 
 
-     draw_text(n + 20, y, contents.width - n - 36, 24, name, 0) 
 
-     change_color(normal_color) 
 
-     text = rate.to_s + "%" 
 
-     draw_text(16, y, contents.width - 32, 24, text, 2) 
 
-   end 
 
- end 
 
-   
 
- ## The window that shows drop rate. 
 
- class Window_VictoryItemTop < Window_Base 
 
-   def initialize 
 
-     side = CP::VICTORY::FLIP_LOWER ? 0 : Graphics.width / 2 
 
-     super(side, 200, Graphics.width / 2, 48) 
 
-   end 
 
-   
 
-   def get_rates(rate) 
 
-     change_color(system_color) 
 
-     draw_text(16, 0, contents.width-32, 24, CP::VICTORY::SPOILS, 0) 
 
-     change_color(normal_color) 
 
-     text = rate.to_s + "%" 
 
-     draw_text(16, 0, contents.width-32, 24, text, 2) 
 
-   end 
 
- end 
 
-   
 
- ## The window that shows items.  You can scroll through the items in it. 
 
- class Window_VictoryItem < Window_Selectable 
 
-   def initialize 
 
-     side = CP::VICTORY::FLIP_LOWER ? 0 : Graphics.width / 2 
 
-     super(side, 248, Graphics.width / 2, Graphics.height - 248) 
 
-     @index = 0 
 
-   end 
 
-   
 
-   def item_max 
 
-     @data ? @data.size : 0 
 
-   end 
 
-   
 
-   def draw_all_items 
 
-     return super if item_max > 0 
 
-     draw_null 
 
-   end 
 
-   
 
-   def draw_item(index) 
 
-     item = @data[index] 
 
-     if item 
 
-       rect = item_rect(index) 
 
-       rect.width -= 4 
 
-       draw_item_name(item, rect.x, rect.y) 
 
-       draw_item_number(rect, index) 
 
-     end 
 
-   end 
 
-   
 
-   def draw_null 
 
-     rect = item_rect(0) 
 
-     rect.width -= 4 
 
-     draw_text(rect, CP::VICTORY::NO_DROPS, 1) 
 
-   end 
 
-   
 
-   def draw_item_number(rect, index) 
 
-     draw_text(rect, sprintf(":%2d", @number[index]), 2) 
 
-   end 
 
-   
 
-   def get_drops(drops) 
 
-     @data = [] 
 
-     @number = [] 
 
-     for i in 0...drops.size 
 
-       ind = @data.index(drops[i]) 
 
-       if ind.nil? 
 
-         @data.push(drops[i]) 
 
-         @number.push(1) 
 
-       else 
 
-         @number[ind] += 1 
 
-       end 
 
-     end 
 
-     self.refresh 
 
-   end 
 
-   
 
-   def get_windows(ar1, ar2) 
 
-     @done = 0 
 
-     @ar1 = ar1 
 
-     @ar2 = ar2 
 
-   end 
 
-   
 
-   def process_handling 
 
-     return unless open? && active 
 
-     BattleManager.victory_end if Input.trigger?(:B) 
 
-     check_leveled_up if Input.trigger?(:C) 
 
-   end 
 
-   
 
-   def check_leveled_up 
 
-     @done = 0 if @done.nil?; @done += 1 
 
-     return BattleManager.victory_end unless CP::VICTORY::LVL_UP_ENABLE 
 
-     return BattleManager.victory_end if @ar2.nil? 
 
-     return BattleManager.victory_end if @done > @ar2.size 
 
-     sfx = CP::VICTORY::LVL_SFX 
 
-     vol = CP::VICTORY::LVL_VOL 
 
-     pit = CP::VICTORY::LVL_PIT 
 
-     RPG::SE.new(sfx, vol, pit).play unless sfx.nil? 
 
-     @ar1.each {|wind| wind.visible = false} 
 
-     @ar2.each {|wind| wind.visible = false} 
 
-     @ar1[2].hide_image 
 
-     @ar2[@done - 1].visible = true 
 
-   end 
 
-   
 
-   def update 
 
-     super 
 
-     if Audio.bgm_pos != 0 
 
-       BattleManager.play_battle_end_me 
 
-     end 
 
-   end 
 
-   
 
-   def refresh 
 
-     contents.clear 
 
-     create_contents 
 
-     draw_all_items 
 
-   end 
 
- end 
 
-   
 
- ## Modifies a skill's score modification when used. 
 
- class RPG::UsableItem < RPG::BaseItem 
 
-   def add_score 
 
-     karma_modif if @add_score.nil? 
 
-     return @add_score 
 
-   end 
 
-   
 
-   def karma_modif 
 
-     @add_score = 0 
 
-     self.note.split(/[\r\n]+/).each do |line| 
 
-       case line 
 
-       when CP::VICTORY::KARMA 
 
-         @add_score = ($1.to_s + $2.to_s).to_i 
 
-       end 
 
-     end 
 
-   end 
 
- end 
 
-   
 
- class RPG::Enemy::DropItem 
 
-   def req_grade 
 
-     return @req_grade ? @req_grade : 0 
 
-   end 
 
-   
 
-   def req_grade=(val) 
 
-     @req_grade = val 
 
-   end 
 
- end 
 
-   
 
- ## Modifies the enemy's drops from the database. 
 
- class RPG::Enemy < RPG::BaseItem 
 
-   def add_score 
 
-     add_drops if @add_score.nil? 
 
-     return @add_score 
 
-   end 
 
-   
 
-   def one_hit 
 
-     add_drops if @one_hit.nil? 
 
-     return @one_hit 
 
-   end 
 
-   
 
-   def drop_items 
 
-     add_drops if @added_drops.nil? 
 
-     return @drop_items 
 
-   end 
 
-   
 
-   def add_drops 
 
-     @added_drops = true 
 
-     @add_score = 0 
 
-     @one_hit = CP::VICTORY::ONE_HIT 
 
-     self.note.split(/[\r\n]+/).each do |line| 
 
-       case line 
 
-       when CP::VICTORY::DROPS 
 
-         temp = RPG::Enemy::DropItem.new 
 
-         case $1.to_s 
 
-         when "I", "i" 
 
-           temp.kind = 1 
 
-         when "W", "w" 
 
-           temp.kind = 2 
 
-         when "A", "a" 
 
-           temp.kind = 3 
 
-         end 
 
-         temp.data_id = $2.to_i 
 
-         temp.denominator = $3.to_i 
 
-         temp.req_grade = $4.to_i 
 
-         @drop_items.push(temp) 
 
-       when CP::VICTORY::SCORE 
 
-         @add_score = $1.to_i 
 
-       when CP::VICTORY::ONEHIT 
 
-         @one_hit = $1.to_i 
 
-       end 
 
-     end 
 
-   end 
 
- end 
 
-   
 
- ## Creates windows at the end of the victory screen that display level up stats. 
 
- class Window_LvlUp < Window_Base 
 
-   def initialize(actor) 
 
-     @actor = actor  ## Gets the actor, old level, and new skills. 
 
-     @old_level = BattleManager.old_levels(actor.actor_id) 
 
-     @skills = actor.skills - BattleManager.old_skills(actor.actor_id) 
 
-     create_params  ## Creates all params.  Here for custom params. 
 
-     super(0, 0, box_width, box_height)  ## Creates and moves the box. 
 
-     self.x = (Graphics.width - width) / 2 
 
-     self.y = (Graphics.height - height) / 2 
 
-     refresh 
 
-   end 
 
-   
 
-   ## Creates the entire list of params. 
 
-   def create_params 
 
-     @params = [] 
 
-     8.times do |i| 
 
-       p1 = @actor.class.params[i, @old_level] 
 
-       p2 = @actor.class.params[i, @actor.level] 
 
-       vocab = Vocab.param(i) 
 
-       add_param(vocab, p1, p2) 
 
-     end 
 
-   end 
 
-   
 
-   ## Adds a param to the list. 
 
-   def add_param(vocab, p1, p2) 
 
-     @params.push([vocab, p1, p2]) 
 
-   end 
 
-   
 
-   ## Width of the box based on whether any new skills were learned. 
 
-   def box_width 
 
-     wd = @skills.empty? ? 240 : 480 
 
-     return wd + standard_padding * 2 
 
-   end 
 
-   
 
-   ## Height of the box based on total params. 
 
-   def box_height 
 
-     return line_height + 104 + line_height * (@params.size + 1) 
 
-   end 
 
-   
 
-   ## Refreshed the box contents. 
 
-   def refresh 
 
-     contents.clear 
 
-     draw_header 
 
-     draw_face_area(line_height * 1.5) 
 
-     draw_attr_area(0, line_height * 2 + 104) 
 
-     draw_skill_area(240, line_height * 2 + 104) 
 
-   end 
 
-   
 
-   ## Draws the level up header. 
 
-   def draw_header 
 
-     x = (contents.width - 240) / 2 
 
-     ml = 0 
 
-     p1 = @old_level 
 
-     p2 = @actor.level 
 
-     ml = contents.text_size(p1).width if contents.text_size(p1).width > ml 
 
-     ml = contents.text_size(p2).width if contents.text_size(p2).width > ml 
 
-     ml += 4 
 
-     mo = 236 - ml 
 
-     change_color(system_color) 
 
-     draw_text(x + 2, 0, mo - ml - 22, line_height, CP::VICTORY::LEVEL_UP, 0) 
 
-     draw_text(x + mo - 22, 0, 22, line_height, "→", 1) 
 
-     change_color(normal_color) 
 
-     draw_text(x + mo - ml - 22, 0, ml, line_height, p1, 2) 
 
-     change_color(power_up_color) 
 
-     draw_text(x + mo, 0, ml, line_height, p2, 2) 
 
-   end 
 
-   
 
-   ## Draws the params section. 
 
-   def draw_attr_area(x, y) 
 
-     ml = 0 
 
-     @params.each do |p|  ## Find the wides param. 
 
-       ml = contents.text_size(p[1]).width if contents.text_size(p[1]).width > ml 
 
-       ml = contents.text_size(p[2]).width if contents.text_size(p[2]).width > ml 
 
-     end 
 
-     ml += 4  ## Set params box size. 
 
-     mo = 236 - ml  ## Last object's location. 
 
-     @params.each_with_index do |para, i| 
 
-       ylh = y + i * line_height  ## Gets the y location. 
 
-       change_color(system_color)  ## Draws the name and arrow. 
 
-       draw_text(x + 2, ylh, mo - ml - 22, line_height, para[0], 0) 
 
-       draw_text(x + mo - 22, ylh, 22, line_height, "→", 1) 
 
-       change_color(normal_color)  ## Draws the old and new stats. 
 
-       draw_text(x + mo - ml - 22, ylh, ml, line_height, para[1], 2) 
 
-       change_color(para[2] > para[1] ? power_up_color : power_down_color) 
 
-       change_color(normal_color) if para[1] == para[2] 
 
-       draw_text(x + mo, ylh, ml, line_height, para[2], 2) 
 
-     end 
 
-   end 
 
-   
 
-   def draw_face_area(y)  ## Draws the area with the face, name, and class. 
 
-     xi = (contents.width - 216) / 2 
 
-     draw_actor_name(@actor, xi + 104, y + 0 * line_height) 
 
-     draw_actor_class(@actor, xi + 104, y + 1 * line_height) 
 
-     draw_actor_face(@actor, xi + 4, y + 4) 
 
-   end 
 
-   
 
-   def draw_skill_area(x, y)  ## Draw skill names. 
 
-     change_color(system_color)  ## First, draw the skill message. 
 
-     draw_text(x + 18, y, 220, line_height, CP::VICTORY::NEW_SKILLS, 1) 
 
-     change_color(normal_color)  ## Next, check if there are too many skills. 
 
-     if @skills.size > @params.size - 1 
 
-       total = @params.size-3 
 
-       total.times do |i| 
 
-         item = @skills[i]  ## Draws only so many skills. 
 
-         draw_item_name(item, x + 18, y + (i + 1) * line_height, true, 220) 
 
-       end  ## Draws the final message. 
 
-       draw_text(x + 18, y + (@params.size - 2) * line_height, 220, line_height, 
 
-                 more_skills, 1) 
 
-     else 
 
-       @skills.each_with_index do |item, i|  ## Draws all skills. 
 
-         draw_item_name(item, x + 18, y + (i + 1) * line_height, true, 220) 
 
-       end 
 
-     end 
 
-   end 
 
-   
 
-   def more_skills  ## Gets the more skills text. 
 
-     more = @skills.size - @params.size 
 
-     return sprintf(CP::VICTORY::MORE_SKILLS, more) 
 
-   end 
 
- end 
 
-   
 
-   
 
- ###--------------------------------------------------------------------------### 
 
- #  End of script.                                                              # 
 
- ###--------------------------------------------------------------------------###