Beispiel #1
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();
            }
        }
Beispiel #2
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();
        }
Beispiel #3
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);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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));
        }
Beispiel #6
0
        public override void UpdateInventory(Player player)
        {
            item.favorited = true;
            TBAPlayer.Get(player).StaminaRegenBuff += 60;

            if (!TBAPlayer.Get(player).KnifeGangMember)
            {
                item.TurnToAir();
            }
        }
Beispiel #7
0
        public virtual void KillStand()
        {
            if (CanDie || Owner.dead || !Owner.active)
            {
                projectile.Kill();
                TBAPlayer.Get(Owner).KillStand();

                Animations.Clear();
            }
        }
Beispiel #8
0
 public override void Action(CommandCaller caller, string input, string[] args)
 {
     if (TBAMultiplayerConfig.EnableDebugCommands)
     {
         TBAPlayer.Get().IsDebugging = !TBAPlayer.Get().IsDebugging;
     }
     else
     {
         DisabledDebugCommands();
     }
 }
Beispiel #9
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();
            }
        }
Beispiel #10
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);
     }
 }
Beispiel #11
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);
                 }
             }
         }
     }
 }
Beispiel #12
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);
        }
Beispiel #13
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;
            }
        }
Beispiel #14
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();
            }
        }
Beispiel #15
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();
     }
 }
Beispiel #16
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();
                }
            }
        }
Beispiel #17
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));
        }
Beispiel #18
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);
                    }
                }
            }
        }
Beispiel #19
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;
            }
        }
Beispiel #20
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);
        }
Beispiel #21
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);
        }
Beispiel #22
0
        public override bool PreKill(int timeLeft)
        {
            TBAPlayer.Get(Owner).PointOfInterest = Vector2.Zero;

            return(base.PreKill(timeLeft));
        }
Beispiel #23
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
                        );
                }
            }
        }
Beispiel #24
0
        public override void AI()
        {
            base.AI();

            if (_previousAngle != Angle)
            {
                projectile.netUpdate = true;
            }


            Owner.heldProj = projectile.whoAmI;


            if (Vector2.Distance(Center, Owner.Center) >= 16 * 100)
            {
                CurrentState = "RETURN";
            }

            if (CurrentAnimation != null)
            {
                Width  = (int)CurrentAnimation.FrameSize.X;
                Height = (int)CurrentAnimation.FrameSize.Y;
            }


            if (!SetVel)
            {
                if (Owner.direction == -1)
                {
                    Angle = (float)MathHelper.Pi;
                }


                Opacity = 0f;
                Center  = Owner.Center - new Vector2(120 * Owner.direction, 24);
                SetVel  = true;
            }


            Speed = 8.0f;

            if (CurrentState == "TURN" && CurrentAnimation.CurrentFrame <= 8)
            {
                Speed = 9 - MathHelper.Clamp(CurrentAnimation.CurrentFrame, 0, 8);
            }
            else if (CurrentState == "TURN" && CurrentAnimation.CurrentFrame >= 8)
            {
                Speed = 0 - MathHelper.Clamp(8 - (CurrentAnimation.CurrentFrame - CurrentAnimation.FrameCount), 0, 8);
            }


            TBAPlayer tPlayer = TBAPlayer.Get(Owner);

            if (IsSpawning)
            {
                if (Opacity < 1f)
                {
                    Opacity += 0.04f;
                }
            }



            if (IsDespawning || IsSpawning)
            {
                for (int i = 0; i < 5; i++)
                {
                    int dustIndex = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y) + projectile.velocity * 4.5f, 0, 0, 31, 0f, 0f, 100, default, 2f);
Beispiel #25
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();
                }
            }
        }
Beispiel #26
0
        public override bool PreKill(int timeLeft)
        {
            TBAPlayer.Get(Owner).KillStand();

            return(base.PreKill(timeLeft));
        }
Beispiel #27
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;
            }
        }
Beispiel #28
0
        public override bool PreAI()
        {
            projectile.timeLeft = 200;


            if (CurrentState != LastState)
            {
                projectile.netUpdate = true;
            }

            if (!ReverseOffset)
            {
                if (DrawOffset < 5.0f)
                {
                    DrawOffset += 0.1f;
                }
                else
                {
                    ReverseOffset = true;
                }
            }
            else
            {
                if (DrawOffset > 0.0f)
                {
                    DrawOffset -= 0.1f;
                }
                else
                {
                    ReverseOffset = false;
                }
            }

            if (DrawRotation < MathHelper.Pi)
            {
                DrawRotation += 0.07f;
            }
            else
            {
                DrawRotation = 0.0f;
            }


            LastState = CurrentState;

            if (TBAPlayer.Get(Owner).ActiveStandProjectile != projectile.modProjectile)
            {
                KillStand();
            }

            if (Main.dedServ)
            {
                return(false);
            }

            if (TBAPlayer.Get(Owner).Stamina <= 0)
            {
                ShouldDie = true;
            }

            if (!HasSetAnimations)
            {
                AddAnimations();

                if (Animations.Count >= 1)
                {
                    Width  = (int)Animations[CurrentState].FrameSize.X;
                    Height = (int)Animations[CurrentState].FrameSize.Y;
                }

                HasSetAnimations = true;
            }

            if (ShouldDie && CanDie && CurrentState != ANIMATION_DESPAWN)
            {
                CurrentState = ANIMATION_DESPAWN;
            }

            if (Animations.Count >= 1 && !TimeStopManagement.projectileStates.ContainsKey(projectile))
            {
                Animations[CurrentState].Update();

                SpriteAnimation nextAnimation = CurrentAnimation.NextAnimation;

                bool reverseAnimation = CurrentAnimation.ReverseNextAnimation;

                if (CurrentAnimation.Finished && nextAnimation != null && Animations.ContainsValue(nextAnimation))
                {
                    CurrentAnimation.ResetAnimation(CurrentAnimation.ReversePlayback);
                    CurrentState = Animations.Where(x => x.Value == nextAnimation).Select(x => x.Key).First();
                    CurrentAnimation.ResetAnimation(reverseAnimation);
                }
            }


            if (Owner.dead || !Owner.active)
            {
                KillStand();
            }


            return(true);
        }
Beispiel #29
0
 public override void Update(Player player, ref int buffIndex)
 {
     TBAPlayer.Get(player).Exhausted = true;
 }
Beispiel #30
0
        public override void AI()
        {
            base.AI();

            Opacity = 1f;

            IsFlipped = Owner.direction == 1;

            projectile.timeLeft = 200;

            int xOffset = CurrentState.Contains("PUNCH") || CurrentState.Contains("RUSH") || CurrentState == "THROW_KNIVES" || CurrentState == TIMESTOP_ANIMATION ?  34 : -16;

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

            if (CurrentState.Contains("PUNCH") || CurrentState == "SLAM" || CurrentState == "THROW_KNIVES" || CurrentState == TIMESTOP_ANIMATION)
            {
                Owner.heldProj = projectile.whoAmI;
            }

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

            if (CurrentState == "THROW_KNIVES")
            {
                if (CurrentAnimation.CurrentFrame == 10)
                {
                    Vector2 direction = VectorHelpers.DirectToMouse(projectile.Center, 14f);

                    if (Owner.Center.X + direction.X > Owner.Center.X)
                    {
                        Owner.direction = 1;
                    }
                    else
                    {
                        Owner.direction = -1;
                    }
                    for (int i = 0; i < 2; i++)
                    {
                        Projectile.NewProjectile(projectile.Center + direction * 2.2f + new Vector2(Main.rand.Next(-5, 5), Main.rand.Next(-34, 34)).RotatedBy(direction.ToRotation()), direction, ModContent.ProjectileType <Knife>(), 80, 3.5f, Owner.whoAmI, projectile.whoAmI);
                    }
                }
            }


            if (CurrentState == ANIMATION_DESPAWN && CurrentAnimation.Finished && TimeStopDelay <= 0)
            {
                KillStand();
            }

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

                    if (TBAInputs.ExtraAction02.JustPressed && TBAPlayer.Get(Owner).CheckStaminaCost(10))
                    {
                        CurrentState = "THROW_KNIVES";
                    }

                    if (TBAInputs.SummonStand.JustPressed)
                    {
                        CurrentState = ANIMATION_DESPAWN;
                    }

                    int roadRollerCost = TimeStopManagement.TimeStopped ? 10 : 50;

                    if (TBAInputs.ExtraAction01.JustPressed && !BeganAscending && TBAPlayer.Get(Owner).CheckStaminaCost(roadRollerCost))
                    {
                        projectile.netUpdate = true;
                        if (!TimeStopManagement.TimeStopped)
                        {
                            if (!TimeStopManagement.TimeStopped)
                            {
                                TBAMod.PlayVoiceLine("Sounds/TheWorld/TimeStop");
                            }

                            IsTaunting    = false;
                            TimeStopDelay = 25;
                        }

                        Owner.Center        -= new Vector2(0, 16);
                        Owner.velocity.Y     = -16;
                        CurrentState         = "FLY_UP";
                        projectile.netUpdate = true;
                        TBAPlayer.Get(Owner).PointOfInterest = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f;
                        BeganAscending = true;
                    }

                    if (TBAInputs.ContextAction.JustPressed)
                    {
                        TimeStop();
                    }
                }

                if (StopsItemUse)
                {
                    if (PunchCounter < 2)
                    {
                        if (TBAPlayer.Get(Owner).MouseOneTimeReset > 0)
                        {
                            projectile.netUpdate = true;
                            if (TBAPlayer.Get(Owner).MouseOneTime < 15 && !Owner.controlUseItem)
                            {
                                TBAPlayer.Get(Owner).CheckStaminaCost(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 = 32;

                                Projectile.NewProjectile(projectile.Center, VectorHelpers.DirectToMouse(projectile.Center, 22f), ModContent.ProjectileType <Punch>(), 80, 3.5f, Owner.whoAmI, projectile.whoAmI);
                            }
                        }
                    }
                    else if (Owner.controlUseItem)
                    {
                        projectile.netUpdate = true;
                        TBAMod.PlayVoiceLine("Sounds/TheWorld/MudaRush");

                        TBAPlayer.Get(Owner).CheckStaminaCost(16);
                        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, 22f);

                        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 <WorldBarrage>(), 60, 0, Owner.whoAmI);

                        if (Main.projectile[barrage].modProjectile is WorldBarrage worldBarrage)
                        {
                            worldBarrage.RushDirection    = PunchRushDirection;
                            worldBarrage.ParentProjectile = projectile.whoAmI;
                        }
                    }
                }
            }

            if (TimeStopDelay > 1)
            {
                TimeStopDelay--;
            }
            else if (TimeStopDelay == 1)
            {
                if (!TimeStopManagement.TimeStopped)
                {
                    Projectile.NewProjectile(Owner.Center, Vector2.Zero, ModContent.ProjectileType <TimeStopVFX>(), 0, 0, Owner.whoAmI);

                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/TheWorld/TheWorld_ZaWarudoSFX"));
                }

                TimeStopManagement.ToggleTimeStopIfStopper(TBAPlayer.Get(Owner), 11 * Constants.TICKS_PER_SECOND);
                TimeStopDelay--;
            }

            if (Animations.Count > 0)
            {
                Animations["RUSH_DOWN"].AutoLoop = RushTimer > 0;
                Animations["RUSH_UP"].AutoLoop   = RushTimer > 0;
                Animations["RUSH_MID"].AutoLoop  = RushTimer > 0;
            }

            if (BeganAscending)
            {
                if (AscensionTimer >= (int)(2 * Constants.TICKS_PER_SECOND))
                {
                    if (RoadRollerXAxis == -1.0f)
                    {
                        RoadRollerXAxis = Main.MouseWorld.X;
                    }

                    TBAPlayer.Get(Owner).PointOfInterest = new Vector2(MathHelper.Lerp(TBAPlayer.Get(Owner).PointOfInterest.X, RoadRollerXAxis, 0.1f), TBAPlayer.Get(Owner).PointOfInterest.Y);
                }

                if (++AscensionTimer >= (int)(2.5 * Constants.TICKS_PER_SECOND))
                {
                    TBAPlayer.Get(Owner).TirePlayer(30);
                    projectile.netUpdate = true;
                    TBAMod.PlayVoiceLine("Sounds/TheWorld/RoadRoller");
                    BeganAscending               = false;
                    AscensionTimer               = 0;
                    CurrentState                 = "SLAM";
                    HasResetRoadRollerDrop       = false;
                    RoadRollerID                 = Projectile.NewProjectile(new Vector2(RoadRollerXAxis, Owner.Center.Y), Vector2.Zero, ModContent.ProjectileType <RoadRoller>(), 20, 0, projectile.owner);
                    RoadaRollaDa.spriteDirection = Owner.direction * -1;
                    RoadaRollaDa.Center          = new Vector2(RoadRollerXAxis, Owner.Center.Y);
                    RoadRollerXAxis              = -1.0f;
                }
                else
                {
                    Owner.velocity = Vector2.Zero;
                    Owner.Center  -= new Vector2(0f, 10f);
                }
            }

            if (RoadaRollaDa.modProjectile is RoadRoller roller)
            {
                if (RushTimer > 0 && roller.HasTouchedGround || !roller.HasTouchedGround)
                {
                    Owner.direction   = RoadaRollaDa.spriteDirection * -1;
                    Owner.Center      = projectile.Center + new Vector2(20 * Owner.direction * -1, -20);
                    projectile.Center = RoadaRollaDa.Center + new Vector2(40 * Owner.direction * -1, -40);
                }

                if (roller.HasTouchedGround && !HasResetRoadRollerDrop)
                {
                    TBAMod.PlayVoiceLine("Sounds/TheWorld/MudaRush");
                    CurrentState = "RUSH_DOWN";

                    RushTimer = 180;

                    PunchRushDirection = (RoadaRollaDa.Center - projectile.Center).SafeNormalize(-Vector2.UnitX) * 12f;

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

                    TBAPlayer.Get(Owner).PointOfInterest = Vector2.Zero;

                    HasResetRoadRollerDrop = true;

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

                    if (Main.projectile[barrage].modProjectile is WorldBarrage worldBarrage)
                    {
                        worldBarrage.RushDirection    = PunchRushDirection;
                        worldBarrage.ParentProjectile = projectile.whoAmI;
                    }
                }
            }
        }