Hit Rules ​
Part of the Gameplay Config (Combat). These rules decide whether an attack can miss.
These rules decide whether an attack can miss. This section is long on purpose: the hit roll has a few moving parts, and your game probably wants some of them and not others.
The idea in one minute ​
When an ability that can miss reaches an enemy, the game makes one hit roll for that ability and that enemy. The roll has three possible results:
| Result | What happens |
|---|---|
| Hit | The ability applies as usual. |
| Glancing hit | The ability applies, but its damage and healing are weaker. Only if you turn glancing hits on. |
| Miss | Nothing of the ability reaches that enemy. The attacker sees "Miss". |
The chance to hit is one number you can read at any time:
text
chance to hit = base chance (melee or ranged)
+ accuracy of the attacker
- evasion of the target
+ the change of the level gap
and then kept between the minimum and the maximumEverything in that line is a setting you choose, or a stat you build. You can use all of it, some of it, or none of it:
- No misses in your game? Leave Use hit system off. Nothing in this section does anything.
- A flat 5 % miss for everybody? Turn it on, leave the rest as it is (the default base chance is 95 %).
- Miss chances that grow with stats (accuracy, evasion) and with the difference in level? Turn it on and build the stats, and choose a level gap mode.
- Only some abilities can miss? Leave it off and set Hit rule to Can miss on those abilities.
The roll belongs to the ability, not to the damage
Earlier versions of the toolkit worked out a miss inside the damage calculation. Now an ability rolls to hit once, before any of its effects apply. A miss therefore also stops the debuffs, statuses and everything else of that ability on that enemy, and a composite effect or an ability with three damage effects does not roll three times: all its parts hit or all miss.
When the roll is made ​
- An ability is used and one of its effects reaches an enemy: the damage effect of a sword swing, the first tick of a poison, the explosion of a projectile when it lands.
- If the ability can miss (see Hit rule), the game rolls once for that ability use and that enemy, and remembers the result.
- Every other effect of the same use that reaches the same enemy uses the same result. A fireball that hits five enemies makes five rolls, one for each.
- On a hit or glancing hit the effects apply, and then the normal damage calculation runs: the target can still dodge, parry or block. Those are not misses; they are rolled by the target's stats in Damage Taken.
- On a miss the effects are rejected with the reason "Missed" and the attacker sees "Miss".
What is never rolled:
| Case | Why |
|---|---|
| Effects an ability applies to itself (a buff on the caster, a self heal) | Nothing is aimed at an enemy |
| Anything aimed at a friend (a heal on an ally, a shield on the tank) | You do not miss your friends |
| Effects aimed at the user | The user is not an enemy of itself |
| The parts of a composite effect | The composite only passes its parts on. The parts share one roll |
| The ticks of a damage-over-time effect | The effect rolls once when it is applied. A poison that hit does not miss on tick 3 |
| Abilities set to Always hits, or with the hit system off and Hit rule on Project default | They never miss |
Neutral entities (wolves that have not noticed you) can be missed. Hostile ones can. Friendly ones cannot.
Settings ​
Every field has a tooltip in the editor. These are the fields of Hit Rules:
| Field | What it does | Default |
|---|---|---|
| Use hit system | The master switch. Off: no attack ever misses, whatever the abilities and stats say, except abilities whose Hit rule is Can miss. On: every ability rolls to hit, except those that Always hit | off |
| Melee range | An ability whose Attack style is Automatic counts as melee when its range is at most this many metres, and as ranged beyond. An ability with no range limit counts as melee | 5 |
| Base melee hit chance | The chance to hit (percent) of a melee attack before stats, the level gap and the limits. 95 is a flat 5 % chance to miss | 95 |
| Base ranged hit chance | The same for ranged attacks. Give ranged attacks a different base if you want ranged and melee to feel different | 95 |
| Minimum hit chance | The chance never goes below this, so a target is never untouchable. 0 means an enemy can be impossible to hit | 5 |
| Maximum hit chance | The chance never goes above this. 95 means even the best attacker misses one time in twenty. 100 means no limit | 100 |
| Level gap mode | How the levels of attacker and target change the chance: not at all, points per level, a table, or a formula. Its own fields appear under it | None |
| Glancing hits enabled | A failed roll can still land, weaker. See Glancing hits | off |
| Glancing chance | The share of the failed rolls that become glancing hits instead of misses | 30 |
| Glancing reduction | How much weaker a glancing hit is: the percent taken off its damage and healing | 40 |
| Glancing other effects apply | Do the statuses, buffs and debuffs of a glancing hit still apply? Off: only damage and healing happen | on |
If Minimum hit chance is higher than Maximum, the lower of the two is used as the minimum.
Melee and ranged ​
Hit chance has two bases because games disagree on whether bows should miss as often as swords. An ability counts as one or the other by its Attack style:
| Attack style | Counts as |
|---|---|
| Automatic (default) | Melee if its range is at most Melee range, otherwise ranged |
| Melee | Melee, whatever its range (a spear, a whip) |
| Ranged | Ranged, whatever its range (a thrown dagger, a spell with a short range) |
The style also decides which accuracy and evasion effects count: you can build "+5 % accuracy with ranged attacks" with the Melee or ranged hit filter. There is no distance between the two entities involved: it is melee or ranged because the ability is, not because of how far apart they happen to stand.
Level gap ​
The level gap is a decision of your game, so the toolkit does not force one. The gap is the level of the target minus the level of the attacker: +3 is an enemy three levels above you, -2 is an enemy two levels below.
| Mode | What it does | Its fields |
|---|---|---|
| None | The levels never matter | none |
| Points per level | Every level the target is above the attacker takes points off the chance. Optionally, every level it is below adds points back | Penalty per level, Bonus per level, Limit (the most the gap can change the chance, up or down; 0 = no limit) |
| Table | You write the number for each gap yourself | A list of rows: a gap of N levels or more changes the chance by X points |
| Formula | Your own calculation. The formula gets the gap and returns the change | A formula |
Points per level, with a penalty of 2, a bonus of 0 and no limit, against a base chance of 95:
| Target level against yours | Gap | Change | Chance to hit |
|---|---|---|---|
| Equal | 0 | 0 | 95 % |
| 3 levels above | +3 | -6 | 89 % |
| 5 levels above | +5 | -10 | 85 % |
| 10 levels above | +10 | -20 | 75 % |
| 5 levels below | -5 | 0 | 95 % |
With a Bonus per level of 1 the last row becomes +5 (100 %), and a Limit of 6 stops the table at -6 and +6.
Table. A gap uses the row with the largest gap that is not above it. A gap below every row changes nothing. A table like the one World of Warcraft used to have looks like this:
| Row: gap of | Change | So a gap of ... uses it |
|---|---|---|
-5 | +10 | -5 to -1 |
0 | 0 | 0 to 2 |
3 | -5 | 3 and 4 |
5 | -20 | 5 and up |
| (no row) | 0 | -6 and lower |
Formula. The formula receives the gap as its number and returns the change in points. A Linear formula of -3 per point is "3 points off per level above, 3 points on per level below". Formulas can use level scaling, so you can make a gap hurt more at high levels, or add diminishing returns so the first levels count most.
The editor shows a small table of the change for a few gaps, so you can check your choice without playing.
Accuracy and evasion ​
Stats change the chance with the Hit Chance Effect, one of the stat effects:
| Field | What it does |
|---|---|
| Side | Accuracy raises the chance of the attacks of whoever has the stat. Evasion lowers the chance of the attacks aimed at whoever has the stat |
| Value | A number of points of hit chance. A Linear formula of 0.1 per point of the stat is a tenth of a percent per point |
| Hit filters | Limit it to melee or ranged attacks, a school, some abilities, direct hits or ticks |
| Conditions | Like any stat effect: "only against Undead", "only while in combat" |
An Accuracy of 20 points on the attacker and an Evasion of 10 points on the target, against a base of 50, give 50 + 20 - 10 = 60 %. The two sides read their own stats: the target's accuracy and the attacker's evasion do not count in this attack.
The demo has two: Defense carries an Evasion effect, and the proficiency One-Handed Weapons carries an Accuracy effect that only works while a one-handed weapon is held. Recipes are on Stat recipes.
Glancing hits ​
A game with misses sometimes finds them frustrating: a whole ability, wasted. A glancing hit is the softer failure. When the roll fails, a share of the failures become glancing hits: the attack lands, but weaker.
text
roll to hit ..... succeeds ........................... Hit
|
fails ... roll again against Glancing chance
succeeds ........................... Glancing hit
fails .............................. MissWith a base chance of 80 %, a glancing chance of 30 % and a reduction of 40 %:
| Result | How often | What happens |
|---|---|---|
| Hit | 80 % | Full damage and healing |
| Glancing hit | 20 % x 30 % = 6 % | 60 % of the damage and 60 % of the healing |
| Miss | 20 % x 70 % = 14 % | Nothing |
- The glancing chance applies only to failed rolls, so turning it up never lowers the chance to hit.
- Glancing reduction
100makes a glancing hit do nothing (but its other effects still apply, if you let them).0makes it the same as a hit. - Glancing other effects apply decides what happens to the rest of the ability. On (default): a glancing hit still stuns, slows or poisons in full, and only the damage and the healing are weaker. Off: only damage and healing happen, so the debuffs are lost.
- Dodges, blocks and critical strikes still work on a glancing hit.
- The floating text reads "42 (glancing)" and the combat log says the attack "glancingly hit".
Per ability: Hit rule and Attack style ​
The Abilities editor has a Hit roll box with two fields:
| Field | Options |
|---|---|
| Hit rule | Project default: it can miss when Use hit system is on. Always hits: it never misses, whatever the project says (a spell that cannot be dodged, a trap, an execution). Can miss: it rolls even when Use hit system is off |
| Attack style | Automatic, Melee, Ranged, as above |
| Hit rule | Hit system off | Hit system on |
|---|---|---|
| Project default | never misses | can miss |
| Always hits | never misses | never misses |
| Can miss | can miss | can miss |
The editor tells you what the ability does with the current settings. Can miss with the hit system off is how you make a game where only a few abilities (a sniper shot, a dangerous gamble) can miss.
The same hit rule is what ends the old question "should the hit chance be a calculation?": there is no hit chance in the damage calculation any more, the ability decides.
What the player sees ​
| Result | Floating text | Combat log |
|---|---|---|
| Hit | the damage | "X hit Y for N" |
| Glancing hit | "N (glancing)" | "X glancingly hit Y for N" |
| Miss | "Miss" | "X's Ability missed Y" |
Recipes ​
| You want | Settings |
|---|---|
| No misses at all | Use hit system off, and no ability with Can miss |
| A flat 5 % miss chance for everyone | Use hit system on, base chances 95, Minimum 5, no stats |
| Spells that never miss, weapons that can | Use hit system on, and Hit rule Always hits on the spells |
| Only a sniper shot can miss | Use hit system off, Hit rule Can miss on that ability, base ranged chance as you like |
| Bows miss more than swords | Base melee 95, Base ranged 85 |
| Higher level enemies are harder to hit, old-school | Level gap mode Table or Points per level with a penalty |
| Gear and skills raise your chance to hit | Build an Accuracy stat. A proficiency can carry one |
| Enemies you can never be sure to hit | Maximum hit chance 95 |
| A target nobody can hit | Minimum 0 and an Evasion above the base chance |
| Misses that sting less | Glancing hits on |
For programmers ​
The chance is one function, so a tooltip or an AI can ask for it without rolling:
gdscript
var chance: float = HitRules.get_chance(attacker, target, ranged) # 0 to 100
var outcome: HitRules.Outcome = HitRules.roll(attacker, target, ranged) # HIT, GLANCING or MISSAn ability instance answers can_miss() and is_ranged_attack(). See Advanced > Entity Stats > the hit and heal pipeline.