Sengoku Rance:Parameters & Formulae

National stats

 * Cost (コスト) / Nation power (国力) - Cost is the total cost of all your commanders combined. Nation power is the sum of nation powers of the provinces you control. The game will not allow you to hire a new commander who will put your total cost over the nation power or hire a number of troops that will increase a commander's cost such that your total cost will exceed your national power, although the plot may force a commander to join who will make your cost exceed your national power. If your total cost exceeds your nation power, you will receive half as much income from the provinces under your control every turn.


 * Satisfaction (満足度) - When Rance achieves various objectives in the game, his satisfaction increases. Satisfaction can be used to trigger various beneficial events. See Sengoku Rance:Satisfaction bonuses for more information on the bonuses.


 * Gold (金) - Gold is the monetary standard of the land. You gain gold from lands under your control, events in the game and some of your unit's skills. Gold can be used for increasing a commander's maximum troops size or replenishing dead troops, it can also be used for several events within the storyline.


 * Score (得点) - The base score for the first game is 60 points. Every turn you lose one point. For every objective you achieve, you gain a certain number of points. Don't worry about the score on your first time playing through it; you are expected to get a score of 0. On subsequent playthroughs you can set the game to a higher difficulty, and you'll start off with more points depending on the difficulty. These points are used for buying bonuses for your second and subsequent playthroughs and only your highest score counts. See Sengoku Rance:Second Game Bonuses for the bonuses you can buy.

Personal stats

 * Name
 * Relationship - has two components:
 * Posture (red-hate, orange-normal, blue-trust, pink-love)
 * Progress (the smiley faces)
 * HP - Only used in commander/dungeon battles.
 * Level / Level Limit - the current level and the maximum level for this character. A character's level limit cannot be changed in game. Character level can be increased by:
 * as a reward option for increasing the relationship with the character.
 * by giving the character a Happiness Pokkuru (see Sengoku Rance:Items).
 * when completing the last level of a dungeon (for the first time for that dungeon), every commander gains a level (even if they were not used in the dungeon)
 * by special events. In particular Ogawa Kentarou has an amazing level up ability in most game routes.
 * Note: Your level only affects dungeon/commander battles (and greatly reduces enemy damage if yours is higher [Rance/Kentarou can go to 99]). It doesn't influence army battles, outside of the damage done by attack where the commander personally attacks (e.g. Commander Charge). (see Sengoku_Rance:Dungeon)
 * Job - The commander may have different job type than his fellow troop soldiers. The job of the commander is only important in dungeon/commander battles
 * Skills

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 exact mechanics of Battle Rating, the slider described here, are not known. However, what follows appears to be true. Like with Battlefield Effect, it is practical to treat the Battle Rating as the difference between the sum of modifiers to the rating on your side and the sum of modifiers to the rating on your opponent's side. With this model, we can say that if we treat the Battle Rating as a number that starts out at zero, then: Code also exists for making Power of the Goddess of War and Power of the Emperor further increase Battle Rating, but this seems impossible to trigger.
 * 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.
 * Before any of the modifiers below, the Battle Rating for any given side appears to be 100 times the amount of damage that the side in question has done divided by the total amount of damage done in the battle. Healing moves do not change these values.
 * 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.
 * Whenever Whitty Comeback is used, swap both Battle Ratings and swap the total amount of damage done by the user's side with that of the opponent's side.
 * Whenever Shouting Charge is used, add +3 to the rating of the side that used it. This appears to be glitched and is not coded to trigger.
 * Whenever Rance Attack, Kentarou-Kun Slash, or Commander Charge are used, add +5 to the rating of the side that used it. These appear to be glitched and are not coded to trigger.
 * 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.

Battlefield Effect
As explained in the next section, the Battlefield Effect is a value which 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
Different troop types with the same stats will work out differently.

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


 * Attack = Base Attack + ATK * (1 + Buff Modifier) * 10
 * Defense = Base Defense + DEF * (1 + Buff Modifier) * 8
 * Note - A Footsoldier's Guard decreases the non-magical damage taking by the Footsoldier by 50%.
 * Magic Attack = Base Intelligence + INT * (1 + Buff Modifier) * 10
 * Magic Defense = INT * (1 + Buff Modifier) * 7
 * Speed is complicated (see the section below), but the lower Base Speed is better than higher Base Speed.


 * [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] Monks heal back all of their troops at the start of a turn.
 * [4] Animal units do not heal between turns.
 * The effectiveness of new troops scales down with increased troop size. See

Damage Modifiers Healing Formula Counterattacks
 * Damage (Without Item Modifier) = { [Adjusted Troop Size * (Attack - Defense)%] * Skill Modifier} * (1 + Battlefield Effect)
 * 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 benfitting from it and negative for those who are not. This means that the side which is benfitting from the Battlefield Effect will, per hit, deal more damage and take less damage than they otherwise would have.
 * 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.
 * 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.
 * Heal = Adjusted Troop Size * (INT * 3)% * Skill Modifier * (1 + Buff Modifier)

The counterattack algorithm is slightly complicated, but the following is believed: Manual Buff Formula Buff Strength
 * 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.
 * Strategy C gives (Troop Size / 300 + 2) buffs.
 * Strategy B gives (Troop Size / 200 + 2) buffs.
 * Strategy A gives (Troop Size / 100 + 2) buffs.
 * 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:
 * With the sole exception of the First Move skill, base speed (see the table above) and the normal speed stat are what is used to determine where a unit will be in the turn order at the start of a battle. Having 0 speed is equivalent to having +8 to base speed and with each extra point of speed (up to 9) this decreases by 2. For example, 9 speed is equivalent to -10 base speed.
 * Speed buffs, regardless of their source or strength, are equivalent to -4 base speed.
 * If and only if the game is determining the initial turn order, the follow apply:
 * Each unit is randomly given either +1, +2, +3, or +4 to its base speed. Each of these outcomes is equally probable.
 * Approximately 92% of the time, add 10 to the base speed of the unit that the game is currently determining the turn order for. If the unit in question is a Diviner, this is instead reduced to 4. If the unit is not a Diviner and does have First Move, this is reduced to 0.
 * All skills in the game have a recovery time. This is used in conjunction with the initial turn order, the unit's base speed, and any modifies to the unit's base speed 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. From skimming the code, it has been guessed that if you have figured out what final number was used to determine each individual unit's initial turn order, then you could add the recovery time of their first action to that earlier number, adjust for base speed and the modifiers to it (e.g. subtract ten if 9 Spd), and then you would have the number that would be used to determine when the unit gets their second move. Using this number should be fairly simple - the unit in question should move before anyone with a higher number and move after anyone with a lower number.
 * In the case of skills that require preparation, recovery time determines both the number of turns until the prepared action is taken and the number of turns until the next action can be taken after the preprepared skill is used.
 * For skills which consume the unit's final action (including skills which consume all of them), the recovery time determines their position once the character receives Convert Action. Using any version of Convert Action on a unit appears to effectively add 6 points to their base speed for this battle, but this does not stack.

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 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 holders can only attack where the player would normally be able to.
 * 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 rule #5 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.

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

Enemy Military Power
Military power is a hidden number that determines the enemy's strength. It determines the troop sizes of enemy commanders and the amount of actions they can perform each turn (more on that in the next section)

At the start of the game the houses start out with the following military power levels: Additionally a house's military power will increase by 3 if their house bonus is picked.
 * 1 for Hara, Ashikaga, Iga, Akashi, Tanegashima, Imagawa
 * 2 for Miko Institute, Asai-Asakura, Tenshi, Tokugawa, Takuga
 * 3 for Takeda, Houjou, Uesugi
 * 4 for Shimazu
 * 5 for Demon Army, Mouri
 * 6 for Dokuganryuu

Whenever a house creates a new generic commander for themselves, the commander's troop count is determined by it's troop type and the house's military power. The formula is (50 * military power + 30) * modifier. In second games it is (50 * military power + 60) * modifier. This number is then randomly fluctuated by +-30%. The modifier is dependent on the commander's troop type and is On some occasions, houses will have their military power and troop sizes increased. Those occasions are: The increases in military power and troop sizes are: The enemies military power and troop sizes can also be decreased by picking the satisfaction bonus "Weaken enemy countries". For all houses currently at war with you, this decreases their military power by 1 and their troop sizes by 40 times the modifier mentioned above. This does not increase with game difficulty.
 * 0.6 for ninjas, mikos, diviners and musketeers
 * 1.0 for warriors, tacticians, cavalry, 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 other houses)
 * (for all houses) when you send Suzume to stop Ishijijii's growth in the true route.
 * (for all houses) during a Demon Army event when Oda has an average troop count (excluding footsoldiers and commanders with less than 300 troops) that is more than 200 troops higher than the average troop count of the demon army.
 * (for a specific house) After a battle take the total amount of troop damage taken by the enemy (DE) and by the player (DP). If DE is larger than 3000 AND larger than 10 times DP, increase military power and troop sizes of the country. In fights against Tenshi, DE is decreased by 3000 (probably to make up for weak peasant units with high troop counts)
 * At 0 and 1 star difficulty, the military power will be increased by 1 and all commander's troop sizes will increase on average by 50 * modifier
 * At 2 star difficulty, the military power will be increased by 2 and all commander's troop sizes will increase on average by 100 * modifier
 * At 5 star difficulty, the military power will be increased by 5 and all commander's troop sizes will increase on average by 200 * modifier

There are also some other events that change a house's military power, but not their existing commander counts, which are:
 * Increase Iga's military power by 5 when Iga reemerges if you conquered it without killing/recruiting Inukai
 * When remnants of Iga or Hara emerge, set their military power level to 1/50 of the average troop size of Oda (excluding footsoldiers and commanders with less than 300 troops)
 * Increase the Demon Army's military power by 20, when Miki becomes the demon lord.

Example
Let's say we play a 5 star difficulty game with the Takeda family bonus and want to capture a footsoldier with at least 1000 troops to get a battle permit running as quickly as possible. What troop counts can we expect from Takeda's generic footsoldier commanders?

Takeda starts out with 3 military power. This gets increased by another 3 from picking their house bonus. This means, their generic footsoldiers will start out on average with ((3+3)*50+60)*2 = 720 troops. After conquering Hara and Ashikaga, this number is increased by 200*2 each, so they will have at least (720+800)*0.7 = 1064 troops.

Enemy Turns
During an enemy turn a country can take a number of actions. Most of those actions decreases the enemy's action fans by 1. If the enemy doesn't have any fans left, his turn ends. The number of action fans on a given turn is a random number between 1 and the maximum number of fans available for that enemy, which is If the house is in political turmoil or vassaled, their action fans are reduced to 0. 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

The following actions are taken once at the start of the enemy's turn without depleting any action fans: Then the following actions are done in descending order. After an action is taken, the fans are decreased by 1 and we start back at the top again
 * Healing commanders. If the average health (max troops / current troops of all commanders) is
 * higher than 70%, heal all commanders by 5%
 * lower than 70%, heal all commanders by 10%
 * lower than 40%, heal all commanders by 20%
 * If the house is the Demon Army, has less than 55 commanders, the Soul Binder is active and the current turn is a multiple of 3, add an Infected commander to the roster.
 * determine if the battle limit for the house's turn is reached. (This doesn't count as an action)
 * 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 player controls some territories in Cairo while Apostle Shikibu is still alive, the Demon Army will launch multiple counter attacks on Cairo, which are not limited by the battle limit and don't decrease the Demon Army's action fans.
 * 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%
 * 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**, theres 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.
 * 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
 * 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 order in which different houses take their turns is randomly calculated at the start of the turn, meaning that you would have to reload to the previous turn to change the order. However there are some anomalies due to how the order is calculated, namely that the Demon Army always moves last and that some houses have a higher probability to move first than others. The order from most likely to move first to least likely is:

Takeda > Houjou > Uesugi > Shimazu > Miko > Asai-Asakura > Tanegashima > Akashi > Iga > Hara > Ashikaga > Tenshi > Takuga > Dokuganryuu > Imagawa > Tokugawa > Mouri

For example simulations show Takeda moving before Houjou about 56% of the time and Takeda moving before Mouri about 77% of the time. In general, the further two countries are apart on the above list, the higher the discrepancy.

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. named guards such as Nanjou Guard)
 * it is a Peasant 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.
 * 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.
 * 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:
 * At the start of the game, you will have 3,000 Gold. With a Second Game Bonus, this amount can be increased to 13,000.
 * Start of turn proceedings:
 * At the start of each turn, before the Gold for starting that turn is collected, the player's current Gold is increases by 4% for every commander under the player's control who has the Asset Tech skill. This can stack up to a maximum of 20% of the current Gold, but will only give either that amount or 2000 Gold, whichever is lower.
 * After this, the player will gain an amount of Gold equal to 60 times their NP. For each Gold Statue that the player has equipped to a commander, this amount will be multiplied by 1.1. After this, the amount will then be multiplied by 1+0.05*[number of possessed commanders with the Merchant skill]. Finally, rounding down, the end result of these calculations will be halved if the player's NP cost exceeds their total NP.
 * Levies - whenever a province is conquered by the Oda House for the first time, an event will be made available which will allow the player to impose a levy. If this is done immediately after the conquer, it will gain the Oda House 2,000 Gold. However, for each turn that passes with the province in question still under the control of the Oda House, the amount which can be levied will increase by 100 Gold, to a maximum of 5,000.
 * Botan Hunt - on the first time they are done, the Botan Hunt in Owari will award the player 500 Gold and the Botan Hunt in Sado will award the player 700 Gold. However, each time that the Botan Hunt in Owari is done, it will increase the reward for every future Botan Hunt by 50 Gold. Similarly, the Botan Hunt in Sado will increase the reward for every future Botan Hunt by 100 Gold.
 * Headfish Hunt - each successful Headfish Hunt awards the player 5,000 Gold.
 * Monkey Hunt in Saitama - when successfully completed, awards the player 5,000 Gold.
 * Colourless event with Kouhime - prior to the first gourd being broken, or the KTM route being entered, 100 Gold can be obtained by doing a colourless event with Kouhime.
 * Iga dirty plan - the one-off event, 'Dirty plan (What's Inukai's is mine)' awards the player 2,000 Gold.
 * Oppressing the Tenshi Sect - the one-off event, 'Oppress the Tenshi Sect to get money' awards the player 500 Gold.
 * 'Get money: 5000' SAT Bonus - self-explanatory.
 * Sado dungeon - when it is cleared for the first time, the player will be awarded 5,000 Gold.
 * The Loot skill - in every battle where it is used, the player will gain an amount of Gold equal to 10 times the NP that they had when the move was used. It does not have to deal damage for this to happen.
 * Selling troops - explained elsewhere on this page.

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. 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
Placeholder.

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:
 * Rance's fan from Iga tries to kill him
 * Any of the Takeda Blitz pre-battle events
 * Any auto-loss to Isoroku or Akashi's Nuhe
 * Isoroku attending an Ashikaga war council
 * Kouhime being told about a strange unit in the enemy's army. Note that if you do not have Kouhime, this event can be counted as triggering without the event actually being played.
 * Iehisa asks Kazuhisa if he is thinking of surrendering
 * Toshihisa wonders if his oldest brother will appear
 * 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.