Example #1
0
        private void recruitAll(MobileParty recruiter, Settlement settlement)
        {
            DefaultPartyWageModel wageModel = new DefaultPartyWageModel();

            foreach (Hero notable in settlement.Notables)
            {
                List <CharacterObject> recruitables = HeroHelper.GetVolunteerTroopsOfHeroForRecruitment(notable);
                for (int recruitableIndex = 0; recruitableIndex < recruitables.Count; recruitableIndex++)
                {
                    CharacterObject recruitable = recruitables[recruitableIndex];
                    if (recruitable != null && hasSufficientRelationsship(notable, recruitableIndex))
                    {
                        int recruitCost = wageModel.GetTroopRecruitmentCost(recruitable, Hero.MainHero);

                        if (recruitCost > recruiter.PartyTradeGold)
                        {
                            continue;
                        }

                        recruiter.MemberRoster.AddToCounts(recruitable, 1);
                        GiveGoldAction.ApplyForPartyToSettlement(recruiter.Party, settlement, recruitCost);
                        for (int i = 0; i < notable.VolunteerTypes.Length; i++)
                        {
                            if (recruitable == notable.VolunteerTypes[i])
                            {
                                notable.VolunteerTypes[i] = null;
                                break;
                            }
                        }
                    }
                }
            }
        }