private void SetLootedResources(IBarbarianTribe barbarianTribe, IBattleManager battle, ITroopObject troopObject, ICombatGroup combatGroup) { if (!battle.BattleStarted) { return; } // Calculate bonus Resource resource = battleFormula.GetBonusResources(troopObject, originalUnitCount, troopObject.Stub.TotalCount); // Add barbarian tribe bonus resource.Add(formula.BarbarianTribeBonus(barbarianTribe.Lvl, battle, combatGroup, barbarianTribe)); // Copy looted resources since we'll be modifying the troop's loot variable var looted = new Resource(troopObject.Stats.Loot); // Add bonus to troop object Resource returning; Resource actual; Resource cap = new Resource(troopObject.Stub.Carry / 1, troopObject.Stub.Carry / 2, troopObject.Stub.Carry / Config.battle_loot_resource_iron_ratio, troopObject.Stub.Carry / 1, troopObject.Stub.Carry / Config.battle_loot_resource_labor_ratio); troopObject.Stats.Loot.Add(resource, cap, out actual, out returning); // Update battle report view with actual received bonus battle.BattleReport.SetLootedResources(combatGroup.Owner, combatGroup.Id, battle.BattleId, looted, actual); }