Mechanics & Formulas

Discuss pet battles, strategy and theorycrafting.
Jackozzo
Posts:6
Joined:May 3rd, 2015
Pet Score:5665
Realm:Ahn'Qiraj-eu
Contact:
Mechanics & Formulas

Post by Jackozzo » October 4th, 2016, 2:47 pm

Hello!
I'm writing an application with the purpose of simulating pet battles to obtain statistically percentage of how much a team is able to win against another and to experiment some algorithms which could evolve to find the better team to defeat a specific trainer.

This requires me to have an in-depth knowledge of the mechanics behind battles, which is what I'm asking here. I need to model the battle in my application as similar as possible to the original game to obtain consistent results. So I'd like to use this thread to ask for specific formulas which I haven't found online.

So I'll start with a couple of easy questions :)
  • Which is the base crit chance of an ability? According to what I've found online it should be 5%, is it correct? Is it influenced by anything (with the exception of abilities which specifically increate the crit chance), eg. level or rarity and if yes is there a specific formula?
  • It seems that all abilities follow the formula of BASE_DMG + PET_POWER * SCALE_FACTOR, is it the case? This also applies to abilities that heal the pet or apply damage over time (which probably would consists of two different scale factors for main dmg and periodic dmg). Is there a list of such base damage? I'm using the WoW API to obtain the pet list, I'm able to reverse the base stats of a pet by calculating the regression of the hp/power/speed in level 1-25 of a pet but there's nothing else.
I have some doubts regarding the turn development of a battle but I'll ask them later!
Thanks in advance for now, your help is appreciated!

PS. the application will be open source and free for everyone to contribute, I just need to finish the basic structure

User avatar
Paladance
Posts:1010
Joined:July 18th, 2015
Pet Score:12412
Realm:Burning Legion-eu
Contact:

Re: Mechanics & Formulas

Post by Paladance » October 4th, 2016, 3:34 pm

Good luck! I'm sure if you manage to do that, you'll become one who takes an important place in the pet battle community and history. :)

I don't know the answer to the first question, sadly, but talking about the second one, perhaps you want to read this topic, especially Vakeetah's posts.

A third thing: the ability order. MAY BE WRONG, PLEASE CHECK THAT -- don't worry, I will edit that. :)

0. Effects from a hostile source that change your pet's resistance. Currently only [ability]Rot[/ability] proc.
1. Abilities that always go first, but this is actually quite a raw buff. There's an excellent post on that, also by Vakeetah.
2. Standard attacks of the first and second pet.
3. Delayed effects like [ability]Whirlpool[/ability] or [ability]Geyser[/ability]. Perhaps [ability]Chew[/ability]'s proc goes here aswell. [ability]Devour[/ability]/[ability]Ravage[/ability]'s healing too, as I'm always annoyed when my cat gets a DoT. Wrrrr.
4. Technical damage over time -- effects that are both halved while against aquatics and can't be avoided by dodges or replacements.
*** procs of the objects such as turrets may fall, but don't have too, under the same tier. Need to check that urgently!***
5. Healing over time.

However, recently I've noticed that [ability]Wish[/ability] falls under an unclear category, as it precedes objects like [ability]Sons of the Root[/ability], but succedes the other stuff. Maybe.

Last but not least: the behaviour of undead pets with more general comments, here and here. There was also some sort of DoT bug, but I can't reproduce that and I'm not sure if it still happens.

Sorry that I'm showing only the perspective of two EU buddies right now, but it's 10:30 p.m. here, I'm gonna turn off my machine and this is what I can recall fast off the top of my head. Have a good one! :D
Last edited by Paladance on November 7th, 2016, 3:09 pm, edited 2 times in total.
Image

I have compiled community knowledge & data about pet battle abilities!
https://www.warcraftpets.com/community/forum/viewtopic.php?f=3&t=19507

User avatar
Gráinne
Posts:948
Joined:July 7th, 2015
Pet Score:13284
Realm:Magtheridon-eu
Contact:

Re: Mechanics & Formulas

Post by Gráinne » October 4th, 2016, 4:19 pm

1. Yes, basic crit chance is always 5%. That can be explicitly modified by auras like [pet]Rain Dance[/pet], but there are no hidden variables that I am aware of.

2. Yes, as far as I know it is entirely formulaic, but there are several specifics.

I started into the project that you're talking about. I collected data, sketched out some data structures, ran some simple semi-manual examples. I got to that stage. The basic mechanics are straightforward enough, and the search tree is shallow. Looks like a great application. The only obvious wrinkle was inbuilt RNG - ability miss chances, Darkness, Sandstorm, hit ranges, the coin flip when both pets are the same speed.

Then I started to look at the battle itself. It's a mess. Different programmers kludged lots of hardcoded cases in. My advice is to scout out how you propose to handle that before investing much effort into developing the basic mechanics. I figured I could do it, but I'd have spent weeks testing all the individual cases, to see how they were actually handled in the game, and I would have needed a partner to do that testing in pet duels. It needs a huge amount of data gathering by practical testing to be done. I did consider "just doing it!" and refine later, but laziness won. If you're determined to have a go, I commend that to you, but create your structures so that you, too, can wedge in some kludges on specific abilities later.

There was a day when I cam across some specific case, and I just threw my hands up and said "No. I'm not even going to try." I wish I could remember what that case was....

Examples:
When 2 Slicing Wind hit a Decoy, it removes one charge, but when Flurry hits, it removes both.
What happens when several end-of-round effects apply? Which hits first, the heal or the damage?
Which abilities hit underground?

Consider tooltip descriptions of abilities indicative rather than dispositive. :)

It did also occur to me that in creating such an app, I would be doing to pet battles what computer programs did to Chess. I'm not sure that would be a positive thing.

User avatar
Paladance
Posts:1010
Joined:July 18th, 2015
Pet Score:12412
Realm:Burning Legion-eu
Contact:

Re: Mechanics & Formulas

Post by Paladance » October 5th, 2016, 1:55 am

Hi back.
Gráinne wrote:Then I started to look at the battle itself. It's a mess. Different programmers kludged lots of hardcoded cases in.
Indeed.

Perhaps you're already aware of things you asked, but OP may also want to find out about this. :)
Gráinne wrote: When 2 Slicing Wind hit a Decoy, it removes one charge, but when Flurry hits, it removes both.
Yes, I was wondering about that too.
General rule is -- when a decoy/bubble/barrier is up, an attack can't miss. Imagine the possible avoidance chain if it could.
But each non-AoE ability, including these similar to [ability]Flurry[/ability], is counted as a single attempt. Flurry isn't.
Jezzebelle-Quel'thalas EU wrote:Flurry is implemented as following:

One attack at 100% hit chance.
One attack at 50% hit chance
One conditional attack at 100% hit chance that happens if your pet is faster.
The suggestions to expand that to other multi-hit abilities were mentioned many times both in US and EU threads about tuning, but nothing has happened. Boo.
Gráinne wrote:What happens when several end-of-round effects apply? Which hits first, the heal or the damage?
Yeah, was talking about that with Vakeetah recently (see [ability]Wish[/ability] part in the previous post)… that IS a lot to note. I can imagine that the poor guy has already closed himself in a soundproof room, with his computer, a pencil and a scrapbook.
Please remember to take care of yourself, okay? 8-)
Gráinne wrote:Which abilities hit underground?
I believe all technical DoTs, [ability]Dive[/ability], [ability]Burrow[/ability] and [ability]Quake[/ability]. To be honest I can't recall a situation when I was surprised with that one. Any detail?
BTW: when two pets perform a [ability]Lift-Off[/ability]/[ability]Proto-Strike[/ability]/[ability]Launch[/ability] one after another, the faster one reaches the slower one while still in the air. Same with their underground equivalents, below the ground.
BTW2: a well-timed speed reduction can cause a pet to be protected by these abilities twice. R1: you're faster, you're avoiding next attack, R2: opponent is faster, you haven't left a hideout yet. :mrgreen:

Another thing that may be confusing: a Dragonkin passive.

EDIT: 1 more -- Sleeping is a bit different effect than being stunned. With an exception of Hibernate/Emerald Dream, if a sleeping pet is damaged, it wakes up regardless of the spell duration. It will still get resilience, though.
Gráinne wrote:It did also occur to me that in creating such an app, I would be doing to pet battles what computer programs did to Chess. I'm not sure that would be a positive thing.
A brilliant comparison, was anxious about "playing the game outside the game" aswell. But you still need to earn these new pets, Pet Charms and so on ingame! :)
And let's don't get started with PvP. :lol:

EDIT: An undocumented change for BfA prepatch has changed the sleep mechanic, now the target receives resilience even if the sleep is interrupted.
Last edited by Paladance on July 18th, 2018, 4:06 pm, edited 2 times in total.
Image

I have compiled community knowledge & data about pet battle abilities!
https://www.warcraftpets.com/community/forum/viewtopic.php?f=3&t=19507

User avatar
Gráinne
Posts:948
Joined:July 7th, 2015
Pet Score:13284
Realm:Magtheridon-eu
Contact:

Re: Mechanics & Formulas

Post by Gráinne » October 5th, 2016, 6:00 am

I don't remember what the underground case was, or whether it was a rabbit or a dive, or what, but I do remember one day saying "How did THAT hit me?"

If locking myself in a room with pencil and paper and spreadsheet and IDE would have been enough, I'd have done it. No, the real problem is that all these cases have to be reverse engineered and understood and documented before you can put them into the simulator, and that takes a co-conspirator and a lot of patience.

The level of inherent RNG in the game is enough to make most relevant fights non-deterministic anyway, so it did occur to me that simulating with averages might be good enough for general indications, like Imp/Kid/Teroclaw beats Blighthawk/Dancer/Crab 80% of the time following strategy X.

I did have an intention to simulate a lot of 1-v-1s, like: Graves with moveset 6 vs Idol with moveset 0 - Graves with moveset 6 wins 100% of the time with X distribution of HP remaining. 1-v-1s are very relevant, since all battles come down to 1-v-1 at the end. That is probably a more tractable problem, and would be a concrete step towards a solver.

Chess has major problems because of computers. In online chess, it's an epidemic, and even in RL chess, people have been found sitting at the board with a small computer or a transmitter to someone using a computer. I am absolutely certain that if someone released a solver, PvP would immediately degenerate into a million people just doing what the solver told them; it's lacklustre enough now, so we don't need that.

User avatar
Kalium
Top Rater
Posts:106
Joined:August 19th, 2008
Contact:

Re: Mechanics & Formulas

Post by Kalium » October 6th, 2016, 8:23 am

Thanks for this.

I am puzzled by the current interaction of [ability]Lift-Off[/ability]. I have noticed recently that you can avoid DoT damage if you are airborne during the damage phase of a DoT... notably [ability]Curse of Doom[/ability]. I don't recall this happening before Legion.

For example:
[pet]Unborn Val'kyr[/pet] uses Curse of Doom on [pet]Waterfly[/pet]... at the start of round four Waterfly uses Lift-Off and avoids the damage of Doom. I would expect to not be able to get DoT'ed while airborne... but to avoid damage from an already applied DoT seems like bug.

User avatar
Sepsis
Posts:122
Joined:August 3rd, 2009
Pet Score:4668
BattleTag®:Kaivic#1622
Realm:Gnomeregan-us
Contact:

Re: Mechanics & Formulas

Post by Sepsis » October 8th, 2016, 11:13 pm

I think my favorite contradiction is [ability]Feign Death[/ability] and [ability]Sticky Grenade[/ability](and the like), which specifically state it can't be avoided.

Not very common to run into, but I did recently when trying the pet family achievements.

Jackozzo
Posts:6
Joined:May 3rd, 2015
Pet Score:5665
Realm:Ahn'Qiraj-eu
Contact:

Re: Mechanics & Formulas

Post by Jackozzo » October 9th, 2016, 7:04 pm

Thanks for the responses so far, I haven't take the time to study them yet since I'm still laying out the framework foundations of the project.

The status is fine since I've been able to parse all abilities / pets from bnet API including hidden abilities (like the passive effects) and all the pets. There's also a lot of garbage in there :)
Then I've been able to scrape the tooltips from wowhead to ease the work of trying to figure out the various mechanics.

I spent some time giving the tool a rough interface usable to work with categorizing abilities and giving them mechanics. I can't show you the result so far because I still can't share links (8 posts required :| ).

Basically all abilities which have a passive effect also have another ability with same name which provides it so it's quite linear.

Regarding hard coded situations it would be very weird to hardcode everything on Blizzard developer side, that would make everything really a mess to maintain so I'm confident most of the edge cases are identifiable. It wouldn't be easy but it's an hobby project, they must be rewarding, not easy ;)

I'm currently working on skimming the list of all abilities to remove all the trivial cases (dmg/heal/basic modifier buff) and see what will remain. So in the meanwhile I'll be able to work a basic battle algorithm, which is still totally lacking.

This is what I'm currently doing to give you an idea:

Code: Select all

/* critter */
forName("scratch").addEffect(singleAttack(20));
mapPassiveEffect(165, 164, Target.SELF, 3, damageReceivedMultiplier(0.5f)); // crouch
mapPassiveEffect(162, 161, Target.SELF, 3, speedMultiplier(1.75f)); // adrenaline rush
so that every ability is able to apply a list of effects or provide a list of passive effects. We'll see how it will sort out.

Jackozzo
Posts:6
Joined:May 3rd, 2015
Pet Score:5665
Realm:Ahn'Qiraj-eu
Contact:

Re: Mechanics & Formulas

Post by Jackozzo » October 11th, 2016, 8:14 pm

Here I am again with some questions :)

I added the mechanics for roughly 25% of the abilities, all trivial things (mostly), but I have some doubts before keeping my work with other kind of abilities. Probably some answers don't apply to all corner cases but there's no hurt in trying.
  • which is the technical difference between stunning the enemy for the turn (not applying the debuff for 1 turn) or interrupting the turn? Basically what changes from [ability]kick[/ability] and [ability]interrupting jolt[/ability]?
  • how does multiple hit abilities behave with respect of hit chance? From an upper reply it seems like that an ability which hits 1-2 times ([ability]quills[/ability]) is not a bare 50% roll of hitting 1 or 2 times but two independent rolls made with 100% hit chance and 50% hit chance. If that's the case is the second chance roll modified indipendently (from buffs/debuffs)?
  • this is most to have confirmation of this, abilities which state to all enemy pets (vs split among enemy pets) just apply the same damage to all pets with a single hit roll or indipendent hit rolls?
  • do effects which affect the whole team (eg [ability]flame jet[/ability]) hit also if the main damage misses?
  • I see that many abilities which have a conditional effect that increases damage ([ability]takedown[/ability]) don't apply a higher amount but are shown as two different applications of damage in the game. Is this the general rule? How they behave with respect to ability which enhances raw damage (not by %)? In general is every single different number you see when damaging something influenced by raw damage increases/reductions?
  • are dots influenced by passive bonus on pet/team that used them, or is their damage calculated on application and there stays?
  • are percentage bonuses calculated always starting from the base value or on successive applications? Just to give an example, if base speed is Y, and we have a +50% bonus and a -25% is it calculated as (1.0 + 0.5 - 0.25)*Y or as (Y * 1.5) * 0.75?
Quite a list of annoying doubts, the good thing is that this could help writing a good mechanics FAQ in addition to helping me :D

Thanks again!

User avatar
Paladance
Posts:1010
Joined:July 18th, 2015
Pet Score:12412
Realm:Burning Legion-eu
Contact:

Re: Mechanics & Formulas

Post by Paladance » October 15th, 2016, 1:50 am

I wanted to leave this to someone else. There's already too much of myself here, after all. :mrgreen: But now, I have more time, so let's go:
Jackozzo wrote:which is the technical difference between stunning the enemy for the turn (not applying the debuff for 1 turn) or interrupting the turn? Basically what changes from [ability]kick[/ability] and [ability]interrupting jolt[/ability]?
The description of Kick is poorly written. Both abilities work as interrupts, affecting only the current round unlike classic stuns.
Jackozzo wrote:how does multiple hit abilities behave with respect of hit chance? From an upper reply it seems like that an ability which hits 1-2 times ([ability]quills[/ability]) is not a bare 50% roll of hitting 1 or 2 times but two independent rolls made with 100% hit chance and 50% hit chance. If that's the case is the second chance roll modified indipendently (from buffs/debuffs)?
That applies only to [ability]Flurry[/ability], actually, what's one of the greatest mysteries of the pet battles. :mrgreen: As far as I know the accuracy buffs used to "boost" it (making it more effective, that is). That, however, doesn't have to apply to other moves that just roll the number of attacks between "less" and "more". On the other hand, I know about a part of initial [ability]Bone Barrage[/ability] (not a DoT) hitting even after [ability]Blinding Poison[/ability]. Some multi-hit abilities have been affected separately to boost only the first part.
Jackozzo wrote:this is most to have confirmation of this, abilities which state to all enemy pets (vs split among enemy pets) just apply the same damage to all pets with a single hit roll or indipendent hit rolls?
The hit chance is independent (can I correct your typo? ^^) for each strike.
Jackozzo wrote:do effects which affect the whole team (eg [ability]flame jet[/ability]) hit also if the main damage misses?
From all abilities, did you have to mention just THAT one? :mrgreen: I have dueled for half a hour to check that, and the results are very curious, sadly I couldn't save the logs. :oops: Other abilities, such as [ability]Flamethrower[/ability], can't apply effects if the main damage misses or is blocked.
BTW: A delayed damage effect that is appropriately described as affecting "current enemy pet", "front pet" etc -- such as [ability]Geyser[/ability], [ability]Whirlpool[/ability] or [ability]Ice Tomb[/ability] -- can be placed upon the battlefield even if the active pet is dodging attacks.
Jackozzo wrote:I see that many abilities which have a conditional effect that increases damage ([ability]takedown[/ability]) don't apply a higher amount but are shown as two different applications of damage in the game. Is this the general rule?
Some are, some not. [ability]Light[/ability] or [ability]Early Advantage[/ability] are split, aswell as all [ability]Alpha Strike[/ability]/[ability]Comeback[/ability] type attacks. However, [ability]Sneak Attack[/ability], [ability]Deep Burn[/ability] or [ability]Predatory Strike[/ability] aren't split.
BTW: Attacks that deal additional damage when user has lower health, such as two mentioned above, are boosted only if the first part doesn't manage to change that status. Crits and damage increases can make a disservice in these cases. :lol:
Jackozzo wrote:How they behave with respect to ability which enhances raw damage (not by %)? In general is every single different number you see when damaging something influenced by raw damage increases/reductions?
Each strike is affected, so what is double for EA stays double etc. [pet]Ikky[/pet] or Zandalari raptors LOVE this (okay, not that kind of ability, but you get it).
Jackozzo wrote:are dots influenced by passive bonus on pet/team that used them, or is their damage calculated on application and there stays?
As long as the racial bonus is up, the DoT is buffed, but then the bonus expires. Beasts' bonus is up even if the pet dies, so this one stays actually, but dragonkin have it whenever they fill the conditions (unless the pet is dead -- then the buff doesn't reappear). For undeads, see the thread linked before.
Jackozzo wrote:are percentage bonuses calculated always starting from the base value or on successive applications? Just to give an example, if base speed is Y, and we have a +50% bonus and a -25% is it calculated as (1.0 + 0.5 - 0.25)*Y or as (Y * 1.5) * 0.75?
They are additive; what you've been told during the Math lessons doesn't apply here and your first example is correct. Tested even such curious cases as [ability]Screech[/ability] on flying pets. Note that exactly this make the [ability]Howl[/ability]/[ability]Stampede[/ability] debuffs such popular against elite pets, as your damage output jumps from 0,5 of normal value to 1,5. :)

I don't want to sound rude, but really, haven't you seen some of these things before? Lucky Yi seems to be a good target for testing, with his big health pool, decent healing and a relatively low DPR. :) Or Dor the Wall, last pet of Hyuna.
Quite a list of annoying doubts, the good thing is that this could help writing a good mechanics FAQ in addition to helping me :D
That's what motivates me to keep posting. ❤ However, as you can see, not always I'm sure about everything! :lol:

EDIT: [ability]Curse of Doom[/ability] is technically not a DoT (though it might have been it at the very beginning), just a delayed effect of a separate category.
H/H Unborn Val'kyr = 592 damage without racial modifiers:
Curse of Doom deals 390 damage to enemy Softshell Snapling (Weak).
(Strange. This isn't 66,(6)% but a bit less, even considering rounding. Blah blah blah)
If it had been kept as a DoT, perhaps it would've dealt mere 94 damage because of aquatic racial (remember, that stuff is subtractive)! :lol:

EDIT2, DYK: When a creature affected by [ability]Brittle Webbing[/ability] casts [ability]Cocoon Strike[/ability], the webbing damage precedes application of the cocoon. I mean, it isn't blocked.
DYK2 (some know): [ability]Dive[/ability], [ability]Lift-Off[/ability] etc protect the pet from Brittle Webbing or [ability]Heat Up[/ability] procs even during the emerging round.
Last edited by Paladance on October 15th, 2016, 11:08 pm, edited 1 time in total.
Image

I have compiled community knowledge & data about pet battle abilities!
https://www.warcraftpets.com/community/forum/viewtopic.php?f=3&t=19507

Jackozzo
Posts:6
Joined:May 3rd, 2015
Pet Score:5665
Realm:Ahn'Qiraj-eu
Contact:

Re: Mechanics & Formulas

Post by Jackozzo » October 15th, 2016, 9:55 am

Thanks for the time you spent in clarifying my doubts. Yes, I've seen them but I've never spent time theorycrafting the whole story so I never dug deep into the mechanics. Still many issues are unclear but I'll enumerate them with time. The main problem for now is not being able to know how each damage ability apply damage (some are split, some are combined, some are split into multiple attacks although the tooltip states "does XYZ damage" and such).

For how the whole battle system works it's quite clear how they implemented it in code, I'm trying to mimic that behavior to allow to customize the effects as much as possible.

How I see this is that each ability/passive has multiple callbacks hooks that are used by the game to alter things, that's why you seem to stumble into edge cases and special situations. The engine itself allows custom scripts for each ability which are probably used in certain circumstances to allow really specific things.

What I am trying to do is to model a passive effect as

Code: Select all

public interface PassiveEffect extends Effect
{
  default void onEndEffect(BattleStatus status) { }
  default void onTickEffect(BattleStatus status) { }
  default void onStartTurn(BattleStatus status) { }
  default void onEndTurn(BattleStatus status) { }
  default PetFamily onGetPetFamily(BattleStatus status, PetFamily family) { return family; } 
  default ComputedStat onCalculateStat(BattleStatus battle, ModifierFunction.Target target, ComputedStat value) { return value; }
  
  default int priority() { return PRIORITY_DEFAULT; }
}
so that any effect is able to hook to the resolution chain and apply potential custom behavior. Then I wrote some basic effects which should cover trivial situations as ModifierEffect, StatusEffect and such. For example a speed modifier bonus will be something like

Code: Select all

@Override onCalculateStat(BattleStatus battle, ModifierFunction.Target target, ComputedStat value) {
   if (target == ModifierFunction.Target.SPEED)
      return value.addToMultiplier(this.value);
   else
      return value;
}


I started writing the combat mechanics and the engine seem able to manage many different situations. I'd like to provide a simple way (maybe through a configuration file) to describe the mechanics so that anyone willing to contribute could help.

User avatar
Vakeetah
Top Rater
Posts:167
Joined:October 11th, 2015
Pet Score:9677
Realm:Dragonblight-eu
Contact:

Re: Mechanics & Formulas

Post by Vakeetah » October 16th, 2016, 10:13 pm

Some more random bits, for thought if nothing else!

Flame Jet: As Paladance points out above, this ability precisely has an exceptional behavior, and is coded as two separate attacks - Flame Jet "damage" on the active pet, and Flame Jet "ignite" on your team at a 50% hit (which cannot be modified by accuracy buff/debuffs)

Now, as the "ignite" roll is a separate attack, and since it is on the team and not the active pet only it will soak two charges of [ability]Decoy[/ability]/[ability]Illusionary Barrier[/ability] (one for the direct damage on the front pet, and another for the ignite effect on the enemy team). Single target blocks (like [ability]Bubble[/ability]) do not stop the ignition, as it doesn't target the active pet but the team as a whole.

While at it, let me stress out that Blocks take precedence over hit checks. Even if an ability has 0% hit (and would miss) it will still be blocked and consume the charges.

As mentioned above as well, other abilities like [ability]Flamethrower[/ability] have the ignition effect attached to the main ability; and then "ground" abilities like [ability]Death and Decay[/ability] dont do hit checks on the active pet.
-

Buffs, Debuffs, and Modifiers: All of them are mostly additive, although in some cases they can behave multiplicatively.

For speed, it's something like this:

Code: Select all

BASE_VALUE * (1 + %MODIFIERS)
So for example, if you apply Quicksand (-50%) on a Flying Pet (+50%) with Adrenaline Rush (+75%) the overall modifier is 1 - 0.5 + 0.5 + 0.75 = 1.75; that is to say, the 75% from Adrenaline Rush (Quicksand and Flying cancelled each other). Remember that all of these are calculated using the base speed value, of course!

For damage, it is roughly the same, just that it gets complex when you add flat modifiers ([ability]Shell Shield[/ability], [ability]Black Claw[/ability]). Furthermore, there are abilities like [ability]Shriek[/ability], [ability]Roar[/ability], or the Beast and Dragonkin passives that affect damage dealt and not just damage taken. So where does this fall in? Tested it a bit and it seems to be a separate multiplier - and this is a good thing, because if it was additive, a pet with [ability]Rake[/ability] against a pet with [ability]Cower[/ability] would deal 0 damage.

Empirically, I'd say a working formula could be:

Code: Select all

(BASE VALUE + FLAT_MODIFIERS) * (1 + %DMG_DEALT) * (1 + %DMG_TAKEN)
I've been trying to achieve an edge case of using two 50% damage reductions (as they are percentage based and would add up to 100%) but there are no bosses with a 50% reduction ability, and [ability]Extra Plating[/ability] cancels [ability]Celestial Blessing[/ability]... :roll:

An actual "working test" - Zandalari Anklerender vs. Ti'Un the Wanderer
Leap: 243 damage
Shell Shield: -123 damage
Black Claw: +130 damage
Beast Passive: +25% damage
Elite: -50% damage
-> Result was (243 - 123 + 130) * (1 + 0.25) * (1 - 0.5) = 250 * 1.25 * 0.5 = 156 as expected.

-
Refreshing effects: When you refresh a buff or debuff before it expires, it is not overwritten, but instead reset to its full duration with the same characteristics it initially had.

Testing done with [ability]Siphon Life[/ability] - Cast by pet "A", deals 65 damage per round. Pet "B" comes in, and uses its [ability]Siphon Life[/ability] (that deals 59 damage). At the end of the turn, the enemy took 65 damage, and healed A (but not B) - proving it refreshed the old [ability]Siphon Life[/ability] instead of replacing it.

Repeated the test the other way around, and the result was the same (initial debuff being refreshed) which implies no other factors apply, besides casting order - and in a way that defies logic, because most of us would've assumed the later effect would overwrite the other, or at best, that the "strongest effect" would prevail.

So you could potentially have a level 1 pet refreshing a DoT and it'll still deal its full damage, and same with HoTs like [ability]Renewing Mists[/ability], and debuffs like [ability]Exposed Wounds[/ability].

-
Conditional, Multi-hit abilities, and accuracy: There's no working rule here. Some do independent hit rolls for each strike, some are tied to the hit check for the primary strike, some cannot be modified by accuracy, etc.

The greatest offender is definitely [ability]Flurry[/ability], as it is completely different to [ability]Tongue Lash[/ability]/[ability]Flank[/ability] despite being seemingly the same ability - but it is nonetheless a fairly exceptional case.
Last edited by Vakeetah on October 17th, 2016, 4:37 am, edited 2 times in total.
Image
- Thanks to Paladance for the sig!

User avatar
Paladance
Posts:1010
Joined:July 18th, 2015
Pet Score:12412
Realm:Burning Legion-eu
Contact:

Re: Mechanics & Formulas

Post by Paladance » October 17th, 2016, 12:44 am

Gasp, thanks. There had to be an exception to the percentage stuff, and you've found it. Why the previous attempts left me in thinking otherwise :(

Yes, pointing out the wildest things once more doesn't hurt. Unless you work yourself out, hmmm? :P

The debuff duration fact has reminded me about the mutual [ability]Haunt[/ability] issue -- that one of the performers would disappear and perhaps the same with one refreshing the DoT of another. I can recall your comment from Wowhead, aswell as a post from the chocolate forums -- but not if the second one was a quote or a separate sample; you perhaps know better. :)
(A side note for others -- Haunting during the damned state is forbidden -- has no effect. [ability]Unholy Ascension[/ability] or [ability]Corpse Explosion[/ability] work, just don't kill the caster as promised by the temporary protection.)

I just (yeah…) wanted to tell about a certain [ability]Brittle Webbing[/ability] (yup again) bug -- if a pet bearing it dies due to the proc during a multi-hit move, it continues to attack that round, what looks as ridiculous as it sounds. :mrgreen:

I guess that we just need MORE LOGS! that having constant elements would be even reshaped into a code-friendly form, but wouldn't it be too suspicious? :roll:

Next part: The tamer mechanics. "Cast these in that order" or "cast that if health drops below X" etc.
Who dares to take up the challenge?!

(A note to the moderators: Sorry for flooding you with so many editions of a single post.)
Image

I have compiled community knowledge & data about pet battle abilities!
https://www.warcraftpets.com/community/forum/viewtopic.php?f=3&t=19507

Jackozzo
Posts:6
Joined:May 3rd, 2015
Pet Score:5665
Realm:Ahn'Qiraj-eu
Contact:

Re: Mechanics & Formulas

Post by Jackozzo » October 27th, 2016, 3:22 pm

So I'm trying to define the correct workflow for the mechanics of an attack. This is what I've come so far:
  • first check if defender will implicitly block attack, if yes then attack is blocked and charges of abilities are consumed (even on attacker, eg bonus to next attack is wasted)
  • check if the ability hits, takes into account base hit chance + modifiers from abilities of the pet, the team and battlefield effect (but not defender abilities, I don't remember abilities which decreases hit chance of attackers). If the ability misses then no damage is applied, unsure about attacker abilities charges (if they are consumed or not)
  • check if the ability is dodged, this just takes into account defender dodge chance (which has 0% base chance) and modifiers from defender abilities and defender team abilities
  • check if the ability will be a critical hit (only applies to ability which inflict damage), this is done before calculating the damage output because the mechanics of damage with range changes if the hit is critical
  • then compute the amount of damage as described in separate section
  • apply damage as intended
Regarding damage:
  • take base damage, if the ability has a range as damage then it's computed using the formula described somewhere here on warcraftpets (like 3 rolls, keep the higher, then add/subtract from average dmg according to hit chance / critical)
  • add or subtract raw bonuses (like black claw)
  • multiply by damage attack bonus done / defender damage bonus received
  • multiply by 1.5 if it's critical
  • adjust according to bonus family if required
  • adjust for special effects (like unkillable for critters or undead round)
Now I guess that almost all abilities which can inflict more damage according to condition (eg hits last or hits fist) just undergo one whole check of mechanics (if first hit hits then second one hits). But this is not the case for other attacks like quills which have different rolls?

User avatar
Vakeetah
Top Rater
Posts:167
Joined:October 11th, 2015
Pet Score:9677
Realm:Dragonblight-eu
Contact:

Re: Mechanics & Formulas

Post by Vakeetah » October 27th, 2016, 10:06 pm

Jackozzo wrote:Now I guess that almost all abilities which can inflict more damage according to condition (eg hits last or hits fist) just undergo one whole check of mechanics (if first hit hits then second one hits). But this is not the case for other attacks like quills which have different rolls?
Aaah, these abilities are also a paragon of consistency! :p

I can't guarantee this is the correct behavior for these abilities, but rather offer a model based upon empirical evidence... The standard model, used by [ability]Tongue Lash[/ability], [ability]Rend[/ability], [ability]Quills[/ability], etc does one check for the first hit, and if it lands, proceeds to roll the 2nd attack and perform the "bonus if faster" one. To my knowledge, neither of those extra attacks do hit checks. As some odd notation I'd put it like this:
:arrow: [100%]→[50%|100%]
Brackets to denote a processing block (with attacks in that block separated by a vertical slash), Bold being an accuracy dependant hit chance, the arrow representing a conditional check, italics being unmodifiable hit chances, and the underline being the speed-dependant hit.

Slicing Wind is also a "first-hit" conditional, just replacing the "100% extra hit if faster" by another 50% hit:
:arrow: [100%]→[50%|50%]
The deal with these moves that require a hit is that a miss or a block on the first hit stops the attack completely!

Now, we can look at [ability]Stampede[/ability] (for example) which is 3 unconditional attacks, each with its own hit check:
:arrow: [100%|100%|100%]

Or [ability]Moth Balls[/ability], comprised of five separate hits (4 for damage, 1 for speed debuff) where only the first attack does a hit check, with the additional hits being a 50% regardless of accuracy:
:arrow: [50%|50%|50%|50%|50%]

And now there's [ability]Flurry[/ability], which unleashes 3 separate attacks, each with its own hit check. The "chance to do an extra attack" is just a 50% hit chance attack which can be cheesed with accuracy boosts to become guaranteed.
:arrow: [100%|50%|100%]

As you may notice, [ability]Flurry[/ability] is almost closer to [ability]Stampede[/ability] than to [ability]Tongue Lash[/ability], and the fact that it triggers 3 separate hit checks (rather than one) allows it to chew through [ability]Decoy[/ability] and [ability]Bubble[/ability] where similar attacks would be stopped.

This possibly doesn't make much sense, I guess :lol: In any case, I don't think there's a rule of thumb for those, because sometimes the extra hits can be modified by accuracy and other conditions, and sometimes not. Wish I had some datamining knowledge!
Image
- Thanks to Paladance for the sig!

User avatar
Paladance
Posts:1010
Joined:July 18th, 2015
Pet Score:12412
Realm:Burning Legion-eu
Contact:

Re: Mechanics & Formulas

Post by Paladance » October 30th, 2016, 3:21 pm

(I can recall @Quintessence saying something about that, but without the details, at least not in the forum. :))

Has anyone noticed how [ability]Comeback[/ability] now deals its bonus damage "backwards"?

I suspect that it was done to work around a problem mentioned before:
Paladance wrote:Attacks that deal additional damage when user has lower health (…) are boosted only if the first part doesn't manage to change that status. Crits and damage increases can make a disservice in these cases. :lol:
Now the engine seems to take into account the health difference before performing the move -- apparently putting the bonus damage first has been done to avoid something that I can imagine as a cardinal code nesting problem.

Tested that also with an effect such as [ability]Wild Magic[/ability]. A shortcut:
  • A Diemetradon Hatchling had 152 HP and beast racial while starting its turn.
  • A Chicken had 435 HP and +74 damage per hit debuff.
The Comeback struck for 318 bonus damage, what gives 117 damage left, and then performed the original hit for 430. Ouch!
Now it looks way better! This change, however, wasn't applied to [ability]Early Advantage[/ability] that is still as "broken" as it used to.
I was also told about EA's second tick being a technical DoT, what would explain ignoring blocks, but not dispatching them.

Note also that the "bonus move" will be performed even if the main attack is subject to miss/be blocked; against fresh decoys, these take away both charges… same with abilities such as [ability]Light[/ability], but not counting most of the speed-related stuff, as [ability]Pounce[/ability], or shown above -- they are entirely stopped if something gets in the way.
Image

I have compiled community knowledge & data about pet battle abilities!
https://www.warcraftpets.com/community/forum/viewtopic.php?f=3&t=19507

Bickus
Posts:3
Joined:November 17th, 2017
Pet Score:3859
Realm:Blackrock-eu
Contact:

Re: Mechanics & Formulas

Post by Bickus » November 18th, 2017, 12:53 pm

Sorry to unbury this old-ish thread :) the op didnt release the version mentioned in this thread i suppose?

i try to make a similar approach using simulations to gain some strategies using my personal pets, as i see a trend with these new battles using very rare pets (dragons-of-nightmare-dragonkin anyone?) and a rng-heavy outcome.

So far it´s in the early stages. i gained some infos using the internal wow-tables, but they are a mess for the most part; sometimes e.g. cooldowns and durations are included, sometimes not, and duplicate ids makes it a hell parsing these.
However, these can be circumvented by hardcoding specific parts.

I am implementing a 3-phased round-strategy, which is based on: preround-abilities/effects (such as maybe traps, bend-time effects), round-effects based on abilities cast, and post-round-effects such as dots ticking, death etc.

What i dont know so far is regarding the pet-battles itself: Are battles priority-based or do they follow a (more or less?) strict sequence. Or maybe something inbetween? What is your experience in battles?
Are they maybe dependent on the type of creature i´m fighting? (Boss/Elite = strict sequence, tamer-pets with teams priority-based?)

The more input, the better.

These inconsistencies regarding specific spells like flurry can be clearly implemented as separate issue, the trick is to find them out :D

User avatar
Rosqo
Posts:276
Joined:April 26th, 2017
Pet Score:9646
Realm:Silvermoon-eu
Contact:

Re: Mechanics & Formulas

Post by Rosqo » November 18th, 2017, 3:42 pm

Pretty much all pve battles are sequenced based so for the majority you can just assume the order the npc will use the ability in that order every time. I’m sure there is at least one pve fight that uses random abilities but I’m much more of a pvper.

I can tell you how most if not all the quirky mechanics work though if you need.

Bickus
Posts:3
Joined:November 17th, 2017
Pet Score:3859
Realm:Blackrock-eu
Contact:

Re: Mechanics & Formulas

Post by Bickus » November 18th, 2017, 5:11 pm

Therefore it would be awesome, to gather these sequences, for a start.

I bet there are some quirks with teambattles
e.g. what happens if a certain enemy-pet dies too early, what if too late, in a fight where constant switching is happening opponent-wise
edit:
or what happens, if enemypet has 3 abilities, each has a cd of 2, so after 3 abilities cast the first one is available again while 2 and 3 are on cd, i put the enemypet to sleep, so it has to pass a round -> ability 2 and 3 come off their cooldowns at the same time -> will it now cast ability 2 or ability 3?
Last edited by Bickus on November 18th, 2017, 5:34 pm, edited 2 times in total.

User avatar
Rosqo
Posts:276
Joined:April 26th, 2017
Pet Score:9646
Realm:Silvermoon-eu
Contact:

Re: Mechanics & Formulas

Post by Rosqo » November 18th, 2017, 5:33 pm

On of the most common reasons a trainer npc will change tactics is if a cc is landed on one of their pets. I think it messes up all the pve strats.

In pve the trainers don’t actively swap their pets unless cc’d. Crits, multi hits, misses and other procs could mess up your strat but the npc would still follow the same pattern with whichever pet they are using.

Post Reply