Resistance is utile!

jasonharper

Developer
This little script will compare your resistance levels as shown on your character sheet with those calculated by mafia. It may be of use in spading outfit bonuses, or finding errors in mafia's modifiers, without having to constantly look up the "Amazingly Unthinkably Moderate" stuff in the Wiki.

Code:
print("ohmmeter v1.0, by JasonHarper@pobox.com (in game: Seventh)");

int[element] elms;
elms[$element[hot]] = 0;
elms[$element[cold]] = 0;
elms[$element[stench]] = 0;
elms[$element[spooky]] = 0;
elms[$element[sleaze]] = 0;
elms[$element[slime]] = 0;

int[string] words;
words["low"] = 2;
words["moderate"] = 3;
words["considerable"] = 4;
words["high"] = 5;
words["very"] = 1;
words["really"] = 1;
words["extremely"] = 3;
words["amazingly"] = 6;
words["extraordinarily"] = 12;
words["incredibly"] = 18;
words["staggeringly"] = 24;
words["mind-bogglingly"] = 30;
words["inconceivably"] = 36;
words["unthinkably"] = 42;
words["indescribably"] = 48;
words["impossibly"] = 54;

string charsheet = visit_url("charsheet.php").to_lower_case();

int csresistance(element el)
{
	string patt = el.to_lower_case() + " protection:</td><td><b>";
	int pos = charsheet.index_of(patt);
	if (pos == -1) return 0;
	pos = pos + length(patt);
	string desc = charsheet.substring(pos, charsheet.index_of("<", pos));
	if (desc == "very low") return 1;
	string[int] pieces = desc.split_string("\\s+");
	int total = 0;
	foreach i in pieces {
		string piece = pieces[i];
		int val = words[piece];
		if (val == 0) abort("don't understand `" + piece + "'");
		total = total + val;
	}
	return total;
}

foreach el in elms {
	print( el + ": charsheet says " + csresistance(el) +
		", mafia says " + numeric_modifier(el + " resistance").to_int());
}
 

Attachments

  • ohmmeter.ash
    1.4 KB · Views: 57
Top