public static RecruitmentResults RecruitPrisoners(PartyVM partyVm, PartyScreenLogic partyScreenLogic)
        {
            RecruitmentResults results = new RecruitmentResults();

            List <PartyCharacterVM> recruitablePrisoners = GetRecruitablePrisoners(partyVm);

            if (recruitablePrisoners.IsEmpty())
            {
                Global.Helpers.Message("No prisoners available to recruit");
                return(results);
            }

            int partySpace = partyScreenLogic.RightOwnerParty.PartySizeLimit - partyScreenLogic.MemberRosters[1].TotalManCount;

            partySpace = partySpace < 0 ? 0 : partySpace;
            if (partySpace == 0)
            {
                if (States.HotkeyControl)
                {
                    Global.Helpers.Message("Party limit reached! Limit overriden, proceeding...");
                }
                else
                {
                    Global.Helpers.Message("Party limit reached! Cannot recruit prisoners. (Hold control to override)");
                    return(results);
                }
            }

            List <Tuple <PartyCharacterVM, PartyScreenLogic.PartyCommand> > commands = PrepareRecruitmentCommands(recruitablePrisoners, partySpace, ref results, partyVm);

            if (commands.Count == 0)
            {
                Global.Helpers.Message("No prisoners recruited");
            }
            else
            {
                ExecuteCommands(commands, partyVm, partyScreenLogic);
            }

            return(results);
        }
        private static List <Tuple <PartyCharacterVM, PartyScreenLogic.PartyCommand> > PrepareRecruitmentCommands(IEnumerable <PartyCharacterVM> recruitablePrisoners, int partySpace, ref RecruitmentResults results, PartyVM partyVm)
        {
            List <Tuple <PartyCharacterVM, PartyScreenLogic.PartyCommand> > commands = new List <Tuple <PartyCharacterVM, PartyScreenLogic.PartyCommand> >();

            CharacterObject playerSelectedCharacter = partyVm.CurrentCharacter.Character;

            foreach (PartyCharacterVM prisoners in recruitablePrisoners)
            {
                if (partySpace == 0 && !States.HotkeyControl)
                {
                    break;
                }

                int prisonerCount      = prisoners.NumOfRecruitablePrisoners;
                int prisonersToRecruit = States.HotkeyControl ? prisonerCount : Math.Min(prisonerCount, partySpace);
                int numOfRemainingRecruitablePrisoners = prisonerCount - prisonersToRecruit;
                results.RecruitedTypes++;
                results.RecruitedTotal += prisonersToRecruit;
                partySpace             -= prisonersToRecruit;

                partyVm.CurrentCharacter.Character = prisoners.Character;

                Campaign.Current.GetCampaignBehavior <IRecruitPrisonersCampaignBehavior>().SetRecruitableNumber(partyVm.CurrentCharacter.Character, numOfRemainingRecruitablePrisoners + 1);

                PartyScreenLogic.PartyCommand recruitCommand = new PartyScreenLogic.PartyCommand();
                recruitCommand.FillForRecruitTroop(prisoners.Side, prisoners.Type, prisoners.Character, prisonersToRecruit);
                commands.Add(new Tuple <PartyCharacterVM, PartyScreenLogic.PartyCommand>(prisoners, recruitCommand));

                partyVm.CurrentCharacter.UpdateRecruitable();
            }

            partyVm.CurrentCharacter.Character = playerSelectedCharacter;

            return(commands);
        }