The two battle enchantments Wailing Winds and Blood Rain both have very intricate effects on a battle. They both apply some variation of fear effects on opponent's units, but they do so in different ways and with different limitations. To try and understand how effective both of those historically iconic spells are, I decided to try and model them with a Monte Carlo simulation. We will see that Blood Rain on its own is very effective at making commanders run, while Wailing Winds is more suited to having low morale units run, and that their combination will allow Wailing Winds to affect medium morale units.
The mechanical details of the two spells are as follow:
Wailing Winds and Blood Rain both hit 3% of the battlefield every 320 ticks (for comparison, Dominion 5's version of Wailing Winds was hitting 5% of the battlefield every 320 ticks).
Blood Rain hits with a frighten effect, without condition.
A frighten effect reduces the morale of the target by 1, to a maximum of 5. If the target is alone in its squad like a commander, it will rout unless it succeeds on a morale check that we will call standard routing morale check (it is failed if the target fails an opposed DRN check of 5 + morale vs 14 + morale malus; ties are successes). This also affects squads if it is small enough, but this will not be modelled for now as it only affects very small squad with numbers below 5.
Wailing Winds hits with full fear effects on the condition that the hit unit fails a morale check that we will call moraleNegateMoraleCheck (it is failed if an open-ended 3d6 roll falls strictly below the unit current morale).
A full fear effect reduces the morale of the target by 1, to a maximum of 5 (this was changed recently in a dom 6 patch, it was previously 10). The full fear target will rout unless it succeeds on a morale check that we will call individual morale check (it is failed if the target fails an opposed DRN check of morale vs 6 + morale malus; ties are successes). If the full fear target did not fail the previous check and is alone in its squad like a commander, it will rout unless it succeeds on an standard routing morale check. If the target is in a squad, morale problems are involved (see
Dom 5 fear mechanics), and if there are enough of them, the whole squad makes a standard routing morale check as a single entity, with morale equal to the average morale in the squad and a bonus equal to 4 + (squadSize/2 + squadSize*5)/squadSize), where / is a division that rounds down. If the squad fails the check, it routs.
A single standard routing morale check can be done every round. A single individual routing morale check can be done every round.
The morale malus decays in the following way: every round, there is a 50% chance that the malus decreases by 1.
import matplotlib.pyplot as plt
import matplotlib.colors
import random as rand
import numpy as np
import math
import exploding_dice as DRN
from matplotlib.lines import Line2D
import os
import matplotlib.ticker as mtick
def ceildiv(a, b):
return -(a -b)
# to-do list:
# - do fear aura I guess as well, assuming line vs line
# - add modelling of the loss of the bonus of 4 to morale check (i would need to make sure that routed units count as killed units)
# - add modeeling of the effect of blood rain on squad that go below size 5
# - try and calculate variance and show it in plots
# - try and add back a simulation for run 2 (ww and ww+bloodrain) and compare to new ones
# - make it 50/50 which of wailing winds or blood rain goes first
# - DONE: check whether blood rain can rout commanders by itself; answer: yes
# - DONE: check what happens if morale malus is above unit's morale; answer: looks like negative morale after maluses are taken into account
# graphics suggestions:
# - DONE: use % instead of proba for easier access by people
# - DONE: alternate half and full lines
# globals effects (values gotten by asking Loggy):
# wailing winds: 3% of battlefield every 320 ticks, full fear effect if fail weird morale check (resists == openended 3d6 < current morale) so max penalty -10
# blood rain 3% of battlefield every 320 ticks, frighten effect, max penalty -5, won't cause rout by itself for the squad scenario, but will for lone commanders
wailingHitRate = 3
rainHitRate = 3
fullFearMalusLimit = 5 # maximum morale malus from wailing winds
frightenMalusLimit = 5 # maximum morale malus from blood rain
DOM5_wailingHitRate = 5
def moraleDomAverage(squadSize, unitMorale, moraleMalus):
totalMorale = 0
for unitID in range(squadSize):
totalMorale += unitMorale - moraleMalus[unitID]
return 1):
# return True
# else:
# return False
def routingMoraleCheckFails_individualCheck(unitMorale, moraleMalus):
if (unitMorale + DRN.DRN() < 6 + moraleMalus + DRN.DRN()):
return True
else:
return False
def moraleNegateCheckFails(unitMorale, moraleMalus):
if (DRN.DRN_triple() < max(unitMorale - moraleMalus, 0)):
return False
else:
return True
def wailingBattleSim_commanders(unitMorale = 10, bloodRainActive = 0, wailingWindsActive = 1, debug = 0):
tickCount = 0
roundCountCurrent = 0
roundCountNew = 0
moraleCheckCount = 0 # one morale check per turn maximum - monitors this
moraleCheckCount_easier = 0 # one morale check per turn maximum - monitors this
unitHasRouted = False
moraleMalus = 0
while unitHasRouted == False:
tickCount += 320
roundCountNew = tickCount 7500
# Blood Rain effect if active
if bloodRainActive == 1:
if rand.randrange(100) < rainHitRate: #chance for Blood rain to hit the commander square: rainHitRate% every 320 ticks
if moraleMalus < frightenMalusLimit:
moraleMalus += 1
if moraleCheckCount == 0 and standardRoutingMoraleCheckFails_commanders(unitMorale, moraleMalus):
unitHasRouted = True
moraleCheckCount = 1
# Wailing Winds effect
if wailingWindsActive == 1:
if rand.randrange(100) < wailingHitRate: #chance for Wailing winds to hit the commander square: wailingHitRate% every 320 ticks
if moraleNegateCheckFails(unitMorale, moraleMalus): # units get a morale check to avoid being affected by wailing winds
if moraleMalus < fullFearMalusLimit:
moraleMalus += 1
if moraleCheckCount == 0 and standardRoutingMoraleCheckFails_commanders(unitMorale, moraleMalus):
unitHasRouted = True
moraleCheckCount = 1
if moraleCheckCount_easier == 0 and routingMoraleCheckFails_individualCheck(unitMorale, moraleMalus):
unitHasRouted = True
moraleCheckCount_easier = 1
# new round, chance of morale malus to decay, and wailing winds will be able to try a rout one more time
if roundCountNew > roundCountCurrent:
if rand.randrange(100) < 50: # 50% chance of the morale malus being reduced by 1 every round
moraleMalus = max(moraleMalus - 1, 0)
moraleCheckCount = 0
moraleCheckCount_easier = 0
if debug == 1:
print(moraleMalus)
roundCountCurrent = tickCount 7500
# end of battle, unit hasn't routed yet (this is dom5 number, gotta check new dom6 end of turn stuff)
if roundCountCurrent > 100: # turn 100: battle enchantents end
unitHasRouted = True
roundCountCurrent = 130 #debug value
return roundCountCurrent
def wailingBattleSim_squad(unitMorale = 10, bloodRainActive = 0, wailingWindsActive = 1, squadSize = 1, unitDensity = 1, debug = 0):
tickCount = 0
roundCountCurrent = 0
roundCountNew = 0
unitHasRouted = np.zeros(squadSize, dtype=bool)
moraleMalus = np.zeros(squadSize)
moraleCheckCount = 0 # one morale check per unit per turn maximum - monitors this ; this one is shared by whole squad
moraleCheckCount_easier = np.zeros(squadSize) # one morale check per unit per turn maximum - monitors this
unitMoraleProblems = np.zeros(squadSize) # see morale problems in https://illwiki.com/dom5/user/loggy/morale ; only counts the 1000 ones, not the finer details, should be enough
squadSquareSize = ceildiv(squadSize, unitDensity) # how many squares deos the squad cover
unitRoutRound = np.zeros(squadSize) # turn at which the unit routed
while not np.all(unitHasRouted):
tickCount += 320
roundCountNew = tickCount 7500
for squadSquare_i in range(squadSquareSize):
# Blood Rain effect if active
if bloodRainActive == 1:
if rand.randrange(100) < rainHitRate: #chance for Blood rain to hit the unit's square: rainHitRate% every 320 ticks
for j in range(unitDensity):
unitID = squadSquare_i*unitDensity + j
if moraleMalus[unitID] < frightenMalusLimit:
moraleMalus[unitID] += 1
# Wailing Winds effect
if wailingWindsActive == 1:
if rand.randrange(100) < wailingHitRate: #chance for Wailing winds to hit the unit's square: wailingHitRate% every 320 ticks
for j in range(unitDensity):
unitID = squadSquare_i*unitDensity + j
if moraleNegateCheckFails(unitMorale, moraleMalus[unitID]): # units get a morale check to avoid being affected by wailing winds
if moraleMalus[unitID] < fullFearMalusLimit:
moraleMalus[unitID] += 1
if moraleCheckCount_easier[unitID] == 0 and unitHasRouted[unitID] == False and routingMoraleCheckFails_individualCheck(unitMorale, moraleMalus[unitID]):
unitHasRouted[unitID] = True
unitRoutRound[unitID] = roundCountNew
if debug == 1:
print("big fear routs unit "+str(unitID)+" at round "+str(roundCountNew))
moraleCheckCount_easier[unitID] = 1
unitMoraleProblems[:] += 1000
unitMoraleProblems[unitID] += 1000
if np.max(unitMoraleProblems) >= 10000: # or 5 cases depending on surviving number of squad members; issue is those cases look at whether the unit is alive, not routed. So it's hard to check in a sim without fighting; maybe ignore for now
if moraleCheckCount == 0 and unitHasRouted[unitID] == False and standardRoutingMoraleCheckFails_fullFear_squad(moraleDomAverage(squadSize, unitMorale, moraleMalus), squadSize): # This should not be a true average, but in fact is rather ((number of alive units in squad / 2) + total morale) / number of alive units (https://illwiki.com/dom5/user/loggy/morale)
unitHasRouted[:] = True
unitRoutRound[:] = roundCountNew
if debug == 1:
print("big fear routs whole squad at round "+str(roundCountNew)+"----------------")
moraleCheckCount = 1
# new round, chance of morale malus to decay, and wailing winds will be able to try a rout one more time
if roundCountNew > roundCountCurrent:
for unitID in range(squadSize):
if rand.randrange(100) < 50: # 50% chance of the morale malus being reduced by 1 every round
moraleMalus[unitID] = max(moraleMalus[unitID] - 1, 0)
moraleCheckCount = 0
moraleCheckCount_easier[:] = 0
unitMoraleProblems[:] = 0
if debug == 1:
print(moraleMalus)
roundCountCurrent = tickCount // 7500
# end of battle, unit hasn't routed yet (this is dom5 number, gotta check new dom6 end of turn stuff)
if roundCountCurrent > 100: # turn 100: battle enchantents end
roundCountCurrent = 130 #debug value
# unitHasRouted = np.ones(squadSize, dtype=bool)
for unitID in range(squadSize):
if unitHasRouted[unitID] == False:
unitHasRouted[unitID] = True
unitRoutRound[unitID] = roundCountCurrent
if debug == 1:
print("sim ends at round "+str(roundCountCurrent)+" with unitRoutRound = "+str(unitRoutRound))
return unitRoutRound
def FearMoraleMalusSim(unitMorale = 10, bloodRainActive = 0, wailingWindsActive = 1, debug = 0):
battleHasEnded = False
tickCount = 0
roundCountCurrent = 0
roundCountNew = 0
moraleMalus = 0
nRounds = 100
moraleMalusArray = np.zeros(nRounds)
moraleMalusArray[0] = 0
while not battleHasEnded:
tickCount += 320
roundCountNew = tickCount // 7500
# Blood Rain effect if active
if bloodRainActive == 1:
if rand.randrange(100) < rainHitRate: #chance for Blood rain to hit the unit's square: rainHitRate% every 320 ticks
if moraleMalus < frightenMalusLimit:
moraleMalus += 1
# Wailing Winds effect
if wailingWindsActive == 1:
if rand.randrange(100) < wailingHitRate: #chance for Wailing winds to hit the unit's square: wailingHitRate% every 320 ticks
if moraleNegateCheckFails(unitMorale, moraleMalus): # units get a morale check to avoid being affected by wailing winds
if moraleMalus < fullFearMalusLimit:
moraleMalus += 1
# new round, chance of morale malus to decay, and wailing winds will be able to try a rout one more time
if roundCountNew > roundCountCurrent:
moraleMalusArray[roundCountNew] = moraleMalus
if rand.randrange(100) < 50: # 50% chance of the morale malus being reduced by 1 every round
moraleMalus = max(moraleMalus - 1, 0)
if debug == 1:
print(moraleMalus)
roundCountCurrent = tickCount // 7500
# end of battle, unit hasn't routed yet (this is dom5 number, gotta check new dom6 end of turn stuff)
if roundCountCurrent > 98: # turn 100: battle enchantents end
roundCountCurrent = 130 #debug value
battleHasEnded = True
if debug == 1:
print("sim ends at round "+str(roundCountCurrent)+" with moraleMalus = "+str(moraleMalus))
return moraleMalusArray
# FearMoraleMalusSim(10, 1, 1, debug = 1)
# did I actually finish those DOM5 versions? to be checked
def DOM5_wailingBattleSim_commanders(unitMorale = 10, bloodRainActive = 0, debug = 0):
tickCount = 0
roundCountCurrent = 0
roundCountNew = 0
moraleCheckCount = 0 # one morale check per turn maximum - monitors this
moraleCheckCount_easier = 0 # one morale check per turn maximum - monitors this
unitHasRouted = False
moraleMalus = 0
while unitHasRouted == False:
tickCount += 320
roundCountNew = tickCount // 7500
# Blood Rain effect if active
# if wailingWindsActive == 1: for DOM5 if wailing winds isn't active there is no rout check, so there would be no need for a simulation
if rand.randrange(100) < DOM5_wailingHitRate: #chance for Blood rain to hit the commander square: rainHitRate% every 320 ticks
if moraleMalus < frightenMalusLimit: # in DOM5 the morale malus caps at 5
moraleMalus += 1
if moraleCheckCount == 0 and standardRoutingMoraleCheckFails_commanders(unitMorale, moraleMalus - (4 if bloodRainActive == 0 else 0)):
unitHasRouted = True
moraleCheckCount = 1
# new round, chance of morale malus to decay, and wailing winds will be able to try a rout one more time
if roundCountNew > roundCountCurrent:
moraleMalus = moraleMalus // 2
moraleCheckCount = 0
if debug == 1:
print(moraleMalus)
roundCountCurrent = tickCount // 7500
# end of battle, unit hasn't routed yet (this is dom5 number, gotta check new dom6 end of turn stuff)
if roundCountCurrent > 100: # turn 100: battle enchantents end
unitHasRouted = True
roundCountCurrent = 130 #debug value
return roundCountCurrent
# did I actually finish those DOM5 versions? to be checked
def DOM5_wailingBattleSim_squad(unitMorale = 10, bloodRainActive = 0, squadSize = 1, unitDensity = 1, debug = 0):
tickCount = 0
roundCountCurrent = 0
roundCountNew = 0
unitHasRouted = np.zeros(squadSize, dtype=bool)
moraleMalus = np.zeros(squadSize)
moraleCheckCount = 0 # one morale check per unit per turn maximum - monitors this ; this one is shared by whole squad
moraleCheckCount_easier = np.zeros(squadSize) # one morale check per unit per turn maximum - monitors this
unitMoraleProblems = np.zeros(squadSize) # see morale problems in https://illwiki.com/dom5/user/loggy/morale ; only counts the 1000 ones, not the finer details, should be enough
squadSquareSize = ceildiv(squadSize, unitDensity) # how many squares deos the squad cover
unitRoutRound = np.zeros(squadSize) # turn at which the unit routed
while not np.all(unitHasRouted):
tickCount += 320
roundCountNew = tickCount // 7500
for squadSquare_i in range(squadSquareSize):
# Wailing Winds effect
# if wailingWindsActive == 1: for DOM5 if wailing winds isn't active there is no rout check, so there would be no need for a simulation
if rand.randrange(100) < DOM5_wailingHitRate: #chance for Wailing winds to hit the commander square: DOM5_wailingHitRate% every 320 ticks
for j in range(unitDensity):
unitID = squadSquare_i*unitDensity + j
# if moraleNegateCheckFails(unitMorale, moraleMalus[unitID]): # in DOM5 units do not get a morale check to avoid being affected by wailing winds
if moraleMalus[unitID] < frightenMalusLimit: # in DOM5 the morale malus caps at 5
moraleMalus[unitID] += 1
# in DOM5 there is no individual rout
# if moraleCheckCount_easier[unitID] == 0 and unitHasRouted[unitID] == False and routingMoraleCheckFails_individualCheck(unitMorale, moraleMalus[unitID]):
# unitHasRouted[unitID] = True
# unitRoutRound[unitID] = roundCountNew
# if debug == 1:
# print("big fear routs unit "+str(unitID)+" at round "+str(roundCountNew))
moraleCheckCount_easier[unitID] = 1
unitMoraleProblems[:] += 1000
unitMoraleProblems[unitID] += 1000
if np.max(unitMoraleProblems) >= 10000: # or 5 cases depending on surviving number of squad members; issue is those cases look at whether the unit is alive, not routed. So it's hard to check in a sim without fighting; maybe ignore for now
if moraleCheckCount == 0 and unitHasRouted[unitID] == False and standardRoutingMoraleCheckFails_fullFear_squad(moraleDomAverage(squadSize, unitMorale, moraleMalus), squadSize): # This should not be a true average, but in fact is rather 2)