weirdeaux monster stat box

deadned

New member
svn checkout http://svn.code.sf.net/p/weirdeauxbox/svn/trunk/

The script decorates the fight to show the number of pieces of weirdeaux's creatures.

Qqtd2H9.png

image courtesy of yojIMBoS_LAW (#1775888)
 

Attachments

  • yu9xPKM.png
    yu9xPKM.png
    65.2 KB · Views: 110
Last edited:

Bale

Minion
Really nice idea. I've already added that into my own fight override, but one thing is bugging me so allow me to share one line of code you might want to use instead of that long switch-case statement:

Code:
matcher m = create_matcher("an_seg(\\d)",page);
while (m.find())
	[COLOR="#FF0000"][B]s[ to_int(group(m,1)) ] += 1;[/B][/COLOR] // This line does the work of those 9 case statement. You can see why it was driving me nuts.
 
Last edited:

Bale

Minion
I've heavily modified the script so that it tells me what horror each part of the monster is going to inflict upon me. Here's my version:

Code:
// Weirdeaux monster part counter by Deadned (#1909053)
// http://kolmafia.us/showthread.php?17091-weirdeaux-monster-stat-box
buffer weirdeaux(buffer page) {
	if(my_location() != $location[The Mansion of Dr. Weirdeaux])
		return page;

	record part {
		string name;
		string ef;
		float factor;
	};
	part [int] bod;
		bod[1] = new part("Shark", "Multiplies Monster Attack by ", 1.2);
		bod[2] = new part("Leopard", "Multiplies Monster Defense by ", 1.2);
		bod[3] = new part("Bear", "Multiplies Monster HP by ", 1.2);
		bod[4] = new part("Bee", "Sometimes dodges attacks", 0.0);
		bod[5] = new part("Snail", "Reflects spells", 0.0);
		bod[6] = new part("Cheetah", "Always gets the jump", 0.0);
		bod[7] = new part("Hedgehog", "Deals damage when hit with melee attacks", 0.0);
		bod[8] = new part("Wolf", "Passively deals spooky damage each round", 0.0);
		bod[9] = new part("Elephant", "Adds elemental resistance", 0.0);
	part [int] head;
		head[1] = new part("Tiger", "Damage 30% of Max HP at start of combat", 0.0);
		head[2] = new part("Cobra", "You acquire an effect: A Little Bit Poisoned", 0.0);
		head[3] = new part("Gorilla", "You acquire an effect: Flattened (Muscle -50%)", 0.0);
		head[4] = new part("Goat", "You acquire an effect: Konked on the Head (Mysticality -50%)", 0.0);
		head[5] = new part("Pufferfish", "	You acquire an effect: Partially Paralyzed (Moxie -50%)", 0.0);
		head[6] = new part("Giraffe", "  --- ", 0.0);
		head[7] = new part("Frog", "Blocks combat items", 0.0);
		head[8] = new part("Alligator", "Damage 50% of Max HP at start of combat", 0.0);
		head[9] = new part("Naked Mole Rat", "Spooky damage 130% of Max HP at start of combat", 0.0);
		head[10] = new part("Jellyfish", "Sometimes blocks your actions", 0.0);
	part [int] butt;
		butt[1] = new part("Rhinocerous", "Damage 10% of current HP each round", 0.0);
		butt[2] = new part("Spider", "Each round, you acquire an effect: Webbed (All stats penalty by 10 * duration)", 0.0);
		butt[3] = new part("Fire Ant", "Hot damage 30% of current HP each round", 0.0);
		butt[4] = new part("Penguin", "Cold damage 30% of current HP each round", 0.0);
		butt[5] = new part("Skunk", "Stench damage 30% of current HP each round", 0.0);
		butt[6] = new part("Bat", "Spooky damage 30% of current HP each round", 0.0);
		butt[7] = new part("Leech", "Sleaze damage 30% of current HP each round", 0.0);
		butt[8] = new part("Rattlesnake", "Spooky damage 50% of current HP each round & prevents familiar actions", 0.0);
		butt[9] = new part("Scorpion", "You acquire an effect: A Little Bit Poisoned", 0.0);
		butt[10] = new part("Octopus", "Prevents the use of combat skills", 0.0);

	//counts parts in image
	int totalParts = 2;
	int [int] s;
	matcher m = create_matcher("an_seg(\\d)",page);
	while(m.find()) {
		s[ to_int(group(m,1)) ] += 1;
		totalParts += 1;
	}
	
	if(totalParts > 0) {
		buffer out;
		out.append("<table><tr><th colspan=4 align=left>The monster\'s <b>");
		out.append(totalParts);
		out.append("</b> pieces are composed of:</th></tr>");
		
		// Find head
		m = create_matcher("an_head(\\d+)",page);
		if(m.find()) {
			out.append("<tr><td><image src=/images/adventureimages/an_head");
			out.append(m.group(1));
			out.append(".gif height=40></td><td>");
			out.append(head[ m.group(1).to_int() ].name);
			out.append("</td><td> Head </td><td>");
			out.append(head[ m.group(1).to_int() ].ef);
			out.append("</td> </tr>");
		}
		// Find butt
		m = create_matcher("an_butt(\\d+)",page);
		if(m.find()) {
			out.append("<tr><td><image src=/images/adventureimages/an_butt");
			out.append(m.group(1));
			out.append(".gif height=40></td><td>");
			out.append(butt[ m.group(1).to_int() ].name);
			out.append("</td><td> Butt </td><td>");
			out.append(butt[ m.group(1).to_int() ].ef);
			out.append("</td> </tr>");
		}
		for x from 1 to 9 {
			if(to_int(s[x])>0) {
				out.append("<tr><td><image src=/images/adventureimages/an_seg");
				out.append(x);
				out.append(".gif height=40></td><td>");
				out.append(bod[x].name);
				out.append("</td><td> (");
				out.append(s[x]);
				out.append(") </td><td>");
				out.append(bod[x].ef);
				if(bod[x].factor != 0)
					out.append(to_string(bod[x].factor * s[x]));
				out.append("</td> </tr>");
			}
		}
		out.append("</table>");

		matcher n=create_matcher("(<table><tr><td><center><table>.+?</table>)<br>",page);
		if(n.find())
			return page.insert(n.end(1), out);
	}
	return page;

}


buffer loadPage() {
	string fetch() {
		if(form_fields() contains "runcombat" && form_field("runcombat") == "heckyes")
			return run_combat();
		return visit_url();
	}
	// Add doctype to escape quirks mode
	return fetch().replace_string('<html>', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html>');
}

void main() {
	loadPage().weirdeaux().write();
}
 
Last edited:

Donavin69

Member
I've heavily modified the script so that it tells me what horror each part of the monster is going to inflict upon me. Here's my version:

I like the idea, but I can't seem to figure out what you've done to make this work. When I copy your code and replace the original, I don't get any information. I really need to learn how to do the relay scripts, what am I missing here?
 

Bale

Minion
I just save that as fight.ash

Here's my current version. I think it's changed a little bit.

Code:
// Weirdeaux monster part counter by Deadned (#1909053)
// http://kolmafia.us/showthread.php?17091-weirdeaux-monster-stat-box
buffer weirdeaux(buffer page) {
	if(my_location() != $location[The Mansion of Dr. Weirdeaux])
		return page;

	record part {
		string name;
		string ef;
		float factor;
	};
	part [int] bod;
		bod[1] = new part("Shark", "Multiplies Monster Attack by ", 1.2);
		bod[2] = new part("Leopard", "Multiplies Monster Defense by ", 1.2);
		bod[3] = new part("Bear", "Multiplies Monster HP by ", 1.2);
		bod[4] = new part("Bee", "Sometimes dodges attacks", 0.0);
		bod[5] = new part("Snail", "Reflects spells", 0.0);
		bod[6] = new part("Cheetah", "Always gets the jump", 0.0);
		bod[7] = new part("Hedgehog", "Deals damage when hit with melee attacks", 0.0);
		bod[8] = new part("Wolf", "Passively deals spooky damage each round", 0.0);
		bod[9] = new part("Elephant", "Adds elemental resistance", 0.0);
	part [int] head;
		head[1] = new part("Tiger", "Damage 30% of Max HP at start of combat", 0.0);
		head[2] = new part("Cobra", "You acquire an effect: A Little Bit Poisoned", 0.0);
		head[3] = new part("Gorilla", "You acquire an effect: Flattened (Muscle -50%)", 0.0);
		head[4] = new part("Goat", "You acquire an effect: Konked on the Head (Mysticality -50%)", 0.0);
		head[5] = new part("Pufferfish", "	You acquire an effect: Partially Paralyzed (Moxie -50%)", 0.0);
		head[6] = new part("Giraffe", "  --- ", 0.0);
		head[7] = new part("Frog", "Blocks combat items", 0.0);
		head[8] = new part("Alligator", "Damage 50% of Max HP at start of combat", 0.0);
		head[9] = new part("Naked Mole Rat", "Spooky damage 130% of Max HP at start of combat", 0.0);
		head[10] = new part("Jellyfish", "Sometimes blocks your actions", 0.0);
	part [int] butt;
		butt[1] = new part("Rhinocerous", "Damage 10% of current HP each round", 0.0);
		butt[2] = new part("Spider", "Each round, you acquire an effect: Webbed (All stats penalty by 10 * duration)", 0.0);
		butt[3] = new part("Fire Ant", "Hot damage 30% of current HP each round", 0.0);
		butt[4] = new part("Penguin", "Cold damage 30% of current HP each round", 0.0);
		butt[5] = new part("Skunk", "Stench damage 30% of current HP each round", 0.0);
		butt[6] = new part("Bat", "Spooky damage 30% of current HP each round", 0.0);
		butt[7] = new part("Leech", "Sleaze damage 30% of current HP each round", 0.0);
		butt[8] = new part("Rattlesnake", "Spooky damage 50% of current HP each round & prevents familiar actions", 0.0);
		butt[9] = new part("Scorpion", "You acquire an effect: A Little Bit Poisoned", 0.0);
		butt[10] = new part("Octopus", "Prevents the use of combat skills", 0.0);

	//counts parts in image
	int totalParts = 2;
	int [int] s;
	matcher m = create_matcher("an_seg(\\d)",page);
	while(m.find()) {
		s[ to_int(group(m,1)) ] += 1;
		totalParts += 1;
	}
	
	if(totalParts > 0) {
		buffer out;
		out.append("<table><tr><th colspan=4 align=left>The monster\'s <b>");
		out.append(totalParts);
		out.append("</b> pieces are composed of:</th></tr>");
		
		// Find head
		m = create_matcher("an_head(\\d+)",page);
		if(m.find()) {
			out.append("<tr><td><image src=/images/adventureimages/an_head");
			out.append(m.group(1));
			out.append(".gif height=40></td><td>");
			out.append(head[ m.group(1).to_int() ].name);
			out.append("</td><td> Head </td><td>");
			out.append(head[ m.group(1).to_int() ].ef);
			out.append("</td> </tr>");
		}
		// Find butt
		m = create_matcher("an_butt(\\d+)",page);
		if(m.find()) {
			out.append("<tr><td><image src=/images/adventureimages/an_butt");
			out.append(m.group(1));
			out.append(".gif height=40></td><td>");
			out.append(butt[ m.group(1).to_int() ].name);
			out.append("</td><td> Butt </td><td>");
			out.append(butt[ m.group(1).to_int() ].ef);
			out.append("</td> </tr>");
		}
		for x from 1 to 9 {
			if(to_int(s[x])>0) {
				out.append("<tr><td><image src=/images/adventureimages/an_seg");
				out.append(x);
				out.append(".gif height=40></td><td>");
				out.append(bod[x].name);
				out.append("</td><td> ");
				if(s[x] > 1) {
					out.append("<span style='font-size: 75%;vertical-align:top;'>x </span>");
					out.append(s[x]);
				}
				out.append("</td><td>");
				out.append(bod[x].ef);
				if(bod[x].factor != 0)
					out.append(to_string(bod[x].factor ** s[x], "%,.2f"));
				out.append("</td> </tr>");
			}
		}
		out.append("</table>");

		matcher n=create_matcher("(<table><tr><td><center><table>.+?</table>)<br>",page);
		if(n.find())
			return page.insert(n.end(1), out);
	}
	return page;

}

buffer loadPage() {
	string fetch() {
		if(form_fields() contains "runcombat" && form_field("runcombat") == "heckyes")
			return run_combat();
		return visit_url();
	}
	// Add doctype to escape quirks mode
	return fetch().replace_string('<html>', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html>');
}


void main() {
	loadPage().weirdeaux().write();
}
 
Top