private void ExecuteTransferWounded() { try { var enumerator = new PartyCharacterVM[_mainPartyList.Count]; _mainPartyList?.CopyTo(enumerator, 0); foreach (PartyCharacterVM character in enumerator) { if (character?.WoundedCount > 0) { if (character.IsTroopTransferrable) { int wounded = Math.Min(character.WoundedCount, character.Number); character.OnTransfer(character, -1, wounded, character.Side); character.InitializeUpgrades(); } } } _partyVm?.ExecuteRemoveZeroCounts(); _parent.RefreshValues(); } catch (Exception e) { Logging.Log(Logging.Levels.ERROR, $"Transfer Wounded Troops: {e}"); Utilities.DisplayMessage($"PSE Transfer Wounded Exception: {e}"); } }
//TODO: Switch to cleaner RecruitByDefault=false logic. public void RecruitAll() { bool shouldIgnoreLimit = Utilities.IsControlDown(); int amountUpgraded = 0; try { var enumerator = new PartyCharacterVM[_mainPartyPrisoners.Count]; _mainPartyPrisoners.CopyTo(enumerator, 0); foreach (PartyCharacterVM prisoner in enumerator) { if (prisoner == null) { continue; } int remainingPartySize = _partyLogic.RightOwnerParty.PartySizeLimit - _partyLogic .MemberRosters[(int)PartyScreenLogic.PartyRosterSide.Right] .TotalManCount; if (remainingPartySize > 0 || shouldIgnoreLimit) { if (prisoner.IsTroopRecruitable) { _partyVM.CurrentCharacter = prisoner; if (PartyScreenConfig.PrisonersToRecruit.TryGetValue(prisoner.Character.StringId, out int val)) { if (val == -1 && PartyScreenConfig.ExtraSettings.RecruitByDefault) { continue; } } else if (!PartyScreenConfig.ExtraSettings.RecruitByDefault) { continue; } RecruitPrisoner(prisoner, shouldIgnoreLimit ? prisoner.NumOfRecruitablePrisoners : remainingPartySize, ref amountUpgraded); } } else { if (PartyScreenConfig.ExtraSettings.ShowGeneralLogMessage) { InformationManager.DisplayMessage( new InformationMessage($"Party size limit reached, {amountUpgraded} recruited!")); } return; } } if (PartyScreenConfig.ExtraSettings.ShowGeneralLogMessage) { InformationManager.DisplayMessage(new InformationMessage($"Recruited {amountUpgraded} prisoners")); } _parent.RefreshValues(); } catch (Exception e) { Logging.Log(Logging.Levels.ERROR, $"Recruit Prisoners: {e}"); Utilities.DisplayMessage($"PSE Recruit Prisoner Exception {e}"); } }