User Tools

Site Tools


user:loggy:morale

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
user:loggy:morale [2021/05/30 00:29]
loggy
user:loggy:morale [2023/04/21 18:51] (current)
loggy
Line 1: Line 1:
-======= RE: Morale, Fear, and related subjects ========+======= Loggy'Morale check and Fear reverse engineering notes ========
  
 === Morale Check === === Morale Check ===
Line 7: Line 7:
   * Rout undead if there is no friendly undead leadership left   * Rout undead if there is no friendly undead leadership left
   * Rout magic beings if there is no friendly magic leadership   * Rout magic beings if there is no friendly magic leadership
-  * If this is a check for special indies with nation ID 3, jump further down+  * If this is a check for special indies with nation ID 3, jump further down to actual unit morale check time
   * Keep a count of units (and commander) with orders matching unknown criteria. This doesn't seem to be used for anything much, though...   * Keep a count of units (and commander) with orders matching unknown criteria. This doesn't seem to be used for anything much, though...
-  * If there is no friendly commander not retreating, val1 = 125. If there isn't, it's 0.+  * If there is no friendly commander not retreating (so all friendly commanders are retreating), val1 = 125. If there isn't, it's 0.
   * If the current field HP is 25% or less than what it started with:   * If the current field HP is 25% or less than what it started with:
      * If val1 was zero from the above, it's set to 50.      * If val1 was zero from the above, it's set to 50.
Line 31: Line 31:
   * If val1 is 100+, every friendly unit is immediately forced to rout, no questions asked   * If val1 is 100+, every friendly unit is immediately forced to rout, no questions asked
   * If val1 is 50-99 inclusive:   * If val1 is 50-99 inclusive:
-    * If you are the attacker, and the province ID the battle is taking place in > 0 [not another plane], you rout without any checks. +    * If you are the attacker, and the province ID the battle is taking place in > 0 [not another plane], commanders rout without any checks so long as they are not mindless or immortal
-    * If you are defending a fort storming, every friendly commander with hp > 0 that is not immortal, not mindless rolls morale + DRN vs 10 + DRN. Losing (not in the case of a tie) routs the commander. [This is "autobreak" in the debug log]+    * If you are defending a fort storming, every non-mindless non-immortal friendly commander with hp > 0 rolls morale + DRN vs 10 + DRN. Losing (not in the case of a tie) routs the commander. [This is "autobreak" in the debug log]
     * If you are defending and not in a fort, you rout without any checks.     * If you are defending and not in a fort, you rout without any checks.
   * If val1 is 25-49, all friendly units have 1 added to their morale problems value   * If val1 is 25-49, all friendly units have 1 added to their morale problems value
Line 42: Line 42:
     * Otherwise:     * Otherwise:
       * Add up the total morale of all units in the squad with greater than 0 HP. Units with morale greater than 30 (mindless and berserk) are considered to have 30 for this purpose.       * Add up the total morale of all units in the squad with greater than 0 HP. Units with morale greater than 30 (mindless and berserk) are considered to have 30 for this purpose.
-      * Calculate the average morale by dividing that by the number of units that have greater than 0 HP, rounding down.+      * Calculate the "averagemorale. This isn't a true average, but is rather %%((number of alive units in squad / 2) + total morale) / number of alive units
       * Find the squad's highest morale problems value (of all members with greater than 0 HP).       * Find the squad's highest morale problems value (of all members with greater than 0 HP).
       * Calculate half the number of surviving units in the squad, rounded down. If the halved result is greater than 100 (with 200+ surviving units), consider it as if it were 100.       * Calculate half the number of surviving units in the squad, rounded down. If the halved result is greater than 100 (with 200+ surviving units), consider it as if it were 100.
       * The morale problems value above is ignored and considered to be 10000 if any of the following are true:       * The morale problems value above is ignored and considered to be 10000 if any of the following are true:
-        * The squad has less than or equal to 80% of its original members alive (rounded down) AND the squad's average morale is 8 or lower AND the half squad size is less than the number of morale problems +        * The squad has less than or equal to 80% of its original members alive (rounded down) AND the squad'"averagemorale is 8 or lower AND the half squad size is less than the number of morale problems 
-        * The squad has less than or equal to 75% of its original members alive (rounded down) AND the squad's average morale is 10 or lower AND the half squad size is less than the number of morale problems +        * The squad has less than or equal to 75% of its original members alive (rounded down) AND the squad'"averagemorale is 10 or lower AND the half squad size is less than the number of morale problems 
-        * The squad has less than or equal to 70% of its original members alive (rounded down) AND the squad's average morale is 11 or lower AND the half squad size is less than the number of morale problems+        * The squad has less than or equal to 70% of its original members alive (rounded down) AND the squad'"averagemorale is 11 or lower AND the half squad size is less than the number of morale problems
         * The squad has less than or equal to 60% of its original members alive (rounded down) AND the half squad size is less than the number of morale problems         * The squad has less than or equal to 60% of its original members alive (rounded down) AND the half squad size is less than the number of morale problems
         * The squad has less than or equal to 30% of its original members alive (rounded down) AND any unit in the squad has morale problems greater than 0         * The squad has less than or equal to 30% of its original members alive (rounded down) AND any unit in the squad has morale problems greater than 0
       * If any of the previous were true, the base morale bonus is 0. Otherwise, it is 4.       * If any of the previous were true, the base morale bonus is 0. Otherwise, it is 4.
-      * The squad takes a morale check if morale problems are greater than 10000 [does NOT set base morale bonus to 0 if failed], and neither of the following are true: +      * The squad takes a morale check if either of the following two points is true, checked in order
-        * The squad has less alive units than a rolled d4 (nonexploding) die [sets base morale to 0 if failed+        * The number of alive units in the squad is less than or equal to closed d4, AND the highest number of morale problems is greater than or equal to half the number of alive units in the squad [sets base morale bonus to 0 if true
-        * The highest morale problems value is less than half the surviving squad size [sets base morale to 0 if failed+        * The highest number of morale problems is 10000 or higher [does not set base morale to 0] 
-      * The actual morale check is [base morale bonus] + [average unit morale] + ([original squad size / 2] + [surviving squad size * 5])/original squad size + DRN vs 14 + DRN. Only losing causes a rout, not a tie. Rounding down occurs after each division.+      * The actual morale check is [base morale bonus] + ["averageunit morale] + ([original squad size / 2] + [surviving squad size * 5])/original squad size + DRN vs 14 + DRN. Only losing causes a rout, not a tie. Rounding down occurs after each division.
       * Regardless of whether or not a morale check was made, set the morale problems value of all units in the squad to 0.       * Regardless of whether or not a morale check was made, set the morale problems value of all units in the squad to 0.
  
Line 63: Line 63:
  
   * Being hit directly with fear type 2 (LA TC howling bows) adds 1 to the unit hit and 1 to all members of the squad.   * Being hit directly with fear type 2 (LA TC howling bows) adds 1 to the unit hit and 1 to all members of the squad.
-  * Being hit directly with fear type 1 (spells, fear auras) adds 1000 to all members of the squad and then SETS the problems of the unit hit to 1000.+  * Being hit directly with fear type 1 (spells, fear auras) adds 1000 to all members of the squad and then ADDS another 1000 problems to the unit hit. Nothing happens to units with 50+ morale (ie mindless and gone berserks), this includes that morale problems are not even dropped on any other vulnerable members of the squad
   * After being damaged, if the unit's current hitpoints are less than 80% (rounded down) of its maximum, it gets +1 morale problems   * After being damaged, if the unit's current hitpoints are less than 80% (rounded down) of its maximum, it gets +1 morale problems
   * If a unit dies, add 100 to morale problems of all still living squad members   * If a unit dies, add 100 to morale problems of all still living squad members
Line 71: Line 71:
  
 Fear effects (and the unused but functional temporary positive morale effect) provide unit-by-unit modification of morale values. This can go no further than 5 in either direction. The modifier is halved (rounding down) every combat round. Fear effects (and the unused but functional temporary positive morale effect) provide unit-by-unit modification of morale values. This can go no further than 5 in either direction. The modifier is halved (rounding down) every combat round.
 +
 +
 +===== TL;DR =====
 +
 +Commanders are squads of one, which makes life easier and simplifies a LOT of this.
 +
 +=== Commmanders ===
 +
 +All units have a hidden "morale problems" value. At least, this is what Illwinter call it in the debug log.
 +
 +Only units with morale problems are valid for morale checks here. Stuff like HP routing is different, this is for "normal" routing only.
 +
 +For sources of morale problems, scroll up a little bit.
 +
 +A commander simply makes a morale check whenever it has a morale problems value greater than zero.
 +
 +In order for a commander to flee:
 +
 +  5 + Commander's Morale + DRN < 14 + DRN
 +  
 +If the commander does not flee, the morale problems value is set to zero, so they will only make a check next round if they get some from any source.
 +
 +=== Squads ===
 +
 +This is still complicated, sorry.
 +
 +For squads, the only value that matters at morale check time is the **highest** morale problems value among all units in the squad.
 +
 +Calculate the average morale of all alive squad members. I'm not certain how the formula makes this round, but it ends up as an integer. Units with 30+ morale (from eg gone berserk, or a mixed mindless/nonmindless squad) are treated as if they had 30.
 +
 +Search for the highest morale problems value of all alive squad members.
 +
 +Calculate the "half squad size". This is half the number of alive squad members rounded down, or 100 if there are 200+ still alive.
 +
 +The game records how many members the squad had initially at battle start.
 +
 +There are some special bad cases, which make your check harder. If all of the conditions on a row are met, this is a "bad case" morale check.
 +
 +A squad takes a morale check if...
 +  * It hits any of the bad case conditions
 +  * Its highest morale problems are 10000+
 +
 +The "half squad condition" is met when the squad's morale problems value meets or exceeds the half squad size. Given that fear effects add morale problems in thousands this is essentially guaranteed to be met when fear is involved.
 +
 +Bad case table:
 +
 +^ Percent original members alive ^ Average morale requirement ^ Half squad condition ^
 +| 80 or less | 8 or lower | y |
 +| 75 or less | 10 or lower | y |
 +| 70 or less | 11 or lower | y |
 +| 60 or less | | y |
 +| 30 or less | | |
 +| Closed d4 matches or exceeds the number of alive units in squad | | y |
 +
 +If a squad makes a morale check, it routs if...
 +   4 (unless bad case, then zero) + average morale + ([original squad size / 2] + [num alive members * 5])/original squad size + DRN < 14 + DRN
 +   
 +In any case, the morale problems values of all squad members are set back to zero, regardless of the check result or if a check was even made.
 +   
 +=== Other Notes ===
 +
 +There are many misconceptions about the Fear aura. Like any other aura, it fires off little single square "bursts". If you want to see what this looks like, roll a test game as Shinuyama and observe the sleep aura at work.
 +
 +Auras cannot hit more than one square away from the source unit without a value of 25+. I suspect the manual's words on this subject are holdovers from dom4. I have found only evidence contrary to this when disassembling the game, including going to lengths to make fear auras produce a visible effect, which makes them look rather like the sleep auras in my recommendation above.
 +
 +There will quickly come a point where stacking more fear aura won't help you much. After all, once you've hit 10000 morale problems on a squad (or any on a commander), throwing more will just lower the average morale of the units you hit, and as above getting a lot of "reach" on your fear aura requires stacking it to extremely high values, which is expensive. And even if you do that, you might be able to bring down the victim's average squad morale by 1 or so.
 +
 +The differences between commanders and normal squads are not special cased specifically by the game. If you ran commanders through the squad logic, you'd find that they will always trigger the final "bad case" (d4 must always be 1 or higher, half squad size = 1/2 rounded down becomes zero, morale problems always greater than zero so half squad condition always met) and trigger a morale check accordingly.
 +
 +=== 5.59 -> 5.60 ===
 +
 +The 5.60 patch notes stated they fixed an overflow in fear. Illwinter also changed a little detail of fear mechanics in 5.60.
 +
 +When hit by a fear effect...
 +
 +  * Add 1000 to all squad members' morale problems
 +  * Subtract the effect's damage value from the hit unit's temporary morale, to a max penalty of -5
 +  * Then the different bit:
 +    * 5.59: **SET** the hit unit's morale problems to 1000
 +    * 5.60: **ADD** another 1000 to the hit unit's morale problems
 +
 +In 5.59, if you had six bakemono in a squad and all in one square together, and hit them all with a fear effect...
 +
 +Hit the first guy, add 1000 to all members, then set the first hit guy's to 1000 (all at 1000)
 +Hit the second guy, add 1000 to all others (all at 2000), then set this hit guy's to 1000 (5x 2000, 1x 1000)
 +...
 +Hit the last guy: the first hit bakemono has 6000 morale problems, the second 5000, the third 4000... and the last guy ends at 1000
 +
 +If you did this again (as many times as you wanted), you'd find the morale problems value didn't change, and no matter how hard you hit this squad with fear effects they'd never make a morale check from that alone due to not passing 10000.
 +
 +The 5.60 change throws this out of the window, and after being hit once they'd all be sitting at 7000.
 +
 +The overflow thing was simply that morale problems would overflow (become -32768) once passing 32767. In theory it would be possible to have used this to avoid making a morale check, but due to the incremental morale problems you got when blasting squads with fear this would probably have required your opponent to tactically kill all the guys with 10k+ while all the overflowed squad members were fine with it all. Good luck to them on that one.
 +
 +5.60 simply makes it not exceed 25k any more. 25k isn't really significant though, as for all but the most insane intents and purposes anything over 10k may as well be the same...
user/loggy/morale.1622334562.txt.gz · Last modified: 2021/05/30 00:29 by loggy