garbagemule / MobArena

MobArena plugin for Minecraft
GNU General Public License v3.0
194 stars 151 forks source link

Mutually exclusive class-limits #669

Open Nesseley opened 3 years ago

Nesseley commented 3 years ago

Feature request

Short description You should be able to set a class-limit for multiple classes. Say, I sell a better healer-class for ingame cash than the default one. I don't want TWO healers in my arena, but technically they can, as you can only limit each class to none or one.

Implementation details The config could look something like this:

class-limits:
      Oddjob: -1                 | No Limit
      Knight: 2                  | Limits Knight to max 2 in this Arena
      Healer, Mage: 1            | Limits to only 1 of these classes in the arena.

or the class-limits could be reworked to this:

class-limits:
      no-limit:
            Oddjob  
      limit-2:
            Knight
            Tank
      limit-only-1
            Healer
            Mage

This does look worse, and I prefer the first one but I spent some time making it and it is an option so why not include it ¯_(ツ)_/¯

garbagemule commented 3 years ago

Great idea!

I think the concept of class limits could use a bit of a dusting off and a rework, but we don't really have a lot of info to go by in terms of how much they're used and how limited they are - maybe we can add a metrics chart for checking if any arenas have modified class limits.

Perhaps what I think is the biggest drawback of the proposed solution is the ambiguity when the number is greater than 1. What does Healer, Mage: 2 mean? Does it mean that Healer+Healer, Mage+Mage, and Healer+Mage are all allowed? Or is it still only mutual exclusion, so Healer+Mage is not allowed?


I'd like to break the concept open a bit to explore what kind of expressive power we could potentially build here. Mutual exclusion of two classes is just one take. Minimum requirements could be a thing as well. Say an arena has a wave that requires a ranged class for some reason, arena designers could put in a requirement of "minimum 1 archer". To expand upon the idea of mutual exclusion itself, instead of capping at 1, it might be desirable to say "you can't have both healers and mages in your party, but pick one and bring as many as you want". This could open up a "one for all"-style of arena, where everyone has to play a given class.

Here is an idea...

If we think of class limits as a set of individually configurable rules, we can say that a rule is either fulfilled or broken. A broken rule will prevent the session from starting. When all rules are fulfilled, the session can begin. A class limit rule consists of a subject (the classes), and a condition in the form of a value and a comparison operator. A higher-order rule is a grouping of rules that requires either none, any, all, or a configurable number of its sub-rules to be fulfilled.

So, the class limits section becomes a list rather than a map. Let's assume for the sake of brevity that we can use a syntax like <class> <operator> <value>, so e.g. Knight <= 1 means "at most one Knight", and Knight > 0 means "at least one Knight".

I'll work out a couple of examples...

This is definitely a little more involved than just tacking , Mage on to an existing definition, but I also think it's a little more explicit what exactly the definitions mean, albeit a bit convoluted. Maybe we can work on something easier to understand than the comparison operators, or perhaps we can change some of the wording.