コード例 #1
0
ファイル: KnucklesDuke.cs プロジェクト: Milliath/WeaponOut
        /// <summary> The method called during a combo. Use for ongoing dust and gore effects. </summary>
        public static void ComboEffects(Player player, Item item, bool initial)
        {
            if (initial)
            {
                player.immuneTime   += 2;
                player.velocity     /= 2;
                player.itemAnimation = player.itemAnimationMax + 8;
                player.GetModPlayer <ModPlayerFists>().jumpAgainUppercut = true;
                Main.PlaySound(SoundID.Item21, player.position);
            }

            Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 10, altHitboxSize);
            Dust      d;

            if (player.itemAnimation > player.itemAnimationMax)
            {
                player.immune = true;
                player.immuneTime++;

                // Charging
                d           = Main.dust[Dust.NewDust(r.TopLeft(), 10, 10, 217, 0, 0, 100, default(Color), 1.2f)];
                d.position -= d.velocity * 40f;
                d.velocity *= 2f;
                d.velocity += player.position - player.oldPosition;
                d.noGravity = true;
            }
            else if (player.itemAnimation == player.itemAnimationMax - 1)
            {
                // Bubble Noise
                Main.PlaySound(SoundID.Item86, player.position);

                // Allow dash
                if (player.controlLeft && player.direction > 0)
                {
                    player.direction = -1;
                }
                else if (player.controlRight && player.direction < 0)
                {
                    player.direction = 1;
                }
                player.GetModPlayer <ModPlayerFists>().
                SetDashOnMovement(altDashSpeed, altDashThresh, 0.992f, 0.96f, true, 0);

                if (player.whoAmI == Main.myPlayer)
                {
                    if (Main.myPlayer == player.whoAmI)
                    {
                        Vector2 telePos;
                        telePos.X = (float)Main.mouseX + Main.screenPosition.X;
                        if (player.gravDir == 1f)
                        {
                            telePos.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height;
                        }
                        else
                        {
                            telePos.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
                        }
                        telePos.X -= (float)(player.width / 2);

                        if (telePos.X > 50f && telePos.X < (float)(Main.maxTilesX * 16 - 50) &&
                            telePos.Y > 50f && telePos.Y < (float)(Main.maxTilesY * 16 - 50))
                        {
                            int num246 = (int)(telePos.X / 16f);
                            int num247 = (int)(telePos.Y / 16f);
                            if ((Main.tile[num246, num247].wall != 87 || (double)num247 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(telePos, player.width, player.height))
                            {
                                player.Teleport(telePos, -1, 0);
                                NetMessage.SendData(MessageID.Teleport, -1, -1, null, -1, (float)player.whoAmI, telePos.X, telePos.Y, 0, 0, 0);
                            }

                            float num2 = Vector2.Distance(player.position, telePos);
                            if (num2 < new Vector2((float)Main.screenWidth, (float)Main.screenHeight).Length() / 2f + 100f)
                            {
                                Main.SetCameraLerp(0.1f, 0);
                            }
                            else
                            {
                                Main.BlackFadeIn = 255;
                                Lighting.BlackOut();
                                Main.screenLastPosition = Main.screenPosition;
                                Main.screenPosition.X   = player.position.X + (float)(player.width / 2) - (float)(Main.screenWidth / 2);
                                Main.screenPosition.Y   = player.position.Y + (float)(player.height / 2) - (float)(Main.screenHeight / 2);
                                Main.quickBG            = 10;
                            }
                        }
                    }
                }
                if (ModPlayerFists.Get(player).specialMove == 0)
                {
                    player.velocity.Y = -player.gravDir;
                }
            }
            else
            {
                // Teledust
                d           = Main.dust[Dust.NewDust(player.position, player.width, player.height, 217, 0, 0, 100, default(Color), 1.2f)];
                d.velocity *= 2f;
                d.velocity += player.position - player.oldPosition;
                d.noGravity = true;
                for (int i = 0; i < 10; i++)
                {
                    d           = Main.dust[Dust.NewDust(player.position, player.width, player.height, 185, 0, 0, 100, default(Color), 1.2f)];
                    d.velocity *= 3f;
                    d.velocity += player.position - player.oldPosition;
                    d.noGravity = true;
                }
            }
        }
コード例 #2
0
ファイル: TeleportBolt.cs プロジェクト: Steviegt6/SpiritMod
        public void Teleport(Vector2 newPos, int Style = 0, int extraInfo = 0)
        {
            Player player = Main.player[projectile.owner];

            try {
                player.grappling[0] = -1;
                player.grapCount    = 0;
                for (int j = 0; j < 1000; j++)
                {
                    if (Main.projectile[j].active && Main.projectile[j].owner == player.whoAmI && Main.projectile[j].aiStyle == 7)
                    {
                        Main.projectile[j].Kill();
                    }
                }
                int extraInfo2 = 0;
                if (Style == 4)
                {
                    extraInfo2 = player.lastPortalColorIndex;
                }
                float num3 = MathHelper.Clamp(1f - player.teleportTime * 0.99f, 0.01f, 1f);
                float num2 = Vector2.Distance(player.position, newPos);
                player.position  = newPos;
                player.fallStart = (int)(player.position.Y / 16f);
                if (player.whoAmI == Main.myPlayer)
                {
                    bool flag = false;
                    if (num2 < new Vector2((float)Main.screenWidth, (float)Main.screenHeight).Length() / 2f + 100f)
                    {
                        int time = 0;
                        if (Style == 1)
                        {
                            time = 10;
                        }
                        Main.SetCameraLerp(0.1f, time);
                        flag = true;
                    }
                    else
                    {
                        Main.BlackFadeIn = 255;
                        Lighting.BlackOut();
                        Main.screenLastPosition = Main.screenPosition;
                        Main.screenPosition.X   = player.position.X + (float)(player.width / 2) - (float)(Main.screenWidth / 2);
                        Main.screenPosition.Y   = player.position.Y + (float)(player.height / 2) - (float)(Main.screenHeight / 2);
                        Main.quickBG            = 10;
                    }
                    if (num3 > 0.1f || !flag || Style != 0)
                    {
                        if (Main.mapTime < 5)
                        {
                            Main.mapTime = 5;
                        }
                        Main.maxQ      = true;
                        Main.renderNow = true;
                    }
                }
                if (Style == 4)
                {
                    player.lastPortalColorIndex = extraInfo;
                    extraInfo2 = player.lastPortalColorIndex;
                    player.portalPhysicsFlag = true;
                    player.gravity           = 0f;
                }
                for (int i = 0; i < 3; i++)
                {
                    player.UpdateSocialShadow();
                }
                player.oldPosition   = player.position + player.BlehOldPositionFixer;
                player.teleportTime  = 1f;
                player.teleportStyle = Style;
            }
            catch {
            }
        }