That's the key point, every
actor has agility, luck, attack, etc. defined but they wrote a special formula to calculate the
party agility (which is just the average agility i.e. sum divided by number of actors).
If you wanted to calculate the
party luck the same way, you can add this code to a new plugin. Then, you could use the formula as you've written it above.
Code:
Game_Unit.prototype.luck= function() {
//Game_Unit is the parent of Game_Party and Game_Troop
//This means that any functions owned by Game_Unit are inherited
//by Game_Party and Game_Troop
var members = this.members();
//Define a new variable called 'members'
//This variable is local to this function
//Fill members with all the members of the unit (party / troop, depending)
//This is now an Array of the unit members
if (members.length === 0) {
return 1;
}
//If the unit is empty for some reason, leave the function
//It should never happen, but this is a failsafe so the game
//doesn't crash
var sum = members.reduce(function(r, member) {
return r + member.luk;
}, 0);
//Define a new variable called 'sum'
//This variable is local to this function
//reduce is a function we can use on Arrays that can easily
//calculate a sum
return sum / members.length;
//The 'sum' divided by the number of unit members gives
//us the average
//We return this value back outside the function to whatever is
//asking for it
};