Nemesis quest script

Mr Purple

Member
Like with all general-purpose scripts that deal with combat, I have to think of all the corner cases ^^
I wanted to steal code from slime.ash, as use the code provided by Mr Purple.

I think Mr Purple's idea was good: calculate what level mother hellseals you can easily kill, hurt enough pups, and simply runaway from them after that. I thought about buying the LTS suit if needed, but I won't. The goal is not to start mother-levelling, it's just to be done with the quest.

I removed the stuff I wrote for the SC section from the site a long time back with the intention of making it better. Then I forgot. So here is my suggestion for the SC section:

Code:
boolean nemesis_Seal_Clubber()
{
	// max muscle with a 2h-club
	cli_execute( "muscle, 2 hand, type club" );	
	
	//Set up the numbers to work out how many wails to get from the pups
	int pups_to_kill = 0;
	int pups_killed = 0;

	//This section checking for a shield is irrelevant with the 2 handed instruction above.
	//I'm keeping it in to give you flexibility.
	boolean is_shield( item it )
	{
		int[int] m;
		file_to_map("itemdescs.txt", m);
		return ( contains_text( visit_url("desc_item.php?whichitem=" + m[it.to_int()]) , "off-hand item (shield)" ) );
	}

	//Now the calculation for the mother's likely damage...
	int damage_stat = my_buffedstat($stat[moxie]);
	if( is_shield( equipped_item( $slot[off-hand] ) ) && have_skill( $skill[Hero of the Half-Shell] ) )
	{
		damage_stat = my_buffedstat($stat[muscle]);
	}

	int absorbFrac = damage_absorption_percent() / 100;

	int [int] possible_mothers;
	for i from 1 to 10
	{
		int diff = max( ((150*(1.385^(i)) + monster_level_adjustment()) - damage_stat ) , 0 );
		possible_mothers[i] = (diff + ((150*(1.385^(i)) + monster_level_adjustment())/4) - damage_reduction()) * (1 - absorbFrac);
	}

	int x = 1;
	while( x < 11 )
	{
		if( possible_mothers[x] < my_maxhp() )
			x = x + 1;
		else
		{
			pups_to_kill = x - 1;
			x = 12;
		}
	}

	if( !contains_text( visit_url( "volcanoisland.php?pwd=" + my_hash() + "&action=npc" ) , "you, my friend" ) 
	&& !contains_text( visit_url( "volcanoisland.php?pwd=" + my_hash() + "&action=npc" ) , "pot of palm" ) 
	&& !contains_text( visit_url( "volcanoisland.php?pwd=" + my_hash() + "&action=npc" ) , "Let's see what you've brought" )
	{
		//First of two macros. This one is a stasis macro to get the pups wailing.
		string macroone;
		macro += "if monstername Hellseal Pup";
		macro += "call pup_stasis";
		macro += "endif";
		macro += "mark __yyendifjump0";
		macro += "if monstername Mother Hellseal"; 
		macro += "if hasskill 3004"; 
		macro += "skill 3004";
		macro += "endif";
		macro += "mark __yyendifjump2";
		macro += "endif";
		macro += "mark __yyendifjump1";
		macro += "call attack_routine";
		macro += "sub pup_stasis";
		macro += "while !match \"emits a high-pitched screeching wail\" && !pastround 27";
		macro += "call infinite_use_item";
		macro += "endwhile";
		macro += "mark __yyendwhilejump0";
		macro += "endsub";
		macro += "sub attack_routine";
		macro += "skill lunging thrust smack";
		macro += "repeat";
		macro += "endsub";
		macro += "sub infinite_use_item"; 
		macro += "if hascombatitem 1316"; 
		macro += "use 1316";
		macro += "goto __yyendifjump3";
		macro += "endif";
		macro += "if hascombatitem 8"; 
		macro += "use 8";
		macro += "goto __yyendifjump3";
		macro += "endif";
		macro += "if hascombatitem 2"; 
		macro += "use 2";
		macro += "goto __yyendifjump3";
		macro += "endif";
		macro += "if hascombatitem 2678";
		macro += "use 2678";
		macro += "goto __yyendifjump3";
		macro += "endif";
		macro += "if hascombatitem 536";
		macro += "use 536";
		macro += "goto __yyendifjump3";
		macro += "endif";
		macro += "if hascombatitem 185";
		macro += "use 185";
		macro += "goto __yyendifjump3";
		macro += "endif";
		macro += "abort \"No infinite use items detected!\"";
		macro += "mark __yyendifjump3";
		macro += "endsub";
		
		while( pups_killed < pups_to_kill )
		{
			adventure( 1 , $location[The Broodling Grounds] , macroone );
			if( last_monster() == $monster[hellseal pup] )
				pups_killed = pups_killed + 1;	
		}
		
		//The second macro tries to use CLEESH on the second pup to completely avoid the problem of an extra wail.
		//If someone lacks CLEESH, it simply uses lunging thrust smack as that's likely to OHKO anyway.
		string macrotwo;
		macro += "if monstername Hellseal Pup";
		macro += "if hasskill 15";
		macro += "skill 15";
		macro += "endif";
		macro += "mark __yyendifjump1";
		macro += "endif";
		macro += "mark __yyendifjump0";
		macro += "if monstername Mother Hellseal";
		macro += "if hasskill 3004";
		macro += "skill 3004";
		macro += "endif";
		macro += "mark __yyendifjump3";
		macro += "endif";
		macro += "mark __yyendifjump2";
		macro += "call attack_routine";
		macro += "sub attack_routine";
		macro += "skill lunging thrust smack";
		macro += "repeat";
		macro += "endsub";
		
		while( item_amount( $item[hellseal brain] ) < 6 && item_amount( $item[hellseal sinew] ) < 6  && item_amount( $item[hellseal hide] ) < 6 )
			adventure( 1 , $location[The Broodling Grounds] , macrotwo );
		
		visit_url( "volcanoisland.php?pwd=" + my_hash() + "&action=npc" );
	}
	else print( "You have already killed enough mother hellseals. Go fight in the dark cave!" );
}

Couple of things to mention: firstly, I haven't checked any of it. All I know is that verifying it worked. Secondly, the macros are not necessarily what you want: I used RoyalTonberry's compiler so I'm including the non-compiled ones below to make them more readable. Note though there are no checks for damage or whatever. I hope this is useful to you.

:)

Macroone:

Code:
if  monstername Hellseal Pup
	call pup_stasis
endif

if monstername Mother Hellseal
	if hasskill entangling noodles
		skill entangling noodles
	endif
endif

call attack_routine

sub pup_stasis
	while !match "emits a high-pitched screeching wail" && !pastround 27
		call infinite_use_item
	endwhile
endsub

sub attack_routine
	skill lunging thrust smack
	repeat
endsub


sub infinite_use_item
	if hascombatitem facsimile dictionary 
		use facsimile dictionary 
	else if hascombatitem spices
		use spices
	else if hascombatitem seal tooth
		use seal tooth
	else if hascombatitem spectre scepter
		use spectre scepter
	else if hascombatitem dictionary
		use dictionary
	else if hascombatitem fat stacks of cash
		use fat stacks of cash
	else
		abort "No infinite use items detected!"
	endif
endsub

Macrotwo:

Code:
if  monstername Hellseal Pup
	if hasskill CLEESH
		skill CLEESH
	endif
endif

if monstername Mother Hellseal
	if hasskill entangling noodles
		skill entangling noodles
	endif
endif

call attack_routine

sub attack_routine
	skill lunging thrust smack
	repeat
endsub
 

Numenor

New member
I'm trying to set the default farming location to the DoD. But when I type in zlib <nemesis_farm_location> = <The Dungeons of Doom> I keep getting the following response: No setting named '<nemesis_farm_location>' exists.

Anyone know what's going on here?

Edit: Ok, tried setting it a different way by typing zlib and then typing the rest of that into the box that comes up. I'd like to suggest refining the first post a bit as the instructions for setting those variables are a bit ambiguous.
 
Last edited:

slyz

Developer
Remove the '<' and '>' :
Code:
zlib nemesis_farm_location = Dungeons of Doom

EDIT: I removed those characters in the example of the first post.
 

Numenor

New member
Hmmm, ok and I'm back again. So I'd set the location to "The Dungeons of Doom" but I'm getting this error when trying to run the script: Mafia did not understand this location: none. Please check your nemesis_farm_location zlib setting.

Is there a thread that lists what the various locations are called for mafia to understand?
 

slyz

Developer
I removed the "the" in the command I posted to avoid that problem. You can simply check the location names as Mafia knows them in the adventure tab of the interface, or using this useful alias:
Code:
alias locref => ashq foreach l in $locations[] if(l.to_lower_case().contains_text($string[%%].to_lower_case())) print(l)
Code:
> locref doom

Dungeons of Doom
 
Last edited:
On the SC pup stasis issue, I want to remember that I just used Clobber the last time I did this part and it worked fine. The seal always wails when you don't one-hit him. Also, you don't have to cleesh pups that appear after you've reached Pups_to_kill, you just have to one-hit them (85hp). It gives more stats than cleesh.

The problem I've had with recent SC runs is finding a 2h club. While it might not be in the purview of this script, the easiest/best one I've figured out is to get the bad-ass club by hunting an armored seal (500 meat A&L + 10 seal-blubber candles) at Level 9. The epic/LEW happens to be a 1h club, so there is no issue with seal-hunting. SAM isn't an issue because you have it already to get past the Doors to the Cave. It also doesn't require any turns, so it *could* be included if you want to go the LTS (10k @ Level 10) route.
 

Winterbay

Active member
If you have access to sugar sheets you can use a sugar shille... thingiie as well, but I guess not all have that :)
 

jwylot

Member
The problem I've had with recent SC runs is finding a 2h club
Assuming most of us will complete the quest after freeing the king, finding a two-handed club is not a major issue. Something like the non-stick pugil stick is cheap and perfectly suitable.
 

T_E

Member
Gah... me again. =(
I ran this as a DB and it did not progress to the password/opening the big door once it had all of the paper strips in the Nemesis cave- it just kept going for a total of 29 turns (until I noticed and stopped it manually). Evil paper umbrella drink, anyone? =)
 

Theraze

Active member
There are currently issues with goals and the nemesis cave. It's not the script, it's mafia. At least, from what other people have posted...
 

Theraze

Active member
Two (same) things to be fixed up. There are two spots with "conditions add" that should probably be replaced with "conditions set" instead. That should make it actually stop properly if you can't finish up getting your paper bits or hacienda keys in a single day.
 

Theraze

Active member
Finally (think) I figured out the problem with the Raveosity equipping for DB... it does this:
Code:
  foreach it in rave_items
  {
    if ( it == $item[ glowstick on a string ] && weapon_hands( equipped_item( $slot[ weapon ] ) ) > 1 )
     equip( $slot[ weapon ], LEW );
    equip( it );
   }
but the LEW is a 2 handed weapon, so this will never succeed... I think better would be if raveosity > 7, skipping the glowstick. If raveosity == 7, running "maximize +weapon, -melee, 1 hand" instead of the current equipping.

Changed my code to this for now:
Code:
   if ( item_amount( it ) > 0 && equipped_amount( it ) == 0 )
   {
    if ( it == $item[ glowstick on a string ] )
    {
     if ( raveosity > 7 )
      continue;
     if ( weapon_hands( equipped_item( $slot[ weapon ] ) ) > 1 )
      maximize( "+weapon, -melee, 1 hand", false );
    }
    equip( it );
   }
Tested the maximize check and got this:
> ash maximize( "+weapon, -melee, 1 hand", false );

Maximizing...
3 combinations checked, best score 0.0
Wielding happiness...
Equipment changed.
Returned: true
so it should work...
 
Last edited:

slyz

Developer
I completely overlooked that the Moxie LEWs are 2 handed, thanks!

Since you only want to unlock the lair, I will just replace
PHP:
equip( $slot[ weapon ], LEW );
with
PHP:
equip( $slot[ weapon ], $item[ none ] );
 

slyz

Developer
I saw the thread, I'll upload a fix now.

Thanks again!

EDIT: I should break the prism as a Seal Clubber tomorrow, so I will finally have to implement the missing part to the script, bump to version 1 beta and add automatic version checking.
 
Last edited:

slyz

Developer
And the script can finally kill Mother Hellseals.

A few notes on what it does:
  • The list of passive damage sources is taken from the KoL Wiki page
  • The only viable combat strategy against Mother Hellseals (when you want intact drops) is using LTS. The script will ask if you want it to buy it automatically the first time it is run as a Seal Clubber. If you say no, it will let you deal with the Mothers yourself, although you might want to post your method here if it's cheaper than using LTS.
  • This is the string used to decide what to equip (apart from the club):
    Code:
    hp, weapon dmg, 0.1 weapon damage percent, elemental dmg, -weapon, -offhand, -familiar
    The hp could maybe use a boost if you have cocoon permed. This worked very well for me, but I wonder how people with less equipment available would fare. Or some sort of cycling, replacing +damage gear by +hp gear while you can still kill the same level Mother Hellseals.
  • All the gear that are passive damage sources are added to the maximize string so they won't be equipped.
  • It goes through the available clubs and uses the one that minimizes the HP lost against the highest level mother you can kill. I also considered minimizing the percentage of your max HP lost instead of the HP lost directly, but that might not benefit people who don't have Cocoon to heal. You can edit line 937 to see if it changes anything. In my case it always chose Frosty's nailbat.
  • If you don't have a 2 handed club available, it will buy the cheapest one (under 5k meat) available. The cheapest one is 270 meat currently. If you don't allow Mafia to buy from the mall, you will have to get a 2h club yourself.
  • I just thought of this, but since killing Mother Hellseals should net you some stats, and since most people will run this after breaking the prism, I could add a check to see if one of your base stats reaches 200 and run the maximizer again.
  • For some reason, the script overestimates the maximum damage Mothers do, and underestimates the minimum damage LTS does. I used the wiki formulas, but maybe something strange is going on with the Mother Hellseal's Monster Level. Since the errors are in the right direction, though, I'll leave things as they are.

I'll wait until a couple of players can test it to add version checking and bump to version 1.

EDIT: I forgot to thank Mr. Purple ^^
 
Last edited:

Theraze

Active member
Using the latest version of the script, just ended up collecting 6 baggy rave pants, 15 candy necklaces, 14 glowsticks on a stick, 5 pacifier necklaces, 6 rave visors, and 13 teddybear necklaces... Not EXACTLY what I'd call a good use of 50 adventures or so. :)

Current check_raveosity() function has this:
Code:
 if ( raveosity < 7 ) return false;
 foreach it in rave_items
and I'd suggest making it more like this:
Code:
 if ( raveosity < 7 ) return false;
 equip( $slot[ acc1 ], $item[ none ] );
 equip( $slot[ acc2 ], $item[ none ] );
 equip( $slot[ acc3 ], $item[ none ] );
 foreach it in rave_items
Basically... you know that you'll be using at least one of the accessories, probably multiple. Instead of ending up at 6 raveosity, if you scrap those temporarily, you'll actually get to equip all the items it thinks it's going to. Alternatively, you could just run
Code:
maximize("7 raveosity", false);
and let mafia handle the equipment slots... could even simplify the check if you have enough by just doing
Code:
maximize ("7 raveosity", true);
 
Top