Пример #1
0
        public override void Update(int type, Player player, ref int buffIndex)
        {
            switch (type)
            {
            case BuffID.Rabies:
                if (player.buffTime[buffIndex] > 1)
                {
                    player.AddBuff(MasomodeEX.Souls.BuffType("MutantNibble"), player.buffTime[buffIndex]);
                    player.buffTime[buffIndex] = 1;
                }
                break;

            case BuffID.Frozen:
            case BuffID.Stoned:
                if (player.buffTime[buffIndex] > 3600)
                {
                    player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " shattered."), 9999, 0);
                }
                break;

            case BuffID.MoonLeech:
                player.buffType[buffIndex] = MasomodeEX.Souls.BuffType("MutantNibble");
                break;

            default:
                break;
            }
        }
Пример #2
0
        public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            deathTextTimer = 2;
            if (damageSource.SourceNPCIndex <= -1)
            {
                return(base.PreKill(damage, hitDirection, pvp, ref playSound, ref genGore, ref damageSource));
            }
            if (damageSource.SourceNPCIndex > -1)
            {
                if (Main.npc[damageSource.SourceNPCIndex].type == ModContent.NPCType <Stalker>())
                {
                    switch (Main.rand.Next(1, 6))
                    {
                    case 1:
                        damageSource = PlayerDeathReason.ByCustomReason($"{player.name} was stalked away by Stalker."); break;

                    case 2:
                        damageSource = PlayerDeathReason.ByCustomReason($"A stalker has just mangled {player.name} to death."); break;

                    case 3:
                        damageSource = PlayerDeathReason.ByCustomReason($"{player.name} walked into inevitable doom."); break;

                    case 4:
                        damageSource = PlayerDeathReason.ByCustomReason($"{player.name} withered away from the Stalker's deadly gleam."); break;

                    case 5:
                        damageSource = PlayerDeathReason.ByCustomReason($"The Stalker has consumed {player.name} as his prey."); break;
                    }
                }
            }
            return(true);
        }
Пример #3
0
 public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
 {
     if (heroLives > 0)
     {
         heroLives--;
         if (Main.netMode == 1)
         {
             ModPacket packet = mod.GetPacket();
             packet.Write((byte)ExampleModMessageType.HeroLives);
             packet.Write(player.whoAmI);
             packet.Write(heroLives);
             packet.Send();
         }
         if (heroLives > 0)
         {
             player.statLife = player.statLifeMax2;
             player.HealEffect(player.statLifeMax2);
             player.immune     = true;
             player.immuneTime = player.longInvince ? 180 : 120;
             for (int k = 0; k < player.hurtCooldowns.Length; k++)
             {
                 player.hurtCooldowns[k] = player.longInvince ? 180 : 120;
             }
             Main.PlaySound(SoundID.Item29, player.position);
             reviveTime = 60;
             return(false);
         }
     }
     if (healHurt > 0 && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
     {
         damageSource = PlayerDeathReason.ByCustomReason(" was dissolved by holy powers");
     }
     return(true);
 }
Пример #4
0
        public override bool UseItem(Player player)
        {
            if (player.whoAmI == Main.myPlayer)
            {
                Vector2 newPos = player.position + (Main.MouseWorld - player.position) * 0.7f;
                if (Collision.CanHit(player.position, player.width, player.height, newPos, player.width, player.height))
                {
                    if (player.HasBuff(BuffID.ChaosState))
                    {
                        player.statLife -= player.statLifeMax2 / 7;
                        if (player.statLife <= 0)
                        {
                            string pronoun = player.Male ? " his" : "her";
                            player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " lost " + pronoun + " mind."), 10, 0);
                            return(false);
                        }
                    }

                    player.AddBuff(BuffID.ChaosState, 150);
                    player.Teleport(newPos, 1);
                    return(true);
                }
            }
            return(false);
        }
Пример #5
0
        private void PulseComplete()
        {
            pulsing = false;
            damage  = Math.Min((int)(damage * 1.25f), 100000028);
            switch (mode)
            {
            case MODE_NPC:
                target.StrikeNPC(damage, 0.0f, 1);
                break;

            case MODE_PLAYER:
                if (owner.hostile && ptarget.hostile && (owner.team != ptarget.team))
                {
                    ptarget.Hurt(PlayerDeathReason.ByCustomReason(ptarget.name + "was destroyed by a W.A.M."), damage, 0, true, false);
                }
                else
                {
                    damage = Math.Min(damage, 100000028);
                    if (ptarget != Main.player[Main.myPlayer])
                    {
                        ptarget.HealEffect(damage);
                    }
                    ptarget.statLife += damage;
                }
                break;
            }
        }
Пример #6
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            PlayerDeathReason damageSource;

            damageSource = PlayerDeathReason.ByCustomReason(caller.Player.name + " went suicidal.");
            caller.Player.KillMe(damageSource, 9999, 0);
        }
Пример #7
0
 public override bool UseItem(Player player)
 {
     Main.NewText("Proove that you can challenge me first...", 0, 95, 215);
     player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " disinigrated into stardust"), 10000, 1, false);
     Main.PlaySound(SoundID.Roar, player.position, 0);
     return(true);
 }
Пример #8
0
        public override void AI(NPC npc)
        {
            base.AI(npc);

            EModeGlobalNPC.Aura(npc, 200, BuffID.Bleeding, false, DustID.Blood);

            if (++Counter > 10)
            {
                Counter = 0;

                if (Main.LocalPlayer.active && !Main.LocalPlayer.ghost && !Main.LocalPlayer.dead &&
                    Main.LocalPlayer.bleed && npc.Distance(Main.LocalPlayer.Center) < 200)
                {
                    const int damage = 5;

                    Player target = Main.LocalPlayer;
                    target.statLife -= damage;
                    CombatText.NewText(target.Hitbox, Color.Red, damage, false, true);

                    if (target.statLife < 0)
                    {
                        target.KillMe(PlayerDeathReason.ByCustomReason(target.name + " was sucked dry."), 999, 0);
                    }

                    npc.life += damage;
                    if (npc.life > npc.lifeMax)
                    {
                        npc.life = npc.lifeMax;
                    }

                    npc.HealEffect(damage);
                }
            }
        }
Пример #9
0
 public override void UpdateBadLifeRegen()
 {
     if (doomFire)
     {
         if (player.lifeRegen > 0)
         {
             player.lifeRegen = 0;
         }
         player.lifeRegenTime = 0;
         player.lifeRegen    -= 20;
         if (player.statLife <= 0)
         {
             player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s soul consumed by the wrath of Incinerius"), 10000, 1, false);
         }
     }
     else if (embericCombustion)
     {
         if (player.lifeRegen > 0)
         {
             player.lifeRegen = 0;
         }
         player.lifeRegenTime = 0;
         player.lifeRegen    -= 15;
         if (player.statLife <= 0)
         {
             player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " was cremated into ashes"), 10000, 1, false);
         }
     }
 }
Пример #10
0
        public override bool SoulUpdate(Player p, short stack)
        {
            int lifeCost   = 10 + 5 * stack;
            int manaRegain = 5 + 5 * stack;

            if (p.statLife - lifeCost <= 0)
            {
                return(false);
            }

            if (p.statMana + manaRegain > p.statManaMax2)
            {
                if (p.statMana == p.statManaMax2)
                {
                    return(false);
                }
                manaRegain = p.statManaMax2 - p.statMana;
            }

            p.statMana += manaRegain;
            p.ManaEffect(manaRegain);

            p.Hurt(PlayerDeathReason.ByCustomReason("Ate too much..."), lifeCost, 0);
            Main.PlaySound(SoundID.Item2, p.position);

            return(true);
        }
Пример #11
0
        public override bool CanHitPlayer(Player target)
        {
            if (projectile.Colliding(projectile.Hitbox, target.Hitbox))
            {
                if (target.GetModPlayer <FargoPlayer>().DevianttHearts)
                {
                    target.statLife += 1;
                    target.HealEffect(1);
                }
                else
                {
                    target.hurtCooldowns[0] = 0;
                    int   defense   = target.statDefense;
                    float endurance = target.endurance;
                    target.statDefense = 0;
                    target.endurance   = 0;
                    target.Hurt(PlayerDeathReason.ByCustomReason(target.name + " felt heartbroken."), projectile.damage, 0, false, false, false, 0);
                    target.statDefense = defense;
                    target.endurance   = endurance;

                    if (EModeGlobalNPC.BossIsAlive(ref EModeGlobalNPC.deviBoss, mod.NPCType("DeviBoss")))
                    {
                        target.AddBuff(mod.BuffType("Lovestruck"), 240);
                    }
                }

                projectile.timeLeft = 0;
            }
            return(false);
        }
Пример #12
0
        public override void DoEffect(Player player, Vector2 position, Item item, Vector2 originalVelocity, float shootSpeed, int damage, float knockBack, int importantRun = 0, int totalImportantRuns = -10)
        {
            if (player is Player)
            {
                string deathMessage = player.name + " f****d up their spell";

                /* if (fieryModifier)
                 * {
                 *   deathMessage = player.name + " erupted into flames";
                 * }
                 * if (frostModifier)
                 * {
                 *   deathMessage = player.name + " became a cube of ice";
                 * }
                 * if (holyModifier)
                 * {
                 *   deathMessage = player.name + " turned into rainbow dust";
                 * }
                 * if (crimsonModifier)
                 * {
                 *   deathMessage = player.name + " became a clump of flesh";
                 * }
                 * if (corruptModifier)
                 * {
                 *   deathMessage = player.name + " sacrificed themselves to the dark gods";
                 * }*///redo this one day
                player.KillMe(PlayerDeathReason.ByCustomReason(deathMessage), player.statLifeMax2, 0);
            }
        }
Пример #13
0
 /*public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
  * {
  *  //return spriteBatch.Draw(GetTexture("ExpiryMode/Items/Useables/ChaliceofDeathAnim"), )
  *  Texture2D texture = Main.itemTexture[item.type];
  *  for (int i = 0; i < 4; i++)
  *  {
  *      Vector2 offsetPositon = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * 2;
  *      spriteBatch.Draw(GetTexture("ExpiryMode/Items/Useables/ChaliceofDeathAnim"), position, frame, drawColor, 0, origin, scale, SpriteEffects.None, 0f);
  *  }
  *  return true;
  * }*/
 public override bool UseItem(Player player)
 {
     if (Main.npc.Any(n => n.active && n.boss))
     {
         player.KillMe(PlayerDeathReason.ByCustomReason($"{player.name} tried to cheat. What a scumbag."), player.statLifeMax2 + 200, 0, false);
         return(false);
     }
     if (SuffWorld.ExpiryModeIsActive)
     {
         SuffWorld.ExpiryModeIsActive = false;
         if (Main.netMode == NetmodeID.Server)
         {
             SuffWorld.ExpiryModeIsActive = false;
             NetMessage.SendData(MessageID.WorldData);
         }
         Main.NewText($"Expiry Mode has been disabled by {player.name}. What a wimp.", Color.DarkOrange, true);
         return(true);
     }
     if (!SuffWorld.ExpiryModeIsActive)
     {
         SuffWorld.ExpiryModeIsActive = true;
         if (Main.netMode == NetmodeID.Server)
         {
             SuffWorld.ExpiryModeIsActive = true;
             NetMessage.SendData(MessageID.WorldData);
         }
         Main.NewText($"Expiry Mode has been enabled. {player.name} is a real man.", Color.DarkOrange, true);
         return(true);
     }
     return(base.UseItem(player));
 }
Пример #14
0
        public override void AI()
        {
            /*
             * AI fields:
             * 0: Timer
             * 1: Phasestate
             */

            //The boss NPC that this arena is tied to
            NPC parent;

            //Finds the active sentinel, NPC kills itself if zero or >1 is found.
            if (Main.npc.Count(n => n.active && n.type == ModContent.NPCType <VitricBoss>()) != 1)
            {
                npc.Kill(); return;
            }
            else
            {
                parent = Main.npc.FirstOrDefault(n => n.active && n.type == ModContent.NPCType <VitricBoss>());
            }

            //Ticks the timer
            npc.ai[0]++;

            //Creates the arena barrier which prevents players from leaving the fight or attempting to use run-n-gun tactics
            foreach (Player player in Main.player.Where(player => player.active && Vector2.Distance(player.Center, npc.Center) >= 1000))
            {
                player.velocity = Vector2.Normalize(player.Center - npc.Center) * -10;
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " tried to escape the sentinel..."), 50, 0);
            }
            for (float k = 0; k <= 5; k++) //visuals
            {
                float rot = Main.rand.NextFloat(6.28f);
                Dust.NewDustPerfect(npc.Center + Vector2.One.RotatedBy(rot) * 710, ModContent.DustType <Dusts.VitricBossTell>(), Vector2.One.RotatedBy(rot + 1.58f) * 20, 0, new Color(220, 250, 250), 2);
                Dust.NewDustPerfect(npc.Center + Vector2.One.RotatedBy(rot) * 710, ModContent.DustType <Dusts.Air>(), Vector2.One.RotatedBy(rot + 1.58f) * 2, 0, default, 2);
Пример #15
0
        public override void AI()
        {
            if (projectile.timeLeft == 599)
            {
                int y = (int)projectile.Center.Y / 16 - 34;
                for (int k = 0; k < 58; k++)
                {
                    int x = (int)projectile.Center.X / 16 + 22 + k;
                    ValidPoints.Add(new Point16(x, y));
                }
            }
            projectile.ai[1]++;
            projectile.Center = Main.npc.FirstOrDefault(n => n.modNPC is MainBody).Center;

            //collision
            for (int k = 0; k < 100; k++)
            {
                Vector2   pos  = projectile.position + new Vector2(0, -10 * k);
                Rectangle rect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y - k * 10, 60, 10);

                if (Main.tile[(int)pos.X / 16 + 2, (int)pos.Y / 16].active() || Main.tile[(int)pos.X / 16 - 2, (int)pos.Y / 16].active())
                {
                    break;
                }
                foreach (Player player in Main.player.Where(n => n.active && n.Hitbox.Intersects(rect)))
                {
                    player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " got lasered to death by a squid..."), 50, 0);
                }
            }
        }
Пример #16
0
        // Detonates a pustule, damaging all players and npcs within its range, and killing the tile and tile entity
        public void Explode()
        {
            foreach (Player player in Main.player)
            {
                if (player.active && !player.dead && player.DistanceSQ(PustuleWorldCenter) < pustuleRange * pustuleRange)
                {
                    player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was grotesquely detonated"), pustuleDamage, player.Center.X > PustuleWorldCenter.X ? -1 : 1);
                }
            }

            foreach (NPC npc in Main.npc)
            {
                if (npc.DistanceSQ(PustuleWorldCenter) < pustuleRange * pustuleRange)
                {
                    npc.StrikeNPC(pustuleDamage, 0f, npc.Center.X > PustuleWorldCenter.X ? -1 : 1);
                }
            }

            for (int i = 0; i < 30; i++)
            {
                Dust.NewDustDirect(PustuleWorldCenter, 6, 6, DustID.Blood, Main.rand.NextFloat(3f, 6f) * Main.rand.NextFloatDirection(), Main.rand.NextFloat(3f, 6f) * Main.rand.NextFloatDirection(), Scale: Main.rand.NextFloat(1f, 2f));
            }

            for (int i = 1; i <= 4; i++)
            {
                Gore.NewGore(PustuleWorldCenter, Main.rand.NextVector2Unit() * Main.rand.NextFloat(3f, 6f), mod.GetGoreSlot("Gores/CrimsonPustule/CrimsonPustule" + i));
            }

            WorldGen.KillTile(Position.X, Position.Y);
            Kill(Position.X, Position.Y);
        }
Пример #17
0
        public override void PreUpdate()
        {
            if (!Main.expertMode)
            {
                Main.expertMode = true;
                Main.NewText("Expert mode has been enabeld!", Main.hcColor);
                if (Main.netMode != NetmodeID.SinglePlayer)
                {
                    NetMessage.SendData(MessageID.WorldData);
                }
            }

            player.breathMax = 3;

            if (player.ZoneSkyHeight)
            {
                player.AddBuff(BuffID.Suffocation, 2);
            }

            if (!player.accDivingHelm)
            {
                foreach (Dust dust in from Dust d in Main.dust where d.active select d)
                {
                    if (dust.type != DustID.Blood && player.getRect().Contains(dust.position.ToPoint()))
                    {
                        player.Hurt(PlayerDeathReason.ByCustomReason($"{player.name} was dusted to death."), 1, 0);
                        player.immuneTime = 0;
                    }
                }
            }
        }
Пример #18
0
        ////////////////

        private void ApplyBrambleEffects()
        {
            var    config    = CursedBramblesConfig.Instance;
            string timerName = "CursedBrambleHurt_" + this.player.whoAmI;

            if (this.player.velocity.LengthSquared() > 0.1f)
            {
                this.player.velocity *= 1f - config.Get <float>(nameof(config.BrambleStickiness));
            }

            if (Timers.GetTimerTickDuration(timerName) <= 0)
            {
                Timers.SetTimer(timerName, config.Get <int>(nameof(config.BrambleTicksPerDamage)), false, () => {
                    PlayerLibraries.RawHurt(
                        player: this.player,
                        deathReason: PlayerDeathReason.ByCustomReason(this.player.name + " was devoured by cursed brambles"),
                        damage: config.Get <int>(nameof(config.BrambleDamage)),
                        direction: 0,
                        pvp: false,
                        quiet: true,
                        crit: false
                        );
                    return(false);
                });

                this.player.AddBuff(BuffID.Venom, 60);
            }
        }
Пример #19
0
        public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            if ((overPsychosis || DashActive) && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
            {
                switch (Main.rand.Next(5))
                {
                case 0:
                    damageSource = PlayerDeathReason.ByCustomReason(player.name + " has ascended to a higher plane.");
                    break;

                case 1:
                    damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to madness.");
                    break;

                case 2:
                    damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by visions.");
                    break;

                case 3:
                    damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s head inexplicably exploded.");
                    break;

                case 4:
                    damageSource = PlayerDeathReason.ByCustomReason(player.name + " has seen too much.");
                    break;
                }
            }
            return(true);
        }
Пример #20
0
 public override void OnChatButtonClicked(NPC npc, bool firstButton)
 {
     if (npc.TypeName == "Nurse" && Main.npc.Where(n => n.active && n.boss).ToList().Count > 0)
     {
         Main.LocalPlayer.KillMe(PlayerDeathReason.ByCustomReason(Main.LocalPlayer.name + " was punished for dishonorable tactics."), 1.0, 0);
     }
 }
Пример #21
0
        public override bool CanHitPlayer(Player target)
        {
            if (Projectile.Colliding(Projectile.Hitbox, target.Hitbox))
            {
                if (target.GetModPlayer <FargoSoulsPlayer>().DevianttHeartItem == null)
                {
                    target.hurtCooldowns[0] = 0;
                    int   defense   = target.statDefense;
                    float endurance = target.endurance;
                    target.statDefense = 0;
                    target.endurance   = 0;
                    target.Hurt(PlayerDeathReason.ByCustomReason(target.name + " felt heartbroken."), Projectile.damage, 0, false, false, false, 0);
                    target.statDefense = defense;
                    target.endurance   = endurance;

                    if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.deviBoss, ModContent.NPCType <NPCs.DeviBoss.DeviBoss>()))
                    {
                        target.AddBuff(ModContent.BuffType <Lovestruck>(), 240);
                    }
                }
                else
                {
                    target.statLife += 1;
                    target.HealEffect(1);
                }

                Projectile.timeLeft = 0;
            }
            return(false);
        }
Пример #22
0
        public static void TileExplode(int i, int j)
        {
            int     x      = i * 16 + 8;
            int     y      = j * 16 + 8;
            float   range  = 3f * 16;
            Vector2 center = new Vector2(x, y);

            Player[] proximity = Main.player.Where(t => t.Distance(center) < range).ToArray();
            for (float k = 0; k < Math.PI * 2f; k++)
            {
                for (int l = 0; l < range; l++)
                {
                    Vector2 velocity = ArchaeaNPC.AngleToSpeed(k, 3f);
                    int     rand     = Main.rand.Next(20);
                    if (rand == 0)
                    {
                        Dust.NewDustDirect(ArchaeaNPC.AngleBased(center, k, range), 1, 1, DustID.Smoke, velocity.X, velocity.Y, 0, default(Color), 2f);
                    }
                    if (rand == 10)
                    {
                        Dust.NewDustDirect(ArchaeaNPC.AngleBased(center, k, l), 4, 4, DustID.Fire, 0f, 0f, 0, default(Color), 2f);
                    }
                }
            }
            foreach (Player player in proximity)
            {
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " struck dead in a mining accident"), 10, player.position.X / 16 < i ? -1 : 1);
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(MessageID.PlayerHurtV2, player.whoAmI, -1, null);
                }
            }
        }
Пример #23
0
        public override bool UseItem(Player player)
        {
            if (item.owner == player.whoAmI)
            {
                int chance = player.statDefense > 70 ? 4 : 2;
                player.TeleportationPotion();
                player.AddBuff(BuffID.ChaosState, 600);

                if (player.chaosState)
                {
                    player.statLife -= player.statLifeMax / 6;

                    if (player.statLife <= 0)
                    {
                        player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " didn't materialize"), 0, 0);
                    }
                }

                if (Main.rand.Next(chance) == 0)
                {
                    if (!NPC.downedAncientCultist)
                    {
                        player.AddBuff(BuffID.Darkness, Main.rand.Next(300, 1800));
                    }
                    else
                    {
                        player.AddBuff(BuffID.Blackout, Main.rand.Next(120, 600));
                    }
                }
            }
            return(true);
        }
Пример #24
0
        ////////////////

        private void ApplyBrambleEffects()
        {
            string timerName = "AmbushesCursedBrambleHurt_" + this.player.whoAmI;

            if (this.player.velocity.LengthSquared() > 0.1f)
            {
                this.player.velocity *= 1f - AmbushesMod.Config.BrambleStickiness;
            }

            if (Timers.GetTimerTickDuration(timerName) <= 0)
            {
                Timers.SetTimer(timerName, AmbushesMod.Config.BrambleTicksPerDamage, () => {
                    PlayerHelpers.RawHurt(
                        player: this.player,
                        deathReason: PlayerDeathReason.ByCustomReason(" was devoured by cursed brambles"),
                        damage: AmbushesMod.Config.BrambleDamage,
                        direction: 0,
                        pvp: false,
                        quiet: true,
                        crit: false
                        );
                    return(false);
                });

                this.player.AddBuff(BuffID.Venom, 60);
            }
        }
Пример #25
0
        // Code is modified from the vanilla source code handling Rod of Discord
        public override bool UseItem(Player player)
        {
            const int MAX_DIST_X = 999999; //999999
            const int MAX_DIST_Y = 999999;



            // Get teleport location
            Vector2 teleportTo;

            teleportTo.X = (Main.mouseX + Main.screenPosition.X);

            teleportTo.Y = (float)((double)player.gravDir != 1.0 ? (Main.screenPosition.Y + (double)Main.screenHeight - (double)Main.mouseY) : ((double)Main.mouseY + Main.screenPosition.Y - (double)player.height));

            // Can't teleport beyond a certain distance, specified by MAX_DIST_X and MAX_DIST_Y
            int distX = (int)(System.Math.Abs(teleportTo.X - player.position.X)) / 16; //16
            int distY = (int)(System.Math.Abs(teleportTo.Y - player.position.Y)) / 16;

            if (distX > MAX_DIST_X || distY > MAX_DIST_Y)
            {
                Main.PlaySound(SoundID.Item8, player.position);
                return(true);
            }

            // Must be in bounds
            if (teleportTo.X > 50.0 && teleportTo.X < (double)(Main.maxTilesX * 16 - 50) && (teleportTo.Y > 50.0 && teleportTo.Y < (double)(Main.maxTilesY * 16 - 50)))
            {
                // Get tile array indexes
                int index1 = (int)(teleportTo.X / 16.0); //16.0
                int index2 = (int)(teleportTo.Y / 16.0);

                // Can't teleport into a solid block, or into the Lihzahrd temple early
                if (((int)Main.tile[index1, index2].wall != 87 || (double)index2 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(teleportTo, player.width, player.height))
                {
                    player.Teleport(teleportTo, 1, 0);

                    // Copied from Rod of Discord source code
                    NetMessage.SendData(65, -1, -1, (NetworkText)null, 0, (float)player.whoAmI, (float)teleportTo.X, (float)teleportTo.Y, 1, 0, 0);

                    // If you die, you get a special message, u cant get this message since this RoD cant kill you
                    if (player.statLife <= 0)
                    {
                        PlayerDeathReason damageSource = PlayerDeathReason.ByCustomReason(player.name + "this message cannot be seen");
                        player.KillMe(damageSource, 1.0, 0, false);

                        return(true);
                    }
                }
                else
                {
                    Main.PlaySound(SoundID.Item8, player.position);
                }
            }
            else
            {
                Main.PlaySound(SoundID.Item8, player.position);
            }

            return(true);
        }
Пример #26
0
        public override void UpdateInventory(Player player)
        {
            PlayerEnergy modPlayer = player.GetModPlayer <PlayerEnergy>(mod);

            if (enabled && modPlayer.energy < modPlayer.maxEnergy)
            {
                if (lifeRegenAmount > 0)
                {
                    player.lifeRegenCount = 0;

                    lifeRegenTimer += lifeRegenAmount;

                    if (lifeRegenTimer >= 120)
                    {
                        lifeRegenTimer -= 120;
                        modPlayer.energy++;
                        player.statLife -= 2;
                        if (player.statLife <= 0)
                        {
                            player.statLife = 0;
                            player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " boiled away"), 1.0, 0, false);
                        }
                    }
                }
            }
            leftArrowCooldown--;
            rightArrowCooldown--;

            if (Main.HoverItem.type == item.type)
            {
                Keys[] pressedKeys = Main.keyState.GetPressedKeys();

                for (int j = 0; j < pressedKeys.Length; j++)
                {
                    Keys key = pressedKeys[j];
                    if (key == Keys.Left)
                    {
                        if (leftArrowCooldown <= 0 && lifeRegenAmount > 0)
                        {
                            lifeRegenAmount--;
                            leftArrowCooldown = 3;
                            Main.PlaySound(SoundID.MenuTick, player.position);
                        }
                    }
                    if (key == Keys.Right)
                    {
                        if (rightArrowCooldown <= 0 && lifeRegenAmount < 50)
                        {
                            lifeRegenAmount++;
                            rightArrowCooldown = 3;
                            Main.PlaySound(SoundID.MenuTick, player.position);
                        }
                    }
                }
            }
            if (!player.active || player.dead)
            {
                lifeRegenAmount = 0; // reset when dead in case player cant turn it off in time
            }
        }
Пример #27
0
        public override void PreUpdate(Player player, Mod mod)
        {
            //hurt sounds and any additional features of the race (abilities, etc) go here
            //custom hurt sounds would normally be put in PreHurt, but they conflict with Godmode in other mods so I made a custom system to avoid the confliction
            var modPlayer          = player.GetModPlayer <MrPlagueRaces.MrPlagueRacesPlayer>();
            var _MrPlagueRaces     = ModLoader.GetMod("MrPlagueRaces");
            var MrPlagueCustomRace = ModLoader.GetMod("MrPlagueCustomRace");

            if (player.HasBuff(_MrPlagueRaces.BuffType("DetectHurt")) && (player.statLife != player.statLifeMax2))
            {
                if (player.Male || !HasFemaleHurtSound)
                {
                    //when choosing a sound, make sure to put your mod's name before .GetSoundSlot instead of "mod". using mod will cause the program to search for the sound file in MrPlagueRace's sound folder
                    Main.PlaySound(SoundLoader.customSoundType, (int)player.Center.X, (int)player.Center.Y, MrPlagueCustomRace.GetSoundSlot(SoundType.Custom, "Sounds/" + this.Name + "_Hurt"));
                }
                else if (!player.Male && HasFemaleHurtSound)
                {
                    Main.PlaySound(SoundLoader.customSoundType, (int)player.Center.X, (int)player.Center.Y, MrPlagueCustomRace.GetSoundSlot(SoundType.Custom, "Sounds/" + this.Name + "_Hurt_Female"));
                }
                else
                {
                    Main.PlaySound(SoundLoader.customSoundType, (int)player.Center.X, (int)player.Center.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/Mushfolk_Hurt"));
                }
            }
            if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir))
            {
                player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " dissolved."), 10.0, 0, false);
            }
        }
Пример #28
0
            public override void Action(CommandCaller caller, string input, string[] args)
            {
                Player player       = Main.player[myPlayer];
                var    damageAmount = args[0];

                if (!int.TryParse(args[0], out int type))
                {
                    if (type == 0)
                    {
                        throw new UsageException($"{damageAmount} is not a valid integer.");
                    }
                }

                int damage = 1;

                if (args.Length >= 2)
                {
                    damage = int.Parse(args[1]);
                }
                if (!player.HasItem(ItemType <CommandItem>()))
                {
                    NewText("This command can only be used while debugging!", Color.Red);
                }
                if (player.HasItem(ItemType <CommandItem>()))
                {
                    caller.Player.Hurt(PlayerDeathReason.ByCustomReason($"{player.name} hurt themself a bit too much."), type, 0, false, false, false, -1);
                }
            }
Пример #29
0
 public override void FloorVisuals(Player player)
 {
     if (!player.HasBuff(BuffType <SpikeImmuneBuff>()))
     {
         player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " got distracted by pretty colors..."), 15, 0);
     }
 }
Пример #30
0
 public override void Update(Player player, ref int buffIndex)
 {
     timer++;
     player.buffImmune[BuffID.Poisoned]     = true;
     player.buffImmune[BuffID.Venom]        = true;
     player.buffImmune[BuffID.Darkness]     = true;
     player.buffImmune[BuffID.Blackout]     = true;
     player.buffImmune[BuffID.Silenced]     = true;
     player.buffImmune[BuffID.Cursed]       = true;
     player.buffImmune[BuffID.Confused]     = true;
     player.buffImmune[BuffID.Slow]         = true;
     player.buffImmune[BuffID.Chilled]      = true;
     player.buffImmune[BuffID.Warmth]       = true;
     player.buffImmune[BuffID.Stoned]       = true;
     player.buffImmune[BuffID.VortexDebuff] = true;
     player.allDamageMult += 100f;
     player.endurance     += 100f;
     player.statLifeMax2  += 100000;
     if (timer == 295)
     {
         if (player.statLife > 0 && player.active)
         {
             player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " was killed from the inside by Mutant."), 10000, player.direction);
             player.ResetEffects();
             NPC.NewNPC((int)player.Center.X, (int)player.Center.Y, ModLoader.GetMod("FargowiltasSouls").NPCType("MutantBoss"));
             timer = 0;
         }
         else
         {
             player.ClearBuff(Type);
             timer = 0;
         }
     }
 }