Feature Track turns spent in all locations

lostcalpolydude

Developer
Staff member
I'm working on adding tracking of all turns spent in an ascension in each area, stored basically the same as the queue for each area. This should obsolete some of the per-zone settings that have started to pop up. My plan is for it to be accessible as a proxy field for locations, turns_spent is what I have currently.

As far as implementation, combats are being added no matter how they end (but only when they end, so rollover runaways won't count, I unintentionally spaded that years ago); that part is working properly. Combats triggered from using an item need to not count, and that is working properly. Items that say they occur in a particular location will be counted for that location; I don't know if that's correct, but it seems okay.

I still need some testing on noncombats. I want those to count only if they take a turn (not counting choice adventures where you choose to walk away, or introduction adventures that don't take a turn). My brief testing has a choice adventure not being counted when it should, so that's still a work in progress.
 
Last edited:

Darzil

Developer
Wow, really looking forward to this. I'll just look at the encounter mechanics that don't involve encounter counting for the time being, so I don't have to rip them out again later.
 

lostcalpolydude

Developer
Staff member
I think I have this all working. I'll sit on it for a little bit longer, start at least 1 ascension to check resetting and such, but this should get added pretty soon.
 

Bale

Minion
What per-zone settings are you referring to?


I think I have this all working. I'll sit on it for a little bit longer, start at least 1 ascension to check resetting and such, but this should get added pretty soon.

It'll be nice to get this in the next release so that Ezandora will begin using it for Guide.
 

lostcalpolydude

Developer
Staff member
bossbatTurns and nextScreambatCount were recently added, among other things. And I expect to get this added before the next point release. It can't break anything else, the worst it can do is not work quite right in some edge case.
 

Darzil

Developer
Only thing I'd like to request is that there is a way (in internal Mafia code) to update it. Mafia could recognise something like a screambat being off schedule and add to the number of turns in a zone to get it back on schedule, which would be better than always giving the wrong information just because someone played 1 or more turns without mafia, or lost their mafia data to a crash or something.

You'd probably have added this anyway, of course.
 

lostcalpolydude

Developer
Staff member
A lot of things happen every X turns, so it's impossible to tell for sure whether it's 40 turns or 64 turns (for example) in the bat hole. And since that number is the sum of 3 areas, which one would you change?

This can apply in the castle ground floor and the outskirts when unlocking the next area, except not really since wandering monsters can show up on turn 11 to override those superlikelies and push it back to turn 12 anyway (I guess you could know that it's at least turn 11 though).

If someone got Break Time! (Sloppy Seconds Diner) when it wasn't expected, and you add turns to make it a multiple of 15, it might still be the wrong multiple of 15. Especially if someone got Sloppy Secrets along the way.

I guess this is a long way of wondering exactly how you would use that.
 

Darzil

Developer
In all those cases we don't really know, we'd just know it was wrong, and that the real number is larger. In the case of Bat Hole I'd therefore just change one, and maybe put a message in the GCli/session log to say that it was done.

Given that we know it's wrong, we have two choices, remain wrong and useless, or become wrong and useful. I prefer mafia to become wrong in the count, but useful by being right in the prediction, if possible, rather than remain wrong in both.

Your wandering monster example is a good example of why I added isWanderingMonster, so we can account for it.

Castle ground floor I believe isn't every 10 turns, but guarantees a non-combat after 10 turns in which one doesn't appear. Top floor and spooky forest are similar. So we'd not track them using this code anyway.
 

lostcalpolydude

Developer
Staff member
In all those cases we don't really know, we'd just know it was wrong, and that the real number is larger. In the case of Bat Hole I'd therefore just change one, and maybe put a message in the GCli/session log to say that it was done.

Given that we know it's wrong, we have two choices, remain wrong and useless, or become wrong and useful. I prefer mafia to become wrong in the count, but useful by being right in the prediction, if possible, rather than remain wrong in both.

Your wandering monster example is a good example of why I added isWanderingMonster, so we can account for it.

I don't think isWanderingMonster actually helps here, since most recurring superlikelies can be pushed back a turn. I guess adding turns to a bat hole area would work, since you just miss out completely on the screambat if a wandering monster overrides it. I'm doubtful that it can be reliably used anywhere else.

Castle ground floor I believe isn't every 10 turns, but guarantees a non-combat after 10 turns in which one doesn't appear. Top floor and spooky forest are similar. So we'd not track them using this code anyway.

The ground floor is the middle area (basement is the bottom) and takes exactly 11 turns, barring a wandering monster pushing it back.
 

Darzil

Developer
It's not a panacea, but there are places where this will be very helpful to my project, and others that it won't. There are many different systems in play, as most of this is hard coded, as we see from twitch.

Hence why we have things like castle ground floor where wandering monster pushes it back, and things like burn down the hotel, buttler skelton, etc, where a wandering monster overrides it (for an extra 50 turns and impossible this ascension respectively)
 
Last edited:

lostcalpolydude

Developer
Staff member
I added this in 14778.

One implementation detail is that I need to reliably determine whether a noncombat takes a turn. Many noncombats trigger a charpane refresh, and then it is checked immediately, but some do not (which means they did not take an adventure), so I check for charpane refreshing in the response text. The alternative is that a non-turntaking noncombat could be followed by a combat that is immediately finished by KoL's autoattack, and a turn gets added for both the noncombat and the combat.

A consequence of this is that mining turns don't get tracked. Comparing HTML, I see that the charpane refresh HTML is there in vanilla KoL, but not in mafia (but a charpane refresh is triggered anyway). I have no idea why that happens.

I don't know of any other cases of incorrect tracking, but if any are found, make sure to list what encounter(s) triggered it.

Since this isn't technically turns spent (non-turntaking combats are counted), a different name for the proxy field might make more sense. I might change it if someone has a better suggestion, but I won't change it once the next point release goes out.
 

Bale

Minion
Is it possible for KoLmafia to note if the noncombat triggers a charpane refresh after a choiceadventure? Then if it does not refresh charpane, mafia will check api before running a new adventure.
 

lostcalpolydude

Developer
Staff member
That would be a wasted server hit every time, and it would almost always be unnecessary. KoL says it wants a charpane refresh for mining, and I think that mafia is suppressing that somehow, and that's the part that should be fixed. It wouldn't be hard to check api in that case, it should just be pointless.
 

lostcalpolydude

Developer
Staff member
Mafia could note the lack of a charpane refresh. However, if KoL doesn't request a charpane refresh, then mafia loading api is a wasted server hit, because absolutely nothing about the character has changed. No turn spent, no meat change, no HP change, nothing.
 
FR: $location[].turns_spent should reset on ascension.

> ash $location[the hidden apartment building].turns_spent

Returned: 17

That was 9 last ascension, and 8 so far this one. I was checking to see if I needed to rainfax the last Shaman, and I do, after math. :)
 

lostcalpolydude

Developer
Staff member
FR: $location[].turns_spent should reset on ascension.

> ash $location[the hidden apartment building].turns_spent

Returned: 17

That was 9 last ascension, and 8 so far this one. I was checking to see if I needed to rainfax the last Shaman, and I do, after math. :)

14792
 

lostcalpolydude

Developer
Staff member
Sometimes the combat/noncombat pair in The Haunted Bedroom is counted as 2 turns instead of 1. I don't know why it doesn't always happen (which is what I would expect after thinking about it). It should always count as 1 turn, though.
 

Veracity

Developer
Staff member
It's sort of like a multi-fight - except it is a fight followed by a (0-turn) choice.
Ed is a 7-turn multi fight.
Her Naughtiness is 3 fights - but is 1 turn, right?
 

lostcalpolydude

Developer
Staff member
I think I can fix the Bedroom by updating the lastTurnUpdated value at the end of combat, and I'm pretty sure that won't break anything (I want to be in aftercore to test that out before making a change though).

I have no idea how KoL tracks Ed and the NS fights, but I'm not so worried about them because there's no practical reason to care if those should actually be counted as 1 turn.
 
Top