Beispiel #1
0
        private bool FindRandomVisitPlace(TAI instance, uint citizenId, ref TCitizen citizen, int doNothingProbability, ushort visitBuilding)
        {
            int targetType = touristAI.GetRandomTargetType(instance, doNothingProbability);

            if (targetType == 1)
            {
                Log.Debug(TimeInfo.Now, $"Tourist {GetCitizenDesc(citizenId, ref citizen)} decides to leave the city");
                touristAI.FindVisitPlace(instance, citizenId, visitBuilding, touristAI.GetLeavingReason(instance, citizenId, ref citizen));
                return(true);
            }

            if (CitizenProxy.GetInstance(ref citizen) == 0 && !touristAI.DoRandomMove(instance))
            {
                return(false);
            }

            if (!IsChance(GetGoOutChance(CitizenProxy.GetAge(ref citizen))))
            {
                FindHotel(instance, citizenId, ref citizen);
                return(true);
            }

            switch (targetType)
            {
            case 2:
                touristAI.FindVisitPlace(instance, citizenId, visitBuilding, touristAI.GetShoppingReason(instance));
                Log.Debug(TimeInfo.Now, $"Tourist {GetCitizenDesc(citizenId, ref citizen)} stays in the city, goes shopping");
                break;

            case 3:
                Log.Debug(TimeInfo.Now, $"Tourist {GetCitizenDesc(citizenId, ref citizen)} stays in the city, goes relaxing");
                touristAI.FindVisitPlace(instance, citizenId, visitBuilding, touristAI.GetEntertainmentReason(instance));
                break;
            }

            return(true);
        }
Beispiel #2
0
 private bool ShouldRealizeCitizen(TAI ai)
 {
     return(touristAI.DoRandomMove(ai));
 }