public bool RegisterParty(MobileParty mb, PatrolAroundClosestLestInterruptedAndSwitchBehaviourData data)
        {
            var behaviours = AI.AIManager.GetAIBehavioursForParty(mb);

            foreach (var b in behaviours)
            {
                if (!b.IsCompatible(this))
                {
                    return(false);
                }
            }
            ModDebug.ShowMessage(mb.StringId + " will now patrol around closest settlement, unless interrupted, and, if has not been interrupted, will" +
                                 " switch settlements every " + data.minStablePatrolDays.ToString() + " to " +
                                 data.maxStablePatrolDays.ToString() + " days.");
            AIManager.RegisterAIBehaviour(mb, this);
            instances.Add(data);
            return(true);
        }
 private Settlement GetSettlementToPatrol(PatrolAroundClosestLestInterruptedAndSwitchBehaviourData dat)
 {
     return(CampaignUtils.GetClosestNonHostileCityAmong(dat.party, dat.preferredSettlements, dat.currentPatrolledSettlement));
 }
 private float GetRolledDay(PatrolAroundClosestLestInterruptedAndSwitchBehaviourData dat)
 {
     return(MBRandom.RandomFloatRanged(dat.minStablePatrolDays, dat.maxStablePatrolDays));
 }
 public PatrolAroundClosestLestInterruptedAndSwitchBehaviourData(MobileParty party, PatrolAroundClosestLestInterruptedAndSwitchBehaviourData data)
 {
     this.party                 = party;
     minStablePatrolDays        = data.minStablePatrolDays;
     maxStablePatrolDays        = data.maxStablePatrolDays;
     isValidData                = true;
     this.preferredSettlements  = data.preferredSettlements;
     currentDays                = 0;
     currentPatrolledSettlement = null;
     currentRolledDays          = 0;
 }