New Content - Implemented Bird-A-Day calendar

Veracity

Developer
Staff member
Revision 19710

I want to see (tomorrow) what api.php and the charpane say about my carried-over turns of Blessing of a Bird.
When I log in, I will not have chosen a bird, and will therefore not have the skill yet, but the effect will still give me modifiers.

Once I get that all working to my satisfaction, this IOTM might be done...
 

Veracity

Developer
Staff member
The difficulty is that KoLmafia tries to understand the state of your character even if you do some things outside of KoLmafia and then come into the program. This is an example of something where nothing in the static state of the game itself - api.php, charpane.php, charsheet.php, effect descriptions, etc. - can give us the full story.

The question to solve is: When I log in, is "Seek out a Bird" an available skill?
If you have not yet used the Bird-A-Day calendar, it is not available.
Using the calendar the first time grants you the skill and tells you the Bird of the Day.
Using the calendar an additional time tells you to go seeking. You already have the skill, and it does not tell bird of the day.
If you have used the calendar, it is available.
The skill is not on the charsheet.

I created a property - _bird ofTheDay - and set it when you use the calendar.
I also set it when you gain the Blessing of the Bird effect.
I also set it from api.php and charpane.php if you have that effect.

So, if we watch you use the calendar - or use the skill at least once, _birdOfTheDay is set and the skill is available.
If you log out and back in, _bird ofTheDay is still set.

I figured that having _birdOfTheDay set when you log in indicates the skill is available today. But, no.
You can have Blessing of the Bird active at rollover. When you log in after rollover, the effect is there - so we set _birdOfTheDay - but the skill is not available since you have not used the calendar. How can we know if you've used the calendar today - even outside of KoLmafia? We cannot. We could just use the calendar and make the skill available - but that will reset your Bird of the Day - including the active Effect - and you may not want to do that.

Revision 19711 adds a new setting - _canSeekBirds - which is set when you use the calendar and checked at login to add Seek out a Bird to available skills.
The first time you log in to KoLmafia in a day, that property will be false.
When you use the calendar, it becomes true, and you are good to log out and back in for the rest of the day.

The glitch is that if you use the calendar outside of KoLmafia and log in, we don't know.
The workaround is to use the calendar from within KoLmafia.
If you haven't done it outside KoLmafia, you can do it when you are done with active Blessing of the Bird turns.
If you have already done it, no harm to do it again.

Huh. I just realized that the skill description of Seek out a Bird changes. Mine currently says:

Code:
Seek out a Canny Georgia Mahogany Mockingbird

Type: Noncombat
MP Cost: 10

Now that you know what today's bird looks like, you should go find one and... look at it, I guess? Is that really what birdwatching is?

Gives Effect: Blessing of the Bird
(10 Adventures)
Not only does that tell me the Bird of the Day, but the MP Cost tells me how many times you already used it today.

OK, back to the drawing board. If you log in and we don't know the skill is available, look up the skill description and figure it out.
 

Veracity

Developer
Staff member
Well, OK. Nothing like a little math...

Revision 19712 will look at the skill description of Seek out a Bird if _canSeekBirds is false. If you have unlocked the skill, it will set that property to true, learn the skill (make it available) and calculate _birdOfTheDay and _birdsSoughtToday from there.
 

Veracity

Developer
Staff member
Turns out you can "Seek out a Western ..." or "Seek out an Eastern ...".
Revision 19714 allows "a" or "an".

I logged in to KoL in the Browser.
I used my Bird-A-Day Calendar.
I logged out and logged with KoLmafia.

KoLmafia looked up the skill description, set _birdOfTheDay, learned the skill and set _canSeekBirds to true, and set _birdsSoughtToday to 0, based on the mp cost.

I am sure that if I had sought a few birds, it would have done the right calculation from the mp.

Of course, if I now log in outside of KoLmafia, seek a few birds, and then log via KoLmafia, it will not look at the skill description when I log in, so will not update the casting cost.
That is such an edge case, I am not sure it's worth the extra server hit to ALWAYS look at the description. Maybe it is. Sigh.
 

Veracity

Developer
Staff member
Revision 19715 does that.

I logged in outside of KoLmafia and sought out 2 birds
I logged in via KoLmafia and _birdsSoughtToday is now 2.

Surely this is done now?
 

Veracity

Developer
Staff member
Maybe not. :)

Small tweak: Revision 19716 adds two properties:

_birdOfTheDayMods - same as ASH string_modifier( $effect[ Blessing of the Bird ], "Modifiers" )
yourfavoriteBirdMods - same as ASH string_modifier( $effect[ Blessing of your favorite Bird ], "Modifiers" )

You can see these in the gCLI via

prefref bird

and make an informed decision on whether to replace your favorite bird.
 

Veracity

Developer
Staff member
OK, I think this is done. I just logged in with some carried over turns of Blessing of a Bird and all the expected properties were set as expected:

_birdOfTheDay - yesterday's bird
_birdOfTheDayMods - ditto
_birdsSoughtToday - 0
_canSeekBirds = false

That all used to work fine, but with all the refactoring I did recently to autodetect those things at login, I had not tested with turns of the buff carried over a rollover. Now I have, and that still works.

Marking this Implemented.

Expecting somebody to chime in with something new, any day now. :)
 

Malibu Stacey

Active member
Thanks for all your efforts Veracity, it is very much appreciated.
If I see anything else I'll report it but it looks all good to me.
 

Erosion

Member
_birdsSoughtToday seems to not recognize the 'New Favorite Bird?' noncom as increasing the counter. I have 80 turns of the effect (6 seeks, 1 seek+fav, 1 seek), but Mafia still thinks I only cast 7 times.
Tried it again today, same thing. Cast for a total of 70 turns, Mafia thinks I'm only on 6 casts even though I cast the 320 (7th bird) and skills page says it will cost 640 (8th bird) for my next one.
I'm on R19835.
 
Top