using System.Collections.Generic; using UnityEngine; namespace Wizard; public class AIVirtualTargetSelectInfo { public int Count; public List Candidates; public TargetSelectType Type; public bool IsForbiddenSelectedTarget; public AIRemovalType RemovalType; public AIPlayTag SelectRule; public AIVirtualTargetSelectInfo(int count, List candidates, TargetSelectType type, bool isForbiddenSelectedTarget, AIPlayTag rule = null, AIRemovalType removalType = AIRemovalType.None) { Candidates = candidates; IsForbiddenSelectedTarget = isForbiddenSelectedTarget; Type = type; Count = count; SelectRule = rule; RemovalType = removalType; } public AISelectedTargetInfo GetChoiceTargets(AIVirtualCard actor, AIVirtualField field, List playPtn, AISituationInfo situation) { List choiceTargets = actor.GetChoiceTargets(field, Candidates, playPtn, Count, situation); if (choiceTargets != null && choiceTargets.Count > 0) { return new AISelectedTargetInfo(choiceTargets, TargetSelectType.Choice); } return null; } public AISelectedTargetInfo GetBurialSelectTargets(AIVirtualTargetSelectAction situation, AIVirtualField field, AIVirtualTargetSelectInfo info, AISinglePlayptnRecord playPtnRecord, out bool isBreakPlayptn) { isBreakPlayptn = false; if (!situation.Actor.TagCollectionContainer.HasTag(AIPlayTagType.BurialRite)) { return null; } List prospectedTargetWithPlayPtnUsableCardCheck = AITargetSelectUtility.GetProspectedTargetWithPlayPtnUsableCardCheck(info.Candidates, field, situation, playPtnRecord, info.Count, (AIVirtualCard card, AIVirtualField aIVirtualField, List playPtn, AIVirtualTargetSelectAction aIVirtualTargetSelectAction) => Mathf.Abs(aIVirtualField.AllyPpTotal - card.Cost), out isBreakPlayptn); if (prospectedTargetWithPlayPtnUsableCardCheck != null && prospectedTargetWithPlayPtnUsableCardCheck.Count > 0) { return new AISelectedTargetInfo(prospectedTargetWithPlayPtnUsableCardCheck, TargetSelectType.BurialRite); } return null; } public AISelectedTargetInfo GetRuleBaseTargets(AIVirtualTargetSelectAction situation, AIVirtualField field) { if (SelectRule == null) { return null; } return AITargetSelectFilteringUtility.GetRuleBaseTargets(SelectRule, Candidates, field, situation, RemovalType); } public List GetAllDefaultTargetPattern() { List targetPatternList = null; GetDefaultTargetPatternRecursion(ref targetPatternList, 0); return targetPatternList; } private void GetDefaultTargetPatternRecursion(ref List targetPatternList, int targetIndex, List selectedTargets = null) { for (int i = 0; i < Candidates.Count; i++) { if (targetIndex == 0) { selectedTargets = new List(); } AIVirtualCard item = Candidates[i]; if (IsForbiddenSelectedTarget || !selectedTargets.Contains(item)) { selectedTargets.Add(item); if (targetIndex < Count - 1) { targetIndex++; GetDefaultTargetPatternRecursion(ref targetPatternList, targetIndex, selectedTargets); } else { AISelectedTargetInfo element = new AISelectedTargetInfo(selectedTargets, TargetSelectType.Default, RemovalType); targetPatternList = AIParamQuery.AddElementToList(element, targetPatternList); } } } } }