Action cycle

## Action Timer

All actions taken in the game are ruled by the action timer. It is the heart of the engine. Think of "ticks" in Minecraft: Every time a tick fires, updates to the environment happen: fires spread, water flows, redstone activates, etc. Here, every soldier has his own tick system for his actions such as shooting, reloading, or throwing grenades.

The time between ticks varies based on several factors:

* Bulk (how heavy the gun is)
* Experience
* Luck

The formula for time between "ticks" is:

```
(random number(300+(soldier weapon bulk*5)-soldier xp))/100

```

So you have a potential timer range of roughly .3 to 3.5 seconds per action.

A soldier can take an action about every 1 to 3 seconds. This time is greatly modified by the experience of the soldier. Quite evidently, a more experienced soldier will act faster in combat than a rookie.

Actions such as but not limited to:

* finding mines,
* Medic healing,
* Officer rallying,
* aiming, reloading, clearing a jam, and
* detecting enemies

are all affected by the action cycle.

## Hit Chance Calculations

In Mud and Blood, all combat action is determined by the combat skill (Cbt on the paperdoll when you mouse over a soldier). The Cbt score is modified by many factors when a weapon is fired. The recoil of the weapon, the range and other factors such as skills, stun effect, fear and such.

* **Combat Skill** (normally a base of 30)
* multiplied by **a range effect** (Targets farther away are harder to hit)
	+ A **recoil** malus, depending on the weapon
	+ A **cover** malus, if the target is in cover, a (100 - cover%)
	+ If the target is **pinned** or **moving**, -10% is applied
	+ An obstruction malus, -5% per other soldiers being too close to the shooter
	+ A shotgun bonus (if equipped), x2 bonus when under 200 px and x0.5 malus when over 500 px.
	+ A tracer bonus (if equipped), +3% each
		- as of 0.4.3 all LMGs (m1919, bar, bren etc) have 1/2 accuracy after 3x range (so starting 4x range and out)

**For germans only:** (see pages referencing Skill Creep.)

* **Win Streak,** + 0.1% \* (streak length)

### An Example

A soldier with **30 Combat Skill,** with **300 pixels** range to the **moving** target, armed with a **shotgun**, and obstructed by one soldier.

The chance is calculated as:

30 (skill) x 2 (range) x 2 (shotgun) - 5 (obstruction) - 10 (moving target) = a 115% chance to hit the target.

## Reloading Time

Time between shots is determined by the rate of fire of the weapon for all automatic weapons. The rate of fire of the all weapons in Mud and Blood is historically accurate. We get to experiment the real deal when it comes to the MG42 insane rate of fire and all of its meaning when you are on the receiving end.

For other weapon systems the time is counted as follow:

#### Bolt Action Weapons

((random number(300- soldier xp+(weapon bulk\*10)))/100) + random number((weapon recoil/10))

#### Semi-Automatic Weapons

(weapon bulk + weapon recoil + random number(20))/20

Note: For a semi automatic weapon, the soldier's xp doesn't affect the time between shots since the firing is instinctive and already fairly fast. almost all soldiers will fire from 1 to 3 shots from a semi auto weapon.

## Hand to Hand Combat

* As of 0.3.3, Hand to hand speed is influenced by the bulk of the weapon:
	+ (1 to 3 seconds) - (xp/100) + (Bulk/15)

* The average soldier, both allied and German, has a 30 to hand to hand skill. This can be increased by giving them certain items like Fighting Knives or Brass Knuckles.
* Special soldiers, like the Commando and FJ / SS have higher abilities, some like the Medic have lower ones.

The one that gets the first swing normally will win the fight, but not always.
You can have the whole squad punch 1 enemy soldier!

* As of 0.3.3, Weapon bulk now plays a part in hand to hand speed, but not damage or chance to hit.
* As of 0.4.4: Germans have a base 40 to HTH when defending
* As of 0.4.4: all units have a -5 to HTH when obstructing, per soldier

## Morale

Morale (Mrl on the paper doll) represents the mental state of the soldier. His willingness to fight and eagerness to expose himself to danger in order to accomplish the mission. Many factors can affect the soldier's mental state ranging from incoming fire to particularly gruesome casualties. The morale value of a soldier will replenish over time. As a commander it is important to keep an eye out on the morale value of a soldier as it fluctuates alot during a fight.

**Morale and suppression:** An important mechanic that is affected by morale is suppression. Every time a soldier if fired upon he will make a morale check (d100 rolled under his morale score) if he succeed his roll the soldier will continue performing his actions. If the test is failed, the soldier will become pinned. Once a soldier is pinned, he stops moving, fighting and responding to orders and focus entirely on self preservation.

In order to recover from his suppression state, the soldier will perform one morale check per action cycle. If the morale check is successful the soldier will stand up and carry on his orders given to him prior being pinned. If the morale check is failed the soldier will remain pinned for that action cycle and will try again on the next action. A low morale soldier has strong chance to become pinned for an extended amount of time if things get out of hand or he if catching a fair amount of incoming fire.

Natural morale regeneration caps at 50, but the Officer will boost your men's morale up from that.

morale buff cycle is based on a random roll under (officer exp/10)+5

The range of the morale aura for the officer is (100 + 1 per xp) pixels.

The amount of Morale naturally regained over time is relative to the soldier's current morale:

* under 30 +5 morale
* under 60 +2 morale
* under 90 +1 morale

Panic: If a soldier gets to 0 morale he will panic and leave the front line. A red circle will appear at the base of the soldier indicating the panic state. A panicking soldier will run in a straight line (this can be problematic if you are fighting in a mine field) towards the rear of the fight where he feels safe and will try to collect himself once arrived there. The time a soldier takes to recover from a panic state is affected by his experience. Panic is also contagious, if a soldier panics nearby soldiers will have to do morale checks in order to not be seriously affected by seeing their squamate running away. A soldier who recovers from panic can will answer to orders normally and have 15 morale, so not entirely too keen to fight.

## Healing

### Medkits

Green medkits (found on Germans) add 10 health to any alive friendly soldiers. Click to grab. Right-click to select a target, and click again on the guy you want to patch up.

### Medic Healing

The Medic's passive ability to heal troops works as follows:

On every third action tick, the medic has a (15+ xp/10) % chance to perform healing on all nearby troops in a radius of (100 + xp) pixels.