Marek15
Veteran
Summary:
The number of troops sacrificed when trying to escape from battle increases with high tactics skill instead of decreasing. For example a sacrifice of 36 troops at 0 tactics would become 84 troops at 300 tactics.
Also the number of troops sacrificed when breaking into or out of a siege is not affected by the tactics skill.
This is caused by bad math in "DefaultTroopSacrificeModel.cs". Specifically methods "GetNumberOfTroopsSacrificedForTryingToGetAway" and "GetLostTroopCount".
To fix this replace these lines of code:
With this:
The number of troops sacrificed when trying to escape from battle increases with high tactics skill instead of decreasing. For example a sacrifice of 36 troops at 0 tactics would become 84 troops at 300 tactics.
Also the number of troops sacrificed when breaking into or out of a siege is not affected by the tactics skill.
This is caused by bad math in "DefaultTroopSacrificeModel.cs". Specifically methods "GetNumberOfTroopsSacrificedForTryingToGetAway" and "GetLostTroopCount".
To fix this replace these lines of code:
Code:
//GetNumberOfTroopsSacrificedForTryingToGetAway
SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Tactics, DefaultSkillEffects.TacticsTroopSacrificeReduction, CharacterObject.PlayerCharacter, ref stat1, -1, true, 0);
ExplainedNumber stat2 = new ExplainedNumber((float) Math.Max(((double) ofRegularMembers * Math.Pow((double) Math.Min(val1, 3f), 1.3) * 0.1 / (2.0 / (2.0 + ((double) stat1.ResultNumber - 1.0) * 10.0)) + 5.0).Round(), 1), false, (TextObject) null);
//GetLostTroopCount
ExplainedNumber stat1 = new ExplainedNumber(0.01f, false, (TextObject) null);
SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Tactics, DefaultSkillEffects.TacticsTroopSacrificeReduction, CharacterObject.PlayerCharacter, ref stat1, -1, true, 0);
float num2 = stat1.ResultNumber - 0.01f;
Code:
//GetNumberOfTroopsSacrificedForTryingToGetAway
SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Tactics, DefaultSkillEffects.TacticsTroopSacrificeReduction, CharacterObject.PlayerCharacter, ref stat1, -1, false, 0);
ExplainedNumber stat2 = new ExplainedNumber((float) Math.Max(((double) ofRegularMembers * Math.Pow((double) Math.Min(val1, 3f), 1.3) * 0.1 * (double) stat1.ResultNumber + 5.0).Round(), 1), false, (TextObject) null);
//GetLostTroopCount
ExplainedNumber stat1 = new ExplainedNumber(1f, false, (TextObject) null);
SkillHelper.AddSkillBonusForCharacter(DefaultSkills.Tactics, DefaultSkillEffects.TacticsTroopSacrificeReduction, CharacterObject.PlayerCharacter, ref stat1, -1, true, 0);
float num2 = stat1.ResultNumber - 1f;