Ejemplo n.º 1
0
        static void ActivityCallback()
        {
            Logger.Append("Alien Activity Alarm Triggered");

            if (Household.AlienHousehold == null || Household.AlienHousehold.NumMembers == 0)
            {
                Logger.Append("Alien Activity: Alien Household Null or Empty");
                return;
            }

            float chance = GetActivityChance();

            if (RandomUtil.RandomChance(chance))
            {
                Logger.Append("Alien Activity: Chance Passed " + chance);

                List <SimDescription> aliens = GetAliens();

                if (aliens == null)
                {
                    Logger.Append("Alien Activity: No valid aliens.");
                    return;
                }

                SimDescription alien = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);

                chance = GetAbductionChance();

                if (RandomUtil.RandomChance(chance))
                {
                    Logger.Append("Alien Abduction: Chance Passed " + chance);

                    chance = GetAbductionChance(true);

                    Lot targetLot;
                    Sim abductee;

                    if (IsActiveTarget(chance))
                    {
                        Logger.Append("Alien Abduction (Active): Chance Passed " + chance);

                        List <Sim> abductees = GetAbductees(Household.ActiveHousehold);

                        if (abductees == null)
                        {
                            Logger.Append("Alien Abduction (Active): No Valid Abductees");
                            ResetAbductionHelper();
                            return;
                        }

                        abductee = RandomUtil.GetRandomObjectFromList <Sim>(abductees);

                        if (!CanSimBeAbducted(abductee))
                        {
                            Logger.Append("Alien Abduction (Active): Can't Abduct Target");
                            ResetAbductionHelper();
                            return;
                        }

                        targetLot = abductee.LotCurrent;
                    }
                    else
                    {
                        Logger.Append("Alien Abduction (Active): Chance Failed " + chance);

                        List <Lot> lots = GetLots();

                        if (lots == null)
                        {
                            Logger.Append("Alien Abduction (Non-Active): No Valid Lots");
                            ResetAbductionHelper();
                            return;
                        }

                        targetLot = RandomUtil.GetRandomObjectFromList <Lot>(lots);

                        List <Sim> abductees = GetAbductees(targetLot);

                        if (abductees == null)
                        {
                            Logger.Append("Alien Abduction (Non-Active): No Valid Abductees");
                            ResetAbductionHelper();
                            return;
                        }

                        abductee = RandomUtil.GetRandomObjectFromList <Sim>(abductees);

                        if (!CanSimBeAbducted(abductee))
                        {
                            Logger.Append("Alien Abduction (Non-Active): Can't Abduct Target");
                            ResetAbductionHelper();
                            return;
                        }
                    }

                    AlienAbductionSituationEx.Create(alien, abductee, targetLot);
                }
                else
                {
                    Logger.Append("Alien Abduction: Chance Failed " + chance);

                    chance = GetVisitChance();

                    if (RandomUtil.RandomChance(chance))
                    {
                        Logger.Append("Alien Visit: Chance Passed " + chance);

                        chance = GetVisitChance(true, alien);

                        Lot farthestLot, targetLot;
                        Sim visitor;

                        if (IsActiveTarget(chance))
                        {
                            Logger.Append("Alien Visit (Active): Chance Passed " + chance);

                            targetLot   = Household.ActiveHouseholdLot;
                            farthestLot = LotManager.GetFarthestLot(targetLot);
                            visitor     = alien.InstantiateOffScreen(farthestLot);
                        }
                        else
                        {
                            Logger.Append("Alien Visit (Active): Chance Failed " + chance);

                            List <Lot> lots = GetLots();

                            if (lots == null)
                            {
                                Logger.Append("Alien Visit (Non-Active): No Valid Lots");
                                ResetAbductionHelper();
                                return;
                            }

                            targetLot   = RandomUtil.GetRandomObjectFromList <Lot>(lots);
                            farthestLot = LotManager.GetFarthestLot(targetLot);
                            visitor     = alien.InstantiateOffScreen(farthestLot);
                        }

                        AlienSituation.Create(visitor, targetLot);
                    }
                    else
                    {
                        Logger.Append("Alien Visit: Chance Failed " + chance);
                    }
                }
            }
            else
            {
                Logger.Append("Alien Activity: Chance Failed " + chance);
            }

            ResetAbductionHelper();
        }
Ejemplo n.º 2
0
        static void AlienActivityCallback()
        {
            if (Abductor.Settings.mDebugging)
            {
                StyledNotification.Format format = new StyledNotification.Format("Alien Visitation Alarm triggered!",
                                                                                 StyledNotification.NotificationStyle.kDebugAlert);
                StyledNotification.Show(format);
            }

            if (Household.AlienHousehold == null || Household.AlienHousehold.NumMembers == 0)
            {
                Logger.Append("Alien Activity Alarm: Alien Household Null or Empty");
                return;
            }

            float chance = GetActivityChance();

            if (!RandomUtil.RandomChance(chance))
            {
                Logger.Append("Alien Activity Alarm: Chance Fail " + chance);
                ResetAbductionHelper();
                return;
            }

            List <SimDescription> aliens = GetAliens();

            if (aliens == null)
            {
                Logger.Append("Alien Activity Alarm: No valid aliens");
                ResetAbductionHelper();
                return;
            }

            SimDescription alien = RandomUtil.GetRandomObjectFromList <SimDescription>(aliens);

            chance = GetAbductionChance();

            if (RandomUtil.RandomChance(chance))
            {
                chance = GetAbductionChance(true);

                Lot target;
                Sim abductee;

                if (IsActiveTarget(chance))
                {
                    List <Sim> abductees = GetAbductees(Household.ActiveHousehold);

                    if (abductees == null)
                    {
                        Logger.Append("Alien Abduction: No abductees");
                        ResetAbductionHelper();
                        return;
                    }

                    abductee = RandomUtil.GetRandomObjectFromList <Sim>(abductees);
                    target   = abductee.LotCurrent;
                }
                else
                {
                    List <Lot> lots = GetLots();

                    if (lots == null)
                    {
                        Logger.Append("Alien Abduction: No lots");
                        ResetAbductionHelper();
                        return;
                    }

                    target = RandomUtil.GetRandomObjectFromList <Lot>(lots);
                    List <Sim> abductees = GetAbductees(target);

                    if (abductees == null)
                    {
                        Logger.Append("Alien Abduction: No abductess");
                        ResetAbductionHelper();
                        return;
                    }

                    abductee = RandomUtil.GetRandomObjectFromList <Sim>(abductees);
                }

                AlienAbductionSituationEx.Create(alien, abductee, target);
            }
            else
            {
                Logger.Append("Alien Abduction: Chance Fail " + chance);

                chance = GetVisitChance();

                if (RandomUtil.RandomChance(chance))
                {
                    chance = GetVisitChance(true, alien);

                    Lot farthestLot, target;
                    Sim visitor;

                    if (IsActiveTarget(chance))
                    {
                        farthestLot = LotManager.GetFarthestLot(Household.ActiveHouseholdLot);
                        target      = Household.ActiveHouseholdLot;
                        visitor     = alien.InstantiateOffScreen(farthestLot);
                        //AlienSituation.Create(visitor, Household.ActiveHouseholdLot);
                    }
                    else
                    {
                        List <Lot> lots = GetLots();

                        if (lots == null)
                        {
                            Logger.Append("Alien Visit: No lots");
                            ResetAbductionHelper();
                            return;
                        }

                        target      = RandomUtil.GetRandomObjectFromList <Lot>(lots);
                        farthestLot = LotManager.GetFarthestLot(target);
                        visitor     = alien.InstantiateOffScreen(farthestLot);
                    }

                    AlienSituation.Create(visitor, target);
                }
                else
                {
                    Logger.Append("Alien Visit: Chance Fail " + chance);
                }
            }

            ResetAbductionHelper();
        }