예제 #1
0
        public override void SetMount(Player player, ref bool skipDust)
        {
            ScarabMountPlayer modplayer = player.GetModPlayer <ScarabMountPlayer>();

            modplayer.scarabrotation = 0;
            modplayer.scarabtimer    = 0;
            for (int i = 0; i < modplayer.scaraboldposition.Length; i++)
            {
                modplayer.scaraboldposition[i] = player.Center;
            }
        }
예제 #2
0
        public override void UpdateEffects(Player player)
        {
            ScarabMountPlayer modplayer = player.GetModPlayer <ScarabMountPlayer>();

            modplayer.scarabrotation += player.velocity.X / 25;
            modplayer.scarabtimer++;
            player.buffImmune[BuffID.WindPushed] = true;

            for (int i = (modplayer.scaraboldposition.Length - 1); i > 0; i--)
            {
                modplayer.scaraboldposition[i] = modplayer.scaraboldposition[i - 1];
            }
            modplayer.scaraboldposition[0] = player.Center;

            if (Math.Abs(player.velocity.X) > 3 && player.velocity.Y == 0)
            {
                if (modplayer.scarabtimer % 20 <= 1)
                {
                    Main.PlaySound(SoundID.Roar, player.Center, 1);
                }

                for (int j = 0; j < Math.Abs(player.velocity.X) / 3; j++)
                {
                    Dust.NewDustPerfect(player.Center + new Vector2(0, player.height / 2) + Main.rand.NextVector2Circular(6, 6), mountData.spawnDust,
                                        -player.velocity.RotatedBy(MathHelper.PiOver4 * Math.Sign(player.velocity.X)).RotatedByRandom(MathHelper.Pi / 6) * Main.rand.NextFloat(0.5f, 1),
                                        Scale: Main.rand.NextFloat(0.9f, 1.5f));
                }
            }

            if (Math.Abs(player.velocity.X) > 6)
            {
                modplayer.scarabtimer++;
                var enemies = Main.npc.Where(x => x.Hitbox.Intersects(player.Hitbox) && x.CanBeChasedBy(this) && x.immune[player.whoAmI] == 0);
                foreach (NPC npc in enemies)
                {
                    npc.StrikeNPC((int)(25 * player.meleeDamage * Main.rand.NextFloat(0.9f, 1.2f)), 1, player.direction, Main.rand.NextBool(10));
                    npc.immune[player.whoAmI] = 10;
                }
            }
        }
예제 #3
0
        public override bool Draw(List <DrawData> playerDrawData, int drawType, Player drawPlayer, ref Texture2D texture, ref Texture2D glowTexture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, ref Color glowColor, ref float rotation, ref SpriteEffects spriteEffects, ref Vector2 drawOrigin, ref float drawScale, float shadow)
        {
            ScarabMountPlayer modplayer = drawPlayer.GetModPlayer <ScarabMountPlayer>();

            rotation    = modplayer.scarabrotation;
            glowTexture = mod.GetTexture("Items/Sets/ScarabeusDrops/ScarabExpertDrop/ScarabMount_Glow");
            Vector2 heightoffset = new Vector2(0, mountData.heightBoost - 16);

            drawPosition += heightoffset;
            if (Math.Abs(drawPlayer.velocity.X) > 6)
            {
                for (int i = 0; i < modplayer.scaraboldposition.Length; i++)
                {
                    float    opacity  = (modplayer.scaraboldposition.Length - i) / (float)modplayer.scaraboldposition.Length;
                    DrawData drawdata = new DrawData(texture, modplayer.scaraboldposition[i] - Main.screenPosition + heightoffset, null, drawColor * 0.2f * opacity, rotation, texture.Size() / 2, 1, SpriteEffects.None, 0);
                    playerDrawData.Add(drawdata);

                    DrawData drawdataglow = new DrawData(glowTexture, modplayer.scaraboldposition[i] - Main.screenPosition + heightoffset, null, Color.White * 0.2f * opacity, rotation, texture.Size() / 2, 1, SpriteEffects.None, 0);
                    playerDrawData.Add(drawdataglow);
                }
            }
            return(true);
        }