示例#1
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            try
            {
                if ((Sim.CreatedSim != null) && (Sim.CreatedSim.InteractionQueue != null))
                {
                    Sim.CreatedSim.InteractionQueue.CancelAllInteractions();
                }
            }
            catch (Exception e)
            {
                Common.DebugException(Sim, e);

                IncStat("Exception");
                return(false);
            }

            int defChanceOfDeath = GetValue <PushDeathChanceOption, int>(Sim);

            if ((mChanceOfDeath < 0) || ((mChanceOfDeath > 0) && (mChanceOfDeath < defChanceOfDeath)))
            {
                mChanceOfDeath = defChanceOfDeath;
            }

            AddScoring("Chance of Death", mChanceOfDeath);

            if (RandomUtil.RandomChance(mChanceOfDeath))
            {
                if (mKiller != null)
                {
                    Deaths.AddAlarm(new KillScenario(Sim, mKiller, mDeathType, GetTitlePrefix(PrefixType.Story)));
                    return(false);
                }
            }
            else
            {
                IncStat("Chance Fail");
            }

            if (!Situations.PushToRabbitHole(this, Sim, RabbitHoleType.Hospital, false, false))
            {
                IncStat("Push Fail");
                return(false);
            }

            return(true);
        }