When we’re calculating combat math, we usually just aggregate all of the different damage mods together and apply them at some step along the damage calculation. This might be a large list from a bunch of different sources like the attacker’s talents, equipment, weapon, buffs, debuffs, character class, race/species, etc. but also the defender’s talents, equipment, weapon, buffs, debuffs, character class, race/species, etc. These different factors oppose each other and get evaluated for the damage calculation. In your example (-15% damage from Aliens), the incoming damage modifiers from the attacker would be marked as “type: alien” and the defensive bonus would match the incoming damage type to reduce the damage as part of the damage calculation process.
I’ll take the opportunity to point out that the data displayed in UI tooltips and combat math don’t necessarily have to match (trivia - tooltip and combat math not matching for a particular effect is a very common bug). Combat math and tooltips go through different paths and there are usually damage modifiers we will occasionally apply that don’t want players to see. The most common damage modifier we don’t want players to see would be debug damage mods. This is often used for dealing very specific amounts of damage or instantly killing enemies for test purposes, which may include needing to bypass enemy properties like health gates and damage resistance. Similarly, we might want to put special effects on certain monsters that we don’t want players to know about, like world boss damage reduction to combat item inflation. One game I worked on had to apply massive damage reduction to most of their elder game enemies because the damage inflation from gear and levels had eclipsed the engine’s original 32-bit integer-based combat math (maximum of ~4 billion), so the damage reduction was necessary in order to keep the game working.
[Join us on Discord] and/or [Support us on Patreon]
Got a burning question you want answered?
- Short questions: Ask a Game Dev on Twitter
- Long questions: Ask a Game Dev on Tumblr
- Frequent Questions: The FAQ