Spielerando

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.

Also called: Elemental damage, Resistances and weaknesses, Damage kinds.

An armoured turtle on a stone bridge shrugs off a bolt of fire that bounces from its shell in harmless sparks, while a spike of ice from the same lizard mage cracks its soft belly in a bright burst.
Embrel Crossing, an invented pixel-art duelling game. Invented game, image generated with AI.

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

ValueStart withWhat it changes
maxHealth100The character's full health. It sets the scale the other numbers are read against.
armor5A 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.
weakMultiplier1.5 xWhat a weakness multiplies the damage by. One and a half is clearly noticeable without making one weapon the only answer.
resistMultiplier0.5 xWhat a resistance multiplies the damage by. Half is felt at once and still lets the wrong weapon work.
absorbShare0.5The share of an absorbed part that heals. Half keeps absorbing from being a way to live forever by being hit.
minChip1The 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

Works well with

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.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

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