Sengoku Rance:Parameters & Formulae

Main stats

 * Troop type - different troop types have different icons. Known troop types include:
 * Bushi/Warrior (武士) - Sword icon. The stereotypical samurai.
 * Foot soldier (足軽) - Shield icon.
 * Tactician (軍師) - War fan icon.
 * Archer (弓兵) - Bow icon.
 * Ninja (忍者) - Shuriken icon.
 * Miko (巫女) - Red cross icon.
 * Monk (僧兵) - Praying bead icon.
 * Yin Yang/Diviner (陰陽) - Prayer slip icon.
 * Musketeer (鉄砲) - Rifle icon.
 * Cannon (砲兵) - Mortar/Cannon icon.
 * Knight (騎士) - Sword + shield icon.
 * Mage (魔法) - Staff icon.
 * Cavalry (騎馬) - Bird icon.
 * Animal (動物) - No icon.
 * Battle stats
 * Troop size
 * Actions - The number of actions the commander/unit may perform per fight.
 * Attack (Atk) - Increases physical damage done, formulae is Attack Power = base attack+ ATKx10
 * Hannys have ATK based attacks.
 * Magicians use ATK when counterattacking.
 * Defense (Def) - Increases defense against physical damage, formulae is Defense = base defense + DEFx8
 * Intelligence (Int) - Increases magic damage done, increases defense against magic. Formulae is Magic damage = Base Damage + Int x 10, Magical defense = Int x 7
 * Foot Soldier - Each point of Int increases the amount of 'guard' you get when using a guard command, although the amount differs depending on which command was used. All Guard grants 10% Guard per point, Ally Guard grants 20% Guard per point, and Ally Guard Plus provides 30% Guard per Point.
 * Tactician - Each INT gives 1 initial buff, and increases buff strength by 5%.
 * Diviner/Yin Yang - Affects magic damage done.
 * Monk/Miko - Affects healing.
 * Speed - influences the cooldown time between combat actions. this is also influenced by what attack is used, no exact formula is known.
 * Map event stats
 * Exploration (green) - covert actions, skill at finding dungeons, treasures and special locations.
 * Negotiation (yellow) - declaring war, creating a vassal, persuading prisoners and foreign generals to join your army.
 * Construction (blue) - increasing NP, preparation for battles.
 * Cost - national influence point cost of employing this commander

Battle Rating
The following explains how the game handles Battle Rating internally. The slider showing it appears to the result of dividing the Battle Rating of each side by 400, giving one color for each side.

Battle Rating calculation:
 * The rating for either side is [(100 * Ally Damage) / Total Damage + Ally Advantage Modifiers] - [(100 * Enemy Damage / Total Damage]
 * Recalculated each time there is an adjustment from cumulative totals
 * Healing does not factor into the calculation

Advantage Modifiers: Determining victory (when time runs out or all commanders run out of actions):
 * At start of battle, damage is set to 10% of total troop count for both sides (Total Damage to 20%)
 * Each side will get 0 Battle Rating baseline to start based on the default damage (50 on each side, which cancel out)
 * At start of battle:
 * If the battle takes place in a field, the defending side gains +10 to the rating.
 * If the battle takes place in a town, the defending side gains +20 to the rating.
 * If the battle takes place in a castle, the defending side gains +40 to the rating.
 * For each unit with Power of the Goddess of War, add +5 to the rating of the side that has it.
 * For each unit with Initial Battle Rating or Power of the Emperor, add +10 to the rating of the side that has it.
 * During battle:
 * Whenever Witty Comeback is used, swap both side's ratings (and manipulations up until that point) and swap the total amount of damage done by the user's side with that of the opponent's side.
 * Whenever Battle Rating Down 1 is used, add +5 to the rating of the side that used it.
 * Whenever Battle Rating Down 2 is used, add +10 to the rating of the side that used it.
 * Whenever Battle Rating Up 1 is used, add +8 to the rating of the side that used it.
 * Whenever Battle Rating Up 2 is used, add +15 to the rating of the side that used it.
 * Whenever a unit is annihilated, add +5 to the rating of the side that did not lose their unit.
 * Bugged (in the code, but not functional):
 * Whenever Shouting Charge is used, add +3 to the rating of the side that used it.
 * Whenever Rance Attack, Kentarou-Kun Slash, or Commander Charge are used, add +5 to the rating of the side that used it.
 * Power of the Goddess of War and Power of the Emperor should further increase the rating of the side with them by 30 and 50 respectively.
 * If the battle ends on a strictly positive value, the player's side wins.
 * If the battle ends on a strictly negative value, the opponent's side wins.
 * If the battle ends with a value of zero, the defending side wins.

Battlefield Effect
As explained further down, the Battlefield Effect is a value that factors heavily in to damage calculation during army battles. During army battles, the value of the Battlefield Effect will be shown on the screen. The side of the screen that it is on indicates which side is benefiting from it. For calculation purposes, it is practical to treat the Battlefield Effect as the difference between the sum of modifiers to the Battlefield Effect on your side and the sum of modifiers to the Battlefield Effect on your opponent's side. The following is an exhaustive list of the factors that determine its value, all in terms of adding percentage points to the Battlefield Effect. Note that the final value of the Battlefield Effect will never go above 50% in favour of any side.
 * Each type of battlefield has its own initial value for the Battlefield Effect. These will always be in favour of the defender.
 * Fields give +0% to the Battlefield Effect.
 * Towns give +10% to the Battlefield Effect.
 * Exception: If the player is attacking a town in Yamatai controlled by the Miko Institute, then the Battlefield Effect will, before other modifiers, be +50% in the favour of the defending Miko Institute. This also remains true in National Edition.
 * Castles give +20% to the Battlefield Effect.
 * Successfully scouting will add a number of percentage points equal to the difficulty of the scout to the Battlefield Effect, in favour of the side who scouted (NB: the AI can't scout).
 * During a battle, the Ninja Arts: Battleground Construction skills can increase the Battlefield Effect in favour of the user. Per use, the first level adds 4%, the second level adds 6%, and the final level adds 8%.
 * Via the 'Prepare for next battle' command, the player can increase the Battlefield Effect that they will have at the start of the next battle in the chosen province. The Battlefield Effect that is added by this command is often referred to as the battle prep and will initially be equal to 0.
 * The difficulty of the command will be equal to the minimum of 99 and 5+floor[current battle prep ÷ 2].
 * While it is possible to battle prep over 50%, this will never give a final Battlefield Effect of over 50%.
 * Each time the command is used, your battle prep in the chosen province will increase by 7 + 3*[number of times that the 'Increase Battle Preparation to [number]' SAT bonus has been used].
 * At the start of each turn, the battle prep of every province decreases by 3 percentage points, to a minimum of 0.
 * After a battle has been fought by the player, the battle prep in the province that it was fought in will be reduced to 0. Note that the player has to actually fight the battle: Battle Permits and battles that are skipped (e.g. by right clicking on the commander selection menu) do not count. "Event battles" such as the Tenshi Sect riots will also not count and will, in fact, not add your battle prep to the Battlefield Effect in those battles.

How scouting works
NB: This was extracted from a quick dive in to the game's decompiled code and only a few minutes of in-game testing. It may be wrong.

The difficulty required for a successful scouting is calculated as follows. Be warned that this calculation is made as soon as the attack is declared, so equipping the Battlefield Correspondent in the battle menu immediately before you scout will have no effect on the difficulty. NB: As mentioned above, a successful scouting will add a number of percentage points equal to the difficulty of the scout to the Battlefield Effect, in favour of the side who scouted (which is always the player). This may have consequence for whether or not you will want to equip the Battlefield Correspondent.
 * Generate a random whole number between 1 and 4, with each option having equal probability.
 * If the player is attacking, increase the randomly generated number by:
 * 1 if the target is a field
 * 2 if the target is a town
 * 3 if the target is a castle
 * Then, if the final result is greater than 3 and any of the player's units have the Battlefield Correspondent equipped (regardless of if said unit is being used for the scouting or not), make the final result 3 and do not change it otherwise.

Summary table
Note that various costs and parameters may be affected by other factors such as items or satisfaction bonuses.

As shown by the formulae below, commanders with the same stats will perform differently depending on the base stats of their classes. These base stats are in the table below. ATK, DEF, INT, and SPD refer to the commander's individual stat, as shown on the Troops menu.
 * Attack = Base Attack + ATK * (1 + Buff Modifier) * 10
 * Defense = Base Defense + DEF * (1 + Buff Modifier) * 8
 * Magic Attack = [Base Intelligence-Diviner Guard] + INT * (1 + Buff Modifier) * 10
 * Magic Defense = INT * (1 + Buff Modifier) * 7
 * Speed is complicated, but lower SPD (Base Speed) is faster than higher.
 * [1] Max troop size is based on difficulty and the number of provinces controlled. Vassaled provinces are not counted. The base value is then multiplied by each unit's troop ratio.


 * [2] Recruit cost goes up by 20 when troop size is 500~999. Recruit cost goes up by 40 more (base + 60) when troop size is 1000~.
 * [3] It is unclear if Mikos and Monks can benefit from their 20 base INT. It does not appear to affect any of their skills, including healing.
 * [4] Monks heal back all of their troops at the start of a turn.
 * [5] As detailed in the Speed section, this number can usually be treated as 8.
 * [6] Animal units do not heal between turns.
 * [7] Interacts strangely with Diviner Guard, giving it half effectiveness against this class. Diviner Guard works by subtracting 10 from the attacker's Base Intelligence, to a minimum of 0, giving this class a decrease of -5 rather than -10.

Adjusted Troop Size
The effectiveness of new troops scales down with increased troop size:

Damage

 * Damage (Without Item Modifier) = { [ Adjusted Troop Size * (Attack - Defense)% ] * Skill Modifier } * (1 + Battlefield Effect)
 * Magical damage uses the same formula but with Magic Attack - Magic Defence instead of the physical versions.
 * Both Attack - Defence and Magic Attack - Magic Defence have a minimum value of 10.
 * The number within square brackets caps at the actual troop size.
 * If an attacker has sufficiently high attack versus the enemy's defense, they can reach maximum damage for their troop size.
 * Skills that do more than 100% damage to a single unit can cause damage to easily rise above a unit's actual troop size.
 * The Battlefield Effect is taken to be exactly as it is on the screen, but with the percentage being treated as positive for those who are benefiting from it and negative for those who are not. This means that the side which is benefiting from the Battlefield Effect will, per hit, deal more damage and take less damage than they otherwise would have.

Damage Modifiers

 * Item modifiers are calculated after skill modifiers. An example:
 * When (Oiuchi Fang equipped) Leila with 100 troops uses Royal Guard Charge against 1000 peasant rioters., she gains 50 damage after her damage doubles. Her final damage will be 250.
 * In the same way, enemy defense skills like ally guard will halve your damage before an item like Mysterious Sword Murasame adds 20%, calculated on the halved amount.
 * Items that add damage do NOT affect magic damage, only physical.
 * Field Battle Expert, Dungeon Expert, and Castle Siege Expert give a 40% increase in damage in the relevant damage type. These do not provide actual buffs, the increase in damage is not capped by the troop size limit, and they stack with all other multipliers.
 * A Footsoldier's (or Knight's) Guard halves any non-magical damage taken by them.
 * Diviner Guard subtracts 10 from the attacker's Base Intelligence, to a minimum of 0. See the Skills page for details on how it triggers and what it is equivalent to, and make note of the footnote above on the Monster units that have magical attacks.

Healing

 * Heal = Adjusted Troop Size * (INT * 6)% * Skill Modifier * (1 + Buff Modifier)

Counterattacks
The counterattack algorithm is slightly complicated, but the following is believed:
 * 1) Before any modifiers, counterattack damage appears to be equal to the amount of damage that the unit dealing the counterattack damage would have been able to do with a completely unmodified physical attack. The only modifiers that appear to apply this this are buffs, each unit's type, and each unit's stats.
 * 2) *There appears to be some safeguard in place if the damage that would've been dealt is very low. In theory, counterattacks should never do a tiny amount of damage.
 * 3) Couterattack damage is scaled based on what move is used by the unit receiving the counterattack damage. If we call the figure in step 1 "100% damage", then Side Attack guarantees 0% damage, Warrior Attack gives about 25%, and Full Power Warrior Attack gives about 50%.
 * 4) After step 2, the Dragonfly Cutter multiples this damage by 1.5 whereas Counterattack doubles this figure and Counterattack 2 triples it. These stack multiplicatively.
 * 5) Guard Shikigami will be broken by counterattack damage, reducing said damage to zero.
 * 6) Battlefield Effect appears to be irrelevant.

Tactican Buff Formulae

 * Battle Strategy C gives (Troop Size / 300 + 2) buffs.
 * Battle Strategy B gives (Troop Size / 200 + 2) buffs.
 * Battle Strategy A gives (Troop Size / 100 + 2) buffs.

Buff Strength

 * Fuu-Rin-Ka-Zan, How to Siege Castles, Japan's Field Battles Weekly, and Attack/Defense/Intelligence/Speed Luck give 50% boosts.
 * Dungeon Walker and Outcall Miko give 40% boosts.
 * Tacticians give 5% boosts per point of INT during army battles
 * Tacticians give 4 boosts with the boost strength being their level in % during solo battles.
 * In commander battles Fuu-Rin-Ka-Zan gives 30% boosts.
 * Seigan's Triplet ability gives +50% buffs.

Speed
The speed algorithm is complicated, but we think that we know the following:
 * A unit's delay until its next (or first) action is a number determined by:
 * The Base Speed of its class. See the table above, e.g. Warriors have a Base Speed of 12. The higher the number, the more their next turn is delayed. This is best seen as their slowness.
 * The character's speed stat. Having a speed stat of 0 gives +8 delay and each extra point decreases the delay by 2. For example, 9 speed is equivalent to -10 delay.
 * Speeds buffs. Regardless of their source or strength, they are equivalent to -4 delay.
 * The recovery time of the skills that the unit has used in this battle.
 * When determining the initial turn order for any given unit, add the following to its delay:
 * One of +1, +2, +3, or +4, each with equal chance.
 * +10, approximately 92% of the time. If the unit is a Diviner, add 4 instead of 10.
 * Exception: If the unit is not a Diviner and has First Move, do not add 10.

Recovery time

 * All non-passive skills have a recovery time. This is used in conjunction with the initial turn order, the unit's Base Speed, and any modifiers to the unit's delay to determine how soon the unit next acts after using said skill. Many of these recovery times are tabulated below.
 * Determining non-initial turn order may be nothing more than simple arithmetic. It has been guessed that if you have the final number that was used to determine each individual unit's initial turn order, then you could add the recovery time of their first action to that number, adjust for their Base Speeds and any relevant modifiers (e.g. -10 if 9 Spd), and then you would have the number that would be used to determine when each unit gets their second move. A unit should move before any with a higher number and move after any with a lower number.
 * For skills that require preparation, recovery time is used in determining both the delay until the prepared action is taken and the delay until their action following that.
 * For skills that consume a unit's final action (or all of them), the recovery time is used in determining their new position in the turn order when that unit receives a new action.
 * Using either version of Convert Action adds 6 points to the target's delay. This is only added once per battle, cannot be removed during the battle, and does not stack between versions of Convert Action.

Battle Permits

 * If you are not in the KTM route and have not taken them as a Second Game Bonus, then, in a start of turn event that can happen at any point after turn 60, 3G will give the player all five permits. These are equippable items.
 * Each permit corresponds to a particular unit type (Warrior, Foot Solder, Ninja, Tactician, and Diviner).
 * A unit cannot equip its corresponding permit unless it has at least 1,000 total troops.
 * Immediately after a turn is ended, each unit that can use its permit will attack and automatically take an enemy territory. This is subject to the following rules and restrictions:
 * Permits are used in the order that they appear in the item menu and are used one at a time. In other words, you can take five territories in one turn.
 * A unit cannot use its permit unless it has at least 1,000 troops alive.
 * An exhausted unit cannot use its permit.
 * Permit holders always reclaim territories in your provinces before attacking enemy provinces.
 * The last territory of a province will never be attacked.
 * Regardless of who owns the province, attacks on any Demon Army controlled territory in Senkan Nagato, Cairo, Morocco, or Amazon while in the True Route will always fail. As detailed in the Walkthrough, this will cause your permits to be permanently confiscated. This is the only way that the permits can be taken from the player or fail.
 * NB: Contrary to popular belief, this list does not include South Africa.
 * Permit users can only attack where the player would normally be able to.
 * Exception: If you are not at war with a faction that owns some territory in a province that you own, you cannot attack those territories, but a permit's use can. This type of territory can appear when a house stops its war with you without becoming a vassal, conquered, or otherwise defeated.
 * Exception: When Miki or Kouhime are missing or when you are able to attack Honnouji, the player cannot attack enemy provinces but a permit's use can.
 * The target of the attack is picked randomly from the list of all valid targets (see below).
 * Each valid enemy province is not equally likely to be attacked by a permit holder. To help decide which enemy province will be attacked, the game assigns each province a certain ID (pictured below) and it loops through all of the provinces that can be attacked from lowest ID to highest. When the first valid target is reached, the game will mark that as the target. For every valid target after that, it flips a coin. If the coin lands on heads, the current battle permit target is instead set to that corresponding territory. Regardless of the result of these coin flips, the loop continues until every province has been checked. This means that successful coin flips from provinces with higher IDs will override earlier results. This makes territories with higher IDs more likely to be targeted.
 * In an example where there are only four valid battle permit targets and they are all enemy provinces, the enemy province with the:
 * largest ID has a chance of 50% to be attacked
 * second largest ID has a chance of 25% to be attacked
 * third largest ID has a chance of 12.5% to be attacked
 * smallest ID has a chance of 12.5% to be attacked
 * In general the probabilities are 0.5, (0.5)^2, (0.5)^3,...,(0.5)^(n-1), (0.5)^(n-1), where n is the number of territories that can be attacked.
 * Unlike the above, the target of a permit attack on enemy territory in your own provinces is completely deterministic. If any such territories exists, your battle permits will always attack the one with the highest corresponding province's ID. For example, your permits will never recover territory in Owari if you control Izumo and have lost some of it.
 * After the permit has been used, some of the user's troops will die. Where n is the number of times that all of your battle permits have attacked in total during the current game (not counting this attack), the initial number of lost troops is a random number taking any value between its minimum of 101 and its maximum of 200 + 30*n. The following rules are then applied to it, in order:
 * Add 200 if the user has more than 2000 max troops.
 * If it exceeds 2000, reduce to 2000.
 * Add 500 if you are in the Demon King route,
 * Add 300 if your target is the Demon Army or the One Eyed House,
 * If it exceeds the user's current troop count, reduce to the user's troop count and subtract 1.
 * Due to these rules, it is recommended to keep permit user's troop counts at exactly 1000.
 * Glitch: Rule #2 and an oversight of rule #5's can lead to a unit having a troop count of zero. This does not appear to be able to cause any major problems. Before the next turn starts, the troops will be healed back as normal.
 * After a permit user's attack on an enemy province, events for the target house can trigger. This will not happen if the attack was on enemy territory in one of your provinces.
 * Note that being equipped with a permit affects Senhime's leaving event and can block other events.

Dungeons
Information for damage done in Dungeons can be found on the Dungeons page.

Military Power
Military power is a hidden attribute that determines the strength of each house except for the player. It determines troop sizes of commanders and the number of actions that each house can perform during their turns.

Each house starts with a default military power.

Military Power is then modified by a number of factors

Troop Sizes and Scaling
Troop sizes both of Oda recruits and of enemy houses as well as certain events, are based on a combination of
 * 1) Military power (a faction/house parameter)
 * 2) A scaling factor: a) Average number of troops OR b) number of conquered provinces
 * 3) A unique commander's unique troop multiplier
 * 4) Unique commander troop equalizers
 * 5) Difficulty setting (stars)

Average number of troops
The average number of troops is calculated as:
 * The average number of player troops excluding footsoldiers and units under 300 troops

Whenever a house creates a new generic commander, the commander's max troop count is determined by its troop type and the house's military power.

Before the troop size increase is applied, its size is randomly fluctuated by up to 30%, up or down.

In first games, the troop count formula is (50 * military power + 30) * modifier, but in second games it is (50 * military power + 60) * modifier. This final value is then randomly fluctuated by up to 30%, up or down, and will not exceed 9999 at any point during the calculation. The modifier is dependent on the commander's troop type and is: On the following occasions, houses will have both their military power and troop sizes increased:
 * 0.6 for ninjas, mikos, diviners and musketeers. Solely in the case of generating new generics, this also includes Demon Army mage units.
 * 1.0 for anything not listed here (e.g. warriors, tacticians, cavalry, most Demon Army units)
 * 1.3 for archers and monks
 * 1.5 for infected
 * 2.0 for footsoldiers
 * 3.0 for peasants
 * (for all houses) immediately at the start of the game if the difficulty is higher than 0 star.
 * (for all houses) whenever a house gets conquered or vassaled, including getting conquered by or merging with other houses. This can only happen once per defeated house.
 * (for all houses) when you send Suzume to stop Ishijijii's growth. Technically, the increase is an end of turn event that can happen once for each time that Suzume is sent. Suzume cannot be re-sent until after the increase has happened.
 * (for all houses) if the Demon Army has less than 5 provinces, the monster units have joined, and the Demon Army has less than 55 introduced commanders, then a hidden and repeatable Demon Army end of turn event can trigger. In this event, an increase will happen if the Oda House has an average max troop count, excluding footsoldiers and any commanders with less than 300 max troops, that is more than the sum of 230 and 50 times the military power of the Demon Army. Neither of these numbers can exceed 9999. The minimum value of the first number is 300. In second games, 30 is added to the last number.
 * (for a specific house) Whenever the game tries to increase enemy stat scaling for that house. This applies even if the relevant counter is already at its maximum

[*1] In addition to Military Power, the difficulty setting will also have a direct influence on troop sizes. Specifically:
 * At 0 and 1 star difficulty, all commanders' troop sizes will increase by 50 * their type's modifier
 * At 2 star difficulty, all commander's troop sizes will increase by 100 * their type's modifier
 * At 5 star difficulty, all commander's troop sizes will increase by 200 * their type's modifier

Takeda example: In a 5 star difficulty game with the Takeda family bonus....
 * Takeda starts out with 3 military power (3)
 * This gets increased by 3 due to their house bonus (6)
 * This gets increased by 3 due to 5 star (9)
 * Therefore, their generic footsoldiers will start out with (9*50+60)*2 = 720 troops on average. After conquering a house, this number is increased by 200*2, so after two houses they will have at least (720+4*200)*0.7 = 1064 troops.

Unique commanders
Most unique commanders have a unique troop multiplier. These range between 1 to 20 and affect the number of troops they get when generated.

However, some unique commanders have a static troop count that overrides all other factors. For example, Kentarou will always be recruited with exactly 300 troops, whichever faction he joins. Similarly for Suzume with 120 troops or Kojika with 100 troops.

Unique commander troop equalizers
In addition to their original troop multiplier, however, many unique commanders also have a troop equalizing function that runs whenever their faction gets a turn.

These equalizing functions generally make it so storyline characters keep up with new developments in troop scaling.

For example, in the Uesugi faction, Kenshin, Ai, Katsuko and Torako each have an equalizing function that will increase their troop size to a ratio of the maximum, if it ever falls underneath. This will not normally do anything unless the player's troops have a significant increase, and will never reduce troop size in the reverse case.

Weaken Enemy Countries
The Weaken enemy countries SAT bonus, in addition to decreasing Military Power, also has a direct impact on troop sizes, decreasing enemy troops by 40 x the relevant troop size modifier, including the random fluctuation and to a minimum of 1. This does not change with game difficulty.

Non-player Turns
At the end of your turn, other houses can do actions until they run out of action fans. Most actions decrease their action fans by 1. The number of action fans that a house has on a given turn is a random number between 1 and the maximum number of fans available for that house, which is: If the house is in political turmoil or vassaled, their action fans are reduced to 0. This also occurs if the gate is sealed on the Takuga House. If the house is neutral, their action fans are reduced to 1.
 * 1 initially,
 * 2 if their military power level is 4 or higher and the house is not Takuga,
 * 3 if their military power level is 6 or higher and the house is Mouri, Takeda or the Demon Army,
 * increased by 1 after turn 40 on 2 star difficulty,
 * increased by 2 after turn 40 on 5 star difficulty.

In the following order, the following actions are done once at the start of each house's turn and without depleting any action fans: Following this, the following actions are done in the following order. After an action is taken, the fan count is decreased by 1 and we go back to the top of this list until we run out of actions:
 * Healing commanders. If the sum of the current troop counts of all commanders in the house divided by the sum of their max troop counts is:
 * None of the below, heal all commanders by 5%
 * lower than 70% but not lower than 40%, heal all commanders by 10%
 * lower than 40%, heal all commanders by 20%
 * Note: In the oldest English translation, the messages displayed with this healing were in the wrong order. That is, the biggest healing was listed as the smallest and vice versa.
 * If the house is the Demon Army, has less than 55 commanders, the Soul Binder is active, and the turn count is a multiple of 3, add an Infected commander to their roster.
 * Restore all Monk units in the current house to their full troop counts.
 * Takeda blitz events for the Takeda House. In particular, any time that a blitz is attempted (even if no attacks happen) and any time that the message 'Takeda army is gathering' is displayed. Both of these reduce their fans to zero for this turn. See Walkthrough for details.
 * Determine if the battle limit for the house's turn is reached. These do not count as actions:
 * If the player lost two battles during this end turn (including battles against other houses)
 * If he has lost one battle, there's a 50% chance that the battle limit is reached
 * If the house already fought one battle and the difficulty is 0 star.
 * Note that blitzes like Takeda's or Demon Army's, but also hidden ones from Ashikaga, Tokugawa and Houjou are not affected by and do not count towards this limit.
 * Try to reclaim own territory:
 * 66% chance of this happening, when enemy has at least 10 fine commanders and the battle limit hasn't been reached
 * In the True route when the Oda House controls some but not all of Cairo while the Demon Army owns it and Apostle Shikibu is still alive, the Demon Army will launch multiple attacks there. These are not limited by the battle limit and do not decrease the Demon Army's action fans. In other words, the Demon Army will attack until it is no longer capable of doing so.
 * Attack enemy territory:
 * 66% chance of this happening, when enemy has at least 20 fine commanders and the battle limit hasn't been reached
 * If the enemy is Tenshi, this can only happen on even turns
 * Recruit commander:
 * 50% chance of this happening, if house is at war with you and has less than 30 commanders
 * 25% chance of this happening, if house is at war with you and has more than 29 commanders
 * 12.5% chance of this happening otherwise
 * Recruiting can only happen once per enemy turn, if the house has less than 60 commanders. There's a 50:50 chance of either picking a random commander from the recruitment pool or creating a new generic commander.

Notes:
 * Heal commanders by 10%. There is a 50% chance of this happening when the enemy's average commander health is less than 90%.
 * Increase troop size of random commander by one fifth of the player's average troop count**. If the commander's maximum troop count is smaller than twice the player's average troop count**, there is a 25% chance (50% after turn 60) of this happening.
 * Display a message ("The hannys are having fun", "Dancing around the fire", etc.)
 * fine commanders means commanders which haven't taken an action this turn and have more than 60% of their troops.


 * average troop count means the average troop count of the player excluding footsoldiers and commanders with less than 300 troops

Recruitment pool
As mentioned above, when recruiting new commanders, a house has a 50% chance to recruit a randomly picked commander from the recruitment pool. The pool starts out empty, but whenever a house is conquered (by battle or by event, not by vassaling), some of it's commanders are added to this pool. The commanders which are added are non-important named commanders (named in this context just means without a randomized name) and previously important characters, which are added manually (Takeda generals, Torako & Katsuko etc.).

This means that when trying to have a specific commander recruited from the pool by another house, it is advantageous for the pool to contain as little commanders as possible, i.e. having most houses still intact. Some houses add more commanders to the pool than others, namely: The recruitment pool has a maximum capacity of 60 commanders. Once it is full, only commanders highlighted in bold will get added by taking the place of and killing the first commanders sent to the pool. The problem with this however is that these newly added commanders will be the first ones to be killed off again. This means that when assassinating Shingen while the recruitment pool is full, only one of the Takeda generals will be added to the pool. This is yet another reason to not conquer too many houses before and after assassinating Shingen.
 * Hara: 4 generics
 * Ashikaga: Ikkyu and 6 generics
 * Iga: Ninja 14/16/33/55/68 and 4 generics
 * Tenshi: Miyoshi Akichi, Miyoshi Bko, Miyoshi Czou, Honda Masanobu and 5 generics
 * Akashi: 8 generics (2 of them have a certain death event when you encounter them in battle though)
 * Takuga: 6 generics
 * Mouri: Iwami Ginzan, Murakami Suigun, Kuu Hime and 3 generics
 * Tanegashima: 4 generics
 * Tokugawa: 5 racoon dogs and 4 generics (if Senhime runs away she will be added to the pool but uncapturable)
 * Houjou: 7 generics
 * Uesugi: Katsuko, Torako (If you conquered Uesugi and seen the event where you fuck them) and 6 generics
 * Takeda: Takeda generals (after assassinating Shingen, Akiyama Yoshifuru otherwise) and 8 generics
 * Asai-Asakura: 18 generics
 * Mikos: Himiko, Goemon, Maya, Isuzu, Souma Hayata and 2 generics
 * Shimazu: 8 generics
 * Demon Army, Dokuganryuu, Imagawa: none

Turn order
The following does not apply in FFA.

The Algorithm
The order that different houses take their turns in is randomly calculated at the start of each turn. The algorithm itself is as follows:
 * 1) Generate the list of whole numbers from 1 to 17, inclusive.
 * 2) Pick two random whole numbers between 1 and 17, inclusive.
 * 3) Swap the elements in the list that are in the positions corresponding to these two random numbers.
 * 4) Repeat steps 2 and 3 until you have done them a total of 9 times.
 * 5) Make the following substitutions: Takeda House = 1, Houjou House = 2, Uesugi House = 3, Shimazu House = 4, Miko Institute = 5, Asai-Asakura House = 6, Tanegashima House = 7, Akashi House = 8, Iga House = 9, Hara House = 10, Ashikaga House = 11, Tenshi Sect = 12, Takuga = 13, One-Eyed House = 14, Imagawa House = 15, Tokugawa House = 16, Mouri House = 17.
 * 6) Make the Oda House always move first, and the Demon Army always move last.
 * 7) You now have your turn order. The house at the top of the list will be the first to move after the Oda House and the house at the bottom will always move last before the Demon Amy.

Analysis
The following conclusions can be drawn immediately: From simulations, we can give some numbers for these last points. For example, the Takeda House will move before the Houjou House about 56% of the time and before the Mouri House about 77% of the time. This fact is demonstrated by the table below, which shows the probability (from simulation and to two decimal places) that a house in a given row moves before a house in a given column. For example, the Uesugi House will move before the Shimazu House about 55% of the time, as shown in row 3 (Uesugi) column 4 (Shimazu). Note: Further simulations reveal the following. Ignoring the Owari House and the Demon Army:
 * You will have to reload to a previous turn to change another house's turn order.
 * The Oda House always moves first.
 * The Demon Army always moves last.
 * Not counting the Oda House and the Demon Army, some houses have a higher probability to move before others.
 * The further apart two countries are in the following list, the higher the probability of the earlier moving before the latter: Takeda > Houjou > Uesugi > Shimazu > Miko > Asai-Asakura > Tanegashima > Akashi > Iga > Hara > Ashikaga > Tenshi > Takuga > One-Eyed > Imagawa > Tokugawa > Mouri.
 * Countries at top of the above list will usually move before all other members and countries at the bottom will usually move after the others.
 * The values in this table are not independent. For example, there is no way to use this table to calculate the probability that the Hara House moves before both the Takeda House and the Mouri House. However, the ordering given earlier can be used to infer that the most likely move order is Takeda, then Hara, then Mouri.
 * Each value in this table was calculated individually and therefore many values that should sum to 1 do not.
 * The results for this table have most likely not been double-checked by anyone, but the R code for generating them can be found here.
 * These are only rough numbers. Even with a much larger number of simulations, the final decimal place tends to vary.
 * Although it may appear most likely that the Takeda House will move first, the Houjou House will move second, and so on until we also have the Mouri House moving last, this turn order will almost never happen. It appears to have a less than a one in one million chance of occurring.
 * Because of how many swaps are performed, a house is more likely to be removed from its default position in the turn order than not.
 * With some small variance in the last decimal point, every house has about a 36.4% of moving from the position that it is in by default and about a 3.96% chance of moving in any particular other position. For example, the Takeda House moves first about 36.4% of the time and moves sixteenth about 3.97% of the time.

Randomness
This game uses two different kinds of randomness.

The first kind is produced by a function called "RAND" which returns a random integer in the interval between 1 and a certain specified number. This function can be treated as truly random and it governs the majority of the game's randomness. Here are a few examples: There are however "random" events that aren't determined by RAND. When a new game is started, a random array R is created. One can think of R as a list with 400 entries all containing a random integer between 1 and 60. This array will never change. It will also set an index variable i to 1. Every time a random number R(i) (meaning the i-th entry of R) is requested by the game, i will increase by 1. When i reaches 401, it will start over at 1.
 * After battle drops (affection items, textbooks)
 * The units your enemy targets in battles
 * Footsoldier guarding
 * Ero diary entries gained from levies
 * Ashikaga deciding whether or not to ask you for money
 * Troop count fluctuations of commanders joining you

Since this index will be the same, no matter how often you reload, all outcomes of events that use this kind of randomness will also be the same unless the index changes from being used by another function.

Suppose you have two ninjas trying to use assassinate, a skill that has its success or failure determined by this "deterministic" randomness. By attempting an assassination and thus changing the index i, the first ninja will change the outcome of the second ninja's assassination attempt.

Other than the "kill move probability function" there is only one other function that also uses R and that is the "Pick a random commander" function. It is used in a wide variety of events including: The outcomes of these events can be changed by changing the index i. Increasing i by even 1 may have dramatic changes to the outcome of certain events.
 * Deciding the composition of enemy forces during a non-scripted battle
 * Enemy increasing a random commander's troop size at the end of your turn
 * Shimazu brothers seducing your commanders
 * Selecting commanders to fight Apostle Gigai

For an example of how to change i, suppose that we want to capture a certain commander, but he is not appearing in battles. This means that we need to change the enemy's army composition. Maybe the enemy attacked us only once during the last end of turn phase or maybe we didn't use assassinate. If we change any of these things after reloading, the enemy's army composition during our next battle will be different.

We can also, without changing i ourselves, let normal RNG change it. For example, during the end of turn phase each introduced enemy house makes a decision (based on a 50% chance calculated by RAND) to increase a random commander's troop size. This uses the "Pick a random commander" function and thus changes i.

By combining all of these methods, we can produce a wide variety of different index values i at the start of our next turn. If we are lucky, one of them results in the desired commander showing up in our next battle.

"Certain kill move" algorithm:
Some skills, such as assassinate or whirlwind shot, have the ability to annihilate an enemy commander (without reducing their troop count) with a random probability. These skills are: If the target is not deemed important by the game, the success probability of these skills is determined using the following algorithm:
 * Assassinate
 * Assassinate 2
 * Commander snipe
 * Whirlwind shot
 * Aim and shoot

if (Commander snipe) probability = 75%

if (Assassinate) probability = 75%

if (Assassinate 2) probability = 83%

if (Whirlwind shot) probability = 75%

if (Aim and shoot) probability = 67%

if (any defending unit has assassination guard) probability -= 17% if (defender's troops * 2 < attacker's troops) probability += 8%

if (defender's troops > attacker's troops) probability -= 17%

if (defender's troops > attacker's troops + 1000) probability -= 17% if(attacker has "assassination skill +" AND defender has no actions) probability = 100%

The random number number is determined by the nth value in a list of 400 predefined random values, where n is a global variable that increments by 1 every time the list is accessed. When n reaches 401 it is reset back to 0 and the random numbers start to repeat.

Note: "assassination skill +" is a skill that only Gekkou has.

"Picking a random commander" algorithm:
A lot of events require the selection of a random commander. The algorithm that governs this process looks like this: RandomCommanderSelection( "TroopType", "SkipActed" ) for (k from 1 to 199){ i = i + 1	               // i is the global RNG index discussed earlier if (i > 400){ i = 1 }   n = R(i)                     // Picks the ith element out of the random array R    X = Commander(n)             // Picks the nth commander out of the roster // Note: Sorting your commander list doesn't change //      the commander's number. if ( (X doesn't exist) OR (X is reserved) OR        (X has acted this turn and  "SkipActed" == true) ){ do nothing }   else if ((X's troop type is "TroopType") OR ("TroopType" isn't specified)){ pick X   } } // In the rare case that the algorithm hasn't been able to pick a fitting commander, the // following loop will come into play, doing the same as the previous loop, but going // through all possible commanders from first one to last for (k from 1 to 60){ X = Commander(k) if ( (X doesn't exist) OR (X is reserved) OR        (X has acted this turn and  "SkipActed" == true) ){ do nothing }   else if ( (X's troop type is "TroopType") OR ("TroopType" isn't specified) ){ pick X   } } Note that this algorithm can be potentially unable to pick a commander. This can be the case when selecting commanders for a battle. In that instance, the enemy will send out "Gathered Footsoldiers", a weak unit with low troop count and 2 ATK/DEF/INT/SPD.

Capturing/Killing Enemy Commanders
The algorithm for checking if an annihilated enemy unit is captured or killed can be summarized as follows: The capturing/killing attempts will be made in the following order, relative to the initial positions of the enemy commanders:
 * In event battles, no commanders will be captured or killed.
 * A capturing attempt will fail immediately if:
 * the commander is marked as uncapturable. This will happen if:
 * it is marked as important (e.g. heads of house before their house is conquered)
 * it is marked as impossible to recruit (e.g. Ootomo Sourin, Kashinkoji, and Abe Heizou)
 * it is forced to appear in this battle without ever being in the corresponding side's army (e.g. generics spawned for special fights such as: Musketeer 2, Akamamushi, and Miko Mania, and also entourage units such as Nanjou Guard, Yoshihisa's woman, and Takeda Cavalry)
 * it is a Peasant or Infected unit
 * it is a generic from the Demon army, Dokuganryuu, or Imagawa.
 * two enemy commanders have already been captured or killed and the commander was either not hit by Light Attack or was defeated by the instant kill of an instant kill attack. The order that captures/kills are checked in is explained below.
 * the house that the commander belongs to has less than four commanders left, not counting commanders who require introductions but have not yet been introduced (e.g. the five Ninja units that join Iga's army when they are almost conquered).
 * Note that not all commanders who need to be introduced have introductions. For example, Ikkyu's unit will not be introduced until the event that causes Isoroku to start fighting the Oda House. However, this should not be an issue because it appears that a unit cannot appear in a battle unless it has been introduced.
 * If a commander is not important and not generic, they will be marked as introduced after their house has been conquered. This appears to work differently in National Edition.
 * the prison has not been opened.
 * Note: capturing a unit via an event (e.g. conquering the Hara House) opens the prison
 * you have more than 25 prisoners. If this is not the case, but you still have more than 20 prisoners, the probability of immediate failure is 50%.
 * The 20 and 25 figures should not count non-introduced commanders who require introductions. However, as above, this may be a non-issue.
 * The capturing attempt will be a success with a probability of 1 in n and fail otherwise. The integer n takes the value:
 * 1 (meaning certain success), if:
 * your commanders participating in the battle have both Defeated Warrior Hunt and Sticky Ground
 * the commander has been hit with Light Attack, but has not been defeated by the instant kill of an instant kill attack
 * the commander is Nanjou Ran or Yamamoto Isoroku and it is after their respective events which make them capturable have been seen
 * 2, if your commanders participating in the battle have either Defeated Warrior Hunt or Sticky Ground, but not both.
 * 5 otherwise.
 * If the following are all true, a kill attempt is made:
 * The capturing attempt on this commander has failed.
 * The commander is not important.
 * The commander is a generic.
 * The commander is not one that was forced to appear in this battle without ever being in the corresponding side's army.
 * Either two enemy commanders have not already been captured or killed or the commander in question was hit by Light Attack and not defeated by the instant kill of an instant kill attack.
 * The house that the commander belongs to is not too low on commanders (counted as above).
 * During a kill attempt, the commander is certainly killed if:
 * the unit is an Infected unit.
 * he is Abe Heizou or Asahina Hyakuman (despite having unique dialogue, they are coded as generics).
 * it was defeated by the instant kill of an instant kill attack.
 * Otherwise, there is a 50% chance that the commander will be killed during a kill attempt.

Consequences

 * Kills have a negative effect on your chances of capturing units. For capturing, this means that instant kill moves should only be used on commanders which will be processed late in the algorithm (e.g. back row) to not lower your chances of capturing earlier commanders.
 * Using Light Attack on a unit that you are able to kill but have failed to capture makes it possible to kill more than two commanders in one battle.
 * Ignoring special commanders, instant kill moves, Light Attack and Sticky Ground, these are some probabilities for capturing commanders (determined by simulation):
 * Capturing at least one commander with/without Defeated Warrior Hunt, if
 * 1 unit is annihilated: 50% / 20%
 * 2 units are annihilated: 75% / 36%
 * 3 units are annihilated: 84% / 46%
 * 4 units are annihilated: 88% / 51%
 * 5 units are annihilated: 89% / 53%
 * 6 units are annihilated: 89% / 55%
 * Capturing two commanders with/without Defeated Warrior Hunt, if
 * 2 units are annihilated: 25% / 4%
 * 3 units are annihilated: 38% / 7%
 * 4 units are annihilated: 42% / 9%
 * 5 units are annihilated: 44% / 10%
 * 6 units are annihilated: 44% / 11%

Gold
Excluding things that are exclusive to National Edition, and mostly ignoring rounding, here is a complete list of all of the methods for acquiring Gold in the game:

Enemy stat scaling
In the game's code there exists a counter for each country that roughly translates as "secret reinforcements". It has an initial value of zero, but when its value is one it gives +1 to every one of the main four combat stats for every unit in that country's army and it gives +2 if its value is two. It cannot take any other values. Detailed below is every way to change this value. Note that all of these have consequences for the enemy's troop sizes. A version of this counter also appears in Free For All mode, but will not be detailed here.
 * The Weaken Enemy Countries SAT Bonus will reduce every enemy house's value to 0.
 * If the player is not in normal (0 star) difficulty, has killed more than 3,000 enemy troops during a single battle, and if a tenth of the total number of troops that the enemy has lost during that battle is greater than the total number of troops that the player has lost during the battle, the counter will increase by one to a maximum of two.
 * There is currently no evidence to suggest that healing units will make the lost troops no longer count.
 * If you are fighting the Tenshi Sect, the number of dead enemy troops is decreased by 3,000 before any calculations are done.

Harm
Many of the game's non-event army battles do not use units that are from the enemy house's army. Instead, they load the relevant commanders in to existence specifically for that battle. Examples of such battles include fights with the H-able Shogun units and the final battles in the final province of most houses. Because these units are created for the battle rather than stored in the enemy's army, they are immune to some methods of weakening the enemy's army. To account for this, the game tracks a variable called harm in every territory of every province in the game. Before some battles where the game creates new units and/or forcibly adds existing units to a battle, the game will treat the harm value as a percentage and multiply each enemy unit's current troop size by this value.

Despite every enemy unit being modified as described above, it is possible for a modified unit to be overwritten by one that is not modified. For example, the fights with the H-able Shogun units will have Human Killer Bis and Time Killer Ari almost always replace two units that have had their troop counts modified.

Aside from the final territory of Naniwa, every territory where the harm value is set to 100 by default are areas where the game will create new units and/or forcibly add existing units to the battle and modify their troop counts as described above. Although there are other cases where the game will create new units, this list contains every occurrence that uses the harm value. Note however that this is subject to what house controls the province. For example, the Shimazu House has no such battles, but the Demon Army has many.

The following is an exhaustive list of the ways that this value is changed: The following is an exhaustive list of the ways that this value is used:
 * By default, it is set to 0.
 * At the start of the game, it is set to 100 in the final territory of every province except for Death Country, Himeji, Owari, Mid-Earth, Mikan, Sado, Saitama, Senkan Nagato, Toukaidou, Yamatai, and Yamato. Furthermore, counting from the final territory upwards, it is set to 100 in the:
 * Second territory of Senkan Nagato.
 * Third territories of Cairo, Death Country, Naniwa, Saitama, Yamatai, and Yamato.
 * Fourth territories of Shinano and Tanba.
 * At the start of each turn, if a territory's harm value is above 0, then the following is done in this order:
 * Add 10 if the game is on 0 star difficulty and add 2 otherwise.
 * If the harm value is below 30, set it to 30.
 * If the harm value is above 100, set it to 100.
 * If you attack an enemy province and win, set the harm value to 0 in the territory that you won.
 * If you attack a province that is not completely owned by its owner, lose, and have no annihilated units, then do the following to the harm value of the territory where the battle happened:
 * If the game's difficulty is not 0 star, subtract 5.
 * Otherwise, total the current troop counts and total the max troop counts of every enemy unit that fought and divide the first of these two values by the second and multiply the result by 100. After getting this final value, set harm to 0.5*harm+0.5*(that value). If this harm value is below 20, set harm to 20 instead.
 * If you trigger a revolt via Covert Action, subtract 10 from any harm values that exceed 40 in the territories that your target owns.
 * As a trigger for some Tenshi Sect attacks, see Walkthrough.
 * Before some battles where the game creates new units and/or forcibly adds existing units to the battle, the game will treat the harm value of the territory where the battle is occurring as a percentage and multiply each enemy unit's current troop size by this value. However:
 * As described above, some units may be overwritten.
 * If the controller of the province in question is the Oda House, then the game appears to treat the harm value as 0.
 * If the harm value is 0, the enemy units that should be spawned for this battle are not spawned and no change is made to their troop counts.
 * The above two points mean that the battles in question should not need to be (re-)fought if the player loses a province after conquering it.

Uesugi Kenshin's random assistance
It is possible for Uesugi Kenshin's unit to randomly appear to assist either side of a battle. There are two different mechanics for this, based on whether or not Oda is the attacking side. Note that in both cases, the game appears to spawn a new unit for her and therefore damaging her unit in the current battle should not have any future consequences.

Oda is being attacked
If all of the following are true, Kenshin's unit will have a 20% chance to appear on Oda's side of a battle. If all of the following are true and you have never seen Kenshin's unit help Oda before, this will instead be a 100% chance. In this case, her unit should always spawn in the bottom of your front row fully healed and with a very large troop count.
 * The Oda House is being attacked in a province that it owns.
 * The Uesugi House has been introduced.
 * The Uesugi House is yellow on the map. In other words, it is not conquered, vassaled, or at war.
 * The turn count is even.
 * Kenshin's unit has not appeared to aid any house during this turn.

Oda is attacking
If all of the following are true, Kenshin's unit will have a 25% chance to appear on the enemy's side of a battle. If all of the following are true and you have never seen Kenshin's unit help an enemy house before, this will instead be a 50% chance. In this case, her unit will always spawn fully healed and with a troop count based on 150% of some average of Oda's troop numbers. Her position will be in the first empty space in the enemy force. Each position is checked in the same order as it is for the capture/kill algorithm (i.e. the game starts by trying to put her in the top of the front row, failing that, it tries again in the middle of that row, and so on until it reaches the bottom of the back row).
 * The Oda House is attacking a province that it does not own.
 * The Uesugi House has been introduced.
 * The Uesugi House is yellow on the map. In other words, it is not conquered, vassaled, or at war.
 * Rance is not in the battle.
 * Kenshin's unit has not appeared to aid any house during this turn.
 * None of the following pre-battle events have played for this battle:
 * Any of the Takeda Blitz pre-battle events
 * Any auto-loss to Akashi's Nuhe
 * Isoroku attending an Ashikaga war council
 * Counting this battle, but not counting the latest battle in which she helped Oda's enemy, it has been 10 or more battles since she last helped Oda's enemy. For a battle to count, none of the above pre-battle events must have triggered for that battle and said battle must have fully started (e.g. battles where the enemy does not appear do not count). If she has never helped Oda's enemy before, treat it as if it has been more than 10 battles since she last helped.
 * The enemy force does not already consist of six units.
 * The enemy house is not the One Eyed House or the Demon Army.