Mafia Area Hit + Avoid Ratings in ASH?

cjswimmer

Member
Is there any way to determine the Mafia To Hit% and Avoid% numbers for a particular area from inside an ASH script? I currently have a script that has ratings for each area, but it doesn't calculate the percentages, just whether you're past the 'safe level' for avoidance.
 

Tirian

Member
A key part that would need to be scripted is the amount of monster level boosting you're doing. Here are a few functions that cover the worst of figuring that out:

Code:
int [item] Mitem_to_ml_boost;
Mitem_to_ml_boost[$item[hockey stick of furious angry rage]] = 30;
Mitem_to_ml_boost[$item[stainless steel scarf]] = 20;
Mitem_to_ml_boost[$item[ice sickle]] = 15;
Mitem_to_ml_boost[$item[hippo whip]] = 10;
Mitem_to_ml_boost[$item[annoying pitchfork]] = 5;
Mitem_to_ml_boost[$item[giant needle]] = 5;
Mitem_to_ml_boost[$item[goth kid t-shirt]] = 5;
Mitem_to_ml_boost[$item[ring of aggravate monster]] = 5;

# This tells you how much the given item affects monster level
int how_much_ml(item it)
{
	if (Mitem_to_ml_boost contains it) return Mitem_to_ml_boost[it];
	return 0;
}

# This tells you how much +ML stuff you've got going for you not counting the
# MCD (since that is the variable we're most likely to want to tinker with at
# the end.

int current_monster_level()
{
	int x = 0;
	x = x + how_much_ml(current_equipment($slot[weapon]));
	x = x + how_much_ml(current_equipment($slot[off-hand]));
	x = x + how_much_ml(current_equipment($slot[shirt]));
	x = x + how_much_ml(current_equipment($slot[acc1]));
	x = x + how_much_ml(current_equipment($slot[acc2]));
	x = x + how_much_ml(current_equipment($slot[acc3]));
	x = x + how_much_ml(current_equipment($slot[familiar]));
	if (have_effect($effect[Ur-Kel's Aria of Annoyance]) > 0)
		x = x + 2*my_level();

	return x;
}

Then you add in current_mind_control_level() if you're under a mysticality sign, add that to your buffed moxie, and subtract the safe zone level. If that result is between -1 and -18, then your to-evade percentage is (19+X)/19. Same with strength for to-hit assuming that you also have a table of always hitting percentages.
 

cjswimmer

Member
I was thinking of some way to tap into what Mafia already displays when you select Location Details on the main adventure interface, since it already factors in all of the +ML affects and other influences on the Hit and Evade percentages.
 

macman104

Member
Courtesy of Veracity's amazing ASH talents, I give you:
Monster Base Attack
Code:
monster_base_attack(monster name)
Monster Base Defense
Code:
monster_base_defense(monster name)
Monster HP
Code:
monster_base_HP(monster name)

Note, that these require a monster name, and I'm not exactly sure how specific the matching is for it, but yea, there's the basics. Note that these return integer values. Enjoy.
 

Nightmist

Member
Have a look in here http://kolmafia.us/index.php/topic,144.0.html
Its a bit outdated (and so doesn't take full advantage of some of the newer functions but its a place to start I guess.) but it seems to have basic functionality. (Haha feel free to update it ^^;; )

Edit: Haha it seems veracity has made most of the script I linked to obsolete (It was mostly monster values which with the commands macman has posted makes them largely useless)
 
Top