Esempio n. 1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            CalculatedStyle dims          = base.GetDimensions();
            Vector2         MousePosition = new Vector2((float)Main.mouseX, (float)Main.mouseY);

            if (this.ContainsPoint(MousePosition))
            {
                Main.LocalPlayer.mouseInterface = true;
            }

            Texture2D texture = TBAPlayer.Get().Stand.StandName == StandDisplayName ? Textures.SCCurrent : Textures.StandCard;

            spriteBatch.Draw(texture, dims.Position(), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);

            if (!Unlocked)
            {
                spriteBatch.Draw(Textures.SCUnknown, dims.Position() + new Vector2(70), null, Color.White, 0f, new Vector2(Textures.SCUnknown.Width / 2, Textures.SCUnknown.Height / 2), 1f, SpriteEffects.None, 1f);
                Utils.DrawBorderString(spriteBatch, "???", dims.Position() + new Vector2(56, 160), Color.White);
            }

            if (Unlocked)
            {
                Vector2 anchor = dims.Position() + new Vector2(16, 160);
                spriteBatch.Draw(Idle.SpriteSheet, dims.Position() + new Vector2(70), Idle.FrameRect, Color.White, 0f, Idle.DrawOrigin, 1f, SpriteEffects.None, 1f);
                Utils.DrawBorderString(spriteBatch, StandDisplayName, anchor, Color.White, 1);
            }
        }
Esempio n. 2
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            TBAPlayer tbaPlayer = TBAPlayer.Get(Main.LocalPlayer);

            // Stand shouldn't be drawn in 2 scenarios:
            // 1) We aren't a stand user, so we can't see stands
            // 2) Someone f****d shit up and forgot to fill Animations smh;

            if (!tbaPlayer.StandUser || Animations.Count <= 0)
            {
                return;
            }

            SpriteEffects spriteEffects = IsFlipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None;

            if (DrawStandAura)
            {
                spriteBatch.Draw(Animations[CurrentState].SpriteSheet, projectile.Center + new Vector2(DrawOffset, 0).RotatedBy(DrawRotation) - Main.screenPosition, Animations[CurrentState].FrameRect, AuraColor * 0.25f * Opacity, projectile.rotation, Animations[CurrentState].DrawOrigin, 1f, spriteEffects, 1f);
                spriteBatch.Draw(Animations[CurrentState].SpriteSheet, projectile.Center + new Vector2(-DrawOffset, 0).RotatedBy(DrawRotation) - Main.screenPosition, Animations[CurrentState].FrameRect, AuraColor * 0.25f * Opacity, projectile.rotation, Animations[CurrentState].DrawOrigin, 1f, spriteEffects, 1f);
                spriteBatch.Draw(Animations[CurrentState].SpriteSheet, projectile.Center + new Vector2(0, DrawOffset).RotatedBy(DrawRotation) - Main.screenPosition, Animations[CurrentState].FrameRect, AuraColor * 0.25f * Opacity, projectile.rotation, Animations[CurrentState].DrawOrigin, 1f, spriteEffects, 1f);
                spriteBatch.Draw(Animations[CurrentState].SpriteSheet, projectile.Center + new Vector2(0, -DrawOffset).RotatedBy(DrawRotation) - Main.screenPosition, Animations[CurrentState].FrameRect, AuraColor * 0.25f * Opacity, projectile.rotation, Animations[CurrentState].DrawOrigin, 1f, spriteEffects, 1f);
            }

            spriteBatch.Draw(Animations[CurrentState].SpriteSheet, projectile.Center - Main.screenPosition, Animations[CurrentState].FrameRect, Color.White * Opacity, projectile.rotation, Animations[CurrentState].DrawOrigin, 1f, spriteEffects, 1f);
        }
Esempio n. 3
0
        protected override void ActionLocal(CommandCaller caller, Player player, string input, string[] args)
        {
            if (TBAMultiplayerConfig.EnableDebugCommands)
            {
                TBAPlayer tPlayer = TBAPlayer.Get(caller.Player);

                if (input.Contains("DayOrk"))
                {
                    tPlayer.Stand = StandLoader.Instance.FindGeneric(x => x is SREKTStand);
                    Main.NewText("What the~");
                    return;
                }

                if (StandLoader.Instance.FindGeneric(x => input.Contains(x.StandName.ToString()) && x.CanAcquire(TBAPlayer.Get(caller.Player))) != null)
                {
                    tPlayer.Stand = StandLoader.Instance.FindGeneric(x => input.Contains(x.StandName.ToString()));
                }
                else
                {
                    Main.NewText("Incorrect stand name, please use /listStands to see their names");
                }
            }
            else
            {
                DisabledDebugCommands();
            }
        }
Esempio n. 4
0
        public override void PreUpdate()
        {
            if (Main.netMode == NetmodeID.SinglePlayer || Main.dedServ)
            {
                TimeSkipManager.UpdateTimeSkip();
                TimeStopManagement.MainOnOnTick();
            }


            TBAPlayer plr = TimeStopManagement.TimeStopper as TBAPlayer;

            if (TimeStopManagement.TimeStoppedFor <= 78 && TimeStopManagement.TimeStoppedFor > 76)
            {
                if (plr.StandUser)
                {
                    if (plr.Stand is TheWorldStand)
                    {
                        TBAMod.PlayVoiceLine("Sounds/TheWorld/TimeResume");
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/TheWorld/TheWorld_ZaWarudoReleaseSFX"));
                    }

                    if (plr.Stand is StarPlatinumStand)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/StarPlatinum/SP_TimeRestore"));
                    }
                }
            }

            base.PreUpdate();
        }
Esempio n. 5
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (!HasLoaded && StandLoader.Instance.Loaded)
            {
                HasLoaded = true;
                foreach (var stand in StandLoader.Instance.Generics)
                {
                    if (!stand.CanAcquire(TBAPlayer.Get(Main.LocalPlayer)))
                    {
                        continue;
                    }
                    int projToKill = Projectile.NewProjectile(Vector2.Zero, Vector2.Zero, TBAMod.Instance.ProjectileType(stand.GetType().Name), 0, 0, Main.myPlayer);

                    StandCard standCard = new StandCard(Main.projectile[projToKill].modProjectile as Stand);

                    standCard.Left.Set(5, 0);
                    standCard.OnClick += SetStand;

                    StandCardGrid.Add(standCard);

                    Main.projectile[projToKill].Kill();
                }
            }

            Recalculate();
        }
Esempio n. 6
0
        public bool Run(InstantlyRunnable instantlyRunnable, TBAPlayer tbaPlayer, bool local = true)
        {
            if (instantlyRunnable == null)
            {
                return(false);
            }

            LastRan = instantlyRunnable;

            try
            {
                if (!LastRan.Run(tbaPlayer))
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }

            if (local && Main.netMode == NetmodeID.MultiplayerClient)
            {
                new InstantlyRunnableRanPacket
                {
                    StringifiedClass = instantlyRunnable.GetType().ToString()
                }.Send();
            }

            return(true);
        }
Esempio n. 7
0
        public override void UpdateInventory(Player player)
        {
            item.favorited = true;
            TBAPlayer.Get(player).StaminaRegenBuff += 60;

            if (!TBAPlayer.Get(player).KnifeGangMember)
            {
                item.TurnToAir();
            }
        }
Esempio n. 8
0
        // TODO: change those two to something else
        public void ExecuteAction(UIMouseEvent evt, UIElement listeningElement)
        {
            if (SelectedRunnable == null)
            {
                Main.NewText("You must select a save slot!");
                return;
            }

            LastInstantEnvironment.Run(TBAPlayer.Get(Main.LocalPlayer));
        }
Esempio n. 9
0
        public virtual void KillStand()
        {
            if (CanDie || Owner.dead || !Owner.active)
            {
                projectile.Kill();
                TBAPlayer.Get(Owner).KillStand();

                Animations.Clear();
            }
        }
Esempio n. 10
0
        public Stand GetRandom(TBAPlayer tbaPlayer)
        {
            Stand stand = null;

            while (stand == null || !stand.CanAcquire(tbaPlayer) || tbaPlayer.Stand == stand)
            {
                stand = GetRandom();
            }

            return(stand);
        }
Esempio n. 11
0
 public override void Action(CommandCaller caller, string input, string[] args)
 {
     if (TBAMultiplayerConfig.EnableDebugCommands)
     {
         TBAPlayer.Get().IsDebugging = !TBAPlayer.Get().IsDebugging;
     }
     else
     {
         DisabledDebugCommands();
     }
 }
Esempio n. 12
0
        protected override void ActionLocal(CommandCaller caller, Player player, string input, string[] args)
        {
            if (TBAMultiplayerConfig.EnableDebugCommands)
            {
                TBAPlayer tPlayer = TBAPlayer.Get(caller.Player);

                tPlayer.ActiveStandProjectile.KillStand();
            }
            else
            {
                DisabledDebugCommands();
            }
        }
Esempio n. 13
0
 public void EraseTime()
 {
     if (TimeSkipManager.TimeSkippedFor <= 0 && TBAPlayer.Get(Owner).CheckStaminaCost(25))
     {
         TBAPlayer.Get(Owner).TirePlayer(15);
         Projectile.NewProjectile(Center, Vector2.Zero, ModContent.ProjectileType <FakeTilesProjectile>(), 0, 0, Owner.whoAmI);
         TimeSkipManager.SkipTime(TBAPlayer.Get(Owner), Constants.TICKS_PER_SECOND * 10 + 26);
     }
     else if (TimeSkipManager.TimeSkippedFor > 0)
     {
         Main.projectile.FirstActive(x => x.modProjectile is FakeTilesProjectile).timeLeft = 30;
         TimeSkipManager.SkipTime(TBAPlayer.Get(Owner), 36);
     }
 }
Esempio n. 14
0
 public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 {
     if (TimeStopManagement.TimeStopped)
     {
         for (int i = 0; i < Main.combatText.Length; i++)
         {
             if (!Main.combatText[i].active)
             {
                 if (!TBAPlayer.Get().CombatTextQue.ContainsKey(i))
                 {
                     TBAPlayer.Get().CombatTextQue.Add(i, damage);
                 }
             }
         }
     }
 }
Esempio n. 15
0
        private void SetStand(UIMouseEvent evt, UIElement listeningElement)
        {
            StandCard card = listeningElement as StandCard;

            if (card != null)
            {
                if (!TBAPlayer.Get(Main.LocalPlayer).UnlockedStands.Contains(card.StandUnlocalizedName))
                {
                    return;
                }

                UIManager.StandComboLayer.State.Visible      = true;
                UIManager.StandComboLayer.State.CurrentStand = StandLoader.Instance.FindGeneric(x => x.StandName.ToString() == card.StandDisplayName);
                UIManager.StandComboLayer.State.NeedsToUpdateAutopsyReport = true;
            }
        }
Esempio n. 16
0
        public override void NetReceive(BinaryReader reader)
        {
            bool timeStopped = reader.ReadBoolean();

            if (timeStopped)
            {
                TimeStopManagement.MainTime      = reader.ReadDouble();
                TimeStopManagement.MainRainTimer = reader.ReadInt32();

                TimeStopManagement.StopTime(TBAPlayer.Get(Main.player[reader.ReadInt32()]), reader.ReadInt32());
            }
            else
            {
                TimeStopManagement.ResumeTime();
            }
        }
Esempio n. 17
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (!TBAPlayer.Get(Main.LocalPlayer).StandUser)
            {
                return;
            }


            Texture2D texture  = Main.projectileTexture[projectile.type];
            Vector2   position = Center - Main.screenPosition;

            float rotation = Velocity.ToRotation() + MathHelper.Pi / 2;
            float opacity  = TimeLeft > 116 ? 0f : 1f;

            spriteBatch.Draw(texture, position, null, Color.White * opacity, rotation, new Vector2(1), 1f, SpriteEffects.None, 1f);
        }
Esempio n. 18
0
 protected override void ActionLocal(CommandCaller caller, Player player, string input, string[] args)
 {
     if (TBAMultiplayerConfig.EnableDebugCommands)
     {
         foreach (Stand s in StandLoader.Instance.Generics)
         {
             if (s.CanAcquire(TBAPlayer.Get(caller.Player)))
             {
                 Main.NewText(s.StandName);
             }
         }
     }
     else
     {
         DisabledDebugCommands();
     }
 }
Esempio n. 19
0
        internal static void MainOnOnTick()
        {
            int previousTimeStoppedFor = TimeStoppedFor;

            if (TimeStoppedFor > 0)
            {
                TimeStoppedFor--;
            }

            if (TimeStoppedFor == 0 && TimeStoppedFor != previousTimeStoppedFor)
            {
                TryResumeTime(TimeStopper);
            }


            if (TimeStopped)
            {
                TBAPlayer tbaPlayer = TBAPlayer.Get(Main.LocalPlayer);
                Main.blockInput = !(tbaPlayer.StandUser && (tbaPlayer.Stand.IsNativelyImmuneToTimeStop() || TimeStopper == tbaPlayer));

                Main.dayRate = 0;
                Main.time    = TimeStopManagement.MainTime;

                Main.rainTime = TimeStopManagement.MainRainTimer;
            }

            if (!TimeStopped)
            {
                if (itemStates.Count > 0)
                {
                    itemStates.Clear();
                }

                if (npcStates.Count > 0)
                {
                    npcStates.Clear();
                }

                if (projectileStates.Count > 0)
                {
                    projectileStates.Clear();
                }
            }
        }
Esempio n. 20
0
        public override bool CanUseItem(Item item, Player player)
        {
            if (item.channel && item.shoot != ProjectileID.None)
            {
                if (!TBAMod.Instance.TimeStopImmuneProjectiles.Contains(item.shoot))
                {
                    TBAMod.Instance.TimeStopImmuneProjectiles.Add(item.shoot);
                }
            }

            TBAPlayer tPlayer = TBAPlayer.Get(player);

            if (tPlayer.StandActive && tPlayer.ActiveStandProjectile.StopsItemUse)
            {
                return(false);
            }

            return(base.CanUseItem(item, player));
        }
Esempio n. 21
0
        public void PostSCARDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor)
        {
            if (Main.LocalPlayer.whoAmI == Main.myPlayer)
            {
                TBAPlayer standUser = TBAPlayer.Get(Main.LocalPlayer);


                if (standUser.Stand is SREKTStand && standUser.StandActive)
                {
                    int maxHeight = (npc.life * npc.height) / npc.lifeMax;


                    if (standUser.ActiveStandProjectile is SREKTStand stand && stand.Wallhack)
                    {
                        DrawHelpers.DrawBorderedRectangle(npc.position - Main.screenPosition - new Vector2(12, maxHeight - npc.height), 10, maxHeight, Color.Lime, Color.Green, spriteBatch);
                        DrawHelpers.DrawBorderedRectangle(npc.position - Main.screenPosition, npc.width, npc.height, Color.Black * 0f, Color.Green, spriteBatch);
                    }
                }
            }
        }
Esempio n. 22
0
        public void TimeStop()
        {
            if (TimeStopManagement.TimeStopped)
            {
                TimeStopManagement.TryResumeTime(TBAPlayer.Get(Owner));
                Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, TimeStopRestorePath));
                return;
            }

            if (!TBAPlayer.Get(Owner).ShatteredTime&& TBAPlayer.Get(Owner).CheckStaminaCost(TimeStopCost))
            {
                TBAPlayer.Get(Owner).TirePlayer(15);

                if (!TimeStopManagement.TimeStopped)
                {
                    TBAMod.PlayVoiceLine(TimeStopVoiceLinePath);
                }

                CurrentState = TIMESTOP_ANIMATION;
            }
        }
Esempio n. 23
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            TBAPlayer tbaPlayer = TBAPlayer.Get(Main.player[Main.myPlayer]);


            if (!tbaPlayer.StandUser)
            {
                return;
            }


            SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally;


            Texture2D texture = ModContent.GetTexture(Texture);

            spriteBatch.Draw(texture, projectile.Center + new Vector2(2, 0) - Main.screenPosition, new Rectangle(0, (int)(texture.Height * SFrame), (int)texture.Width, (int)texture.Height / 2), Color.White * Opacity * 0.35f, projectile.velocity.ToRotation(), new Vector2(texture.Width / 2, texture.Height / 4), 1f, spriteEffects, 1f);
            spriteBatch.Draw(texture, projectile.Center + new Vector2(-2, 0) - Main.screenPosition, new Rectangle(0, (int)(texture.Height * SFrame), (int)texture.Width, (int)texture.Height / 2), Color.White * Opacity * 0.35f, projectile.velocity.ToRotation(), new Vector2(texture.Width / 2, texture.Height / 4), 1f, spriteEffects, 1f);
            spriteBatch.Draw(texture, projectile.Center + new Vector2(0, 2) - Main.screenPosition, new Rectangle(0, (int)(texture.Height * SFrame), (int)texture.Width, (int)texture.Height / 2), Color.White * Opacity * 0.35f, projectile.velocity.ToRotation(), new Vector2(texture.Width / 2, texture.Height / 4), 1f, spriteEffects, 1f);
            spriteBatch.Draw(texture, projectile.Center + new Vector2(0, -2) - Main.screenPosition, new Rectangle(0, (int)(texture.Height * SFrame), (int)texture.Width, (int)texture.Height / 2), Color.White * Opacity * 0.35f, projectile.velocity.ToRotation(), new Vector2(texture.Width / 2, texture.Height / 4), 1f, spriteEffects, 1f);

            spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle(0, (int)(texture.Height * SFrame), (int)texture.Width, (int)texture.Height / 2), Color.White * Opacity, projectile.velocity.ToRotation(), new Vector2(texture.Width / 2, texture.Height / 4), 1f, spriteEffects, 1f);
        }
Esempio n. 24
0
        public override bool UseItem(Player player)
        {
            TBAPlayer tbaPlayer = TBAPlayer.Get(player);

            Stand stand = StandLoader.Instance.GetRandom(tbaPlayer);

            tbaPlayer.Stand = stand;
            Main.NewText($"You got yourself a Stand{(Main.rand.Next(0, 100) > 98 ? "oda" : "")}!");

            if (TBAInputs.StandPose.GetAssignedKeys().Count <= 0 ||
                TBAInputs.ContextAction.GetAssignedKeys().Count <= 0 ||
                TBAInputs.ExtraAction01.GetAssignedKeys().Count <= 0 ||
                TBAInputs.ExtraAction02.GetAssignedKeys().Count <= 0)
            {
                Main.NewText("Whoops! It looks like you forgot to setup your hotkeys! Go to Settings -> Controls and scroll down. Bind all hotkeys from this mod & try again");
            }

            if (!tbaPlayer.UnlockedStands.Contains(stand.UnlocalizedName))
            {
                tbaPlayer.UnlockedStands.Add(stand.UnlocalizedName);
            }

            return(true);
        }
Esempio n. 25
0
 public bool Run(TBAPlayer tbaPlayer, bool local = true) => Run(Selected, tbaPlayer, local);
Esempio n. 26
0
 public override void Update(Player player, ref int buffIndex)
 {
     TBAPlayer.Get(player).Exhausted = true;
 }
Esempio n. 27
0
        public override void AI()
        {
            base.AI();


            Opacity           = 1f;
            projectile.Center = Owner.Center + new Vector2(34 * Owner.direction, -10 + Owner.gfxOffY);
            IsFlipped         = Owner.direction == 1;


            if (CurrentState == ANIMATION_SUMMON)
            {
                if (InstantEnvironment == null && Owner == Main.LocalPlayer)
                {
                    InstantEnvironment = new InstantEnvironment();
                }

                if (!InitialSummonComplete)
                {
                    Opacity = CurrentAnimation.FrameRect.Y / CurrentAnimation.FrameRect.Height * 0.25f;
                }

                if (CurrentAnimation.Finished)
                {
                    InitialSummonComplete = true;
                    CurrentState          = ANIMATION_IDLE;
                }
            }


            projectile.timeLeft = 200;


            if (Owner.IsLocalPlayer())
            {
                if (TBAInputs.SummonStand.JustPressed && CurrentState == ANIMATION_IDLE)
                {
                    CurrentState = ANIMATION_DESPAWN;
                }

                if (TBAInputs.ContextAction.JustPressed && CurrentState == ANIMATION_IDLE)
                {
                    UIManager.RATMState.Visible = true;
                }

                if (TBAInputs.StandPose.JustPressed && CurrentState == ANIMATION_IDLE)
                {
                    if (!InstantEnvironment.CompileAssembly(Path.Combine(Main.SavePath, "Mods", "Cache", "TBA")))
                    {
                        CurrentState = ANIMATION_ERROR;
                    }
                }

                if (TBAInputs.ExtraAction01.JustPressed && CurrentState == ANIMATION_IDLE)
                {
                    InstantEnvironment?.Run(TBAPlayer.Get(Owner));
                }

                if (TBAInputs.ExtraAction02.JustPressed && CurrentState == ANIMATION_IDLE)
                {
                    InstantEnvironment?.Selected?.Stop();
                }
            }


            if (CurrentState == ANIMATION_ERROR && _errorLoopCount < ERROR_LOOP_COUNT)
            {
                if (CurrentAnimation.Finished)
                {
                    _errorLoopCount++;
                    CurrentAnimation.ResetAnimation();
                }

                if (_errorLoopCount == 1)
                {
                    _errorLoopCount = 0;
                    CurrentState    = ANIMATION_SUMMON;
                    CurrentAnimation.ResetAnimation();
                }
            }


            if (CurrentState == ANIMATION_DESPAWN)
            {
                Opacity = (Animations[ANIMATION_DESPAWN].FrameCount - CurrentAnimation.FrameRect.Y / (int)CurrentAnimation.FrameSize.Y) * 0.2f;

                if (CurrentAnimation.Finished)
                {
                    KillStand();
                }
            }
        }
Esempio n. 28
0
 public override bool CanAcquire(TBAPlayer tbaPlayer) => SteamHelper.Webmilio.SteamId64 == SteamHelper.SteamId64;
Esempio n. 29
0
        public override void AI()
        {
            base.AI();

            if (Animations.Count <= 0)
            {
                return;
            }

            OwnerCtrlUse = Owner.controlUseTile;


            projectile.width  = (int)CurrentAnimation.FrameSize.X;
            projectile.height = (int)CurrentAnimation.FrameSize.Y;

            IsFlipped = Owner.direction == 1;

            projectile.timeLeft = 200;
            projectile.friendly = true;

            if (Owner.whoAmI == Main.myPlayer)
            {
                /*if (TBAInputs.StandPose.JustPressed)
                 *  if (CurrentState == ANIMATION_IDLE)
                 *      IsTaunting = true;
                 *  else
                 *      IsTaunting = false;*/

                if (TBAInputs.SummonStand.JustPressed && InIdleState)
                {
                    CurrentState = ANIMATION_DESPAWN;
                }
            }
            int xOffset = IsTaunting || CurrentState.Contains("PUNCH") || CurrentState.Contains("ATT") || CurrentState == "DONUT_UNDO" || CurrentState == "DONUT_MISS" || RushTimer > 0? 34 : -16;

            int yOffset = CurrentState.Contains("POSE") ? 36 : 0;

            xOffset = CurrentState.Contains("POSE") ? 24 : xOffset;


            PositionOffset = Owner.Center + new Vector2(xOffset * Owner.direction, -24 + Owner.gfxOffY + yOffset);

            projectile.Center = Vector2.Lerp(projectile.Center, PositionOffset, 0.26f);

            if (CurrentState == ANIMATION_SUMMON)
            {
                Opacity = 1;
            }

            #region Punching
            if (InIdleState)
            {
                if (TBAInputs.StandPose.JustPressed && Owner.whoAmI == Main.myPlayer)
                {
                    CurrentState = "POSE_PREP";
                }

                if (StopsItemUse)
                {
                    if (PunchCounter < 2)
                    {
                        projectile.netUpdate = true;
                        if (TBAPlayer.Get(Owner).MouseOneTimeReset > 0)
                        {
                            if (TBAPlayer.Get(Owner).MouseOneTime < 15 && !Owner.controlUseItem)
                            {
                                TBAPlayer.Get(Owner).Stamina -= 2;
                                Owner.direction = Main.MouseWorld.X < Owner.Center.X ? -1 : 1;

                                if (Main.MouseWorld.Y > Owner.Center.Y + 60)
                                {
                                    CurrentState = "PUNCH_" + (Main.rand.NextBool() ? "R" : "L") + "D";
                                }
                                else if (Main.MouseWorld.Y < Owner.Center.Y - 60)
                                {
                                    CurrentState = "PUNCH_" + (Main.rand.NextBool() ? "R" : "L") + "U";
                                }
                                else
                                {
                                    CurrentState = "PUNCH_" + (Main.rand.NextBool() ? "R" : "L");
                                }

                                PunchCounter++;

                                PunchCounterReset = 28;

                                Projectile.NewProjectile(projectile.Center, VectorHelpers.DirectToMouse(projectile.Center, 22f), ModContent.ProjectileType <Punch>(), 60, 3.5f, Owner.whoAmI, projectile.whoAmI);
                            }

                            if (TBAPlayer.Get(Owner).MouseOneTime >= 15)
                            {
                                TBAPlayer.Get(Owner).Stamina -= 10;
                                Owner.direction = Main.MouseWorld.X < Owner.Center.X ? -1 : 1;
                                CurrentState    = "CUT_PREP";
                            }
                        }
                    }
                    else if (Owner.controlUseItem)
                    {
                        projectile.netUpdate = true;

                        TBAPlayer.Get(Owner).CheckStaminaCost(16, true);

                        if (Main.MouseWorld.Y > Owner.Center.Y + 60)
                        {
                            CurrentState = "RUSH_DOWN";
                        }

                        else if (Main.MouseWorld.Y < Owner.Center.Y - 60)
                        {
                            CurrentState = "RUSH_UP";
                        }

                        else
                        {
                            CurrentState = "RUSH_MID";
                        }

                        RushTimer = 180;

                        PunchRushDirection = VectorHelpers.DirectToMouse(projectile.Center, 18f);

                        TBAPlayer.Get(Owner).AttackDirectionResetTimer = RushTimer;
                        TBAPlayer.Get(Owner).AttackDirection           = Main.MouseWorld.X < projectile.Center.X ? -1 : 1;

                        int barrage = Projectile.NewProjectile(projectile.Center, PunchRushDirection, ModContent.ProjectileType <CrimsonBarrage>(), 60, 0, Owner.whoAmI);

                        if (Main.projectile[barrage].modProjectile is CrimsonBarrage crimsonBarrage)
                        {
                            crimsonBarrage.RushDirection    = PunchRushDirection;
                            crimsonBarrage.ParentProjectile = projectile.whoAmI;
                        }
                    }
                }
            }
            #endregion

            #region Rush

            Animations["RUSH_DOWN"].AutoLoop = RushTimer > 0;
            Animations["RUSH_UP"].AutoLoop   = RushTimer > 0;
            Animations["RUSH_MID"].AutoLoop  = RushTimer > 0;
            #endregion

            if (CurrentState.Contains("PUNCH") || CurrentState.Contains("ATT") || CurrentState.Contains("UNDO") || CurrentState == "DONUT_MISS")
            {
                Owner.heldProj = projectile.whoAmI;
            }

            #region Yeet attacc
            // If we do a YEET attack, damage is dealt by stand itself instead of a seperate projectile
            bool yeeting  = CurrentState == "CUT_ATT" && CurrentAnimation.CurrentFrame > 3 && CurrentAnimation.CurrentFrame < 9;
            bool donuting = CurrentState == "DONUT_ATT" && CurrentAnimation.CurrentFrame == 3;
            projectile.damage = yeeting ? 400 : 0;

            if (donuting && Owner.ownedProjectileCounts[ModContent.ProjectileType <DonutPunch>()] <= 1)
            {
                Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <DonutPunch>(), 60, 0, Owner.whoAmI, projectile.whoAmI, -1);
            }

            if (CurrentState == "CUT_IDLE" && !Owner.controlUseItem)
            {
                CurrentAnimation.ResetAnimation();
                CurrentState = "CUT_ATT";
            }
            #endregion

            if (StopsItemUse && TBAPlayer.Get(Owner).MouseTwoTime > 20 && InIdleState)
            {
                TBAPlayer.Get(Owner).CheckStaminaCost(10, true);
                CurrentState = "DONUT_PREP";
            }

            if (CurrentState == "DONUT_IDLE" && !OwnerCtrlUse)
            {
                CurrentAnimation.ResetAnimation();
                CurrentState = "DONUT_ATT";
            }

            Animations["DONUT_UNDO"].FrameSpeed = Animations["DONUT_UNDO"].CurrentFrame < 5 ? 12 : 5;



            if (InIdleState && CurrentAnimation.Finished)
            {
                CurrentAnimation.ResetAnimation();
            }

            if (CurrentState == ANIMATION_DESPAWN)
            {
                Opacity = (5 - CurrentAnimation.FrameRect.Y / (int)CurrentAnimation.FrameSize.Y) * 0.2f;

                if (CurrentAnimation.Finished)
                {
                    KillStand();
                }
            }

            if (InIdleState)
            {
                HasMissedDonut = true;
            }

            if (CurrentState == "DONUT_ATT")
            {
                Animations["DONUT_ATT"].SetNextAnimation(HasMissedDonut ? Animations["DONUT_MISS"] : Animations["DONUT_UNDO"]);
            }

            if (TBAInputs.ContextAction.JustPressed && Owner.whoAmI == Main.myPlayer && !CurrentState.Contains("RUSH"))
            {
                EraseTime();
            }


            if (TBAInputs.StandPose.JustPressed && Owner.whoAmI == Main.myPlayer && CurrentState == "POSE_IDLE")
            {
                CurrentState = "POSE_END";
            }

            if (CurrentState.Contains("POSE"))
            {
                Owner.heldProj = projectile.whoAmI;
            }
        }
Esempio n. 30
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            TBAPlayer mPlayer = TBAPlayer.Get(Main.LocalPlayer);

            Texture2D border   = Textures.StaminaBarBorder;
            Texture2D bar      = Textures.StaminaBar;
            Vector2   position = new Vector2(20, Main.screenHeight - 80);
            Rectangle barSize  = new Rectangle((int)position.X, (int)position.Y, border.Width, border.Height);

            for (int i = Entries.Count - 1; i >= 0; i--)
            {
                Entries[i].DrawSelf(spriteBatch);
            }


            if (mPlayer.StandUser)
            {
                int drawPercent = (mPlayer.Stamina * bar.Width) / mPlayer.MaxStamina;

                float regen = (mPlayer.StaminaRegenTickRate) / 60;

                string result = string.Format("{0}.{1}", regen, mPlayer.StaminaRegenTickRate % 60);

                if (barSize.Contains(Main.MouseScreen.ToPoint()))
                {
                    Main.hoverItemName = "You restore " + mPlayer.StaminaGain + " stamina over " + result + " seconds";
                }

                spriteBatch.Draw(
                    border,
                    position,
                    null,
                    Color.White,
                    0,
                    Vector2.Zero,
                    1f,
                    SpriteEffects.None,
                    1f);

                spriteBatch.Draw(
                    bar,
                    position + new Vector2(14, 6),
                    new Rectangle(0, 0, drawPercent, bar.Height),
                    Color.White,
                    0,
                    Vector2.Zero,
                    1f,
                    SpriteEffects.None,
                    1f);

                spriteBatch.DrawString(
                    Main.fontMouseText,
                    mPlayer.Stamina + " / " + mPlayer.MaxStamina,
                    position + new Vector2(30, 4),
                    Color.White);

                spriteBatch.DrawString(
                    Main.fontMouseText,
                    result + "s",
                    new Vector2(20, Main.screenHeight - 80) + new Vector2(116, 24),
                    Color.White,
                    -MathHelper.Pi / 4 + .1f,
                    Vector2.Zero,
                    0.75f,
                    SpriteEffects.None,
                    1f
                    );

                if (mPlayer.IsDebugging)
                {
                    spriteBatch.DrawString(
                        Main.fontMouseText,
                        "DEBUG",
                        new Vector2(20, Main.screenHeight - 80) + new Vector2(16, -36),
                        Color.Red,
                        0,
                        Vector2.Zero,
                        1,
                        SpriteEffects.None,
                        1f
                        );
                }
            }
        }