Why doesn't Mafia use other healing methods when spells are unavailable?

I'm not sure whether this is a bug, a result of settings I've got set incorrectly, or intentional behavior.

The only options I've checked under Adventure tab > HP/MP Usage > HP section (left side) > Use these restores: are scroll of drastic healing and Cannelloni Cocoon. I've never had anything other than Cocoon checked before, but I assumed this configuration would result in a fallback to the scroll when Cocoon isn't available. Namely, when I'm fighting in Dread, and at +243 MP to cast skills.

But instead of falling back to the scroll, Mafia just fails to cast Cocoon, and then aborts. I can use a scroll manually, but Mafia doesn't do it automatically. Is there a way I can change that?

After Battle: You gain 139 Roguishness

Casting Cannelloni Cocoon 1 times...
Loading character status...
Not enough mana to cast Cannelloni Cocoon.
Autorecovery failed.

Autorecovery failed.


> use scroll of drastic healing

Using 1 scroll of drastic healing...
Finished using 1 scroll of drastic healing.
 

xKiv

Active member
You had a variable "+MP cost" debuff from DV. Mafia doesn't parse it, because it can change based on various things (I *think* the change triggers when you get the effect, and can depend on your current clan, among other things).
Thus mafia thinks you should be able to cast the spell, and failing to do so is a cause to ask for your interaction.
 
Last edited:

lostcalpolydude

Developer
Staff member
In this case, mafia doesn't know about the +243 MP cost effect of that debuff, because it's variable (mafia actually assumes +3 no matter what). Mafia tries to cast Cocoon, fails, and aborts because things aren't working as expected. It doesn't matter what you have checked, the failed skill cast will cause an abort.

A straightforward way to handle this is "set _userMods = Mana Cost: +240". You need to do that every day, and you need to remember to adjust it if you get a different level of Chilled or remove it completely.
 
Thanks for the explanation and the potential fix, guys.

Sounds like not parsing the effect was an intentional choice. Is that simply to save server hits? Seems to me that it wouldn't be an overwhelming server burden to say "Each time a skill would be cast, first check for this effect, and parse the effect if it exists." But I guess those hits could add up, if you're running a mood that maintains dozens of effects.
 

heeheehee

Developer
Staff member
Fundamentally, the problem is that the strength of the effect can change without warning (you could change clans, or a clannie could increase the kisses in the zone).

I wonder if we can do something along the lines of "if we get this effect, and we didn't have it before, set its strength based on how many turns we got of it". Then the only thing left would be parsing the effect on login.
 

Bale

Minion
I was thinking that there has to be a better way to handle that. Then I thought about the various things we tracked and I cam up with a function to add to my between battle script:

Code:
void chilledBones() {
	int chill = have_effect($effect[Chilled to the Bone]);
	if(chill > 0) {
		location last = get_property("lastAdventure").to_location();
		if(last.zone == "Dreadsylvania") {
			if(get_property("_chilledDuration").to_int() < chill) {
				int x = last.kisses - 1;
				int penalty = 3 ** x - 3;
				if(penalty > 0)
					set_property("_userMods", "Mana Cost: +"+penalty);
			}
			set_property("_chilledDuration", chill);
		}
	} else if(get_property("_userMods").contains_text("Mana Cost: +")) {
		set_property("_userMods", "");
	}
}

I'm putting this in my between battle script instead of my after adventure script in case Chilled to the Bone gets unaffected. Note that this only triggers when we gain more turns of Chilled to the Bone and it judges the power of the effect based on the number of elements banished in the zone where it last adventured. (my_location() wouldn't work if you are changing adventuring locations.)

Does anyone see any problems I missed or improvements to make?


I thought that effect can only change when you get hit with it, so not on clan change.

This is correct. It changes when you get hit by the effect again. If you get hit in a new location with a different kiss level it changes in power and this is the only thing that changes it. Merely adventuring in a location with a different kiss level won't alter the strength of the effect. That's why my script checks to see if the number of turns increases.
 
Last edited:

heeheehee

Developer
Staff member
I thought for some strange reason it only changed when you gained the effect.

Bale: you'll need to also check turns spent, since power pill or otherwise ending the combat without taking a turn will cause you to think you got more Chilled than you actually did.
 

lostcalpolydude

Developer
Staff member
You can drop that code as of 16532, which adds _chilledToTheBone and uses that for the MP cost modifier. I got my dread stuff as quickly as possible and have avoided adventuring there since, so I didn't actually test the code, but it looks simple enough that it should work.
 

Bale

Minion
I really appreciate that you added the functionality, but I just looked at the code... By using an underline preference you are ensuring that mafia won't remember the value after rollover. Why did you do that? I think that you should remove the underline.
 

Veracity

Developer
Staff member
I haven't been paying attention and I didn't look at the code, but didn't he say it checked on login if you have the effect active? Considering that you have to login after rollover anyway, what's the problem?

Edit: Actually, I just looked at the code. I does not look at the description on login, even if you do have the effect. Considering that you can get the effect outside of KoLmafia and then log in via KoLmafia, perhaps it should.
 
Last edited:
Top