Monster Attack Calculations / Formulas

Discussion on running your own board and editing MajorMUD.
User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Monster Attack Calculations / Formulas

Post by syntax »

My memory of this game is just not what it used to be... I'm working on something for MME to show average and max damage from a mob. I can't recall how the "Cast %" factors into a mob's attacks? There is the regular "attack %" which IIRC is the chance of the mob to use the attack at all. But then there is also a "Cast %" when the attack type is set to spell. Most mobs just have 100 in there, but there are quite a few that have many varying numbers, both above and below 100.


User avatar
BearFather
Posts: 656
Joined: Sun Feb 09, 2014 6:27 pm
Location: Portland, OR
Contact:

Re: Monster Spells - Spell Attack Type -> Cast %

Post by BearFather »

Ok re-read your question, is it how well they cast that spell?

So if it's set to 90 it would cast 90%? So anything over 100 be overkill.

This is how I been using it so please tell me if I'm wrong.


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Monster Spells - Spell Attack Type -> Cast %

Post by syntax »

What does how "well" mean? Monsters can fail an attack? Or is it a damage adjustment?


Ravyn
Posts: 38
Joined: Wed Mar 30, 2016 4:40 pm

Re: Monster Spells - Spell Attack Type -> Cast %

Post by Ravyn »

They will fail the spell, just like a player, as in great white shark attempts to cast rainbow dust, but fails!


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Monster Spells - Spell Attack Type -> Cast %

Post by syntax »

So I just did some testing...

I created a mob with 3 attacks...

attack 1--
type: normal
attack %: 33

attack 2--
type: normal
attack %: 66

attack 3--
type: spell
attack %: 100
cast %: 50

That should result in a 33% / 33% / 34% chance for each attack.

Here are the results:

attack 1: 29 times
attack 2: 32 times
attack 3: 33 times * ... 21 casts, 12 fails

* Sometimes on a round where a spell fails, a second spell would cast, could be a hit or a fail. Not sure how this works as the monster has 1000 energy and the attack costs 1000 energy. So even if the mob is only charged for 50% of the energy spent on a failed cast I would think it wouldn't have enough energy to cast a second one?

=======================

As a second test I used just 2 attacks

attack 1--
type: normal
attack %: 50

attack 2--
type: spell
attack %: 100
cast %: 50

results in excel pic below:
mob attack.png
mob attack.png (30.19 KiB) Viewed 10307 times
By the numbers everything is right, each attack (normal and spell) was cast 50% of the time. And the spell failed 50% of the time. The only issue is why is a second attack going off *sometimes*? I assume it has to do with extra energy getting built up over time and then having more than 1000, but is there documentation or knowledge of how that happens?


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Monster Spells - Spell Attack Type -> Cast %

Post by syntax »

Nevermind, I figured it out... If a spell fails 500 energy (half the cost) is returned. If the monster then starts a round with over 1000 energy and fails a spell, it will attempt to cast a second one if they have enough energy. Same chart as above with starting and ending energy added:
mob attack2.png
mob attack2.png (51.27 KiB) Viewed 10299 times


User avatar
BearFather
Posts: 656
Joined: Sun Feb 09, 2014 6:27 pm
Location: Portland, OR
Contact:

Re: Monster Spells - Spell Attack Type -> Cast %

Post by BearFather »

As you can see the "well" is percent it casts/fail. And looking at syntax's data look's like I was right for once. Now I have proof for the wife:)


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Monster Spells - Spell Attack Type -> Cast %

Post by syntax »

I'm trying to figure out a formula for MME/NMR that will enable me to easily figure out and display a monster's average damage/round, max damage/round (much easier), and true cast % of each attack. Hoping there may be a math nerd to help me out...
  • I figured out that a monster tries to attack up to 6 times a round.
  • Each of those 6 times is an independent check to see if it will use that attack, based on the attack % in the dats.
  • Then, once it choose an attack, it sees if it has the energy to do it. If it doesn't we move on to the attack attempt out of the 6 attempts.
  • If it does have the energy, it attempts to do it.
    • If it's a "normal" (physical) attack it will attempt to hit the defender, and based on the monster's attack Accuracy vs the defender's AC/dodge it will either hit or miss. I'm also working on being able to incorporate that if I can figure out the calculations on that (RE: this thread) but I'm more worried about getting this formula figured out first. The important thing here with the physical attack is that no matter if it misses or hits (I assume dodge too but I didn't test it) no energy is returned. So a normal attack always uses its full energy.
    • If it's a spell attack, it has a chance to cast or fail based on the attack's cast percentage. If it fails, half the energy is returned.
    • We then move on to the next of the 6 attack attempts.
  • Once the 6 attempts are exhausted, there is 0 energy (or not enough energy for any of the attacks probably), the remaining energy is added to the next round's energy pool.
What ends up happening is that some attacks are able to cast more often than their initial attack% in the dats simply because of the energy pool. For example, say you have an attack 90% attack chance (from the dats) with no chance to fail and uses 700 of 1000 energy. And you have a second attack that has a 10% chance to attack (from the dats) costing 200 energy with a 50% chance to fail. 90% of the time it will use that 700 energy first and then it has 5 more chances to still choose that 90% attack but not have the energy. And then if it choose the second attack it has a chance to fail it, return 100 energy, and still have more chances to try again. The numbers end up going all over the place depending on the initial cast % of each attack, energy pool of the monster, and the energy cost of the attacks.

The best example of this is attack #3 below. Attack 1 has an 85% chance to attack costing 1000 of the 1000 energy, but only a 1% chance of success. The remaining attacks have 5% and 10% chance to cast. However, since 85% of the time that first attack is going to go off and fail, leaving 500 energy, it cannot be cast the next 5 attempts. So what ends up happening is the attack% on attack 1 is much lower and the attack % on attacks 2 and 3 are much higher.

Surely there is a math geek that can whip something up here :) Pretty please.

I built up a simulator and verified my findings against in-game simulations. The character I tested against had 0 AC, only 10 MA, and 0 MR so normal attacks rarely ever (1%?) missed (why I'm putting 99% in the physical spot) and spell damage was never resisted.

So given the values in yellow, I want to easily figure out the values in green (again, this is before AC/DODGE/MR is taken into consideration)...

Scenario 1:
attack3.png
attack3.png (25.44 KiB) Viewed 10270 times
Notice how drastically the true cast percentages change between the attacks above and below changing nothing but the energy cost of the first attack. (Min/Max damage changes but not relevant to this statement :))

Scenario 2:
attack2.png
attack2.png (27.08 KiB) Viewed 10270 times
Scenario 3:
attack1.png
attack1.png (21.67 KiB) Viewed 10270 times
Example output from my simulator (using scenario 1 above):
sim.png
sim.png (43.68 KiB) Viewed 10265 times


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Monster Spells - Spell Attack Type -> Cast %

Post by syntax »

And here is the code for the simulator I made in case anyone is interested: http://pastebin.com/4UwHcAmB


User avatar
syntax
Site Admin
Posts: 517
Joined: Tue Jun 02, 2009 10:02 am

Re: Monster Spells - Spell Attack Type -> Cast %

Post by syntax »

Here are some updated screen shots from my simulator running 100,000 rounds each with more information about each attack if it will help anyone help me out. The scenarios above are repeated with the additional info + I added two samples from real mobs. Note that Greater Glabrezu has 1500 energy.

Scenario 1:
scenario1.png
Scenario 2:
scenario2.png
Scenario 3:
scenario3.png
saracen high priest:
saracen high priest.png
Greater Glabrezu:
Greater Glabrezu.png


Post Reply