Advertisement
Double_X

DoubleX RMMV Death Records v100a

Feb 19th, 2016 (edited)
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*============================================================================
  2.  *    ## Plugin Info                                                          
  3.  *----------------------------------------------------------------------------
  4.  *    # Plugin Name                                                          
  5.  *      DoubleX RMMV Death Records                                            
  6.  *----------------------------------------------------------------------------
  7.  *    # Terms Of Use                                                          
  8.  *      1. Commercial use's always allowed and crediting me's always optional.
  9.  *      2. You shall keep this plugin's Plugin Info part's contents intact.  
  10.  *      3. You shalln't claim that this plugin's written by anyone other than
  11.  *         DoubleX or my aliases. I always reserve the right to deny you from
  12.  *         using any of my plugins anymore if you've violated this.          
  13.  *      4. CC BY 4.0, except those conflicting with any of the above, applies
  14.  *         to this plugin, unless you've my permissions to not to follow so.  
  15.  *      5. I always reserve the right to deny you from using this plugin      
  16.  *         anymore if you've violated any of the above.                      
  17.  *----------------------------------------------------------------------------
  18.  *    # Prerequisites                                                        
  19.  *      Abilities:                                                            
  20.  *      1. Little Javascript coding proficiency to fully utilize this plugin  
  21.  *----------------------------------------------------------------------------
  22.  *    # Links                                                                
  23.  *      This plugin:                                                          
  24.  *      1. http://pastebin.com/5Vb2Uh17                                      
  25.  *      Mentioned Patreon Supporters:
  26.  *      https://www.patreon.com/posts/71738797
  27.  *----------------------------------------------------------------------------
  28.  *    # Author                                                                
  29.  *      DoubleX                                                              
  30.  *----------------------------------------------------------------------------
  31.  *    # Changelog                                                            
  32.  *      v1.00a(GMT 1400 19-2-2016):                                          
  33.  *      1. 1st version of this plugin finished                                
  34.  *============================================================================*/
  35. /*:
  36.  * @plugindesc Lets users mark the actors/enemies' death times via their ids
  37.  * @author DoubleX
  38.  *
  39.  * @help
  40.  * Initializing a battler will raise its death record flag and set its death
  41.  * record as 0
  42.  *============================================================================
  43.  *    ## Plugin Call Info                                                    
  44.  *----------------------------------------------------------------------------
  45.  *    # Party manipulations                                                  
  46.  *      1. markActorDeathRecords[actorId] = boolean                          
  47.  *         - Sets whether each death of actor with id actorId will be marked  
  48.  *      2. markEnemyDeathRecords[enemyId] = boolean                          
  49.  *         - Sets whether each death of enemy with id actorId will be marked  
  50.  *      3. actorDeathRecords[actorId]                                        
  51.  *         - Returns the marked number of deaths of actor with id actorId    
  52.  *      4. enemyDeathRecords[enemyId]                                        
  53.  *         - Returns the marked number of deaths of enemy with id actorId    
  54.  *============================================================================
  55.  */
  56.  
  57. "use strict";
  58. var DoubleX_RMMV = DoubleX_RMMV || {};
  59. DoubleX_RMMV["Death Records"] = "v1.00a";
  60.  
  61. /*============================================================================
  62.  *    ## Plugin Implementations                                              
  63.  *       You need not edit this part as it's about how this plugin works      
  64.  *----------------------------------------------------------------------------
  65.  *    # Plugin Support Info:                                                  
  66.  *      1. Prerequisites                                                      
  67.  *         - Little Javascript coding proficiency to fully comprehend this    
  68.  *           plugin                                                          
  69.  *      2. Function documentation                                            
  70.  *         - The 1st part describes why this function's rewritten/extended for
  71.  *           rewritten/extended functions or what the function does for new  
  72.  *           functions                                                        
  73.  *         - The 2nd part describes what the arguments of the function are    
  74.  *         - The 3rd part informs which version rewritten, extended or created
  75.  *           this function                                                    
  76.  *         - The 4th part informs whether the function's rewritten or new    
  77.  *         - The 5th part informs whether the function's a real or potential  
  78.  *           hotspot                                                          
  79.  *         - The 6th part describes how this function works for new functions
  80.  *           only, and describes the parts added, removed or rewritten for    
  81.  *           rewritten or extended functions only                            
  82.  *         Example:                                                          
  83.  * /*----------------------------------------------------------------------
  84.  *  *    Why rewrite/extended/What this function does                      
  85.  *  *----------------------------------------------------------------------*/
  86. /* // arguments: What these arguments are                                    
  87.  * functionName = function(arguments) { // Version X+; Hotspot                
  88.  *     // Added/Removed/Rewritten to do something/How this function works    
  89.  *     functionContents                                                      
  90.  *     //                                                                    
  91.  * } // functionName                                                          
  92.  *----------------------------------------------------------------------------*/
  93.  
  94. /*----------------------------------------------------------------------------
  95.  *    # Edit class: Game_Actor                                                
  96.  *----------------------------------------------------------------------------*/
  97.  
  98. Game_Actor.prototype.initMembersDeathRecords = Game_Actor.prototype.initMembers;
  99. Game_Actor.prototype.initMembers = function() {
  100.     this.initMembersDeathRecords();
  101.     this.initDeathRecords(); // Added
  102. }; // Game_Actor.prototype.initMembers
  103.  
  104. Game_Actor.prototype.initDeathRecords = function() { // New
  105.     $gameParty.markActorDeathRecords[this.actorId()] = true;
  106.     $gameParty.actorDeathRecords[this.actorId()] = 0;
  107. }; // Game_Actor.prototype.initDeathRecords
  108.  
  109. Game_Actor.prototype.die = function() { // New
  110.     Game_BattlerBase.prototype.die.call(this);
  111.     this.updateDeathRecords();
  112. }; // Game_Actor.prototype.die
  113.  
  114. Game_Actor.prototype.updateDeathRecords = function() { // New
  115.     var actorId = this.actorId();
  116.     if (!$gameParty.markActorDeathRecords[actorId]) { return; }
  117.     if (!$gameParty.actorDeathRecords[actorId]) { // It's just to play safe
  118.         return $gameParty.actorDeathRecords[actorId] = 1;
  119.     }
  120.     $gameParty.actorDeathRecords[actorId] += 1;
  121. }; // Game_Actor.prototype.updateDeathRecords
  122.  
  123. /*----------------------------------------------------------------------------
  124.  *    # Edit class: Game_Enemy                                                
  125.  *----------------------------------------------------------------------------*/
  126.  
  127. Game_Enemy.prototype.initMembersDeathRecords = Game_Enemy.prototype.initMembers;
  128. Game_Enemy.prototype.initMembers = function() {
  129.     this.initMembersDeathRecords();
  130.     this.initDeathRecords(); // Added
  131. }; // Game_Enemy.prototype.initMembers
  132.  
  133. Game_Enemy.prototype.initDeathRecords = function() { // New
  134.     $gameParty.markEnemyDeathRecords[this.enemyId()] = true;
  135.     $gameParty.enemyDeathRecords[this.enemyId()] = 0;
  136. }; // Game_Enemy.prototype.initDeathRecords
  137.  
  138. Game_Enemy.prototype.die = function() { // New
  139.     Game_BattlerBase.prototype.die.call(this);
  140.     this.updateDeathRecords();
  141. }; // Game_Enemy.prototype.die
  142.  
  143. Game_Enemy.prototype.updateDeathRecords = function() { // New
  144.     var enemyId = this.enemyId();
  145.     if (!$gameParty.markEnemyDeathRecords[enemyId]) { return; }
  146.     if (!$gameParty.enemyDeathRecords[enemyId]) { // It's just to play safe
  147.         return $gameParty.enemyDeathRecords[enemyId] = 1;
  148.     }
  149.     $gameParty.enemyDeathRecords[enemyId] += 1;
  150. }; // Game_Enemy.prototype.updateDeathRecords
  151.  
  152. /*----------------------------------------------------------------------------
  153.  *    # Edit class: Game_Party                                                
  154.  *----------------------------------------------------------------------------*/
  155.  
  156. /*----------------------------------------------------------------------------
  157.  *    New public instance variables                                          
  158.  *----------------------------------------------------------------------------*/
  159. Object.defineProperties(Game_Party.prototype, {
  160.     markActorDeathRecords: { // The actor death number recording flag
  161.         get: function() { return this._markActorDeathRecords; },
  162.         configurable: true
  163.     },
  164.     actorDeathRecords: { // The records of the number of deaths of actors
  165.         get: function() { return this._actorDeathRecords; },
  166.         configurable: true
  167.     },
  168.     markEnemyDeathRecords: { // The enemy death number recording flag
  169.         get: function() { return this._markEnemyDeathRecords; },
  170.         configurable: true
  171.     },
  172.     enemyDeathRecords: { // The records of the number of deaths of enemies
  173.         get: function() { return this._enemyDeathRecords; },
  174.         configurable: true
  175.     }
  176. });
  177.  
  178. Game_Party.prototype.initAllItemsDeathRecords =
  179. Game_Party.prototype.initAllItems;
  180. Game_Party.prototype.initAllItems = function() {
  181.     this.initAllItemsDeathRecords();
  182.     this.initDeathRecords(); // Added
  183. }; // Game_Party.prototype.initAllItems
  184.  
  185. Game_Party.prototype.initDeathRecords = function() { // New
  186.     this._markActorDeathRecords = {};
  187.     this._actorDeathRecords = {};
  188.     this._markEnemyDeathRecords = {};
  189.     this._enemyDeathRecords = {};
  190. }; // Game_Party.prototype.initDeathRecords
  191.  
  192. /*============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement