Esempio n. 1
0
        private void TimeStop(Player player)
        {
            TBARPlayer p = TBARPlayer.Get(player);

            if (p.ShatteredTime)
            {
                return;
            }

            player.AddBuff(ModContent.BuffType <ShatteredTime>(), Global.SecondsToTicks(30));

            bool   isTimeStopped = TBAR.TimeStopManager.IsTimeStopped;
            string path          = isTimeStopped ? "" : "Sounds/TheWorld/TheWorld_ZaWarudoSFX";

            TimeStopInstance ts = new TimeStopInstance(player, Global.SecondsToTicks(10), path)
            {
                EndSoundEffect = "Sounds/TheWorld/TheWorld_ZaWarudoReleaseSFX"
            };

            if (!isTimeStopped)
            {
                Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <TimeStopVFX>(), 0, 0, player.whoAmI);
                TBAR.Instance.PlaySound("Sounds/TheWorld/TimeStop");
            }
            else
            {
                p.RepeatCount--;
            }

            TBAR.TimeStopManager.TryStopTime(ts);
        }
Esempio n. 2
0
        public void OnOpen()
        {
            ComboGrid.Clear();

            TBARPlayer plr = TBARPlayer.Get();

            if (plr.IsStandUser)
            {
                DamageStat.DamageType = plr.PlayerStand.StandDamageType;

                DamageStat.DamageScaleText?.SetText(plr.PlayerStand.GetDamageScalingText);

                RangeStat.RangeText?.SetText(plr.PlayerStand.GetEffectiveRangeText);

                Card.SetStand(plr.PlayerStand);

                List <StandCombo> combos = new List <StandCombo>(plr.PlayerStand.GlobalCombos.Count + plr.PlayerStand.NormalCombos.Count);

                combos.AddRange(plr.PlayerStand.GlobalCombos);
                combos.AddRange(plr.PlayerStand.NormalCombos);

                combos.Reverse();

                foreach (StandCombo c in combos)
                {
                    ComboGrid.Add(new ComboPanel(c));
                }
            }

            Recalculate();
            RecalculateChildren();
        }
Esempio n. 3
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            TBARPlayer.Get(Main.player[projectile.owner]).AddStylePoints(5);
            projectile.penetrate++;

            npcs.Add(target);
        }
Esempio n. 4
0
        public override void HandleInputs(Player player, List <ComboInput> receivedInputs)
        {
            if (player.whoAmI != Main.myPlayer || receivedInputs.Count <= 0)
            {
                return;
            }

            TBARPlayer plr = TBARPlayer.Get(player);

            if (IsActive)
            {
                foreach (StandCombo combo in NormalCombos)
                {
                    if (combo.TryActivate(player, receivedInputs))
                    {
                        AddStylePoints(plr, combo);

                        return;
                    }
                }
            }

            foreach (StandCombo combo in GlobalCombos)
            {
                if (combo.TryActivate(player, receivedInputs))
                {
                    AddStylePoints(plr, combo);
                    return;
                }
            }
        }
Esempio n. 5
0
        public override bool UseItem(Player player)
        {
            TBARPlayer tBAR = TBARPlayer.Get(player);

            tBAR.PlayerStand = StandLoader.Instance.GetNewRandom(tBAR);

            if (!TBARConfig.internalSimpleArrowUse)
            {
                InputBlocker.BlockInputs(player, item.useAnimation);

                player.mount.Dismount(player);

                tBAR.ArrowProgress = tBAR.ArrowProgressMax;

                tBAR.ScreenModifiers.Add(new SmoothStepScreenModifier(player.Center, player.Center - new Vector2(0, 64), 0.025f, item.useAnimation));
                tBAR.ScreenModifiers.Add(new ScreenModifier(player.Center - new Vector2(0, 64), item.useAnimation));

                tBAR.UsePosition = player.Center + new Vector2(0, player.height * 0.5f);

                player.velocity = Vector2.Zero;
            }

            Main.NewText("You've acquired a stand: " + tBAR.PlayerStand.StandName);

            return(true);
        }
Esempio n. 6
0
        private void StopTime(Player player)
        {
            TBARPlayer p = TBARPlayer.Get(player);

            if (p.ShatteredTime)
            {
                return;
            }

            player.AddBuff(ModContent.BuffType <ShatteredTime>(), Global.SecondsToTicks(30));

            bool   isTimeStopped = TBAR.TimeStopManager.IsTimeStopped;
            string path          = isTimeStopped ? "" : "Sounds/StarPlatinum/SP_TimeStopSignal";

            TimeStopInstance ts = new TimeStopInstance(player, Global.SecondsToTicks(10), path)
            {
                EndSoundEffect = "Sounds/StarPlatinum/SP_TimeRestore"
            };

            if (!isTimeStopped)
            {
                Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <TimeStopVFX>(), 0, 0, player.whoAmI);
                TBAR.Instance.PlayVoiceLine("Sounds/StarPlatinum/SP_TimeStopCall");
            }
            else
            {
                p.RepeatCount--;
            }

            TBAR.TimeStopManager.TryStopTime(ts);
        }
Esempio n. 7
0
        public override void UpdateMusic(ref int music, ref MusicPriority priority)
        {
            if (Main.myPlayer == -1 || Main.gameMenu || !Main.LocalPlayer.active)
            {
                return;
            }

            TBARPlayer plr = TBARPlayer.Get();

            if (Tracks.Count > 0)
            {
                Tracks[0].TimeLeft--;

                music    = GetSoundSlot(SoundType.Music, Tracks[0].Path);
                priority = Tracks[0].Priority;

                Tracks.RemoveAll(x => x.TimeLeft <= 0);
            }

            if (plr.IsUsingArrow)
            {
                music    = GetSoundSlot(SoundType.Music, "Sounds/Music/StandObtain2");
                priority = MusicPriority.BossHigh;
            }
        }
Esempio n. 8
0
 public static void AddModifiersToPlayer(Player player, params ScreenModifier[] modifiers)
 {
     foreach (ScreenModifier mod in modifiers)
     {
         TBARPlayer.Get(player).ScreenModifiers.Add(mod);
     }
 }
Esempio n. 9
0
        public override void PostAI()
        {
            base.PostAI();

            projectile.Center = projectile.Center.ClampLength(Owner.Center, Range * 64f);

            if (BaseDPS == -1)
            {
                if (Owner.HeldItem.GetDamageType() == TBARPlayer.Get(Owner).PlayerStand.StandDamageType)
                {
                    BaseDPS = Owner.HeldItem.GetDamageData(Owner).DPS;
                }
                else
                {
                    BaseDPS = 5;
                }
            }

            ElapsedTime++;

            HitNPCs.RemoveAll(x => x.IsTimed && (x.TimeOfHit + AttackSpeed) < ElapsedTime);

            if (CanPunch && Owner.controlUseItem && Owner.whoAmI == Main.myPlayer)
            {
                SetState(PunchState, GetPunchVariation());
            }
        }
Esempio n. 10
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;
            }

            Stand stand = TBARPlayer.Get().PlayerStand;

            bool existsAndMatches = stand != null && stand.StandName == StandDisplayName;

            Texture2D texture = existsAndMatches ? Textures.StandCardCurrent : Textures.StandCard;

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

            /*if (!Unlocked)
             * {
             *  spriteBatch.Draw(Textures.Instance.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.FrameCenter, 1f, SpriteEffects.FlipHorizontally, 1f);
            Utils.DrawBorderString(spriteBatch, StandDisplayName, anchor, Color.White, 1);
            //}
        }
Esempio n. 11
0
 private void DespawnState_OnStateBegin(StandState sender)
 {
     if (Main.myPlayer == Owner.whoAmI)
     {
         TBARPlayer.Get(Owner).ScreenModifiers.RemoveAll(x => x is AerosmithScreenModifier || x is PlayerChaseScreenModifier);
         TBARPlayer.Get(Owner).ScreenModifiers.Add(new PlayerChaseScreenModifier(projectile.Center, Owner.Center, 0.2f));
     }
 }
Esempio n. 12
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            TBARPlayer plr = TBARPlayer.Get(caller.Player);

            int.TryParse(args[0], out int temp);

            plr.CurrentStyleRank = (StyleRank)temp;
        }
Esempio n. 13
0
        public float GetProgress()
        {
            TBARPlayer plr = TBARPlayer.Get();

            float progress = (plr.ComboTime * 88) / TBARConfig.inputDelay;

            return(progress);
        }
Esempio n. 14
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.immune[projectile.owner] = 10;

            TBARPlayer.Get(Main.player[projectile.owner]).AddStylePoints(20);

            target.AddBuff(BuffID.OnFire, 180);
        }
Esempio n. 15
0
        public override bool UseItem(Player player)
        {
            TBARPlayer tBAR = TBARPlayer.Get(player);

            tBAR.PlayerStand = null;

            return(true);
        }
Esempio n. 16
0
        public override void ModifyHitPvp(Player target, ref int damage, ref bool crit)
        {
            projectile.penetrate++;

            TBARPlayer.Get(Owner).AddStylePoints(10);

            OnHit?.Invoke(this, target);
        }
Esempio n. 17
0
        public override bool CanUseItem(Item item, Player player)
        {
            if (item.damage > 0 && TBARConfig.standOnly && TBARPlayer.Get(player).PlayerStand != null && TBARPlayer.Get(player).PlayerStand.IsActive)
            {
                return(false);
            }

            return(base.CanUseItem(item, player));
        }
Esempio n. 18
0
        private void OffensiveTimeStop(Player player)
        {
            TBARPlayer plr = TBARPlayer.Get(player);

            plr.OnRightClick -= Plr_OnRightClick;
            plr.OnRightClick += Plr_OnRightClick;

            BeamVisual.AddBeamVisual(player, 20, 1200, 30, 15, Color.Beige);
        }
Esempio n. 19
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (!TBARPlayer.Get().IsStandUser)
            {
                return;
            }

            DrawDefault(spriteBatch, projectile.Center, Color.White, SpriteFX);
        }
Esempio n. 20
0
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            PacketType type = (PacketType)reader.ReadByte();

            switch (type)
            {
            case PacketType.SyncStand:
                byte       playerNumber = reader.ReadByte();
                string     name         = reader.ReadString();
                TBARPlayer plr          = TBARPlayer.Get(Main.player[playerNumber]);

                plr.PlayerStand = StandLoader.Instance.Get(name);

                if (IsServer)
                {
                    plr.PlayerStand = StandLoader.Instance.Get(name);
                }

                break;

            case PacketType.UsedCombo:
                this.Logger.Debug("Combo packet received");
                playerNumber = reader.ReadByte();
                string comboName = reader.ReadString();

                this.Logger.Debug($"Combo Name {comboName}");
                plr = TBARPlayer.Get(Main.player[playerNumber]);

                plr.PlayerStand.ForceCombo(comboName, plr.player);

                if (IsServer)
                {
                    StandCombo.SendPacket(plr.player, comboName, playerNumber);
                }
                break;

            case PacketType.StandChanged:
                playerNumber = reader.ReadByte();
                name         = reader.ReadString();
                plr          = TBARPlayer.Get(Main.player[playerNumber]);

                plr.PlayerStand = StandLoader.Instance.Get(name);

                if (IsServer)
                {
                    plr.PlayerStand = StandLoader.Instance.Get(name);
                    plr.SendStandChangedPacket(playerNumber);
                }
                break;

            case PacketType.RemoveTimeStopInstance:
                var timeStopIndex = reader.ReadInt32();

                TimeStopManager.RemoveEffectAt(timeStopIndex);
                break;
            }
        }
Esempio n. 21
0
        public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            TBARPlayer.Get(Owner).AddStylePoints(10);

            projectile.penetrate++;

            OnHit?.Invoke(this, target);

            HitNPCs.Add(new HitEntityData(target.whoAmI, ElapsedTime, !NonTimedAttack));
        }
Esempio n. 22
0
        private void MagicianRedProjectile_OnHit(PunchGhostProjectile attacker, Entity victim)
        {
            TBARPlayer.Get(Owner).AddStylePoints(500);
            Vector2 dir = new Vector2(Owner.direction * 7.8f, 0);

            for (int i = 0; i < 5; i++)
            {
                Vector2 off = new Vector2(Owner.direction * 8, 0);
                Projectile.NewProjectile(projectile.Center + off, (dir).RotatedByRandom(0.5), ModContent.ProjectileType <FireballFart>(), 0, 0, projectile.owner);
            }
        }
Esempio n. 23
0
        public static void UnblockInputs(Player player, int id)
        {
            TBARPlayer plr = TBARPlayer.Get(player);

            var blocker = plr.InputBlockers.Find(x => x.ID == id);

            if (blocker != null)
            {
                plr.InputBlockers.Remove(blocker);
            }
        }
Esempio n. 24
0
        public override void Update(GameTime gameTime)
        {
            if (Main.gameMenu)
            {
                return;
            }

            if (LongBool)
            {
                Main.isMouseLeftConsumedByUI = true;
            }

            TBARPlayer plr = TBARPlayer.Get();

            if (delay <= 0 && (scale += pulseSpeeds[(int)plr.CurrentStyleRank] * (float)gameTime.ElapsedGameTime.TotalSeconds) > 1.4f)
            {
                delay = bumpDelays[(int)plr.CurrentStyleRank];
                scale = 0.8f;
            }

            if (lastRank != plr.CurrentStyleRank)
            {
                var l = new FallingLetter(lastRank);

                var kek = Main.rand.NextBool();
                l.Position = this.GetDimensions().Position();
                l.velocity = new Vector2(kek ? -190f : 191f, -130f);
                letters.Add(l);

                if (lastRank < plr.CurrentStyleRank)
                {
                    l.haltTime = 90;
                    var slap = new SlappingLetter(plr.CurrentStyleRank)
                    {
                        Position = this.GetInnerDimensions().Position()
                    };
                    letters.Add(slap);
                }
            }

            foreach (ILetter l in letters)
            {
                l.Update(gameTime);
            }

            letters.RemoveAll(x => (x is FallingLetter y && y.Opacity <= 0) || (x is SlappingLetter z && z.scale <= 1f));

            lastRank = plr.CurrentStyleRank;

            delay -= 60 * (float)gameTime.ElapsedGameTime.TotalSeconds;

            base.Update(gameTime);
        }
Esempio n. 25
0
        public override void UpdateModifier(Player player)
        {
            TBARPlayer tPlayer = TBARPlayer.Get(player);

            if (tPlayer.PlayerStand is Aerosmith aero && aero.ActiveInstance != null)
            {
                AerosmithProjectile proj = aero.ActiveInstance;

                //Active = !aero.IsPatroling;

                Position = proj.projectile.Center + proj.projectile.Center.DirectTo(proj.MousePosition, 16);
            }
Esempio n. 26
0
        public Color GetColor()
        {
            if (TBARPlayer.Get().ComboTimeExpired)
            {
                if (AchievedCombo)
                {
                    return(Color.Green);
                }
                return(Color.Red);
            }

            return(Color.White);
        }
Esempio n. 27
0
        // Will keep rolling until it finds a diffrent stand
        public Stand GetNewRandom(TBARPlayer player)
        {
            Stand stand = player.PlayerStand;

            Stand resultStand = GetRandom();

            bool bruhMoment = stand != null && stand.GetType() == resultStand.GetType();

            if (bruhMoment || !resultStand.CanAcquire(player))
            {
                return(GetNewRandom(player));
            }

            return(resultStand);
        }
Esempio n. 28
0
        public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (!TBARPlayer.Get().IsStandUser)
            {
                return;
            }

            for (int i = 0; i < 4; i++)
            {
                Vector2 voffset = new Vector2(offset, 0).RotatedBy(MathHelper.PiOver2 * i);
                DrawDefault(spriteBatch, projectile.Center + voffset, AuraColor * 0.5f, SpriteFX);
            }

            DrawDefault(spriteBatch, projectile.Center, Color.White, SpriteFX);
        }
Esempio n. 29
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            TBARPlayer plr = TBARPlayer.Get(caller.Player);

            string tempInput = input.Remove(0, "/getStand".Length);

            tempInput = tempInput.Trim();

            Stand stand = StandLoader.Instance.Get(tempInput);

            if (stand != null)
            {
                plr.PlayerStand = stand;
            }
        }
Esempio n. 30
0
        public static BeamVisual AddBeamVisual(Player player, int width = 20, int height = 1200, int duration = 60, int openTime = 20, Color color = default)
        {
            TBARPlayer tbr = TBARPlayer.Get(player);

            if (color == default)
            {
                color = Color.PaleVioletRed;
            }

            var beam = new BeamVisual(width, height, duration, openTime, color);

            tbr.BeamVisuals.Add(beam);

            return(beam);
        }