Exemplo n.º 1
0
 public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
 {
     TBMPlayer.Get(Main.player[projectile.owner]).Stamina += 1;
     Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Punch" + Main.rand.Next(1, 5)).WithVolume(0.35f));
     target.immune[projectile.owner] = 10;
     TBMUtils.CircleDust(projectile.Center, projectile.velocity, DustID.AncientLight);
 }
Exemplo n.º 2
0
 public override void SpecialMove0(int length)
 {
     if (Owner.whoAmI == Main.myPlayer && FistRushVelocity == Vector2.Zero)
     {
         //Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, ShortShoutID).WithVolume(1f));
         FistRushVelocity = TBMUtils.DistanceToMouse(projectile.Center, 10f);
         if (Main.MouseWorld.X < Owner.Center.X)
         {
             Owner.direction = -1;
         }
         else
         {
             Owner.direction = 1;
         }
         TBMPlayer.Get(Owner).PreRushDirection = Owner.direction;
     }
     if (_attackCounter < 1)
     {
         Projectile.NewProjectile(projectile.Center + new Vector2(34 * Main.player[projectile.owner].direction, -14), FistRushVelocity, mod.ProjectileType <UnzippedStickyFist>(), 60, 2.5f, projectile.owner);
     }
     if (++_attackCounter < length)
     {
         FrameOffset      = 5;
         _positionOffsetX = 25;
     }
     else
     {
         FistRushVelocity = Vector2.Zero;
         _positionOffsetX = -20;
         State            = StandState.Idle;
         _attackCounter   = 0;
     }
 }
Exemplo n.º 3
0
 private void RushAttackLong(int length)
 {
     FrameSpeed = 1;
     if (Owner.whoAmI == Main.myPlayer && FistRushVelocity == Vector2.Zero)
     {
         FistRushVelocity = TBMUtils.DistanceToMouse(projectile.Center, 10f);
         if (Main.MouseWorld.X < Owner.Center.X)
         {
             Owner.direction = -1;
         }
         else
         {
             Owner.direction = 1;
         }
         TBMPlayer.Get(Owner).PreRushDirection = Owner.direction;
     }
     if (++_attackCounter < length)
     {
         TBMPlayer.Get(Owner).InRush = true;
         _positionOffsetX            = 25;
         Projectile.NewProjectile(projectile.Center, FistRushVelocity, FistID, 60, 3.5f, projectile.owner);
     }
     else
     {
         FistRushVelocity = Vector2.Zero;
         _positionOffsetX = -20;
         State            = StandState.Idle;
         _attackCounter   = 0;
     }
 }
Exemplo n.º 4
0
 public override void SpecialMove1(int length)
 {
     if (Owner.whoAmI == Main.myPlayer && FistRushVelocity == Vector2.Zero)
     {
         FistRushVelocity = TBMUtils.DistanceToMouse(projectile.Center, 10f);
         if (Main.MouseWorld.X < Owner.Center.X)
         {
             Owner.direction = -1;
         }
         else
         {
             Owner.direction = 1;
         }
         TBMPlayer.Get(Owner).PreRushDirection = Owner.direction;
     }
     if (_attackCounter < 1)
     {
         for (int i = 0; i < 8; i++)
         {
             Projectile.NewProjectile(projectile.Center + new Vector2(Main.rand.Next(-16, 16), Main.rand.Next(-25, 25)).RotatedBy(FistRushVelocity.SafeNormalize(-Vector2.UnitY).ToRotation()), FistRushVelocity, mod.ProjectileType <Knife>(), 22, 0f, projectile.owner);
         }
     }
     if (++_attackCounter < length)
     {
         _positionOffsetX = 25;
     }
     else
     {
         FistRushVelocity = Vector2.Zero;
         _positionOffsetX = -20;
         State            = StandState.Idle;
         _attackCounter   = 0;
     }
 }
Exemplo n.º 5
0
        public override void AI()
        {
            var _bonusVel = new Vector2(0, Main.rand.Next(-20, 20)).RotatedBy(projectile.velocity.ToRotation());

            projectile.velocity *= 1.1f;
            if (projectile.velocity.X < 0)
            {
                CurrentFrame = 1;
            }
            else
            {
                CurrentFrame = 0;
            }
            if (TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile != null)
            {
                projectile.netUpdate = true;
                Vector2 pos = Main.projectile[TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile.whoAmI].Center + _bonusVel + projectile.velocity;
                projectile.ai[0] = pos.X;
                projectile.ai[1] = pos.Y;
            }
            foreach (Projectile projectiles in Main.projectile)
            {
                if (projectiles.owner == projectile.owner || !projectiles.active)
                {
                    continue;
                }
                if (projectiles.Name.Contains("Fist") && Collision.CheckAABBvAABBCollision(projectile.position - Main.screenPosition, projectile.Hitbox.Size(), projectiles.position - Main.screenPosition, projectiles.Hitbox.Size()))
                {
                    Main.player[projectile.owner].velocity = (projectile.Center - projectiles.Center).SafeNormalize(-Vector2.UnitY) * 1.5f;
                }
            }
            projectile.Center = new Vector2(projectile.ai[0], projectile.ai[1]);
        }
Exemplo n.º 6
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     if (TBMPlayer.Get(Main.LocalPlayer).IsStandUser)
     {
         DrawMeterUI(spriteBatch, TBMPlayer.Get(Main.LocalPlayer));
     }
     Recalculate();
 }
Exemplo n.º 7
0
 public bool CheckCost(int specialIndex)
 {
     if (TBMPlayer.Get(Owner).Stamina >= SpecialCosts[specialIndex])
     {
         TBMPlayer.Get(Owner).Stamina -= SpecialCosts[specialIndex];
         return(true);
     }
     return(false);
 }
Exemplo n.º 8
0
 public override void OnHitPvp(Player target, int damage, bool crit)
 {
     if (TBMWorld.Get().TimeStopDuration <= 0)
     {
         TBMPlayer.Get(Main.player[projectile.owner]).Stamina += 1;
     }
     TBMUtils.CircleDust(projectile.Center, projectile.velocity, DustID.AncientLight);
     Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Punch" + Main.rand.Next(1, 5)).WithVolume(0.35f));
 }
Exemplo n.º 9
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Vector2   drawOrigin   = new Vector2(StandTexture.Width / 2, StandTexture.Height / TotalFrameCount / 2);
            Rectangle CurrentFrame = new Rectangle(0, StandHeight * _frameY, StandTexture.Width, StandHeight);

            if (TBMPlayer.Get(Main.player[Main.myPlayer]).IsStandUser)
            {
                spriteBatch.Draw(StandTexture, new Vector2((int)projectile.Center.X, (int)projectile.Center.Y) - Main.screenPosition, CurrentFrame, Color.White * _alpha, 0f, drawOrigin, DefaultScale, _standSpriteEffects, 1f);
            }
        }
Exemplo n.º 10
0
        public override bool CanUseItem(Player player)
        {
            StandBase stand = Main.rand.Next(StandManager.AllStands);

            TBMPlayer.Get(player).MyStand = (StandBase)Activator.CreateInstance(stand.GetType());
            PlayerDeathReason reason = new PlayerDeathReason();

            reason.SourceCustomReason = player.name + " could not handle the power within.";

            /*if (stand is EmptyStand)
             *  player.KillMe(reason, 0, 0);*/
            return(base.CanUseItem(player));
        }
Exemplo n.º 11
0
        public override void AI()
        {
            projectile.netUpdate  = true;
            projectile.netUpdate2 = true;
            if (projectile.velocity.X < 0)
            {
                CurrentFrame = 1;
            }
            else
            {
                CurrentFrame = 0;
            }
            if (TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile != null)
            {
                Vector2 pos = Main.projectile[TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile.whoAmI].Center + projectile.velocity;
                projectile.ai[0] = pos.X;
                projectile.ai[1] = pos.Y;
                this._pos        = Main.projectile[TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile.whoAmI].Center + new Vector2(24 * Main.player[projectile.owner].direction, -3);
            }
            if (projectile.timeLeft <= 480)
            {
                if (TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile != null)
                {
                    Vector2 pos = Main.projectile[TBMPlayer.Get(Main.player[projectile.owner]).MyStandProjectile.whoAmI].Center;

                    _velX -= new Vector2(5, 0).RotatedBy(projectile.velocity.ToRotation()).X;
                    _velY -= new Vector2(5, 0).RotatedBy(projectile.velocity.ToRotation()).Y;
                    if (Vector2.Distance(projectile.Center, pos + new Vector2(24 * Main.player[projectile.owner].direction, -5)) <= 10)
                    {
                        projectile.Kill();
                    }
                }
                else
                {
                    projectile.Kill();
                }
            }
            else
            {
                _velX += new Vector2(5, 0).RotatedBy(projectile.velocity.ToRotation()).X;
                _velY += new Vector2(5, 0).RotatedBy(projectile.velocity.ToRotation()).Y;
            }
            projectile.velocity = new Vector2(_velX, _velY);
            projectile.Center   = new Vector2(projectile.ai[0], projectile.ai[1]) + new Vector2(24 * Main.player[projectile.owner].direction, -5);
        }
Exemplo n.º 12
0
 private static void DrawBar(SpriteBatch spriteBatch, TBMPlayer player, Color color, Color pulsingColor, int row = 0)
 {
     for (int i = 0; i < 10; i++)
     {
         spriteBatch.Draw
         (
             TBMTextures.MeterBarTexture,
             new Vector2(30, Main.screenHeight - 80) + new Vector2(15 * 3 - i * 3, 9 + i * 3),
             new Rectangle(0, i * 3, (i > 4 ? player.Stamina - row * 100 < 50 ? player.Stamina - row * 100 : 50 : player.Stamina - row * 100 < 100 ? player.Stamina - row * 100 : 100) * 3, 3),
             player.Stamina == player.StaminaMax ? pulsingColor : color,
             0,
             Vector2.Zero,
             1f,
             SpriteEffects.None,
             1f
         );
     }
 }
Exemplo n.º 13
0
        public void DrawMeterUI(SpriteBatch spriteBatch, TBMPlayer player)
        {
            float gradient     = player.Stamina <= 50 ? (float)player.Stamina * 0.01f : (float)(player.Stamina - 50) * 0.01f;
            Color lerpColor1   = player.Stamina <= 50 ? Color.Red : Color.Lerp(Color.Red, Color.Yellow, 0.5f);
            Color lerpColor2   = player.Stamina <= 50 ? Color.Yellow : Color.SpringGreen;
            Color color        = Color.Lerp(lerpColor1, lerpColor2, gradient);
            Color pulsingColor = Color.Lerp(color, Color.Black, _pulseAmount);


            float row2gradient     = player.Stamina - 100 <= 50 ? (float)(player.Stamina - 100) * 0.01f : (float)(player.Stamina - 150) * 0.01f;
            Color row2LerpColor1   = player.Stamina - 100 <= 50 ? Color.DarkBlue : Color.Lerp(Color.DarkBlue, Color.MediumPurple, 0.5f);
            Color row2LerpColor2   = player.Stamina - 100 <= 50 ? Color.MediumPurple : Color.Violet;
            Color row2Color        = Color.Lerp(row2LerpColor1, row2LerpColor2, row2gradient);
            Color row2pulsingColor = Color.Lerp(row2Color, Color.Black, _pulseAmount);

            float row3gradient     = player.Stamina - 200 <= 50 ? (float)(player.Stamina - 200) * 0.01f : (float)(player.Stamina - 250) * 0.01f;
            Color row3LerpColor1   = player.Stamina - 200 <= 50 ? Color.PaleVioletRed : Color.Lerp(Color.PaleVioletRed, Color.Red, 0.5f);
            Color row3LerpColor2   = player.Stamina - 200 <= 50 ? Color.Red : Color.Crimson;
            Color row3Color        = Color.Lerp(row3LerpColor1, row3LerpColor2, row3gradient);
            Color row3pulsingColor = Color.Lerp(row3Color, Color.Black, _pulseAmount);

            spriteBatch.Draw
            (
                player.StaminaMax <= 50 ? TBMTextures.MeterMainTexture_Alt : TBMTextures.MeterMainTexture,
                new Vector2(30, Main.screenHeight - 80),
                null,
                player.Stamina >= 300 ? row3pulsingColor : Color.White,
                0,
                Vector2.Zero,
                1f,
                SpriteEffects.None,
                1f
            );

            DrawBar(spriteBatch, player, color, pulsingColor);
            if (player.Stamina > 100)
            {
                DrawBar(spriteBatch, player, row2Color, row2pulsingColor, 1);
            }
            if (player.Stamina > 200)
            {
                DrawBar(spriteBatch, player, row3Color, row3pulsingColor, 2);
            }
        }
Exemplo n.º 14
0
 public override void UpdateEquip(Player player)
 {
     TBMPlayer.Get(player).StaminaMax += 150;
 }
Exemplo n.º 15
0
 public override void OnHitPvp(Player target, int damage, bool crit)
 {
     TBMPlayer.Get(Main.player[projectile.owner]).Stamina += 1;
 }