Feature full moveable feast support

fredg1

Member
Back in 2012 it was noticed that additional support was added to KoL API to allow mafia (among others) to track the end of the feast's bonus. However, it seems like it was never actually used, so here goes.


Little reminder of how it works, if it's been too long:

Moveable feast, in addition to being a familiar equipment, can also be used form the inventory. This allows your current familiar to eat from the feast (once per day). Up to five different familiars can feast in the same day, and mafia tracks which familiars ate with the _feastedFamiliars property (string, separated by semi-colons), and the raw number of times a familiar feasted from it with the _feastUsed property (integer).

When a familiar feasts, his description changes from
<name>, the <#> pound <type> to
<name>, the extremely well-fed <#> pound <type>​
, and its weight goes up by 10.

This effect disappears at rollover, or after 20 completed combats, with the message:
<name> lets loose a resounding belch. Looks like he finally managed to digest all of that food.​


So far, mafia wasn't tracking the end of moveable feast, and, with, I guess, the fear of the repercussion of returning a value higher than it actually was, was not adding that boost to weight_adjustment() (...or because it wasn't the place to store that boost in the first place?). In the mafia interface, it's simply adding 10 to the final weight of your familiar is said familiar is in _feastedFamiliars, not saying where it comes from, even when the feast expires (since this preference isn't made to track "that" in the first place).



Enters the feature request:
In the kol API, there's a parameter named "familiar_wellfed", which is either set to 0, or 1 (integer, not string).
This 0 or 1 tells whether the feast effect is active or not on your current familiar (tested).

What this allows:
A new property that could be called something along the lines of _wellFedFamiliars
When the player (successfully) uses the feast, add his current familiar to _wellFedFamiliars along with _feastedFamiliars
Whenever mafia fetches API.php and sees that "familiar_wellfed" is set to 1, and that your current familiar is NOT in _feastedFamiliars or _wellFedFamiliars, be sure to add it to both
Whenever mafia fetches API.php, and your current familiar is in _wellFedFamiliars: if "familiar_wellfed" is set to 0, remove it from the property
_wellFedFamiliars would be used to direct which familiar to apply the +10 boost to, instead of _feastedFamiliars

Could also look for the "<name> lets loose a resounding belch. Looks like he finally managed to digest all of that food." message at the end of fights to remove a fam from the property, but since an API.php fetch presumably follows every fight, it wouldn't be really needed.
 
Top