SHARE
TWEET

DoubleX RMMV Unit Filters v100a

Double_X Oct 17th, 2017 (edited) 111 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 Unit Filters                                            
  6.  *----------------------------------------------------------------------------
  7.  *    # Introduction                                                          
  8.  *      1. Without any plugin, getting a member with specific conditions      
  9.  *         relative to the belonging unit, like finding the party member with
  10.  *         the highest amount of hp, demands relatively heavy event setups,  
  11.  *         even with the aid of common events, which boost event reusability.
  12.  *      2. With this plugin, the same can be done using several easy, simple  
  13.  *         and small plugin calls instead of writing several common events    
  14.  *         from scratch, thus further improving effectiveness and efficiency.
  15.  *----------------------------------------------------------------------------
  16.  *    # Terms Of Use                                                          
  17.  *      1. Commercial use's always allowed and crediting me's always optional.
  18.  *      2. You shall keep this plugin's Plugin Info part's contents intact.  
  19.  *      3. You shalln't claim that this plugin's written by anyone other than
  20.  *         DoubleX or my aliases. I always reserve the right to deny you from
  21.  *         using any of my plugins anymore if you've violated this.          
  22.  *      4. CC BY 4.0, except those conflicting with any of the above, applies
  23.  *         to this plugin, unless you've my permissions not needing follow so.
  24.  *      5. I always reserve the right to deny you from using this plugin      
  25.  *         anymore if you've violated any of the above.                      
  26.  *----------------------------------------------------------------------------
  27.  *    # Prerequisites                                                        
  28.  *      Abilities:                                                            
  29.  *      1. Nothing special for most ordinary cases                            
  30.  *      2. Little RMMV plugin development proficiency to fully utilize this  
  31.  *----------------------------------------------------------------------------
  32.  *    # Author Notes                                                          
  33.  *      1. This plugin's meant to be a convenience tool to facilitate the use
  34.  *         of some unit filters that aren't already available from the default
  35.  *         RMMV codebase, so you're still supposed to write some Javascript  
  36.  *         codes with the aid of the new plugin calls provided by this plugin.
  37.  *      2. You're supposed to implement unit filter result set operations -  
  38.  *         union, intersection, complement, difference, etc - yourselves.    
  39.  *----------------------------------------------------------------------------
  40.  *    # Links                                                                
  41.  *      This plugin:                                                          
  42.  *      1. https://pastebin.com/ZWZED0UC                                      
  43.  *----------------------------------------------------------------------------
  44.  *    # Author                                                                
  45.  *      DoubleX                                                              
  46.  *----------------------------------------------------------------------------
  47.  *    # Changelog                                                            
  48.  *      v1.00a(GMT 0800 18-10-2017):                                          
  49.  *      1. 1st version of this plugin finished                                
  50.  *============================================================================*/
  51. /*:
  52.  * @plugindesc Lets you use plugin calls to use new unit filters in order to
  53.  * write much, much less codes to perform much, much more tasks
  54.  * @author DoubleX
  55.  *
  56.  * @help
  57.  *============================================================================
  58.  *    ## Plugin Call Info                                                    
  59.  *       Members refer to all members outside battles and battle members      
  60.  *       inside battles respectively                                          
  61.  *----------------------------------------------------------------------------
  62.  *    # Battler manipulations                                                
  63.  *      1. isAnyStateAffected(stateIds)                                      
  64.  *         - Returns whether the battler involved has any state included by  
  65.  *           stateIds, which is a list of id of states                        
  66.  *         - stateIds must be an Array of positive Number                    
  67.  *         - E.g.:                                                            
  68.  *           $gameParty.members()[0].isAnyStateAffected([1, 2]) returns      
  69.  *           whether the 1st party member has any state with id 1 or 2        
  70.  *      2. isAllStatesAffected(stateIds)                                      
  71.  *         - Returns whether the battler involved has all states included by  
  72.  *           stateIds, which is a list of id of states                        
  73.  *         - stateIds must be an Array of positive Number                    
  74.  *         - E.g.:                                                            
  75.  *           $gameActors.actor(1).isAllStatesAffected([1, 2]) returns whether
  76.  *           the actor with id 1 has all states with id 1 or 2                
  77.  *      3. isAnyBuffAffected(stateIds)                                        
  78.  *         - Returns whether the battler involved has any buff included by    
  79.  *           paramIds, which is a list of id of corresponding parameters      
  80.  *         - paramIds must be an Array of non negative Number                
  81.  *         - E.g.:                                                            
  82.  *           $gameParty.members()[0].isAnyBuffAffected([0, 1]) returns        
  83.  *           whether the 1st party member has any hp or mp buff              
  84.  *      4. isAllBuffsAffected(stateIds)                                      
  85.  *         - Returns whether the battler involved has all buffs included by  
  86.  *           paramIds, which is a list of id of corresponding parameters      
  87.  *         - paramIds must be an Array of non negative Number                
  88.  *         - E.g.:                                                            
  89.  *           $gameActors.actor(1).isAllBuffsAffected([0, 1]) returns whether  
  90.  *           the actor with id 1 has all hp and mp buffs                      
  91.  *      5. isAnyDebuffAffected(stateIds)                                      
  92.  *         - Returns whether the battler involved has any debuff included by  
  93.  *           paramIds, which is a list of id of corresponding parameters      
  94.  *         - paramIds must be an Array of non negative Number                
  95.  *         - E.g.:                                                            
  96.  *           $gameParty.members()[0].isAnyDebuffAffected([0, 1]) returns        
  97.  *           whether the 1st party member has any hp or mp debuff            
  98.  *      6. isAllDebuffsAffected(stateIds)                                      
  99.  *         - Returns whether the battler involved has all debuffs included by
  100.  *           paramIds, which is a list of id of corresponding parameters      
  101.  *         - paramIds must be an Array of non negative Number                
  102.  *         - E.g.:                                                            
  103.  *           $gameActors.actor(1).isAllDebuffsAffected([0, 1]) returns whether  
  104.  *           the actor with id 1 has all hp and mp debuffs                    
  105.  *      7. hasAnySkill(skillIds)                                              
  106.  *         - Returns whether the battler involved has any skill included by  
  107.  *           skillIds, which is a list of id of corresponding skills          
  108.  *         - paramIds must be an Array of positive Number                    
  109.  *         - E.g.:                                                            
  110.  *           $gameParty.members()[0].hasAnySkill([1, 2]) returns whether the  
  111.  *           1st party member has skill with id 1 or 2                        
  112.  *      8. hasAllSkills(skillIds)                                            
  113.  *         - Returns whether the battler involved has all skills included by  
  114.  *           skillIds, which is a list of id of corresponding skills          
  115.  *         - paramIds must be an Array of positive Number                    
  116.  *         - E.g.:                                                            
  117.  *           $gameActors.actor(1).hasAllSkills([1, 2]) returns whether the    
  118.  *           actor with id 1 has all skills with id 1 and 2                  
  119.  *    # Unit manipulations                                                    
  120.  *      1. memWithAnyState(stateIds)                                          
  121.  *         - Returns the list of members with any state included by stateIds,
  122.  *           which is a list of id of states                                  
  123.  *         - The return value should be an Array of Game_Battler              
  124.  *         - stateIds must be an Array of positive Number                    
  125.  *         - E.g.:                                                            
  126.  *           $gameParty.memWithAnyState([1, 2]) returns the list of party    
  127.  *           members with any state with id 1 or 2                            
  128.  *      2. memWithAllStates(stateIds)                                        
  129.  *         - Returns the list of members with all states included by          
  130.  *           stateIds, which is a list of id of states                        
  131.  *         - The return value should be an Array of Game_Battler              
  132.  *         - stateIds must be an Array of positive Number                    
  133.  *         - E.g.:                                                            
  134.  *           $gameTroop.memWithAllStates([1, 2]) returns the list of troop    
  135.  *           members with all states with id 1 or 2                          
  136.  *      3. memWithoutAnyState(stateIds)                                      
  137.  *         - Returns the list of members without any state included by        
  138.  *           stateIds, which is a list of id of states                        
  139.  *         - The return value should be an Array of Game_Battler              
  140.  *         - stateIds must be an Array of positive Number                    
  141.  *         - E.g.:                                                            
  142.  *           $gameParty.memWithoutAnyState([1, 2]) returns the list of party  
  143.  *           members without any state with id 1 or 2                        
  144.  *      4. memWithoutAllStates(stateIds)                                      
  145.  *         - Returns the list of members without all states included by      
  146.  *           stateIds, which is a list of id of states                        
  147.  *         - The return value should be an Array of Game_Battler              
  148.  *         - stateIds must be an Array of positive Number                    
  149.  *         - E.g.:                                                            
  150.  *           $gameTroop.memWithoutAllStates([1, 2]) returns the list of troop
  151.  *           members without all states with id 1 or 2                        
  152.  *      5. memWithAnyBuff(paramIds)                                          
  153.  *         - Returns the list of members with any buff included by paramIds,  
  154.  *           which is a list of id of corresponding parameters                
  155.  *         - The return value should be an Array of Game_Battler              
  156.  *         - paramIds must be an Array of non negative Number                
  157.  *         - E.g.:                                                            
  158.  *           $gameParty.memWithAnyBuff([0, 1]) returns the list of party      
  159.  *           members with any hp or mp buff                                  
  160.  *      6. memWithAllBuffs(paramIds)                                          
  161.  *         - Returns the list of members with all buffs included by paramIds,
  162.  *           which is a list of id of corresponding parameters                
  163.  *         - The return value should be an Array of Game_Battler              
  164.  *         - paramIds must be an Array of non negative Number                
  165.  *         - E.g.:                                                            
  166.  *           $gameTroop.memWithAllBuffs([0, 1]) returns the list of troop    
  167.  *           members with all hp and mp buffs                                
  168.  *      7. memWithoutAnyBuff(paramIds)                                        
  169.  *         - Returns the list of members without any buff included by        
  170.  *           paramIds, which is a list of id of corresponding parameters      
  171.  *         - The return value should be an Array of Game_Battler              
  172.  *         - paramIds must be an Array of non negative Number                
  173.  *         - E.g.:                                                            
  174.  *           $gameParty.memWithoutAnyBuff([0, 1]) returns the list of party  
  175.  *           members without any hp or mp buff                                
  176.  *      8. memWithoutAllBuffs(paramIds)                                      
  177.  *         - Returns the list of members without all buffs included by        
  178.  *           paramIds, which is a list of id of corresponding parameters      
  179.  *         - The return value should be an Array of Game_Battler              
  180.  *         - paramIds must be an Array of non negative Number                
  181.  *         - E.g.:                                                            
  182.  *           $gameTroop.memWithoutAllBuffs([0, 1]) returns the list of troop  
  183.  *           members without all hp and mp buffs                              
  184.  *      9. memWithAnyDebuff(paramIds)                                        
  185.  *         - Returns the list of members with any debuff included by paramIds,
  186.  *           which is a list of id of corresponding parameters                
  187.  *         - The return value should be an Array of Game_Battler              
  188.  *         - paramIds must be an Array of non negative Number                
  189.  *         - E.g.:                                                            
  190.  *           $gameParty.memWithAnyDebuff([0, 1]) returns the list of party    
  191.  *           members with any hp or mp debuff                                
  192.  *      10. memWithAllDebuffs(paramIds)                                      
  193.  *         - Returns the list of members with all debuffs included by        
  194.  *           paramIds, which is a list of id of corresponding parameters      
  195.  *         - The return value should be an Array of Game_Battler              
  196.  *         - paramIds must be an Array of non negative Number                
  197.  *         - E.g.:                                                            
  198.  *           $gameTroop.memWithAllDebuffs([0, 1]) returns the list of troop    
  199.  *           members with all hp and mp debuffs                              
  200.  *      11. memWithoutAnyDebuff(paramIds)                                    
  201.  *         - Returns the list of members without any debuff included by      
  202.  *           paramIds, which is a list of id of corresponding parameters      
  203.  *         - The return value should be an Array of Game_Battler              
  204.  *         - paramIds must be an Array of non negative Number                
  205.  *         - E.g.:                                                            
  206.  *           $gameParty.memWithoutAnyDebuff([0, 1]) returns the list of party
  207.  *           members without any hp or mp debuff                              
  208.  *      12. memWithoutAllDebuffs(paramIds)                                    
  209.  *         - Returns the list of members without all debuffs included by      
  210.  *           paramIds, which is a list of id of corresponding parameters      
  211.  *         - The return value should be an Array of Game_Battler              
  212.  *         - paramIds must be an Array of non negative Number                
  213.  *         - E.g.:                                                            
  214.  *           $gameTroop.memWithoutAllDebuffs([0, 1]) returns the list of troop
  215.  *           members without all hp and mp debuffs                            
  216.  *      13. memWithAnySkill(skillIds)                                        
  217.  *         - Returns the list of members with any skill included by skillIds,
  218.  *           which is a list of id of corresponding skills                    
  219.  *         - The return value should be an Array of Game_Battler              
  220.  *         - skillIds must be an Array of positive Number                    
  221.  *         - E.g.:                                                            
  222.  *           $gameParty.memWithAnySkill([1, 2]) returns the list of party    
  223.  *           members with skill having id 1 or 2                              
  224.  *      14. memWithAllSkills(skillIds)                                        
  225.  *         - Returns the list of members with all skills included by skillIds,
  226.  *           which is a list of id of corresponding skills                    
  227.  *         - The return value should be an Array of Game_Battler              
  228.  *         - skillIds must be an Array of positive Number                    
  229.  *         - E.g.:                                                            
  230.  *           $gameTroop.memWithAllSkills([1, 2]) returns the list of troop    
  231.  *           members with skills having id 1 and 2                            
  232.  *      15. memWithoutAnySkill(skillIds)                                      
  233.  *         - Returns the list of members without any skill included by        
  234.  *           skillIds, which is a list of id of corresponding skills          
  235.  *         - The return value should be an Array of Game_Battler              
  236.  *         - skillIds must be an Array of positive Number                    
  237.  *         - E.g.:                                                            
  238.  *           $gameParty.memWithoutAnySkill([1, 2]) returns the list of party  
  239.  *           members without skills having id 1 nor 2                        
  240.  *      16. memWithoutAllSkills(skillIds)                                    
  241.  *         - Returns the list of members without all skills included by      
  242.  *           skillIds, which is a list of id of corresponding skills          
  243.  *         - The return value should be an Array of Game_Battler              
  244.  *         - skillIds must be an Array of positive Number                    
  245.  *         - E.g.:                                                            
  246.  *           $gameTroop.memWithoutAllSkills([1, 2]) returns the list of troop
  247.  *           members without skills having id 1 and 2                        
  248.  *      17. anyHighestStatMem(stats)                                          
  249.  *         - Returns the list of members whose values of                      
  250.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  251.  *           is a list of names of corresponding                              
  252.  *           parameters/ex-parameters/sp-parameters, include those being the  
  253.  *           highest among the caller                                        
  254.  *         - The return value should be an Array of Game_Battler              
  255.  *         - stats must be an Array of String as names of Game_Battler        
  256.  *           properties with the get function                                
  257.  *         - E.g.:                                                            
  258.  *           $gameParty.anyHighestStatMem(["hp", "mp"]) returns the list of  
  259.  *           party members with the highest amount of hp or mp among the party
  260.  *      18. allHighestStatsMem(stats)                                        
  261.  *         - Returns the list of members whose values of                      
  262.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  263.  *           is a list of names of corresponding                              
  264.  *           parameters/ex-parameters/sp-parameters, are all the highest among
  265.  *           the caller                                                      
  266.  *         - The return value should be an Array of Game_Battler              
  267.  *         - stats must be an Array of String as names of Game_Battler        
  268.  *           properties with the get function                                
  269.  *         - E.g.:                                                            
  270.  *           $gameTroop.allHighestStatsMem(["hp", "mp"]) returns the list of  
  271.  *           troop members with the highest amount of hp and mp among the    
  272.  *           troop                                                            
  273.  *      19. notAnyHighestStatMem(stats)                                      
  274.  *         - Returns the list of members whose values of                      
  275.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  276.  *           is a list of names of corresponding                              
  277.  *           parameters/ex-parameters/sp-parameters, don't include those being
  278.  *           the highest among the caller                                    
  279.  *         - The return value should be an Array of Game_Battler              
  280.  *         - stats must be an Array of String as names of Game_Battler        
  281.  *           properties with the get function                                
  282.  *         - E.g.:                                                            
  283.  *           $gameParty.notAnyHighestStatMem(["hp", "mp"]) returns the list of
  284.  *           party members with neither the highest amount of hp nor mp among
  285.  *           the party                                                        
  286.  *      20. notAllHighestStatsMem(stats)                                      
  287.  *         - Returns the list of members whose values of                      
  288.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  289.  *           is a list of names of corresponding                              
  290.  *           parameters/ex-parameters/sp-parameters, aren't all the highest  
  291.  *           among the caller                                                
  292.  *         - The return value should be an Array of Game_Battler              
  293.  *         - stats must be an Array of String as names of Game_Battler        
  294.  *           properties with the get function                                
  295.  *         - E.g.:                                                            
  296.  *           $gameTroop.notAllHighestStatsMem(["hp", "mp"]) returns the list  
  297.  *           of troop members without the highest amount of both hp and mp    
  298.  *           among the troop                                                  
  299.  *      21. anyLowestStatMem(stats)                                          
  300.  *         - Returns the list of members whose values of                      
  301.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  302.  *           is a list of names of corresponding                              
  303.  *           parameters/ex-parameters/sp-parameters, include those being the  
  304.  *           lowest among the caller                                          
  305.  *         - The return value should be an Array of Game_Battler              
  306.  *         - stats must be an Array of String as names of Game_Battler        
  307.  *           properties with the get function                                
  308.  *         - E.g.:                                                            
  309.  *           $gameParty.anyLowestStatMem(["hp", "mp"]) returns the list of    
  310.  *           party members with the lowest amount of hp or mp among the party
  311.  *      22. allLowestStatsMem(stats)                                        
  312.  *         - Returns the list of members whose values of                      
  313.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  314.  *           is a list of names of corresponding                              
  315.  *           parameters/ex-parameters/sp-parameters, are all the lowest among
  316.  *           the caller                                                      
  317.  *         - The return value should be an Array of Game_Battler              
  318.  *         - stats must be an Array of String as names of Game_Battler        
  319.  *           properties with the get function                                
  320.  *         - E.g.:                                                            
  321.  *           $gameTroop.allLowestStatsMem(["hp", "mp"]) returns the list of  
  322.  *           troop members with the lowest amount of hp and mp among the party
  323.  *      23. notAnyLowestStatMem(stats)                                        
  324.  *         - Returns the list of members whose values of                      
  325.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  326.  *           is a list of names of corresponding                              
  327.  *           parameters/ex-parameters/sp-parameters, don't include those being
  328.  *           the lowest among the caller                                      
  329.  *         - The return value should be an Array of Game_Battler              
  330.  *         - stats must be an Array of String as names of Game_Battler        
  331.  *           properties with the get function                                
  332.  *         - E.g.:                                                            
  333.  *           $gameParty.notAnyLowestStatMem(["hp", "mp"]) returns the list of
  334.  *           party members with neither the lowest amount of hp nor mp among  
  335.  *           the party                                                        
  336.  *      24. notAllLowestStatsMem(stats)                                      
  337.  *         - Returns the list of members whose values of                      
  338.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  339.  *           is a list of names of corresponding                              
  340.  *           parameters/ex-parameters/sp-parameters, aren't all the lowest    
  341.  *           among the caller                                                
  342.  *         - The return value should be an Array of Game_Battler              
  343.  *         - stats must be an Array of String as names of Game_Battler        
  344.  *           properties with the get function                                
  345.  *         - E.g.:                                                            
  346.  *           $gameTroop.notAllLowestStatsMem(["hp", "mp"]) returns the list of
  347.  *           troop members without the lowest amount of both hp and mp among  
  348.  *           the troop                                                        
  349.  *      25. anyAboveStatMem(stats, val)                                      
  350.  *         - Returns the list of members whose values of                      
  351.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  352.  *           is a list of names of corresponding                              
  353.  *           parameters/ex-parameters/sp-parameters, include those above val  
  354.  *         - The return value should be an Array of Game_Battler              
  355.  *         - stats must be an Array of String as names of Game_Battler        
  356.  *           properties with the get function                                
  357.  *         - val must be a Number                                            
  358.  *         - E.g.:                                                            
  359.  *           $gameParty.anyAboveStatMem(["hp", "mp"], 100) returns the list of
  360.  *           party members with the value of hp or mp above 100              
  361.  *      26. allAboveStatMem(stats, val)                                      
  362.  *         - Returns the list of members whose values of                      
  363.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  364.  *           is a list of names of corresponding                              
  365.  *           parameters/ex-parameters/sp-parameters, are all above val        
  366.  *         - The return value should be an Array of Game_Battler              
  367.  *         - stats must be an Array of String as names of Game_Battler        
  368.  *           properties with the get function                                
  369.  *         - val must be a Number                                            
  370.  *         - E.g.:                                                            
  371.  *           $gameTroop.allAboveStatMem(["hp", "mp"], 100) returns the list of
  372.  *           troop members with the value of hp and mp above 100              
  373.  *      27. anyBelowStatMem(stats, val)                                      
  374.  *         - Returns the list of members whose values of                      
  375.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  376.  *           is a list of names of corresponding                              
  377.  *           parameters/ex-parameters/sp-parameters, include those below val  
  378.  *         - The return value should be an Array of Game_Battler              
  379.  *         - stats must be an Array of String as names of Game_Battler        
  380.  *           properties with the get function                                
  381.  *         - val must be a Number                                            
  382.  *         - E.g.:                                                            
  383.  *           $gameParty.anyBelowStatMem(["hp", "mp"], 100) returns the list of
  384.  *           party members with the value of hp or mp below 100              
  385.  *      28. allBelowStatMem(stats, val)                                      
  386.  *         - Returns the list of members whose values of                      
  387.  *           parameters/ex-parameters/sp-parameters included by stats, which  
  388.  *           is a list of names of corresponding                              
  389.  *           parameters/ex-parameters/sp-parameters, are all below val        
  390.  *         - The return value should be an Array of Game_Battler              
  391.  *         - stats must be an Array of String as names of Game_Battler        
  392.  *           properties with the get function                                
  393.  *         - val must be a Number                                            
  394.  *         - E.g.:                                                            
  395.  *           $gameTroop.allBelowStatMem(["hp", "mp"], 100) returns the list of
  396.  *           troop members with the value of hp and mp below 100              
  397.  *============================================================================
  398.  */
  399.  
  400. var DoubleX_RMMV = DoubleX_RMMV || {};
  401. DoubleX_RMMV["Unit Filters"] = "v1.00a";
  402.  
  403. /*============================================================================
  404.  *    ## Plugin Implementations                                              
  405.  *       You need not edit this part as it's about how this plugin works      
  406.  *----------------------------------------------------------------------------
  407.  *    # Plugin Support Info:                                                  
  408.  *      1. Prerequisites                                                      
  409.  *         - Little Javascript coding proficiency to fully comprehend this    
  410.  *           plugin                                                          
  411.  *----------------------------------------------------------------------------*/
  412.  
  413. DoubleX_RMMV.Unit_Filters = {};
  414.  
  415. /*----------------------------------------------------------------------------
  416.  *    # Edit class: Game_BattlerBase                                          
  417.  *      - Implements all the battler manipulation plugin calls                
  418.  *----------------------------------------------------------------------------*/
  419.  
  420. (function(UF) {
  421.  
  422.     "use strict";
  423.  
  424.     var $ = Game_BattlerBase.prototype;
  425.  
  426.     /**
  427.      * Plugin call/Pure function
  428.      * @author DoubleX
  429.      * @interface
  430.      * @param {Array[Number]} stateIds - The list of id of states involved
  431.      * @returns {Boolean} The check result
  432.      * @since v1.00a
  433.      * @version v1.00a
  434.      */
  435.     $.isAnyStateAffected = function(stateIds) {
  436.         return stateIds.some(this.isStateAffected, this);
  437.     }; // $.isAnyStateAffected
  438.  
  439.     /**
  440.      * Plugin call/Pure function
  441.      * @author DoubleX
  442.      * @interface
  443.      * @param {Array[Number]} stateIds - The list of id of states involved
  444.      * @returns {Boolean} The check result
  445.      * @since v1.00a
  446.      * @version v1.00a
  447.      */
  448.     $.isAllStatesAffected = function(stateIds) {
  449.         return stateIds.every(this.isStateAffected, this);
  450.     }; // $.isAllStatesAffected
  451.  
  452.     /**
  453.      * Plugin call/Pure function
  454.      * @author DoubleX
  455.      * @interface
  456.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  457.      * @returns {Boolean} The check result
  458.      * @since v1.00a
  459.      * @version v1.00a
  460.      */
  461.     $.isAnyBuffAffected = function(paramIds) {
  462.         return paramIds.some(this.isBuffAffected, this);
  463.     }; // $.isAnyBuffAffected
  464.  
  465.     /**
  466.      * Plugin call/Pure function
  467.      * @author DoubleX
  468.      * @interface
  469.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  470.      * @returns {Boolean} The check result
  471.      * @since v1.00a
  472.      * @version v1.00a
  473.      */
  474.     $.isAllBuffsAffected = function(paramIds) {
  475.         return paramIds.every(this.isBuffAffected, this);
  476.     }; // $.isAllBuffsAffected
  477.  
  478.     /**
  479.      * Plugin call/Pure function
  480.      * @author DoubleX
  481.      * @interface
  482.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  483.      * @returns {Boolean} The check result
  484.      * @since v1.00a
  485.      * @version v1.00a
  486.      */
  487.     $.isAnyDebuffAffected = function(paramIds) {
  488.         return paramIds.some(this.isDebuffAffected, this);
  489.     }; // $.isAnyDebuffAffected
  490.  
  491.     /**
  492.      * Plugin call/Pure function
  493.      * @author DoubleX
  494.      * @interface
  495.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  496.      * @returns {Boolean} The check result
  497.      * @since v1.00a
  498.      * @version v1.00a
  499.      */
  500.     $.isAllDebuffsAffected = function(paramIds) {
  501.         return paramIds.every(this.isDebuffAffected, this);
  502.     }; // $.isAllDebuffsAffected
  503.  
  504.     /**
  505.      * Plugin call/Pure function
  506.      * @abstract
  507.      * @author DoubleX
  508.      * @interface
  509.      * @param {Array[Number]} skillIds - The list of id of skills involved
  510.      * @returns {Boolean} The check result
  511.      * @since v1.00a
  512.      * @version v1.00a
  513.      */
  514.     $.hasAnySkill = function(skillIds) { return false; };
  515.  
  516.     /**
  517.      * Plugin call/Pure function
  518.      * @abstract
  519.      * @author DoubleX
  520.      * @interface
  521.      * @param {Array[Number]} skillIds - The list of id of skills involved
  522.      * @returns {Boolean} The check result
  523.      * @since v1.00a
  524.      * @version v1.00a
  525.      */
  526.     $.hasAllSkills = function(skillIds) { return false; };
  527.  
  528. })(DoubleX_RMMV.Unit_Filters);
  529.  
  530. /*----------------------------------------------------------------------------
  531.  *    # Edit class: Game_Actor                                                
  532.  *      - Implements all the actor-specific battler manipulation plugin calls
  533.  *----------------------------------------------------------------------------*/
  534.  
  535. (function(UF) {
  536.  
  537.     "use strict";
  538.  
  539.     var $ = Game_Actor.prototype;
  540.  
  541.     /**
  542.      * Plugin call/Pure function
  543.      * @author DoubleX
  544.      * @interface
  545.      * @param {Array[Number]} skillIds - The list of id of skills involved
  546.      * @returns {Boolean} The check result
  547.      * @since v1.00a
  548.      * @version v1.00a
  549.      */
  550.     $.hasAnySkill = function(skillIds) {
  551.         return skillIds.some(this.hasSkill, this);
  552.     }; // $.hasAnySkill
  553.  
  554.     /**
  555.      * Plugin call/Pure function
  556.      * @author DoubleX
  557.      * @interface
  558.      * @param {Array[Number]} skillIds - The list of id of skills involved
  559.      * @returns {Boolean} The check result
  560.      * @since v1.00a
  561.      * @version v1.00a
  562.      */
  563.     $.hasAllSkills = function(skillIds) {
  564.         return skillIds.every(this.hasSkill, this);
  565.     }; // $.hasAllSkills
  566.  
  567. })(DoubleX_RMMV.Unit_Filters);
  568.  
  569. /*----------------------------------------------------------------------------
  570.  *    # Edit class: Game_Enemy                                                
  571.  *      - Implements all the enemy-specific battler manipulation plugin calls
  572.  *----------------------------------------------------------------------------*/
  573.  
  574. (function(UF) {
  575.  
  576.     "use strict";
  577.  
  578.     UF.Game_Enemy = { orig: {}, new: {} };
  579.     var $ = Game_Enemy.prototype, _UF = UF.Game_Enemy.new;
  580.  
  581.     /**
  582.      * Plugin call/Pure function
  583.      * @author DoubleX
  584.      * @interface
  585.      * @param {Array[Number]} skillIds - The list of id of skills involved
  586.      * @returns {Boolean} The check result
  587.      * @since v1.00a
  588.      * @version v1.00a
  589.      */
  590.     $.hasAnySkill = function(skillIds) {
  591.         return _UF._hasFilteredSkills.call(this, skillIds, "some");
  592.     }; // $.hasAnySkill
  593.  
  594.     /**
  595.      * Plugin call/Pure function
  596.      * @author DoubleX
  597.      * @interface
  598.      * @param {Array[Number]} skillIds - The list of id of skills involved
  599.      * @returns {Boolean} The check result
  600.      * @since v1.00a
  601.      * @version v1.00a
  602.      */
  603.     $.hasAllSkills = function(skillIds) {
  604.         return _UF._hasFilteredSkills.call(this, skillIds, "every");
  605.     }; // $.hasAllSkills
  606.  
  607.     /**
  608.      * Pure function
  609.      * @author DoubleX
  610.      * @param {Array[Number]} skillIds - The list of id of skills involved
  611.      * @param {String} quantifier - The quantifier for filtering skills
  612.      * @returns {Boolean} The check result
  613.      * @since v1.00a
  614.      * @version v1.00a
  615.      */
  616.     _UF._hasFilteredSkills = function(skillIds, quantifier) {
  617.         // Optimized to use an O(n) rather than an O(n ^ 2) algorithm
  618.         return skillIds[quantifier](
  619.                 _UF._isFilteredSkillFunc(_UF._actSkillIds.call(this)), this);
  620.         //
  621.     }; // _UF._hasFilteredSkills
  622.  
  623.     /**
  624.      * Pure function
  625.      * @author DoubleX
  626.      * @returns {Object[String, Boolean]} The requested skill id mapping
  627.      * @since v1.00a
  628.      * @version v1.00a
  629.      */
  630.     _UF._actSkillIds = function() {
  631.         return this.enemy().actions.reduce(
  632.                 _UF._accumActSkillIds.bind(this), {});
  633.     }; // _UF._actSkillIds
  634.  
  635.     /**
  636.      * Pure function
  637.      * @author DoubleX
  638.      * @param {Object[String, Boolean]} accumActSkillIds - The accumulated map
  639.      * @param {Object[String, Number]} act - The action data container involved
  640.      * @returns {Object[String, Boolean]} The requested skill id mapping
  641.      * @since v1.00a
  642.      * @version v1.00a
  643.      */
  644.     _UF._accumActSkillIds = function(accumActSkillIds, act) {
  645.         accumActSkillIds[act.skillId] = true;
  646.         return accumActSkillIds;
  647.     }; // _UF._accumActSkillIds
  648.  
  649.     /**
  650.      * Pure function
  651.      * @author DoubleX
  652.      * @param {Array[Number]} actSkillIds - The list of id of skills involved
  653.      * @returns {Function(Number) -> Boolean} The requested function
  654.      * @since v1.00a
  655.      * @version v1.00a
  656.      */
  657.     _UF._isFilteredSkillFunc = function(actSkillIds) {
  658.         /**
  659.          * Pure function
  660.          * @author DoubleX
  661.          * @param {[Number} skillId - The id of the skill involved
  662.          * @returns {Boolean} The check result
  663.          * @since v1.00a
  664.          * @version v1.00a
  665.          */
  666.         return function(skillId) { return actSkillIds[skillId.toString()]; };
  667.     }; // _UF._isFilteredSkillFunc
  668.  
  669. })(DoubleX_RMMV.Unit_Filters);
  670.  
  671. /*----------------------------------------------------------------------------
  672.  *    # Edit class: Game_Unit                                                
  673.  *      - Implements all the unit manipulation plugin calls                  
  674.  *----------------------------------------------------------------------------*/
  675.  
  676. (function(UF) {
  677.  
  678.     "use strict";
  679.  
  680.     UF.Game_Unit = { orig: {}, new: {} };
  681.     var $ = Game_Unit.prototype, _UF = UF.Game_Unit.new;
  682.  
  683.     /**
  684.      * Plugin call/Pure function
  685.      * @author DoubleX
  686.      * @interface
  687.      * @param {Array[Number]} stateIds - The list of id of states involved
  688.      * @returns {Array[Game_Batler]} The list of requested unit members
  689.      * @since v1.00a
  690.      * @version v1.00a
  691.      */
  692.     $.memWithAnyState = function(stateIds) {
  693.         return this.members().filter(
  694.                 _UF._memWithCondFunc(stateIds, "isAnyStateAffected"), this);
  695.     }; // $.memWithAnyState
  696.  
  697.     /**
  698.      * Plugin call/Pure function
  699.      * @author DoubleX
  700.      * @interface
  701.      * @param {Array[Number]} stateIds - The list of id of states involved
  702.      * @returns {Array[Game_Batler]} The list of requested unit members
  703.      * @since v1.00a
  704.      * @version v1.00a
  705.      */
  706.     $.memWithAllStates = function(stateIds) {
  707.         return this.members().filter(
  708.                 _UF._memWithCondFunc(stateIds, "isAllStatesAffected"), this);
  709.     }; // $.memWithAllStates
  710.  
  711.     /**
  712.      * Plugin call/Pure function
  713.      * @author DoubleX
  714.      * @interface
  715.      * @param {Array[Number]} stateIds - The list of id of states involved
  716.      * @returns {Array[Game_Batler]} The list of requested unit members
  717.      * @since v1.00a
  718.      * @version v1.00a
  719.      */
  720.     $.memWithoutAnyState = function(stateIds) {
  721.         return this.members().filter(
  722.                 _UF._memWithoutCondFunc(stateIds, "isAnyStateAffected"), this);
  723.     }; // $.memWithoutAnyState
  724.  
  725.     /**
  726.      * Plugin call/Pure function
  727.      * @author DoubleX
  728.      * @interface
  729.      * @param {Array[Number]} stateIds - The list of id of states involved
  730.      * @returns {Array[Game_Batler]} The list of requested unit members
  731.      * @since v1.00a
  732.      * @version v1.00a
  733.      */
  734.     $.memWithoutAllStates = function(stateIds) {
  735.         return this.members().filter(
  736.                 _UF._memWithoutCondFunc(stateIds, "isAllStatesAffected"), this);
  737.     }; // $.memWithoutAllStates
  738.  
  739.     /**
  740.      * Plugin call/Pure function
  741.      * @author DoubleX
  742.      * @interface
  743.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  744.      * @returns {Array[Game_Batler]} The list of requested unit members
  745.      * @since v1.00a
  746.      * @version v1.00a
  747.      */
  748.     $.memWithAnyBuff = function(paramIds) {
  749.         return this.members().filter(
  750.                 _UF._memWithCondFunc(paramIds, "isAnyBuffAffected"), this);
  751.     }; // $.memWithAnyBuff
  752.  
  753.     /**
  754.      * Plugin call/Pure function
  755.      * @author DoubleX
  756.      * @interface
  757.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  758.      * @returns {Array[Game_Batler]} The list of requested unit members
  759.      * @since v1.00a
  760.      * @version v1.00a
  761.      */
  762.     $.memWithAllBuffs = function(paramIds) {
  763.         return this.members().filter(
  764.                 _UF._memWithCondFunc(paramIds, "isAllBuffsAffected"), this);
  765.     }; // $.memWithAllBuffs
  766.  
  767.     /**
  768.      * Plugin call/Pure function
  769.      * @author DoubleX
  770.      * @interface
  771.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  772.      * @returns {Array[Game_Batler]} The list of requested unit members
  773.      * @since v1.00a
  774.      * @version v1.00a
  775.      */
  776.     $.memWithoutAnyBuff = function(paramIds) {
  777.         return this.members().filter(
  778.                 _UF._memWithoutCondFunc(paramIds, "isAnyBuffAffected"), this);
  779.     }; // $.memWithoutAnyBuff
  780.  
  781.     /**
  782.      * Plugin call/Pure function
  783.      * @author DoubleX
  784.      * @interface
  785.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  786.      * @returns {Array[Game_Batler]} The list of requested unit members
  787.      * @since v1.00a
  788.      * @version v1.00a
  789.      */
  790.     $.memWithoutAllBuffs = function(paramIds) {
  791.         return this.members().filter(
  792.                 _UF._memWithoutCondFunc(paramIds, "isAllBuffsAffected"), this);
  793.     }; // $.memWithoutAllBuffs
  794.  
  795.     /**
  796.      * Plugin call/Pure function
  797.      * @author DoubleX
  798.      * @interface
  799.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  800.      * @returns {Array[Game_Batler]} The list of requested unit members
  801.      * @since v1.00a
  802.      * @version v1.00a
  803.      */
  804.     $.memWithAnyDebuff = function(paramIds) {
  805.         return this.members().filter(
  806.                 _UF._memWithCondFunc(paramIds, "isAnyDebuffAffected"), this);
  807.     }; // $.memWithAnyDebuff
  808.  
  809.     /**
  810.      * Plugin call/Pure function
  811.      * @author DoubleX
  812.      * @interface
  813.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  814.      * @returns {Array[Game_Batler]} The list of requested unit members
  815.      * @since v1.00a
  816.      * @version v1.00a
  817.      */
  818.     $.memWithAllDebuffs = function(paramIds) {
  819.         return this.members().filter(
  820.                 _UF._memWithCondFunc(paramIds, "isAllDebuffsAffected"), this);
  821.     }; // $.memWithAllDebuffs
  822.  
  823.     /**
  824.      * Plugin call/Pure function
  825.      * @author DoubleX
  826.      * @interface
  827.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  828.      * @returns {Array[Game_Batler]} The list of requested unit members
  829.      * @since v1.00a
  830.      * @version v1.00a
  831.      */
  832.     $.memWithoutAnyDebuff = function(paramIds) {
  833.         return this.members().filter(
  834.                 _UF._memWithoutCondFunc(paramIds, "isAnyDebuffAffected"), this);
  835.     }; // $.memWithoutAnyDebuff
  836.  
  837.     /**
  838.      * Plugin call/Pure function
  839.      * @author DoubleX
  840.      * @interface
  841.      * @param {Array[Number]} paramIds - The list of id of parameters involved
  842.      * @returns {Array[Game_Batler]} The list of requested unit members
  843.      * @since v1.00a
  844.      * @version v1.00a
  845.      */
  846.     $.memWithoutAllDebuffs = function(paramIds) {
  847.         return this.members().filter(_UF._memWithoutCondFunc(
  848.                 paramIds, "isAllDebuffsAffected"), this);
  849.     }; // $.memWithoutAllDebuffs
  850.  
  851.     /**
  852.      * Plugin call/Pure function
  853.      * @author DoubleX
  854.      * @interface
  855.      * @param {Array[Number]} skillIds - The list of id of skills involved
  856.      * @returns {Array[Game_Batler]} The list of requested unit members
  857.      * @since v1.00a
  858.      * @version v1.00a
  859.      */
  860.     $.memWithAnySkill = function(skillIds) {
  861.         return this.members().filter(
  862.                 _UF._memWithCondFunc(skillIds, "hasAnySkill"), this);
  863.     }; // $.memWithAnySkill
  864.  
  865.     /**
  866.      * Plugin call/Pure function
  867.      * @author DoubleX
  868.      * @interface
  869.      * @param {Array[Number]} skillIds - The list of id of skills involved
  870.      * @returns {Array[Game_Batler]} The list of requested unit members
  871.      * @since v1.00a
  872.      * @version v1.00a
  873.      */
  874.     $.memWithAllSkills = function(skillIds) {
  875.         return this.members().filter(
  876.                 _UF._memWithCondFunc(skillIds, "hasAllSkills"), this);
  877.     }; // $.memWithAllSkills
  878.  
  879.     /**
  880.      * Plugin call/Pure function
  881.      * @author DoubleX
  882.      * @interface
  883.      * @param {Array[Number]} skillIds - The list of id of skills involved
  884.      * @returns {Array[Game_Batler]} The list of requested unit members
  885.      * @since v1.00a
  886.      * @version v1.00a
  887.      */
  888.     $.memWithoutAnySkill = function(skillIds) {
  889.         return this.members().filter(
  890.                 _UF._memWithoutCondFunc(skillIds, "hasAnySkill"), this);
  891.     }; // $.memWithoutAnySkill
  892.  
  893.     /**
  894.      * Plugin call/Pure function
  895.      * @author DoubleX
  896.      * @interface
  897.      * @param {Array[Number]} skillIds - The list of id of skills involved
  898.      * @returns {Array[Game_Batler]} The list of requested unit members
  899.      * @since v1.00a
  900.      * @version v1.00a
  901.      */
  902.     $.memWithoutAllSkills = function(skillIds) {
  903.         return this.members().filter(
  904.                 _UF._memWithoutCondFunc(skillIds, "hasAllSkills"), this);
  905.     }; // $.memWithoutAllSkills
  906.  
  907.     /**
  908.      * Plugin call/Pure function
  909.      * @author DoubleX
  910.      * @interface
  911.      * @param {Array[String]} stats - The list of names of stats involved
  912.      * @returns {Array[Game_Batler]} The list of requested unit members
  913.      * @since v1.00a
  914.      * @version v1.00a
  915.      */
  916.     $.anyHighestStatMem = function(stats) {
  917.         return _UF._statFilteredMem.call(this, stats, _UF._descendingSort.bind(
  918.                 this), "some", _UF._equals.bind(this));
  919.     }; // $.anyHighestStatMem
  920.  
  921.     /**
  922.      * Plugin call/Pure function
  923.      * @author DoubleX
  924.      * @interface
  925.      * @param {Array[String]} stats - The list of names of stats involved
  926.      * @returns {Array[Game_Batler]} The list of requested unit members
  927.      * @since v1.00a
  928.      * @version v1.00a
  929.      */
  930.     $.allHighestStatsMem = function(stats) {
  931.         return _UF._statFilteredMem.call(this, stats, _UF._descendingSort.bind(
  932.                 this), "every", _UF._equals.bind(this));
  933.     }; // $.allHighestStatsMem
  934.  
  935.     /**
  936.      * Plugin call/Pure function
  937.      * @author DoubleX
  938.      * @interface
  939.      * @param {Array[String]} stats - The list of names of stats involved
  940.      * @returns {Array[Game_Batler]} The list of requested unit members
  941.      * @since v1.00a
  942.      * @version v1.00a
  943.      */
  944.     $.notAnyHighestStatMem = function(stats) {
  945.         return _UF._statFilteredMem.call(this, stats, _UF._descendingSort.bind(
  946.                 this), "every", _UF._notEquals.bind(this));
  947.     }; // $.notAnyHighestStatMem
  948.  
  949.     /**
  950.      * Plugin call/Pure function
  951.      * @author DoubleX
  952.      * @interface
  953.      * @param {Array[String]} stats - The list of names of stats involved
  954.      * @returns {Array[Game_Batler]} The list of requested unit members
  955.      * @since v1.00a
  956.      * @version v1.00a
  957.      */
  958.     $.notAllHighestStatsMem = function(stats) {
  959.         return _UF._statFilteredMem.call(this, stats, _UF._descendingSort.bind(
  960.                 this), "some", _UF._notEquals.bind(this));
  961.     }; // $.notAllHighestStatsMem
  962.  
  963.     /**
  964.      * Plugin call/Pure function
  965.      * @author DoubleX
  966.      * @interface
  967.      * @param {Array[String]} stats - The list of names of stats involved
  968.      * @returns {Array[Game_Batler]} The list of requested unit members
  969.      * @since v1.00a
  970.      * @version v1.00a
  971.      */
  972.     $.anyLowestStatMem = function(stats) {
  973.         return _UF._statFilteredMem.call(this, stats, _UF._ascendingSort.bind(
  974.                 this), "some", _UF._equals.bind(this));
  975.     }; // $.anyLowestStatMem
  976.  
  977.     /**
  978.      * Plugin call/Pure function
  979.      * @author DoubleX
  980.      * @interface
  981.      * @param {Array[String]} stats - The list of names of stats involved
  982.      * @returns {Array[Game_Batler]} The list of requested unit members
  983.      * @since v1.00a
  984.      * @version v1.00a
  985.      */
  986.     $.allLowestStatsMem = function(stats) {
  987.         return _UF._statFilteredMem.call(this, stats, _UF._ascendingSort.bind(
  988.                 this), "every", _UF._equals.bind(this));
  989.     }; // $.allLowestStatsMem
  990.  
  991.     /**
  992.      * Plugin call/Pure function
  993.      * @author DoubleX
  994.      * @interface
  995.      * @param {Array[String]} stats - The list of names of stats involved
  996.      * @returns {Array[Game_Batler]} The list of requested unit members
  997.      * @since v1.00a
  998.      * @version v1.00a
  999.      */
  1000.     $.notAnyLowestStatMem = function(stats) {
  1001.         return _UF._statFilteredMem.call(this, stats, _UF._ascendingSort.bind(
  1002.                 this), "every", _UF._notEquals.bind(this));
  1003.     }; // $.notAnyLowestStatMem
  1004.  
  1005.     /**
  1006.      * Plugin call/Pure function
  1007.      * @author DoubleX
  1008.      * @interface
  1009.      * @param {Array[String]} stats - The list of names of stats involved
  1010.      * @returns {Array[Game_Batler]} The list of requested unit members
  1011.      * @since v1.00a
  1012.      * @version v1.00a
  1013.      */
  1014.     $.notAllLowestStatsMem = function(stats) {
  1015.         return _UF._statFilteredMem.call(this, stats, _UF._ascendingSort.bind(
  1016.                 this), "some", _UF._notEquals.bind(this));
  1017.     }; // $.notAllLowestStatsMem
  1018.  
  1019.     /**
  1020.      * Plugin call/Pure function
  1021.      * @author DoubleX
  1022.      * @interface
  1023.      * @param {Array[String]} stats - The list of names of stats involved
  1024.      * @param {Number} val - The value to be checked against
  1025.      * @returns {Array[Game_Batler]} The list of requested unit members
  1026.      * @since v1.00a
  1027.      * @version v1.00a
  1028.      */
  1029.     $.anyAboveStatMem = function(stats, val) {
  1030.         return _UF._statValFilteredMem.call(
  1031.                 this, stats, val, "some", _UF._isGreaterThan.bind(this));
  1032.     }; // $.anyAboveStatMem
  1033.  
  1034.     /**
  1035.      * Plugin call/Pure function
  1036.      * @author DoubleX
  1037.      * @interface
  1038.      * @param {Array[String]} stats - The list of names of stats involved
  1039.      * @param {Number} val - The value to be checked against
  1040.      * @returns {Array[Game_Batler]} The list of requested unit members
  1041.      * @since v1.00a
  1042.      * @version v1.00a
  1043.      */
  1044.     $.allAboveStatMem = function(stats, val) {
  1045.         return _UF._statValFilteredMem.call(
  1046.                 this, stats, val, "every", _UF._isGreaterThan.bind(this));
  1047.     }; // $.allAboveStatMem
  1048.  
  1049.     /**
  1050.      * Plugin call/Pure function
  1051.      * @author DoubleX
  1052.      * @interface
  1053.      * @param {Array[String]} stats - The list of names of stats involved
  1054.      * @param {Number} val - The value to be checked against
  1055.      * @returns {Array[Game_Batler]} The list of requested unit members
  1056.      * @since v1.00a
  1057.      * @version v1.00a
  1058.      */
  1059.     $.anyBelowStatMem = function(stats, val) {
  1060.         return _UF._statValFilteredMem.call(
  1061.                 this, stats, val, "some", _UF._isLessThan.bind(this));
  1062.     }; // $.anyBelowStatMem
  1063.  
  1064.     /**
  1065.      * Plugin call/Pure function
  1066.      * @author DoubleX
  1067.      * @interface
  1068.      * @param {Array[String]} stats - The list of names of stats involved
  1069.      * @param {Number} val - The value to be checked against
  1070.      * @returns {Array[Game_Batler]} The list of requested unit members
  1071.      * @since v1.00a
  1072.      * @version v1.00a
  1073.      */
  1074.     $.allBelowStatMem = function(stats, val) {
  1075.         return _UF._statValFilteredMem.call(
  1076.                 this, stats, val, "every", _UF._isLessThan.bind(this));
  1077.     }; // $.allBelowStatMem
  1078.  
  1079.     /**
  1080.      * Pure function
  1081.      * @author DoubleX
  1082.      * @param {Array[Number]} inputtedIds - The list of id of inputs involved
  1083.      * @param {Function(Array[Number]) -> Boolean} condFunc - The condition
  1084.      * @returns {Function(Game_Battler) -> Boolean} The requested function
  1085.      * @since v1.00a
  1086.      * @version v1.00a
  1087.      */
  1088.     _UF._memWithCondFunc = function(inputtedIds, condFunc) {
  1089.         /**
  1090.          * Pure function
  1091.          * @author DoubleX
  1092.          * @param {Game_Battler} mem - The unit member involved
  1093.          * @returns {Boolean} The check result
  1094.          * @since v1.00a
  1095.          * @version v1.00a
  1096.          */
  1097.         return function(mem) { return mem[condFunc](inputtedIds); };
  1098.     }; // _UF._memWithAnyStateFunc
  1099.  
  1100.     /**
  1101.      * Pure function
  1102.      * @author DoubleX
  1103.      * @param {Array[Number]} inputtedIds - The list of id of inputs involved
  1104.      * @param {Function(Array[Number]) -> Boolean} condFunc - The condition
  1105.      * @returns {Function(Game_Battler) -> Boolean} The requested function
  1106.      * @since v1.00a
  1107.      * @version v1.00a
  1108.      */
  1109.     _UF._memWithoutCondFunc = function(inputtedIds, condFunc) {
  1110.         /**
  1111.          * Pure function
  1112.          * @author DoubleX
  1113.          * @param {Game_Battler} mem - The unit member involved
  1114.          * @returns {Boolean} The check result
  1115.          * @since v1.00a
  1116.          * @version v1.00a
  1117.          */
  1118.         return function(mem) { return !mem[condFunc](inputtedIds); };
  1119.     }; // _UF._memWithoutAnyStateFunc
  1120.  
  1121.     /**
  1122.      * Pure function
  1123.      * @author DoubleX
  1124.      * @param {Number} a - A number in the list to be compared in the sort
  1125.      * @param {Number} b - A number in the list to be compared in the sort
  1126.      * @returns {Number} The comparison result
  1127.      * @since v1.00a
  1128.      * @version v1.00a
  1129.      */
  1130.     _UF._ascendingSort = function(a, b) { return a - b; };
  1131.  
  1132.     /**
  1133.      * Pure function
  1134.      * @author DoubleX
  1135.      * @param {Number} a - A number in the list to be compared in the sort
  1136.      * @param {Number} b - A number in the list to be compared in the sort
  1137.      * @returns {Number} The comparison result
  1138.      * @since v1.00a
  1139.      * @version v1.00a
  1140.      */
  1141.     _UF._descendingSort = function(a, b) { return b - a; };
  1142.  
  1143.     /**
  1144.      * Pure function
  1145.      * @author DoubleX
  1146.      * @param {} a - A value to be checked against
  1147.      * @param {} b - A value to be checked against
  1148.      * @returns {Boolean} The check result
  1149.      * @since v1.00a
  1150.      * @version v1.00a
  1151.      */
  1152.     _UF._equals = function(a, b) { return a === b; };
  1153.  
  1154.     /**
  1155.      * Pure function
  1156.      * @author DoubleX
  1157.      * @param {} a - A value to be checked against
  1158.      * @param {} b - A value to be checked against
  1159.      * @returns {Boolean} The check result
  1160.      * @since v1.00a
  1161.      * @version v1.00a
  1162.      */
  1163.     _UF._notEquals = function(a, b) { return a !== b; };
  1164.  
  1165.     /**
  1166.      * Pure function
  1167.      * @author DoubleX
  1168.      * @param {Array[String]} stats - The list of names of stats involved
  1169.      * @param {Function(Number, Number) -> Number} compareFunc - The compare
  1170.      *                                                            function
  1171.      * @param {String} quantifier - The quantifier for filtering unit members
  1172.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1173.      *                                                            function
  1174.      * @returns {Array[Game_Batler]} The list of requested unit members
  1175.      * @since v1.00a
  1176.      * @version v1.00a
  1177.      */
  1178.     _UF._statFilteredMem =
  1179.             function(stats, compareFunc, quantifier, filterFunc) {
  1180.         var mems = this.members();
  1181.         return mems.filter(_UF._isStatFilteredMemFunc(
  1182.                 stats, quantifier, filterFunc, _UF._sortedStats.call(
  1183.                 this, stats, mems, compareFunc)), this);
  1184.     }; // _UF._statFilteredMem
  1185.  
  1186.     /**
  1187.      * Pure function
  1188.      * @author DoubleX
  1189.      * @param {Array[String]} stats - The list of names of stats involved
  1190.      * @param {Array[Game_Battler]} mems - The list of unit members involved
  1191.      * @param {Function(Number, Number) -> Number} compareFunc - The compare
  1192.      *                                                            function
  1193.      * @returns {Array[Array[Number]]} The list of lists of sorted stats values
  1194.      * @since v1.00a
  1195.      * @version v1.00a
  1196.      */
  1197.     _UF._sortedStats = function(stats, mems, compareFunc) {
  1198.         return stats.map(_UF._sortedStatFunc(mems, compareFunc), this);
  1199.     }; // _UF._sortedStats
  1200.  
  1201.     /**
  1202.      * Pure function
  1203.      * @author DoubleX
  1204.      * @param {Array[Game_Battler]} mems - The list of unit members involved
  1205.      * @param {Function(Number, Number) -> Number} compareFunc - The compare
  1206.      *                                                            function
  1207.      * @returns {Function(String) -> Array[Number]} The requested function
  1208.      * @since v1.00a
  1209.      * @version v1.00a
  1210.      */
  1211.     _UF._sortedStatFunc = function(mems, compareFunc) {
  1212.         /**
  1213.          * Pure function
  1214.          * @author DoubleX
  1215.          * @param {String} stat - The name of the stat to be sorted
  1216.          * @returns {Array[Number]} The requested list of sorted stat values
  1217.          * @since v1.00a
  1218.          * @version v1.00a
  1219.          */
  1220.         return function(stat) {
  1221.             return _UF._sortedStat.call(this, mems, compareFunc, stat);
  1222.         };
  1223.     }; // _UF._sortedStatFunc
  1224.  
  1225.     /**
  1226.      * Pure function
  1227.      * @author DoubleX
  1228.      * @param {Array[Game_Battler]} mems - The list of unit members involved
  1229.      * @param {Function(Number, Number) -> Number} compareFunc - The compare
  1230.      *                                                            function
  1231.      * @param {String} stat - The name of the stat to be sorted
  1232.      * @returns {Array[Number]} The requested list of sorted stat values
  1233.      * @since v1.00a
  1234.      * @version v1.00a
  1235.      */
  1236.     _UF._sortedStat = function(mems, compareFunc, stat) {
  1237.         return mems.map(_UF._memStatsFunc(stat), this).sort(compareFunc, this);
  1238.     }; // _UF._sortedStat
  1239.  
  1240.     /**
  1241.      * Pure function
  1242.      * @author DoubleX
  1243.      * @param {String} stat - The name of the stat to be sorted
  1244.      * @returns {Function(String) -> Array[Number]} The requested function
  1245.      * @since v1.00a
  1246.      * @version v1.00a
  1247.      */
  1248.     _UF._memStatsFunc = function(stat) {
  1249.         /**
  1250.          * Pure function
  1251.          * @author DoubleX
  1252.          * @param {Game_Battler} mem - The unit member involved
  1253.          * @returns {Number} The requested stat value
  1254.          * @since v1.00a
  1255.          * @version v1.00a
  1256.          */
  1257.         return function(mem) { return mem[stat]; };
  1258.     }; // _UF._memStatsFunc
  1259.  
  1260.     /**
  1261.      * Pure function
  1262.      * @author DoubleX
  1263.      * @param {Array[String]} stats - The list of names of stats involved
  1264.      * @param {String} quantifier - The quantifier for filtering unit members
  1265.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1266.      *                                                            function
  1267.      * @param {Array[Array[Number]]} sortedStats - The list of lists of sorted
  1268.      *                                              stat values
  1269.      * @returns {Function(Game_Battler) -> Boolean} The requested function
  1270.      * @since v1.00a
  1271.      * @version v1.00a
  1272.      */
  1273.     _UF._isStatFilteredMemFunc =
  1274.             function(stats, quantifier, filterFunc, sortedStats) {
  1275.         /**
  1276.          * Pure function
  1277.          * @author DoubleX
  1278.          * @param {Game_Battler} mem - The unit member inolved
  1279.          * @returns {Boolean} The check result
  1280.          * @since v1.00a
  1281.          * @version v1.00a
  1282.          */
  1283.         return function(mem) {
  1284.             return _UF._isStatFilteredMem.call(
  1285.                     this, stats, quantifier, filterFunc, sortedStats, mem);
  1286.         };
  1287.     }; // _UF._isStatFilteredMemFunc
  1288.  
  1289.     /**
  1290.      * Pure function
  1291.      * @author DoubleX
  1292.      * @param {Array[String]} stats - The list of names of stats involved
  1293.      * @param {String} quantifier - The quantifier for filtering unit members
  1294.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1295.      *                                                            function
  1296.      * @param {Array[Array[Number]]} sortedStats - The list of lists of sorted
  1297.      *                                              stat values
  1298.      * @param {Game_Battler} mem - The unit member inolved
  1299.      * @returns {Boolean} The check result
  1300.      * @since v1.00a
  1301.      * @version v1.00a
  1302.      */
  1303.     _UF._isStatFilteredMem =
  1304.             function(stats, quantifier, filterFunc, sortedStats, mem) {
  1305.         return stats[quantifier](_UF._isStatFilterPassedFunc(
  1306.                 filterFunc, sortedStats, mem), this);
  1307.     }; // _UF._isStatFilteredMem
  1308.  
  1309.     /**
  1310.      * Pure function
  1311.      * @author DoubleX
  1312.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1313.      *                                                            function
  1314.      * @param {Array[Array[Number]]} sortedStats - The list of lists of sorted
  1315.      *                                              stat values
  1316.      * @param {Game_Battler} mem - The unit member inolved
  1317.      * @returns {Function(String, Number) -> Boolean} The requested function
  1318.      * @since v1.00a
  1319.      * @version v1.00a
  1320.      */
  1321.     _UF._isStatFilterPassedFunc = function(filterFunc, sortedStats, mem) {
  1322.         /**
  1323.          * Pure function
  1324.          * @author DoubleX
  1325.          * @param {String} stat - The name of the stat involved
  1326.          * @param {Number} index - The index of the list of sorted stat values
  1327.          * @returns {Boolean} The check result
  1328.          * @since v1.00a
  1329.          * @version v1.00a
  1330.          */
  1331.         return function(stat, index) {
  1332.             return filterFunc(mem[stat], sortedStats[index][0]);
  1333.         };
  1334.     }; // _UF._isStatFilterPassedFunc
  1335.  
  1336.     /**
  1337.      * Pure function
  1338.      * @author DoubleX
  1339.      * @param {Number} a - A number to be checked against
  1340.      * @param {Number} b - A number to be checked against
  1341.      * @returns {Boolean} The check result
  1342.      * @since v1.00a
  1343.      * @version v1.00a
  1344.      */
  1345.     _UF._isGreaterThan = function(a, b) { return a > b; };
  1346.  
  1347.     /**
  1348.      * Pure function
  1349.      * @author DoubleX
  1350.      * @param {Number} a - A number to be checked against
  1351.      * @param {Number} b - A number to be checked against
  1352.      * @returns {Boolean} The check result
  1353.      * @since v1.00a
  1354.      * @version v1.00a
  1355.      */
  1356.     _UF._isLessThan = function(a, b) { return a < b; };
  1357.  
  1358.     /**
  1359.      * Pure function
  1360.      * @author DoubleX
  1361.      * @param {Array[String]} stats - The list of names of stats involved
  1362.      * @param {Number} val - The value to be checked against
  1363.      * @param {String} quantifier - The quantifier for filtering unit members
  1364.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1365.      *                                                            function
  1366.      * @returns {Array[Game_Batler]} The list of requested unit members
  1367.      * @since v1.00a
  1368.      * @version v1.00a
  1369.      */
  1370.     _UF._statValFilteredMem = function(stats, val, quantifier, filterFunc) {
  1371.         return this.members().filter(_UF._isStatValFilteredMemFunc(
  1372.                 stats, val, quantifier, filterFunc), this);
  1373.     }; // _UF._statValFilteredMem
  1374.  
  1375.     /**
  1376.      * Pure function
  1377.      * @author DoubleX
  1378.      * @param {Array[String]} stats - The list of names of stats involved
  1379.      * @param {Number} val - The value to be checked against
  1380.      * @param {String} quantifier - The quantifier for filtering unit members
  1381.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1382.      *                                                            function
  1383.      * @returns {Function(Game_Battler) -> Boolean} The requested function
  1384.      * @since v1.00a
  1385.      * @version v1.00a
  1386.      */
  1387.     _UF._isStatValFilteredMemFunc =
  1388.             function(stats, val, quantifier, filterFunc) {
  1389.         /**
  1390.          * Pure function
  1391.          * @author DoubleX
  1392.          * @param {Game_Battler} mem - The unit member involved
  1393.          * @returns {Boolean} The check result
  1394.          * @since v1.00a
  1395.          * @version v1.00a
  1396.          */
  1397.         return function(mem) {
  1398.             return _UF._isStatValFilteredMem.call(
  1399.                     this, stats, val, quantifier, filterFunc, mem);
  1400.         };
  1401.     }; // _UF._isStatValFilteredMemFunc
  1402.  
  1403.     /**
  1404.      * Pure function
  1405.      * @author DoubleX
  1406.      * @param {Array[String]} stats - The list of names of stats involved
  1407.      * @param {Number} val - The value to be checked against
  1408.      * @param {String} quantifier - The quantifier for filtering unit members
  1409.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1410.      *                                                            function
  1411.      * @param {Game_Battler} mem - The unit member involved
  1412.      * @returns {Boolean} The check result
  1413.      * @since v1.00a
  1414.      * @version v1.00a
  1415.      */
  1416.     _UF._isStatValFilteredMem =
  1417.             function(stats, val, quantifier, filterFunc, mem) {
  1418.         return stats[quantifier](
  1419.                 _UF._isStatValFilterPassedFunc(val, filterFunc, mem), this);
  1420.     }; // _UF._isStatValFilteredMem
  1421.  
  1422.     /**
  1423.      * Pure function
  1424.      * @author DoubleX
  1425.      * @param {Number} val - The value to be checked against
  1426.      * @param {Function(Number, Number) -> Boolean} filterFunc - The filter
  1427.      *                                                            function
  1428.      * @param {Game_Battler} mem - The unit member involved
  1429.      * @returns {Function(Game_Battler) -> Boolean} The requested function
  1430.      * @since v1.00a
  1431.      * @version v1.00a
  1432.      */
  1433.     _UF._isStatValFilterPassedFunc = function(val, filterFunc, mem) {
  1434.         /**
  1435.          * Pure function
  1436.          * @author DoubleX
  1437.          * @param {String} stat - The name of the stat involved
  1438.          * @returns {Boolean} The check result
  1439.          * @since v1.00a
  1440.          * @version v1.00a
  1441.          */
  1442.         return function(stat) { return filterFunc(mem[stat], val); };
  1443.     }; // _UF._isStatValFilterPassedFunc
  1444.  
  1445. })(DoubleX_RMMV.Unit_Filters);
  1446.  
  1447. /*============================================================================*/
RAW Paste Data
Top