Advertisement
Double_X

DoubleX RMMV Unit Filters v100a

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