Damage Types
Damage types give every hit a kind, such as physical, fire, frost or shock, and let a character be weak, normal, resistant, immune or absorbing against each. Armour takes a flat amount off physical damage first, the kind's multiplier comes next, a hit that touched something never does nothing, and the total is rounded once.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Damage Types" to my game.
What it should do: Damage types make choices matter before a fight and during it: the right weapon against the right enemy does much more, and the wrong one does little, which gives a reason to carry more than one of everything.
Use these starting values:
- maxHealth: 100
- armor: 5
- weakMultiplier: 1.5 x
- resistMultiplier: 0.5 x
- absorbShare: 0.5
- minChip: 1
Watch out for these common mistakes:
- Armour and multipliers in the wrong order: Tell your AI: take the flat armour off first, then apply the multiplier. Always in that order, and say so in the game.
- Armour that cancels a hit: Tell your AI: a hit that reaches the character does at least a small minimum amount. A hit the character is immune to is the only one that does nothing.
- Rounding every part: Tell your AI: add the parts up first and round the total once.
- Absorbing and damage in one hit: Tell your AI: settle the damage and the healing of one hit together as a single change, and then keep health between zero and the maximum.
- A kind the character has no entry for: Tell your AI: a kind with no entry counts as normal.
- Immune parts and the minimum: Tell your AI: immune parts do nothing and never trigger the minimum. Only a part that could reach the character counts.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
Damage types make choices matter before a fight and during it: the right weapon against the right enemy does much more, and the wrong one does little, which gives a reason to carry more than one of everything.
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| maxHealth | 100 | The character's full health. It sets the scale the other numbers are read against. |
| armor | 5 | A flat amount taken off every physical part first. Five takes a quarter off a 20 point hit and most of a 6 point one, so armour stops small hits and matters less against big ones. |
| weakMultiplier | 1.5 x | What a weakness multiplies the damage by. One and a half is clearly noticeable without making one weapon the only answer. |
| resistMultiplier | 0.5 x | What a resistance multiplies the damage by. Half is felt at once and still lets the wrong weapon work. |
| absorbShare | 0.5 | The share of an absorbed part that heals. Half keeps absorbing from being a way to live forever by being hit. |
| minChip | 1 | The least a hit that touched something does. One means armour can stop most of a hit but never all of it. Zero lets armour cancel a hit. |
What usually goes wrong
Armour and multipliers in the wrong order
Taking armour off after the multiplier gives a different number than taking it off first, so the same character looks differently strong depending on which code a developer wrote. A weak 20 point hit against 5 armour is 23 one way and 25 the other.
Fix: Tell your AI: take the flat armour off first, then apply the multiplier. Always in that order, and say so in the game.
Armour that cancels a hit
If armour can take a hit down to nothing, a small enough attack never does anything, and a player with enough armour is untouchable by weak enemies and cannot be hurt by a crowd of them either.
Fix: Tell your AI: a hit that reaches the character does at least a small minimum amount. A hit the character is immune to is the only one that does nothing.
Rounding every part
Two small parts of 0.4 each round to nothing one by one, but add up to almost a whole point together. Rounding per part makes mixed hits weaker than the same damage in one part.
Fix: Tell your AI: add the parts up first and round the total once.
Absorbing and damage in one hit
If the damage is applied first, a character that would have survived through absorbing dies before the healing arrives. If the healing goes first, a character at full health wastes it and then takes the damage in full.
Fix: Tell your AI: settle the damage and the healing of one hit together as a single change, and then keep health between zero and the maximum.
A kind the character has no entry for
A new kind of damage added later finds characters without an entry for it, and the game crashes or the hit does nothing at all.
Fix: Tell your AI: a kind with no entry counts as normal.
Immune parts and the minimum
If the minimum applies to every hit that has any damage in it, a fire hit against a character immune to fire still hurts for one point, and immunity is not immunity.
Fix: Tell your AI: immune parts do nothing and never trigger the minimum. Only a part that could reach the character counts.
How to check it works
- Your character is weak against fire. A fire hit of 20 arrives: It does 30 damage.
- Your character resists fire. A fire hit of 20 arrives: It does 10 damage.
- Your character has no weakness to fire. A fire hit of 20 arrives: It does 20 damage and 80 health are left.
- Your character is immune to fire. A fire hit of 50 arrives: It does nothing, not even the minimum.
- Your character absorbs fire and has 50 health. A fire hit of 40 arrives: There is no damage and the character heals 20, so it has 70.
- Your character absorbs fire and has 95 health. A fire hit of 40 arrives: Health is 100, not more.
- Your character has 5 armour. A physical hit of 20 arrives, and then a fire hit of 20: The physical hit does 15 and the fire hit does 20.
- Your character has 5 armour and is weak against physical damage. A physical hit of 20 arrives: It does 23 damage, which is 15 times one and a half, rounded.
- Your character has 5 armour and the minimum is 1. A physical hit of 3 arrives: It does 1 damage. With the minimum at zero it does nothing.
- Your character has 5 armour and is weak against fire. A hit arrives with 10 physical and 10 fire: It does 5 and 15, 20 in all.
- The minimum is zero. A hit arrives with 0.4 fire and 0.4 frost, and a hit with only 0.4 fire: The first does 1 damage and the second does 0.
- Your character has 10 health and absorbs frost. A hit arrives with 25 physical and 40 frost: It does 20 damage and heals 20, so the character is still at 10.
- Your character is immune to fire and has 5 armour. A hit arrives with 30 fire and 2 physical: It does the minimum of 1 for the physical part and nothing for the fire.
- Your character has no entry for frost. A frost hit of 12 arrives: It does 12 damage.
- Your character has 100 health. A hit arrives with no parts, or with parts of zero, below zero or not a number: Nothing happens.
- Your character has 100 health. A hit of 900 arrives: Health is zero, not below.
Works well with
- Health and Damage: This mechanic decides how much a hit does. The health rules decide what happens when health reaches zero. Work out the damage with the kinds first, then take it off the health.
- Status Effects: A kind can carry an effect, such as fire leaving poison or frost leaving slow. Check the character's affinity first, so an immune character is not affected.
- Equipment Slots: Armour and rings can change a character's affinities. Rebuild the table when the equipment changes.
Clashes with Block and Guard: A guard that cuts damage by a share and a table of resistances that also cuts damage can together take a hit down to almost nothing. Apply the kinds first, then the guard, then the minimum last. Keep the minimum so a guarded hit is never free.
Common questions
what do i tell my ai to add damage types
Paste this: Add damage types: physical, fire, frost and shock. Each character is weak, normal, resistant, immune or absorbing against each kind, and a kind with no entry is normal. Armour of 5 comes off physical parts first, then weak multiplies by 1.5 and resist by 0.5. A hit that reaches the character does at least 1, immune parts do nothing, absorbing heals half the part, and the whole hit is added up and rounded once.
should armour work before or after resistances
Before. Flat armour taken off first keeps the multiplier meaningful. Taken off after, a weakness would make armour count for more, and the result depends on the order the code was written in.
how strong should a weakness be
One and a half times is a good start. Double makes one weapon the only right answer, and under one and a quarter is hard to notice.
can armour make a character take no damage
It should not, unless the character is immune. Keep a small minimum so every hit that reaches the character does something.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 20 tests pass on the reference code.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it