Feature Once Per Combat Proxy Records

Catch-22

Active member
There's quite a few skills these days that are only usable once per combat. It'd be nice if we had a proxy record to reflect that.

I don't know if there are skills that can only be used say 2 or 3 times, if anyone wants to chime in. I also don't know if this property should be an integer of say max use per fight (-1 for unlimited?), rather than a boolean of once per fight only, so feel free to offer feedback on that too.

There's a few cases I can think of that this would be tricky, items such as the Haiku Katana/Bottle-rocket crossbow give skills that can be used once per fight, per item equipped.
 
Last edited:

Darzil

Developer
I don't know if there are skills that can only be used say 2 or 3 times, if anyone wants to chime in. I also don't know if this property should be an integer of say max use per fight (-1 for unlimited?), rather than a boolean of once per fight only, so feel free to offer feedback on that too.

Personally I'd suggest integer rather than boolean, in case some future skills are useable 2 or 3 times, they'd also allow you to handle skills that can be used once per item. I'd also suggest maybe a large fixed number over 50, say 1000, for unlimited, as you'll never use a skill more times than there are combat rounds, allowing the use of -1 to handle exceptions.
 

Theraze

Active member
For ease of implementation, I'd suggest maybe a field just tracking how many times a skill has been (officially) used during combat, and leaving it up to the scripter to decide what the real limit is. That means that with items like the haiku katana, the user is responsible to check if the limit is actually 1, 2 (main/offhand or main/disembodied), or 3 (main/offhand/disembodied). This also makes it VERY easy to code... when a skill is used, increase $skill[].combatcount by one. Reset all the combatcounts when combat ends. Permanent coding done, and future skills get tracked just like the rest. :)
 

Theraze

Active member
Aww... You know (I hope) that I'm not trying to tell you guys how to code things. Just about every time I make a patch, you or one of the other devs fixes it up and makes it elegant.

But for non-devs and those who would be using it for scripting, I'd like to generate some thought as to whether they'd rather mafia do all the thinking for them including waiting every time a new limited skill comes out, or they hold some of the responsibility as well and they can just update their scripts without whining.

Edit: If my suggestion actually seems appealing, I could test it... If I initialize the variables properly, the actual combat additions for that basically just seem like the +=1 goes right at the end of updateCurrentAction and the =0 goes into clearInstanceData. But I might be oversimplifying it. :( But I don't want to screw things up if people want mafia to do everything for them. ;)

Edit2: Note on above... that's not me saying how it should be done. That's me saying what I'll put together and test if people actually want something that functions like that. I'm merely putting it up there so that, if I'm totally going off-base on how it should be done and my wandering is aggravating, people can tell me to stop. :p If it's not terribly far off from decent planning, then good. If it's tragic, better that it gets its verbal beatdown quickly and you don't end up with a painful patch to feel sadness over.
 
Last edited:

Catch-22

Active member
Hmm Theraze, one of the reasons I asked for this is so that a well written script could withstand the tests of time. I'd think it's better to write dynamic scripts based on built-in data structures and update KoLmafia once, than for everyone who writes the scripts to have to update them on their own once a new skill is released.

A little while ago I went back and looked at my rollover adventures script and was surprised at how well it still works, despite me having not touched it in nearly a year. This is largely to the credit of the existing KoLmafia functionality (such as the maximizer and extraRolloverAdventures) doing most of the hard work for me (thanks devs :D). As long as KoLmafia is keeping figures like that up to date, my script will keep on chuggin'. I only wish to bestow that feeling of a script that "just works" upon others :)

What I envisage once the hard yards are done, is a fairly simple way for devs to add any newly released skills to this list of single/limited use skills (such as a record in the skills database).
 

Theraze

Active member
The problem with putting hard limits in is that, inevitably, the KoL admins will come up with an exception. Case in point, the pasta nemesis... normal rule for entangling noodles is once per combat. The rule for the nemesis fight is that every other round, you WILL cast it, if you want to succeed. No limits on how many times it's usable during that fight. However, mafia still dutifully greys out the noodle button in the relay window, believing it to be disabled because that's the way it always works... normally.

That's mentioned in this FReq as well as possibly more that my search-fu is failing on, currently. :)
 

roippi

Developer
I'd fall in favor of theraze's implemention, since hard-coded stuff always finds creative ways to fail. Better that said hard-coded stuff be accessible to scripters, rather than somewhere in mafia's internals.

Plus, that information could be used in other ways even for non-limited skills.
 

Catch-22

Active member
What Theraze has suggested wouldn't really be useful. It's not a matter of knowing how many times a skill has been used in combat, it's a matter of knowing how many times you can queue an action in a macro before it will fail, in most cases this is as many times as you can afford the mana cost, but for every other case except two (that I can think of), it's once.
 

Theraze

Active member
Again... that's on the user. If you can only queue it 3 times before it fails, and you put it into a macro to go 6 times, mafia shouldn't unbundle your macro, decide that you've queued it too often, change your macro around, and rebundle it...

It's only useful outside of macros or their execution, when you can decide if it's run enough times to be eliminated. My suggestion, in conjunction with something like BatBrain to pull out skill usage limits, would let you know if a skill is still usable or not. Yours... in macros... I'm struggling to see your usage. For simple CCS? Sure. Macrofied combat?
 
Top