Feature - Implemented Initiative

Tarko

Member
After the new initiative and type update I was looking for the monster initiative....

Am I blind?

I just can't find it.

Since I am here, might as well do a request:

Auto-calculation of how much +Ini% we need to get the jump on all monster in zone.



I always put has much +Ini my empty slots allow me, but sometimes I wonder if I overkill it and I shouldnt just put more +Item% and drop my Ini (from +75% to +50% Ini for an extra +25%Item and still have the jump for example).

If this is already in Mafia, any help to find it would be appreciated.
 

lostcalpolydude

Developer
Staff member
If you do something like $monster[goth giant].base_initiative in a script, it will return 40. The value isn't in the GUI anywhere, but it could be added.
 
I have written a seperate script to calculate initiative, but I would love it if this was part of mafia automatically. I'm not talking base initiative of a particular monster, but initiative needed to not get jumped in a zone. So you pick the highest initiative of the monster in the zone, add in the monster level penalty, and then add in the max of 0 or your unbuffed main stat subtracted by the adjusted monster level of the toughest monster in the zone. If that value was displayed so that people could target it (with modifier maximizer) for initiative, it would be oh so time saving!
 
Last edited:

Theraze

Active member
Used zarqon's Initiative calculation to create this alias:
> alias jumpchance => ashq int requiredinit = 10000; int penalty = min(monster_level_adjustment() / 20, 5)*(monster_level_adjustment()-(min(monster_level_adjustment() / 20, 5)+1)*10); foreach num,it in get_monsters(to_location("%%")) requiredinit = min(requiredinit, (100-it.base_initiative)+max(0, my_basestat(my_class().primestat)-it.base_attack)-penalty); print_html(requiredinit);

String successfully aliased.
jumpchance => ashq int requiredinit = 10000; int penalty = min(monster_level_adjustment() / 20, 5)*(monster_level_adjustment()-(min(monster_level_adjustment() / 20, 5)+1)*10); foreach num,it in get_monsters(to_location("%%")) requiredinit = min(requiredinit, (100-it.base_initiative)+max(0, my_basestat(my_class().primestat)-it.base_attack)-penalty); print_html(requiredinit);

> jumpchance deepest

-100

> jumpchance giant top

50

> jumpchance spooky forest

161
Point your location and it tells you the current jump chance, based on your current ML and no initiative modifier. So for the giant's castle (top), I'd need 50 initiative modifier to get a 100% jump chance. If you'd rather have your current modifier considered as well, this alias:
> alias jumpchance => ashq int requiredinit = 10000; int penalty = min(monster_level_adjustment() / 20, 5)*(monster_level_adjustment()-(min(monster_level_adjustment() / 20, 5)+1)*10); foreach num,it in get_monsters(to_location("%%")) requiredinit = min(requiredinit, (100-it.base_initiative)+initiative_modifier()+max(0, my_basestat(my_class().primestat)-it.base_attack)-penalty); print_html(requiredinit);

String successfully aliased.
jumpchance => ashq int requiredinit = 10000; int penalty = min(monster_level_adjustment() / 20, 5)*(monster_level_adjustment()-(min(monster_level_adjustment() / 20, 5)+1)*10); foreach num,it in get_monsters(to_location("%%")) requiredinit = min(requiredinit, (100-it.base_initiative)+initiative_modifier()+max(0, my_basestat(my_class().primestat)-it.base_attack)-penalty); print_html(requiredinit);

> jumpchance spooky forest

211

> jumpchance giant top

100

> jumpchance deepest

-50
is the same thing with initiative_modifier() added. Rather know how much it takes to get to 100% chance from where you're at? Just change the chance from 100 to 0, like so:
> alias extrainit => ashq int requiredinit = 10000; int penalty = min(monster_level_adjustment() / 20, 5)*(monster_level_adjustment()-(min(monster_level_adjustment() / 20, 5)+1)*10); foreach num,it in get_monsters(to_location("%%")) requiredinit = min(requiredinit, (0-it.base_initiative)+initiative_modifier()+max(0, my_basestat(my_class().primestat)-it.base_attack)-penalty); print_html(requiredinit);

String successfully aliased.
extrainit => ashq int requiredinit = 10000; int penalty = min(monster_level_adjustment() / 20, 5)*(monster_level_adjustment()-(min(monster_level_adjustment() / 20, 5)+1)*10); foreach num,it in get_monsters(to_location("%%")) requiredinit = min(requiredinit, (0-it.base_initiative)+initiative_modifier()+max(0, my_basestat(my_class().primestat)-it.base_attack)-penalty); print_html(requiredinit);

> extrainit spooky forest

111

> extrainit giant top

0

> extrainit deepest

-150
 
Last edited:

Theraze

Active member
It's because of this part, which I wasn't aware of but the wiki claims is true.
Code:
max(0, my_buffedstat(my_class().primestat)-it.base_attack)
735-140 or whatever gives... quite the jump. :)
 
So what's going on here?

> jumpchance caliginous

10000

> jumpchance colleseum

10000

Yeah, I realized about the stats, and so had deleted the post.
 
It's because of this part, which I wasn't aware of but the wiki claims is true.
Code:
max(0, my_buffedstat(my_class().primestat)-it.base_attack)
735-140 or whatever gives... quite the jump. :)

Ah wait, re-look at the wiki, it's your unbuffed main stat, not buffed main stat.
 

Theraze

Active member
10k means there's no init info. Or guaranteed jump.

I've changed my saved aliases from my_buffedstat to my_basestat now. Thanks. :)
 

Tarko

Member
This is awesome! Exactly what I was looking for, thank you SO much!

Now if Mafia could have that baked-in and displayed in the LocationDetails after the Hit/Evade/CombatRate/CombatXp it would be helpfull for everyone that doesnt read these forums.

Thanks again

Dev: I dont think it is useful info to put in combat, next to monster hp. It is only really useful when gearing up for a location and therefore is really only needed in the LocationDetails imho.
 
Last edited:

Darzil

Developer
r13275. I think I've seen it requested elsewhere too, but this was the first thread I found.

Location details now displays Jump Chance.
 

Bale

Minion
Well, there's often no way to know which monster you'll encounter so it is useful to be sure you can get the jump on the whole location. Although there is some reason to want specific monster information.

If I have to choose, then monster would be more useful since I can derive location from all monsters in that location (minus the ones who have been banished — thanks for that). Can I have two versions of the function? One which takes monster as a parameter and another which takes location?

How about an optional second parameter where I give a value for character initiative which differs from the character's current initiative?

My wish list just keeps growing, eh?
 

Darzil

Developer
Well, I'm not going to rush into it, as I'm fairly busy today, but am I right the following are missing and might be useful ?

monster_initiative( [monster] ) - monster initiative from the monsters.txt file
monster_adjusted_initiative( [monster] ) - monster initiative + monster level adjustment
jump_chance( [monster], [initiative], [monsterLevel] ) - chance of getting jump against monster at current (or specified) initiative, monster level and base mainstat
jump_chance( location, [initiative], [monsterLevel] ) - chance of getting jump against all (non UR/special) monsters in area at current (or specified) initiative, monster level and base mainstat

Only reason I'm suggesting monster as optional is that I guess someone may want to see fuller data on a relay script to display data on the monster being fought, and one of them will matter for chance to successfully run away.
 

Fluxxdog

Active member
Question: Would the function consider always-first monsters and return a 0% chance or are those considered special monsters?
Example: Vanya's Castle Foyer has 3 monsters, fleaman (always wins), ghost (Init +50%), and medusa head (Init +80%). If fleaman is considered, you have no chance. If he is not, then you have the medusa head to consider.

Question two: depending on the above question's answer, what about areas where you never win, such as Outside the Club (DB nemesis area)? All monsters there are always first.
 

Darzil

Developer
Yes, it'll always return 0% chance if a non special monster (those that have an appearance weighting of 0 or -1 in combats.txt are considered special here, the other location data also ignores them) can get the jump. If you want something different, you can build it by checking individual monsters.
 
Top