예제 #1
0
        public static void Prefix(uGUI_HardcoreGameOver __instance)
        {
            DeathRun.setCause("Victory");
            DeathRun.saveData.runData.updateVitals(true);
            DeathRun.statsData.SaveStats();

            TimeSpan timeSpan = TimeSpan.FromSeconds((double)DeathRun.saveData.playerSave.allLives);
            string   text     = "Victory! In " + DeathRunUtils.sayTime(timeSpan) + " (" + (DeathRun.saveData.playerSave.numDeaths + 1) + " ";

            if (DeathRun.saveData.playerSave.numDeaths == 0)
            {
                text += "life";
            }
            else
            {
                text += "lives";
            }

            text += ")";

            DeathRunUtils.CenterMessage(text, 10);
            CattleLogger.Message(text);

            string text2 = "Score: " + DeathRun.saveData.runData.Score;

            DeathRunUtils.CenterMessage(text, 10, 1);
            CattleLogger.Message(text);

            //ErrorMessage.AddMessage(text);
        }
예제 #2
0
 public static bool Prefix(Survival __instance)
 {
     if (__instance.water <= 0)
     {
         DeathRun.setCause("Dehydration");
     }
     else
     {
         DeathRun.setCause("Starvation");
     }
     return(true);
 }
예제 #3
0
        /**
         * DecoDamage - this actually applies the decompression damage from getting the bends. Includes "anti-one-shotting" protection. Also
         * resets the "safe depth" higher after each shot of damage.
         */
        private static void DecoDamage(ref NitrogenLevel __instance, float depthOf, int ticks)
        {
            LiveMixin component = Player.main.gameObject.GetComponent <LiveMixin>();

            float damageBase = (Config.DEATHRUN.Equals(DeathRun.config.nitrogenBends)) ? 20f : 10f;

            if ((DeathRun.saveData.nitroSave.safeDepth - depthOf) < 5)
            {
                damageBase /= 2;
            }

            if ((DeathRun.saveData.nitroSave.safeDepth - depthOf) < 2)
            {
                damageBase /= 2;
            }

            float damage = damageBase + UnityEngine.Random.value * damageBase + (DeathRun.saveData.nitroSave.safeDepth - depthOf);

            if (damage >= component.health)
            {
                if (component.health > 0.1f)
                {
                    damage = component.health - 0.05f;
                    if (damage <= 0)
                    {
                        return;
                    }
                }
            }

            if (component.health - damage > 0f)
            {
                if (!Config.NEVER.Equals(DeathRun.config.showWarnings))
                {
                    if ((DeathRun.saveData.nitroSave.reallyTookDamageTicks == 0) ||
                        Config.WHENEVER.Equals(DeathRun.config.showWarnings) ||
                        (Config.OCCASIONAL.Equals(DeathRun.config.showWarnings) && (ticks - DeathRun.saveData.nitroSave.reallyTookDamageTicks > 600)))
                    {
                        ErrorMessage.AddMessage("You have the bends from ascending too quickly!");
                        DeathRunUtils.CenterMessage("You have the bends!", 6);
                        DeathRunUtils.CenterMessage("Slow your ascent!", 6, 1);
                    }
                }
            }
            //else
            //{
            //    ErrorMessage.AddMessage("You died of the bends!");
            //    DeathRunUtils.CenterMessage("You died of the bends!", 5);
            //}

            DeathRun.setCause("The Bends");
            component.TakeDamage(damage, default, DamageType.Starve, null);
예제 #4
0
        public static bool Prefix()
        {
            if (Player.main.IsSwimming())
            {
                DeathRun.setCause("Drowning");
            }
            else
            {
                DeathRun.setCause("Asphyxiation");
            }

            return(true);
        }
예제 #5
0
 public static bool Prefix(DamageOverTime __instance)
 {
     DeathRun.setCause(DeathRun.CAUSE_UNKNOWN_CREATURE);
     DeathRun.setCauseObject(__instance.gameObject);
     return(true);
 }
예제 #6
0
 public static bool Prefix(CrabsnakeMeleeAttack __instance)
 {
     DeathRun.setCause(DeathRun.CAUSE_UNKNOWN_CREATURE);
     DeathRun.setCauseObject(__instance.gameObject);
     return(true);
 }
예제 #7
0
 public static bool Prefix()
 {
     DeathRun.setCause("Elevator Accident");
     return(true);
 }
예제 #8
0
 public static bool Prefix(DamageOnPickup __instance)
 {
     DeathRun.setCause("Falling Objects");
     return(true);
 }
예제 #9
0
 public static bool Prefix(CyclopsDestructionEvent __instance)
 {
     DeathRun.setCause("Went Down w/ Cyclops");
     return(true);
 }
예제 #10
0
 public static bool Prefix(WarpBall __instance)
 {
     DeathRun.setCause("Warp Ball");
     return(true);
 }
예제 #11
0
 public static bool Prefix(SeaDragonMeleeAttack __instance)
 {
     DeathRun.setCause("Stomped by Treader");
     return(true);
 }
예제 #12
0
 public static bool Prefix(Projectile __instance)
 {
     DeathRun.setCause("Projectile");
     return(true);
 }
예제 #13
0
 public static bool Prefix(MagmaBlob __instance)
 {
     DeathRun.setCause("Chunk of Magma");
     return(true);
 }
예제 #14
0
 public static bool Prefix(Lava __instance)
 {
     DeathRun.setCause("Lava");
     return(true);
 }
예제 #15
0
        static void setCauseOfDeath(DamageType damageType)
        {
            try
            {
                switch (damageType)
                {
                case DamageType.Acid:
                    DeathRun.setCause("Acid");
                    break;

                case DamageType.Collide:
                    DeathRun.setCause("Collision");
                    break;

                case DamageType.Electrical:
                    DeathRun.setCause("Electrocution");
                    break;

                case DamageType.Explosive:
                    DeathRun.setCause("Explosion");
                    break;

                case DamageType.Fire:
                    DeathRun.setCause("Burned to Death");
                    break;

                case DamageType.Heat:
                    DeathRun.setCause("Extreme Heat");
                    break;

                case DamageType.Poison:
                    DeathRun.setCause("Poison");
                    break;

                case DamageType.Pressure:
                    DeathRun.setCause("Pressure");
                    break;

                case DamageType.Puncture:
                    DeathRun.setCause("Puncture Wounds");
                    break;

                case DamageType.Radiation:
                    DeathRun.setCause("Radiation");
                    break;

                case DamageType.Smoke:
                    DeathRun.setCause("Smoke Asphyxiation");
                    break;

                //case DamageType.Starve:
                //case DamageType.Normal:
                default:
                    if (DeathRun.CAUSE_UNKNOWN_CREATURE.Equals(DeathRun.cause))
                    {
                        if (DeathRun.causeObject != null)
                        {
                            GameObject go;
                            TechType   t = CraftData.GetTechType(DeathRun.causeObject, out go);

                            if (t != TechType.None)
                            {
                                DeathRun.setCause(Language.main.Get(t.AsString(false)));

                                CattleLogger.Message("Cause of Death: " + DeathRun.cause);
                            }
                            else
                            {
                                CattleLogger.Message("(Couldn't find creature that caused player death) - ");
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                CattleLogger.GenericError("Getting cause of death", ex);
            }
        }
예제 #16
0
 public static bool Prefix()
 {
     DeathRun.setCause("Console Command");
     return(true);
 }
예제 #17
0
        private static void DamagePlayer(float ouch)
        {
            LiveMixin component = Player.main.gameObject.GetComponent <LiveMixin>();

            DeathRun.setCause("Crushed By Pressure");
            component.TakeDamage(UnityEngine.Random.value * ouch / 2 + ouch / 2, default, DamageType.Normal, null);
예제 #18
0
 public static bool Prefix(DamageOnPickup __instance)
 {
     DeathRun.setCause("Explosion");
     return(true);
 }