Any script requests?

If you want a semi-silly way of dealing with it, there is my custom combat script (I haven't really cleaned it up). It handles most of the physical resistant and high hit point creatures, but mostly uses things I have available in my adventures (divine favors), but I has some support for other items.

My future plans was to integrate it into CakeLib since I'm adding formulas for divine favor damage, elemental damage on the love songs, and other things into that mix. And it gives me a single point to add that data entry (which is what CakeLib basically is). But, as it stands, it has a semi-useful approach and pretty much kills the nasty fights for me.

As you can see, I use it for the Wossname fights for me. Nothing like amber funkslinging divine favors. :D

thanks caky, i'm sure that'll help when i'm trying to write my own one.

ok guys, so here's what i was thinking for steps (and i don't know how do-able these steps are, or if i'm missing some steps, so tell me what you think)
  1. ftf
  2. get the monsters resistance and weakness info
  3. calculate how much damage you'll do by just attacking (based on the outfit you're wearing and taking into account the monster's weakness, also factor in phials and wad/nugget effects)
  4. calculate how much damage you'll do by casting spells (taking into account the monster's weakness)
  5. figure out which combat items you have from a list of items the script is allowed to use, calculate how much damage they will do (taking into account the monster's weakness)
  6. determine which method will deal the most damage
  7. add in expected damage from your familiar
  8. if your best option does at least some minimum amount of damage, go with that option
  9. otherwise cleesh
  10. if cleesh fails, run
 

zarqon

Well-known member
You also need to consider how many rounds you can survive -- it is important in determining which method to use. This could be tricky, since I'm not sure how much expected_damage() takes into consideration.
 

lostcalpolydude

Developer
Staff member
And how many rounds you can afford to spend MP on with a given method, determining if that's enough to kill the monster.
 

Alhifar

Member
When writing slime.ash, I found expected_damage to be fairly far off in most cases.

The following (pulled from slime.ash and slightly modified) gives (gave? not currently sure what's wrong with the script.) accurate results:
Code:
int min( int a , int b )
{
	if( a < b ) return a;
	return b;
}

float min( float a , float b )
{
	if( a < b ) return a;
	return b;
}

int max( int a , int b )
{
	if( a > b ) return a;
	return b;
}
int max_possible_damage( monster m )
{
	int def_stat = my_buffedstat( $stat[moxie] );
	if( have_skill( $skill[Hero of the Halfshell] ) && item_type( equipped_item( $slot[offhand] ) ) == "shield" && my_buffedstat( $stat[muscle] ) > my_buffedstat( $stat[moxie] ) )
		def_stat = my_buffedstat( $stat[muscle] );
	int m_attack = monster_attack( m );
	int diff = max( 0 , m_attack - def_stat );
	float absorb_frac = min( .9 , ( square_root( numeric_modifier( "Damage Absorption" ) / 10.0 ) - 1.0 ) / 10.0 );
	
	int damage = ceil( diff + ceil( .25 * m_attack.to_float() ) - numeric_modifier( "Damage Reduction" ) );
	damage = ceil( damage * ( 1 - absorb_frac ) );
	
	int lowest_elem = min( min( min( min( elemental_resistance( $element[hot] ), elemental_resistance( $element[cold] ) ) , elemental_resistance( $element[stench] ) ) , elemental_resistance( $element[sleaze] ) ) , elemental_resistance( $element[slime] ) );
	float elem_resist = ( 100 - lowest_elem  ).to_float() / 100.0;
	damage = ceil( damage * elem_resist );
	
	return max( 1 , damage );
}
 

Bale

Minion
Thanks for that Alhifar. I may have need for that function someday.

Perhaps bad results from expected_damage() should be reported as a bug along with your script to show what the correct formulae are and how to apply them?
 

Alhifar

Member
I think the problem may have been that expected_damage() gave an average result, which wasn't useful for my purposes. I honestly don't remember, it's been quite a while, so I don't feel comfortable creating a bug report regarding it.
 
Okay, so it sounds like maybe if I made some simulation method to determine who will most likely win and then make a decision based on that. And i guess i should probably also take into account +/-ML too. Man, this is starting to sound very mathy.
 

Rinn

Developer
Okay, so it sounds like maybe if I made some simulation method to determine who will most likely win and then make a decision based on that. And i guess i should probably also take into account +/-ML too. Man, this is starting to sound very mathy.
There actually was a script to do this a long time ago, but it broke after a bunch of mafia updates and took like a million years to process when it did work.
 
Last edited:

giraffe man

New member
Would it be hard to make a script to change the clan rank if a certain amount of karma is reached? Also could it not change the certain ranks?
 

halfvoid

Member
posted this over in a different thread but i figured it'd be relevant here as well. i have this counterscript running from the CCS to set a rockmonster counter:

Code:
void main(int initround, monster foe, string url)
   {
   if (foe == $monster[rock snake] || foe == $monster[rock homunculus] || foe == $monster[clod hopper])
      cli_execute("counters add 26 rockmonster");
}

and i'm running this script to do some floaty sand and sandworm farming:

Code:
notify <halfvoid>;

if ( item_amount($item[ drum machine ]) > 0 )
   {

int start = my_meat();
int startspice = item_amount($item[ spices ]);
int startmel = item_amount($item[ spice melange ]);
int startfs = item_amount($item[ floaty sand ]);
int startadv = my_adventures();
outfit("meat");



while ( item_amount( $item[ drum machine ]) > 0 && my_adventures() > 0 )
   {
   outfit("meat");
   use (1, $item[ drum machine ]);
   int iter = iter + 1;
   if (get_counters("rockmonster",0,0) != "")
      {
      outfit("item");
      adventure( 10, $location[ Oasis In The Desert ] );
      }
   }

int changemeat = my_meat() - start;
int changespice = item_amount($item[ spices ]) - startspice;
int changemel = item_amount($item[ spice melange ]) - startmel;
int changefs = item_amount($item[ floaty sand ]) - startfs;
int changeadv = startadv - my_adventures();

print("Meat change: " + changemeat + " | Spice gained: " + changespice + " | Melange gained: "
 + changemel + " | Sand gained: " + changefs);
print("Adventures used: " + changeadv + " | MPA: " + changemeat / changeadv);
print(" ");
   }
   else
   {
   print("Get some drum machines first!");
   }

it stops now whenever the rockmonster counter expires. how can i get it to continue after the rockcounter expires?
and possibly add in detection for the major yellow ray cooldown of the he-boulder?
and and possibly to autouse the he-boulder yellow ray on a clod hopper?
 
Last edited:

halfvoid

Member
just made a simpler counterscript and set the return on the rockmonster counter to true. working now but i'd still like to know how to install the other two features.
 
it stops now whenever the rockmonster counter expires. how can i get it to continue after the rockcounter expires?
and possibly add in detection for the major yellow ray cooldown of the he-boulder?
and and possibly to autouse the he-boulder yellow ray on a clod hopper?

Hmm, what do you mean "stops"? does it abort, hang up, or exit the while loop and print out the summary info? it looks like it should work... as far as the yellow ray stuff it looks like there is a built in counter for it, though i'm not sure how to use it: http://kolmafia.us/showthread.php?t=2391

Also I noticed that your code appears to be wasting adventures by always doing 10, what if instead you did something like this:

Code:
if (get_counters("rockmonster",0,0) != "")
{
	outfit("item");
	while (get_counters("rockmonster",0,0) != "")
	{
		adventure( 1, $location[ Oasis In The Desert ] );
	}
}

That way as soon as you find a rock monster the counter will be set and you will exit the loop. (I'm assuming that's how counters work, I've never used them myself)

EDIT: woops, too slow >_<
 

halfvoid

Member
when i changed the "turn wasting" part of the script you suggested it only adventures once at the oasis before returning to using drum machines to fight sandworms.
 
when i changed the "turn wasting" part of the script you suggested it only adventures once at the oasis before returning to using drum machines to fight sandworms.

well maybe my fix didn't work (as I said, I was just taking a guess at how the counters work) but that doesn't change the fact that you are wasting adventures, you should find a way to only adventure until you encounter the rock monster, then go back to fighting sandworms.
 

Bale

Minion
Code:
repeat {
     // do whatever you want. It will continue until the following condition is true.
} until(condition);
 

halfvoid

Member
so...

Code:
while ( item_amount( $item[ drum machine ]) > 0 && my_adventures() > 0 )
   {
   print("Drum machines remaining: " + item_amount($item[ drum machine ]));
   outfit("meat");
   use_familiar( $familiar[ he-boulder ] );
      if (get_counters("rockmonster",0,0) != "")
      {
      outfit("item");
      use_familiar( $familiar[ baby gravy fairy ] );
         repeat
         {
         adventure( 1, $location[ Oasis In The Desert ] );
         }
         until (get_counters("rockmonster",1,26) != "")
   use (1, $item[ drum machine ]);
   }

...would use drum machines until the rockmonster counter runs out and then loop adventuring in the oasis until the rockmonster counter was between 1 and 26?
(the isitarockmonsterorwhat.ash script in my ccs will add 26 to the rockmonster counter whenever one is encountered.)
 
Is there some function to get the expected amount of damage that attacking with your weapon will do to a monster? (Like expected_damage does for how much damage the monster will do to you)

If not then I guess this would need to be calculated manually, which could get kind of crazy. here's what the wiki says:
Damage done by your weapon attacks can be calculated as follows:

Total Damage =
floor(Player Muscle × rangeadj) - Monster Defense, (minimum 0)
+ [(10% to 20% of Weapon Power + 0 to 1) or 1 if barehanded ] × crit × tsfactor
+ (10% to 20% of Offhand Weapon Power + 0 to 1) if double-wielding
+ Bonus Weapon Damage
+ Bonus Ranged Damage (only when wielding a ranged weapon)
+ Elemental Bonus Damage

Where:
* rangeadj is 1 for melee attack or Moxious Maneuver (any or no weapon), 3/4 for ranged attack, and 1/4 for barehanded (no weapon equipped);
* crit is 1 for a normal hit, 2 for a critical hit; and
* tsfactor is 1 for a normal attack, 2 for Thrust-Smack, 3 for Lunging Thrust-Smack. (You must have a melee weapon equipped for TS or LTS.)
* Penalties to melee damage will not reduce the damage you deal below 1 + Elemental Damage.
* Bonus Weapon Damage applies to both melee and ranged weapons.
* When using Thrust-Smack, Lunging Thrust-Smack, or Lunge-Smack, only the mainhand Weapon Damage is doubled/tripled, not the Total Damage.
In order to calculate it you would have to take into account if it's a melee or ranged weapon (not sure if that's possible)
 
Top