Spielerando

Decide the winner when the last hero and the last enemy both fall

A counterattack or an exploding enemy takes out both sides at once, and the game shows victory, defeat or a frozen screen depending on which check runs first. Here is where to check, what to do about the tie, and what to do with leftover damage.

Why this works

A battle should be judged after an action, not after each hit inside it, because the order of hits within one action is an accident. Collecting all changes first and deciding once means the same action always gives the same verdict.

When not to use it

Skip it when events truly follow each other with a real gap, for example a hero's strike that must end the fight before the foe can answer. Then the first fall rightly ends it; make that order a rule players can see.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • A diagram of every state
  • 21 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Decide the winner when the last hero and the last enemy both fall" (read_entry both-sides-fall-in-one-action) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP