예제 #1
0
        public override bool UseItem(Player player)
        {
            Terraria.Audio.LegacySoundStyle hitSound = SoundID.Item1;
            Vector2 position = GetLightPosition(player);

            //Vector2 location = hitbox.Location.ToVector2();
            Point   tileLocation = position.ToTileCoordinates();
            ModTile tile         = TileLoader.GetTile(Main.tile[tileLocation.X, tileLocation.Y].type);

            if (tile == null)
            {
                return(false);
            }
            switch (tile.soundType & 3)
            {
            case 0:
                hitSound = SoundID.Item11; break;

            case 1:
                hitSound = SoundID.Item12; break;

            case 2:
                hitSound = SoundID.Item13; break;

            case 3:
                hitSound = SoundID.Item14; break;
            }
            Main.PlaySound(hitSound, position);
            return(true);
        }
        public override void SafeSetDefaults()
        {
            IgnoreTrinkets         = true;
            projectile.tileCollide = true;
            projectile.width       = 22;
            projectile.height      = 38;
            projectile.aiStyle     = 16;
            projectile.friendly    = true;
            projectile.penetrate   = -1;
            projectile.timeLeft    = int.MaxValue - 1;
            projectile.damage      = 0;

            //Defining the dusts to spawn
            dustsToSpawn = new int[] {
                158,
                176,
                177,
                177
            };

            //Retrieving the explosion sounds
            explodeSounds = new Terraria.Audio.LegacySoundStyle[4];
            for (int num = 1; num <= explodeSounds.Length; num++)
            {
                explodeSounds[num - 1] = mod.GetLegacySoundSlot(SoundType.Custom, explodeSoundsLoc + num);
            }
        }
예제 #3
0
        public void UpdateStandInfo()
        {
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            newPunchTime            = punchTime - modPlayer.standSpeedBoosts;
            newShootTime            = shootTime - modPlayer.standSpeedBoosts;
            newMaxDistance          = maxDistance + modPlayer.standRangeBoosts;
            newAltMaxDistance       = maxAltDistance + modPlayer.standRangeBoosts;
            newPunchDamage          = (int)(punchDamage * modPlayer.standDamageBoosts);
            newProjectileDamage     = (int)(projectileDamage * modPlayer.standDamageBoosts);
            modPlayer.poseSoundName = poseSoundName;
            if (!playedSpawnSound)
            {
                Terraria.Audio.LegacySoundStyle spawnSound = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SummonCries/" + spawnSoundName);
                spawnSound.WithVolume(MyPlayer.soundVolume);
                Main.PlaySound(spawnSound, projectile.position);
                playedSpawnSound = true;
            }
            if (modPlayer.standType != standType)
            {
                modPlayer.standType = standType;
            }
            if (newPunchTime <= 2)
            {
                newPunchTime = 2;
            }
            if (newShootTime <= 5)
            {
                newShootTime = 5;
            }
        }
예제 #4
0
        public override void UpdateInventory(Player player)
        {
            IncPlayer ic = Main.player[Main.myPlayer].GetModPlayer <IncPlayer>();

            if (Press(1))
            {
                for (int a = 0; a < Main.npc.Length; a++)
                {
                    NPC n = Main.npc[a];
                    if (n != null && n.active && (!n.friendly || !n.townNPC))
                    {
                        if (n.type != NPCID.TargetDummy)
                        {
                            if (n.type == ModContent.NPCType <TheTarr>())
                            {
                                n.wet = true;
                            }
                            n.life = int.MinValue;
                            n.HitEffect();
                            n.checkDead();
                            if (Main.netMode == NetmodeID.Server)
                            {
                                NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, a, 0f, 0f, 0f, 0);
                            }
                        }
                    }
                }
            }
            if (Press(2))
            {
                ic.magicCursor = !ic.magicCursor;
                Terraria.Audio.LegacySoundStyle type = ic.magicCursor ? SoundID.Item103 : SoundID.Item104;
                Main.PlaySound(type, player.position);
                int dustType = ic.magicCursor ? DustID.AncientLight : DustID.ApprenticeStorm;
                for (int i = 0; i < 15; i++)
                {
                    Vector2 position = player.Center + Vector2.UnitX.RotatedBy(MathHelper.ToRadians(360f / 15 * i));
                    Dust    dust     = Dust.NewDustPerfect(position, dustType);
                    dust.noGravity = true;
                    dust.velocity  = Vector2.Normalize(dust.position - player.Center) * 4;
                    dust.fadeIn    = 1f;
                }
            }

            bool Press(int type)
            {
                if (type == 1)
                {
                    return(CastledsContent.SpecialHotkey.JustPressed && player.HeldItem == item);
                }
                if (type == 2)
                {
                    return(CastledsContent.SpecialHotkey.JustPressed && player.HeldItem != item);
                }
                return(false);
            }
        }
예제 #5
0
        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            Shatter(oldVelocity);

            Terraria.Audio.LegacySoundStyle glass = SoundID.Item27;
            glass.WithVolume(0.8f);
            Main.PlaySound(glass, projectile.position);

            return(base.OnTileCollide(oldVelocity));
        }
예제 #6
0
        public override void Kill(int timeLeft)
        {
            int rnd = Main.rand.Next(1, 4);

            for (int i = 0; i < rnd; i++)
            {
                Glass.CreateDust(this, projectile.Center);
            }

            Terraria.Audio.LegacySoundStyle glass = SoundID.Item27;
            glass.WithVolume(0.4f);
            Main.PlaySound(glass, projectile.position);
        }
예제 #7
0
 public override void ChangeKeybladeValues()
 {
     magic = keyMagic.ice;
     keyTransformations = new keyTransformation[] { keyTransformation.guns, keyTransformation.cannon };
     transSprites       = new string[] { "Items/Weapons/Transformations/Christmas_Gun", "Items/Weapons/Transformations/Christmas_Cannon" };
     formChanges        = new keyDriveForm[] { keyDriveForm.element, keyDriveForm.element };
     animationTimes     = new int[] { 20, 1, 20 };
     keybladeElement    = keyType.fire;
     comboMax           = 5;
     transProj          = new int[] { ProjectileID.Flames, ProjectileID.Present };
     transShootSpeed    = new float[] { 7 };
     transSounds        = new Terraria.Audio.LegacySoundStyle[] { SoundID.Item1, SoundID.Item19, SoundID.Item19 };
 }
예제 #8
0
        public static SoundEffectInstance PlayPitched(Terraria.Audio.LegacySoundStyle style, float volume, float pitch, Vector2 position = default)
        {
            if (Main.netMode == NetmodeID.Server)
            {
                return(null);
            }

            if (position == default)
            {
                position = Vector2.One * -1;
            }

            return(Main.PlaySound(style.SoundId, (int)position.X, (int)position.Y, style.Style, volume, pitch));
        }
예제 #9
0
 public override void HoldItem(Player player)
 {
     reloadCounter--;
     if (bulletCount == 6)       //do you really need this line?
     {
         reloadStart++;
     }
     if (bulletCount != 6)
     {
         reloadStart = 0;
     }
     if (reloadStart == 1)
     {
         if (MyPlayer.Sounds)
         {
             Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/Reload60"));
         }
         if (player.altFunctionUse == 2)
         {
             reloadCounter = 180;
         }
         else
         {
             reloadCounter = 60;
         }
     }
     if (JoJoStands.ItemHotKey.JustPressed && reloadCounter <= 1 && player.whoAmI == Main.myPlayer)
     {
         if (MyPlayer.Sounds)
         {
             Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/Reload30"));
         }
         reloadCounter = 30;
     }
     if (reloadCounter <= 0)
     {
         reloadCounter = 0;
     }
     if (reloadCounter == 1)
     {
         bulletCount = 0;
     }
     if (!MyPlayer.Sounds)
     {
         usesound = SoundID.Item38;
     }
     UI.BulletCounter.Visible = true;
 }
예제 #10
0
 public void PlayPunchSound()
 {
     if (punchSoundName != "" && !playedBeginning)
     {
         Terraria.Audio.LegacySoundStyle sound = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/BattleCries/" + punchSoundName + "_Beginning");
         sound.WithVolume(MyPlayer.soundVolume);
         //Main.PlaySound(sound, projectile.position);
         playedBeginning = true;
     }
     if (punchSoundName != "" && playedBeginning)
     {
         Terraria.Audio.LegacySoundStyle sound = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/BattleCries/" + punchSoundName);
         sound.WithVolume(MyPlayer.soundVolume);
         Main.PlaySound(sound, projectile.position);
     }
 }
예제 #11
0
 public static ReLogic.Utilities.SlotId PlayVanillaSound(Terraria.Audio.LegacySoundStyle soundId, Vector2 location, float volume = 1f, float pitchVariance = 0f)
 {
     if (Main.dedServ)
     {
         return(ReLogic.Utilities.SlotId.Invalid);
     }
     if (location == Vector2.Zero)
     {
         return(Main.PlayTrackedSound(soundId.WithVolume(volume).WithPitchVariance(pitchVariance), location));
     }
     else
     {
         // this method doesn't return a sound effect instance, it just plays a sound.
         return(Main.PlayTrackedSound(soundId.WithVolume(volume).WithPitchVariance(pitchVariance), location));
     }
 }
예제 #12
0
        public override void PreUpdate()
        {
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            if (mPlayer.poseMode && player.whoAmI == Main.myPlayer)
            {
                if (mPlayer.poseDuration < 200 && !playedPoseSound && mPlayer.poseSoundName != "")
                {
                    string soundPath = "Sounds/PoseQuotes/" + mPlayer.poseSoundName + JoJoStandsSounds.soundVersion;
                    Terraria.Audio.LegacySoundStyle sound = mod.GetLegacySoundSlot(SoundType.Custom, soundPath);
                    if (sound == null)      //This is for dub sounds that are missing, otherwise there shouldn't be a value for this if both dub and sub are missing
                    {
                        soundPath = "Sounds/PoseQuotes/" + mPlayer.poseSoundName + "_Sub";
                        sound     = mod.GetLegacySoundSlot(SoundType.Custom, soundPath);
                    }
                    Main.PlaySound(sound, player.Center).Volume = MyPlayer.ModSoundsVolume;
                    if (Main.netMode == NetmodeID.MultiplayerClient)
                    {
                        ModNetHandler.soundsSync.SendQuoteSound(256, player.whoAmI, soundPath, player.Center);
                    }
                    playedPoseSound = true;
                }
            }
            else
            {
                playedPoseSound = false;
            }

            if (Main.netMode != NetmodeID.SinglePlayer && JoJoStandsSounds.syncSounds)
            {
                for (int i = 0; i < JoJoStandsSounds.soundInstances.Count; i++)
                {
                    SoundsHelper.PlaySound(JoJoStandsSounds.soundInstances[i], JoJoStandsSounds.soundStates[i], JoJoStandsSounds.soundPositions[i], JoJoStandsSounds.soundTravelDistances[i]);
                }
            }
        }
예제 #13
0
        public override void AI()
        {
            SelectFrame();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (JoJoStands.SpecialHotKey.JustPressed && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !player.HasBuff(mod.BuffType("TheWorldBuff")) && projectile.owner == Main.myPlayer)
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 240;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/StarPlatinumTheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(4);
                    timestopStartDelay = 0;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehindWithAbility();
                }
                if (Main.mouseRight && shootCount <= 0 && player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0 && projectile.owner == Main.myPlayer)
                {
                    shootCount    += 120;
                    Main.mouseLeft = false;
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= shootSpeed;
                    int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("StarFinger"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, Main.myPlayer, projectile.whoAmI);
                    Main.projectile[proj].netUpdate = true;
                    projectile.netUpdate            = true;
                }
                if (player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] != 0)
                {
                    secondaryAbilityFrames = true;
                    Main.mouseLeft         = false;
                    projectile.netUpdate   = true;
                }
            }
            if (modPlayer.StandAutoMode)
            {
                PunchAndShootAI(mod.ProjectileType("StarFinger"));
            }
        }
예제 #14
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (!attackFrames)
            {
                StayBehind();
            }
            else
            {
                GoInFront();
            }

            if (player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0)
            {
                secondaryAbilityFrames = false;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0)
                {
                    attackFrames         = true;
                    Main.mouseRight      = false;
                    projectile.netUpdate = true;
                    if (shootCount <= 0)
                    {
                        shootCount += newShootTime;
                        Vector2 shootVel = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= shootSpeed;
                        int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("FireAnkh"), newProjectileDamage, 3f, projectile.owner, chanceToDebuff, debuffDuration);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                    }
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        normalFrames = true;
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("RedBind")] == 0 && !player.HasBuff(mod.BuffType("AbilityCooldown")))
                {
                    secondaryAbilityFrames = true;
                    Main.mouseLeft         = false;
                    projectile.netUpdate   = true;
                    if (JoJoStands.SoundsLoaded)
                    {
                        Terraria.Audio.LegacySoundStyle redBind = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/RedBind");
                        redBind.WithVolume(MyPlayer.soundVolume);
                        Main.PlaySound(redBind, projectile.position);
                    }
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= 16f;
                    int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("RedBind"), newProjectileDamage, 3f, projectile.owner, projectile.whoAmI, debuffDuration - 60);
                    Main.projectile[proj].netUpdate = true;
                    projectile.netUpdate            = true;
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(15));
                }
                if (SpecialKeyPressed())
                {
                    for (int p = 1; p <= 50; p++)
                    {
                        float   radius = p * 5;
                        Vector2 offset = player.Center + (radius.ToRotationVector2() * 48f);
                        int     proj   = Projectile.NewProjectile(offset.X, offset.Y, 0f, 0f, mod.ProjectileType("CrossfireHurricaneAnkh"), newProjectileDamage, 5f, projectile.owner, 48f, radius);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                    }
                    if (JoJoStands.SoundsLoaded)
                    {
                        Terraria.Audio.LegacySoundStyle crossFireHurricane = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/CrossfireHurricaneSpecial");
                        crossFireHurricane.WithVolume(MyPlayer.soundVolume);
                        Main.PlaySound(crossFireHurricane, projectile.position);
                    }
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(30));
                }
            }
            if (modPlayer.StandAutoMode)
            {
                NPC     target     = null;
                Vector2 targetPos  = projectile.position;
                float   targetDist = 350f;
                if (target == null)
                {
                    for (int k = 0; k < 200; k++)       //the targeting system
                    {
                        NPC npc = Main.npc[k];
                        if (npc.CanBeChasedBy(this, false))
                        {
                            float distance = Vector2.Distance(npc.Center, player.Center);
                            if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                            {
                                if (npc.boss)       //is gonna try to detect bosses over anything
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                                else        //if it fails to detect a boss, it'll detect the next best thing
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                            }
                        }
                    }
                }
                if (target != null)
                {
                    attackFrames = true;
                    normalFrames = false;
                    if ((targetPos - projectile.Center).X > 0f)
                    {
                        projectile.spriteDirection = projectile.direction = 1;
                    }
                    else if ((targetPos - projectile.Center).X < 0f)
                    {
                        projectile.spriteDirection = projectile.direction = -1;
                    }
                    if (targetPos.X > projectile.position.X)
                    {
                        projectile.velocity.X = 4f;
                    }
                    if (targetPos.X < projectile.position.X)
                    {
                        projectile.velocity.X = -4f;
                    }
                    if (targetPos.Y > projectile.position.Y)
                    {
                        projectile.velocity.Y = 4f;
                    }
                    if (targetPos.Y < projectile.position.Y)
                    {
                        projectile.velocity.Y = -4f;
                    }
                    if (shootCount <= 0)
                    {
                        if (Main.myPlayer == projectile.owner)
                        {
                            shootCount += newShootTime;
                            Vector2 shootVel = targetPos - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            shootVel *= shootSpeed;
                            int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("FireAnkh"), newProjectileDamage, 3f, projectile.owner, chanceToDebuff, debuffDuration);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                }
                else
                {
                    normalFrames = true;
                    attackFrames = false;
                }
            }
        }
예제 #15
0
        internal void PlaySound(Terraria.Audio.LegacySoundStyle type, Vector2 position)
        {
            bool nearbyMuffler = WorldGen.InWorld((int)position.X >> 4, (int)position.Y >> 4) && MachineMufflerTile.AnyMufflersNearby(position);

            Main.PlaySound(type.SoundId, (int)position.X, (int)position.Y, type.Style, volumeScale: nearbyMuffler ? 0.1f : 1f);
        }
예제 #16
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopStartDelay <= 0)
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 120;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(5);
                    timestopPoseTimer  = 60;
                    timestopStartDelay = 0;
                }
            }
            if (timestopPoseTimer > 0)
            {
                timestopPoseTimer--;
                normalFrames           = false;
                attackFrames           = false;
                secondaryAbilityFrames = false;
                abilityPose            = true;
                Main.mouseLeft         = false;
                Main.mouseRight        = false;
                if (timestopPoseTimer <= 1)
                {
                    abilityPose = false;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    if (!secondaryAbilityFrames)
                    {
                        StayBehind();
                        projectile.direction = projectile.spriteDirection = player.direction;
                    }
                    else
                    {
                        GoInFront();
                        if (Main.MouseWorld.X > projectile.position.X)
                        {
                            projectile.spriteDirection = 1;
                            projectile.direction       = 1;
                        }
                        if (Main.MouseWorld.X < projectile.position.X)
                        {
                            projectile.spriteDirection = -1;
                            projectile.direction       = -1;
                        }
                        secondaryAbilityFrames = false;
                    }
                }
                if (Main.mouseRight && player.HasItem(mod.ItemType("Knife")) && projectile.owner == Main.myPlayer)
                {
                    Main.mouseLeft         = false;
                    secondaryAbilityFrames = true;
                    normalFrames           = false;
                    attackFrames           = false;
                    if (shootCount <= 0 && projectile.frame == 1)
                    {
                        shootCount += 28;
                        float   rotationk    = MathHelper.ToRadians(15);
                        float   numberKnives = 3;
                        Vector2 shootVel     = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= 100f;
                        for (int i = 0; i < numberKnives; i++)
                        {
                            Vector2 perturbedSpeed = shootVel.RotatedBy(MathHelper.Lerp(-rotationk, rotationk, i / (numberKnives - 1))) * 0.2f;
                            int     proj           = Projectile.NewProjectile(projectile.position + new Vector2(5f, -3f), perturbedSpeed, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                            player.ConsumeItem(mod.ItemType("Knife"));
                            projectile.netUpdate = true;
                        }
                    }
                }
                if (SecondSpecialKeyPressed() && player.HasItem(mod.ItemType("Knife")) && player.CountItem(mod.ItemType("Knife")) >= 45 && projectile.owner == Main.myPlayer)
                {
                    NPC target = null;

                    for (int n = 0; n < Main.maxNPCs; n++)
                    {
                        NPC npc = Main.npc[n];
                        if (npc.active && npc.lifeMax > 5 && !npc.townNPC && !npc.immortal && !npc.hide && Vector2.Distance(npc.Center, Main.MouseWorld) <= 25f)
                        {
                            target = npc;
                            break;
                        }
                    }

                    if (target == null)
                    {
                        return;
                    }

                    int firstRingKnives = 15;
                    for (int k = 0; k < firstRingKnives; k++)
                    {
                        float   radius   = target.height;
                        float   radians  = (360 / firstRingKnives) * k;
                        Vector2 position = target.position + (MathHelper.ToRadians(radians).ToRotationVector2() * radius);
                        Vector2 velocity = target.position - position;
                        velocity.Normalize();
                        velocity *= 8f;
                        Projectile.NewProjectile(position, velocity, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI);
                    }

                    int secondRingKnives = 30;
                    for (int k = 0; k < secondRingKnives; k++)
                    {
                        float   radius   = target.height * 1.8f;
                        float   radians  = (360 / secondRingKnives) * k;
                        Vector2 position = target.position + (MathHelper.ToRadians(radians).ToRotationVector2() * radius);
                        Vector2 velocity = target.position - position;
                        velocity.Normalize();
                        velocity *= 8f;
                        Projectile.NewProjectile(position, velocity, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI);
                    }

                    for (int i = 0; i < firstRingKnives + secondRingKnives; i++)
                    {
                        player.ConsumeItem(mod.ItemType("Knife"));
                    }

                    modPlayer.poseMode = true;
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(15));
                }
            }
            if (modPlayer.StandAutoMode)
            {
                PunchAndShootAI(mod.ProjectileType("Knife"), mod.ItemType("Knife"), true);
            }
        }
예제 #17
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("SkippingTime")) && timeskipStartDelay <= 0)
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timeskipStartDelay = 80;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle kingCrimson = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/KingCrimson");
                    kingCrimson.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(kingCrimson, projectile.position);
                    timeskipStartDelay = 1;
                }
            }
            if (timeskipStartDelay != 0)
            {
                timeskipStartDelay++;
                if (timeskipStartDelay >= 80)
                {
                    player.AddBuff(mod.BuffType("PreTimeSkip"), 10);
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip"));
                    timeskipStartDelay = 0;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && !player.HasBuff(mod.BuffType("SkippingTime")))
                {
                    HandleDrawOffsets();
                    attackFrames         = true;
                    normalFrames         = false;
                    Main.mouseRight      = false;
                    projectile.netUpdate = true;
                    float rotaY = Main.MouseWorld.Y - projectile.Center.Y;
                    projectile.rotation = MathHelper.ToRadians((rotaY * projectile.spriteDirection) / 6f);
                    if (Main.MouseWorld.X > projectile.position.X)
                    {
                        projectile.spriteDirection = 1;
                        projectile.direction       = 1;
                    }
                    if (Main.MouseWorld.X < projectile.position.X)
                    {
                        projectile.spriteDirection = -1;
                        projectile.direction       = -1;
                    }
                    velocityAddition = Main.MouseWorld - projectile.position;
                    velocityAddition.Normalize();
                    velocityAddition *= 5f;
                    mouseDistance     = Vector2.Distance(Main.MouseWorld, projectile.Center);
                    if (mouseDistance > 40f)
                    {
                        projectile.velocity = player.velocity + velocityAddition;
                    }
                    if (mouseDistance <= 40f)
                    {
                        projectile.velocity = Vector2.Zero;
                    }
                    if (shootCount <= 0 && (projectile.frame == 0 || projectile.frame == 4))
                    {
                        shootCount += newPunchTime;
                        Vector2 shootVel = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= shootSpeed;
                        int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Fists"), newPunchDamage, punchKnockback, projectile.owner, fistWhoAmI);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                    }
                    LimitDistance();
                }
                else
                {
                    if (!Main.mouseRight && player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && projectile.owner == Main.myPlayer && !playerHasAbilityCooldown && !player.HasBuff(mod.BuffType("SkippingTime")))
                {
                    GoInFront();
                    normalFrames           = false;
                    attackFrames           = false;
                    secondaryAbilityFrames = true;

                    if (blockSearchTimer > 0)
                    {
                        blockSearchTimer--;
                        return;
                    }

                    int       rectWidth  = 56;
                    int       rectHeight = 64;
                    Rectangle blockRect  = new Rectangle((int)projectile.Center.X - (rectWidth / 2), (int)projectile.Center.Y - (rectHeight / 2), rectWidth, rectHeight);
                    for (int p = 0; p < Main.maxProjectiles; p++)
                    {
                        Projectile otherProj = Main.projectile[p];
                        if (otherProj.active)
                        {
                            if (blockRect.Intersects(otherProj.Hitbox) && otherProj.type != projectile.type && !otherProj.friendly)
                            {
                                for (int i = 0; i < 20; i++)
                                {
                                    Dust.NewDust(player.position, player.width, player.height, 114);
                                }

                                otherProj.penetrate -= 1;
                                if (otherProj.penetrate <= 0)
                                {
                                    projectile.Kill();
                                }
                                secondaryAbilityFrames = false;

                                Vector2 repositionOffset = new Vector2(5f * 16f * -player.direction, 0f);
                                while (WorldGen.SolidTile((int)(player.position.X + repositionOffset.X) / 16, (int)(player.position.Y + repositionOffset.Y) / 16))
                                {
                                    repositionOffset.Y -= 16f;
                                }
                                player.position += repositionOffset;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10));
                                Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip"));
                                for (int i = 0; i < 20; i++)
                                {
                                    Dust.NewDust(player.position, player.width, player.height, 114);
                                }
                            }
                        }
                    }
                    for (int n = 0; n < Main.maxNPCs; n++)
                    {
                        NPC npc = Main.npc[n];
                        if (npc.active && npc.lifeMax > 5 && !npc.immortal && !npc.townNPC && !npc.friendly && !npc.hide && npc.Hitbox.Intersects(blockRect))
                        {
                            for (int i = 0; i < 20; i++)
                            {
                                Dust.NewDust(player.position, player.width, player.height, 114);
                            }

                            Vector2 repositionOffset = new Vector2(5f * 16f * -player.direction, 0f);
                            while (WorldGen.SolidTile((int)(player.position.X + repositionOffset.X) / 16, (int)(player.position.Y + repositionOffset.Y) / 16))
                            {
                                repositionOffset.Y -= 16f;
                            }
                            player.position += repositionOffset;
                            player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10));
                            npc.StrikeNPC(newPunchDamage * 2, punchKnockback * 1.5f, projectile.direction);
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip"));

                            for (int i = 0; i < 20; i++)
                            {
                                Dust.NewDust(player.position, player.width, player.height, 114);
                            }
                        }
                    }
                    blockSearchTimer += 5;
                }
                else
                {
                    secondaryAbilityFrames = false;
                }
                if (!attackFrames && !secondaryAbilityFrames)
                {
                    StayBehind();
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
예제 #18
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player  = Main.player[projectile.owner];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (mPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (Main.dayTime)
            {
                bubbleDamage = 180;
            }
            if (!Main.dayTime)
            {
                bubbleDamage = 158;
            }
            drawOriginOffsetY = -halfStandHeight;
            int newBubbleDamage = (int)(bubbleDamage * mPlayer.standDamageBoosts);

            if (!attackFrames)
            {
                StayBehind();
            }
            if (attackFrames)
            {
                GoInFront();
            }

            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("BitesTheDust")))
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    btdStartDelay = 205;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle biteTheDust = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/BiteTheDust");
                    biteTheDust.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(biteTheDust, projectile.position);
                    btdStartDelay = 1;
                }
            }
            if (btdStartDelay != 0)
            {
                btdStartDelay++;
                if (btdStartDelay >= 205)
                {
                    player.AddBuff(mod.BuffType("BitesTheDust"), 10);
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BiteTheDustEffect"));
                    btdStartDelay = 0;
                }
            }


            if (!mPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && projectile.ai[0] == 0f)
                {
                    attackFrames         = true;
                    Main.mouseRight      = false;
                    projectile.netUpdate = true;
                    if (projectile.frame == 4 && !mPlayer.StandAutoMode)
                    {
                        if (shootCount <= 0)
                        {
                            shootCount += newShootTime;
                            Vector2 shootVel = Main.MouseWorld - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            shootVel *= shootSpeed;
                            int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Bubble"), newBubbleDamage, 6f, projectile.owner, 1f, projectile.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                    if (projectile.frame >= 5)
                    {
                        attackFrames = false;
                    }
                }
                else if (!secondaryAbilityFrames)
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        normalFrames = true;
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && projectile.owner == Main.myPlayer && projectile.ai[0] == 0f)
                {
                    secondaryAbilityFrames = true;
                    projectile.ai[0]       = 1f; //to detonate all bombos
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                }
                if (secondaryAbilityFrames && projectile.ai[0] == 1f)
                {
                    if (projectile.frame >= 2)
                    {
                        projectile.ai[0]       = 0f;
                        normalFrames           = true;
                        attackFrames           = false;
                        secondaryAbilityFrames = false;
                    }
                }
            }
            if (mPlayer.StandAutoMode)
            {
                NPC     target     = null;
                Vector2 targetPos  = projectile.position;
                float   targetDist = 350f;
                if (target == null)
                {
                    for (int k = 0; k < 200; k++)       //the targeting system
                    {
                        NPC npc = Main.npc[k];
                        if (npc.CanBeChasedBy(this, false))
                        {
                            float distance = Vector2.Distance(npc.Center, player.Center);
                            if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                            {
                                if (npc.boss)       //is gonna try to detect bosses over anything
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                                else        //if it fails to detect a boss, it'll detect the next best thing
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                            }
                        }
                    }
                }
                if (target != null)
                {
                    attackFrames = true;
                    normalFrames = false;
                    if ((targetPos - projectile.Center).X > 0f)
                    {
                        projectile.spriteDirection = projectile.direction = 1;
                    }
                    else if ((targetPos - projectile.Center).X < 0f)
                    {
                        projectile.spriteDirection = projectile.direction = -1;
                    }
                    if (attackFrames && projectile.frame == 5 && shootCount <= 0)
                    {
                        if (Main.myPlayer == projectile.owner)
                        {
                            shootCount += newShootTime;
                            Vector2 shootVel = targetPos - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            shootVel *= shootSpeed;
                            int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Bubble"), newBubbleDamage, 6f, projectile.owner, 0f, projectile.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                }
                else
                {
                    normalFrames = true;
                    attackFrames = false;
                }
            }
        }
예제 #19
0
 public SoundData(Terraria.Audio.LegacySoundStyle SoundStyle)
 {
     this.SoundStyle = SoundStyle;
 }
예제 #20
0
        public override void AI()
        {
            PlayAnimations();
            UpdateStandInfo();
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;

            if (shootCount > 0)
            {
                shootCount--;
            }
            if (player.whoAmI == Main.myPlayer && modPlayer.tuskActNumber == 4)         //Making an owner check cause tuskActNumber isn't in sync with other players, causing TA4 to die for everyone else
            {
                projectile.timeLeft = 10;
            }
            if (goldenRectangleEffectTimer >= 215)
            {
                if (JoJoStands.SoundsLoaded && !playedSound)
                {
                    Terraria.Audio.LegacySoundStyle chumimiiin = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/Chumimiiin");
                    chumimiiin.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(chumimiiin, projectile.position);
                    playedSound = true;
                }
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X, projectile.velocity.Y);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X - 5f, projectile.velocity.Y + 5f);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X + 5f, projectile.velocity.Y - 5f);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X + 5f, projectile.velocity.Y + 5f);
                Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, projectile.velocity.X - 5f, projectile.velocity.Y - 5f);
                //Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 169, projectile.velocity.X * -0.5f, projectile.velocity.Y * -0.5f);
            }
            if (goldenRectangleEffectTimer > 0)
            {
                goldenRectangleEffectTimer -= 2;
            }

            NPC target = null;

            for (int n = 0; n < Main.maxNPCs; n++)
            {
                NPC npc = Main.npc[n];
                if (npc.active)
                {
                    float distance = Vector2.Distance(npc.Center, player.Center);
                    if (npc.CanBeChasedBy(this) && distance < 9f * 16f && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                    {
                        target = npc;
                    }
                }
            }
            if (target != null)
            {
                attackFrames = true;
                normalFrames = false;
                PlayPunchSound();

                Vector2 velocity = (target.position + new Vector2(0f, -4f)) - projectile.position;
                velocity.Normalize();
                projectile.velocity = velocity * 4f;
                if ((target.position - projectile.Center).X > 0f)     //the turn around stuff
                {
                    projectile.spriteDirection = projectile.direction = 1;
                }
                else if ((target.position - projectile.Center).X < 0f)
                {
                    projectile.spriteDirection = projectile.direction = -1;
                }
                if (Main.myPlayer == projectile.owner)
                {
                    if (shootCount <= 0)
                    {
                        shootCount += newPunchTime;
                        Vector2 shootVel = target.position - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= shootSpeed;
                        int proj = Projectile.NewProjectile(projectile.Center, shootVel, mod.ProjectileType("Fists"), newPunchDamage, punchKnockback, projectile.owner);
                        Main.projectile[proj].netUpdate = true;
                        Main.projectile[proj].timeLeft  = 3;
                        projectile.netUpdate            = true;
                    }
                }
            }
            else
            {
                attackFrames = false;
                normalFrames = true;
            }
            if (target == null || (!attackFrames && normalFrames))
            {
                Vector2 vector131 = player.Center;
                vector131.X         -= (float)((12 + player.width / 2) * player.direction);
                vector131.Y         -= 25f;
                projectile.Center    = Vector2.Lerp(projectile.Center, vector131, 0.2f);
                projectile.velocity *= 0.8f;
                projectile.direction = projectile.spriteDirection = player.direction;
                projectile.netUpdate = true;
                StopSounds();
            }
        }
예제 #21
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopStartDelay <= 0)
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 240;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/StarPlatinumTheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(4);
                    timestopStartDelay = 0;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehindWithAbility();
                }
                if (Main.mouseRight && shootCount <= 0 && projectile.owner == Main.myPlayer)
                {
                    int bulletIndex = GetPlayerAmmo(player);
                    if (bulletIndex != -1)
                    {
                        Item bulletItem = player.inventory[bulletIndex];
                        if (bulletItem.shoot != -1)
                        {
                            flickFrames = true;
                            if (projectile.frame == 1)
                            {
                                shootCount    += 80;
                                Main.mouseLeft = false;
                                Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 41, 1f, 2.8f);
                                Vector2 shootVel = Main.MouseWorld - projectile.Center;
                                if (shootVel == Vector2.Zero)
                                {
                                    shootVel = new Vector2(0f, 1f);
                                }
                                shootVel.Normalize();
                                shootVel *= 12f;
                                int proj = Projectile.NewProjectile(projectile.Center, shootVel, bulletItem.shoot, (int)(altDamage * modPlayer.standDamageBoosts), bulletItem.knockBack, projectile.owner, projectile.whoAmI);
                                Main.projectile[proj].netUpdate = true;
                                projectile.netUpdate            = true;
                                if (bulletItem.Name.Contains("Bullet"))
                                {
                                    player.ConsumeItem(bulletItem.type);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] == 0)
                        {
                            shootCount    += 120;
                            Main.mouseLeft = false;
                            Vector2 shootVel = Main.MouseWorld - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            shootVel *= shootSpeed;
                            int proj = Projectile.NewProjectile(projectile.Center, shootVel, mod.ProjectileType("StarFinger"), (int)(altDamage * modPlayer.standDamageBoosts), 4f, projectile.owner, projectile.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                }
                if (player.ownedProjectileCounts[mod.ProjectileType("StarFinger")] != 0)
                {
                    secondaryAbilityFrames = true;
                    Main.mouseLeft         = false;
                    projectile.netUpdate   = true;
                }
            }
            if (modPlayer.StandAutoMode)
            {
                PunchAndShootAI(mod.ProjectileType("StarFinger"), shootMax: 1);
            }
        }
예제 #22
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("SkippingTime")) && !player.HasBuff(mod.BuffType("ForesightBuff")))
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timeskipStartDelay = 80;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle kingCrimson = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/KingCrimson");
                    kingCrimson.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(kingCrimson, projectile.position);
                    timeskipStartDelay = 1;
                }
            }
            if (timeskipStartDelay != 0)
            {
                timeskipStartDelay++;
                if (timeskipStartDelay >= 80)
                {
                    player.AddBuff(mod.BuffType("PreTimeSkip"), 10);
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/TimeSkip"));
                    timeskipStartDelay = 0;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    HandleDrawOffsets();
                    attackFrames         = true;
                    normalFrames         = false;
                    Main.mouseRight      = false;
                    projectile.netUpdate = true;
                    float rotaY = Main.MouseWorld.Y - projectile.Center.Y;
                    projectile.rotation = MathHelper.ToRadians((rotaY * projectile.spriteDirection) / 6f);
                    if (Main.MouseWorld.X > projectile.position.X)
                    {
                        projectile.spriteDirection = 1;
                        projectile.direction       = 1;
                    }
                    if (Main.MouseWorld.X < projectile.position.X)
                    {
                        projectile.spriteDirection = -1;
                        projectile.direction       = -1;
                    }
                    velocityAddition = Main.MouseWorld - projectile.position;
                    velocityAddition.Normalize();
                    velocityAddition *= 5f;
                    mouseDistance     = Vector2.Distance(Main.MouseWorld, projectile.Center);
                    if (mouseDistance > 40f)
                    {
                        projectile.velocity = player.velocity + velocityAddition;
                    }
                    if (mouseDistance <= 40f)
                    {
                        projectile.velocity = Vector2.Zero;
                    }
                    if (shootCount <= 0 && (projectile.frame == 0 || projectile.frame == 4))
                    {
                        shootCount += newPunchTime;
                        Vector2 shootVel = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= shootSpeed;
                        int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Fists"), newPunchDamage, punchKnockback, projectile.owner, fistWhoAmI);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                    }
                    LimitDistance();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                if (Main.mouseRight && projectile.owner == Main.myPlayer && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !player.HasBuff(mod.BuffType("ForesightBuff")) && !player.HasBuff(mod.BuffType("SkippingTime")))
                {
                    player.AddBuff(mod.BuffType("ForesightBuff"), 540);
                    modPlayer.Foresight = true;
                    if (Main.netMode == NetmodeID.MultiplayerClient)
                    {
                        ModNetHandler.effectSync.SendForesight(256, player.whoAmI, true, player.whoAmI);
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
예제 #23
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")))
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 120;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(9);
                    timestopPoseTimer  = 60;
                    timestopStartDelay = 0;
                }
            }
            if (timestopPoseTimer > 0)
            {
                timestopPoseTimer--;
                normalFrames           = false;
                attackFrames           = false;
                secondaryAbilityFrames = false;
                abilityPose            = true;
                Main.mouseLeft         = false;
                Main.mouseRight        = false;
                if (timestopPoseTimer <= 1)
                {
                    abilityPose = false;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    if (!secondaryAbilityFrames)
                    {
                        StayBehind();
                        projectile.direction = (projectile.spriteDirection = player.direction);
                    }
                    else
                    {
                        GoInFront();
                        if (Main.MouseWorld.X > projectile.position.X)
                        {
                            projectile.spriteDirection = 1;
                            projectile.direction       = 1;
                        }
                        if (Main.MouseWorld.X < projectile.position.X)
                        {
                            projectile.spriteDirection = -1;
                            projectile.direction       = -1;
                        }
                    }
                    secondaryAbilityFrames = false;
                }
                if (Main.mouseRight && player.HasItem(mod.ItemType("Knife")) && projectile.owner == Main.myPlayer)
                {
                    Main.mouseLeft         = false;
                    secondaryAbilityFrames = true;
                    normalFrames           = false;
                    attackFrames           = false;
                    if (shootCount <= 0 && projectile.frame == 1)
                    {
                        shootCount += 13;       // has to be half if the framecounter + 1 (2 if shootCount goes to -1)
                        float   rotationk    = MathHelper.ToRadians(15);
                        float   numberKnives = 4;
                        Vector2 shootVel     = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= 100f;
                        for (int i = 0; i < numberKnives; i++)
                        {
                            Vector2 perturbedSpeed = new Vector2(shootVel.X, shootVel.Y).RotatedBy(MathHelper.Lerp(-rotationk, rotationk, i / (numberKnives - 1))) * .2f;
                            int     proj           = Projectile.NewProjectile(projectile.position.X + 5f, projectile.position.Y - 3f, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Knife"), (int)(altDamage * modPlayer.standDamageBoosts), 2f, player.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                            player.ConsumeItem(mod.ItemType("Knife"));
                            projectile.netUpdate = true;
                        }
                    }
                }
                if (SpecialKeyPressed() && player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopPoseTimer <= 0 && player.ownedProjectileCounts[mod.ProjectileType("RoadRoller")] == 0)
                {
                    if (JoJoStands.SoundsLoaded)
                    {
                        Main.PlaySound(JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/RoadRollerDa"));
                    }
                    shootCount += 12;
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= shootSpeed + 4f;
                    int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("RoadRoller"), 512, 12f, player.whoAmI);
                    Main.projectile[proj].netUpdate = true;
                    projectile.netUpdate            = true;
                }
            }
            if (modPlayer.StandAutoMode)
            {
                PunchAndShootAI(mod.ProjectileType("Knife"), mod.ItemType("Knife"), true);
            }
        }
예제 #24
0
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (projectile.spriteDirection == 1)
            {
                drawOffsetX = -10;
            }
            if (projectile.spriteDirection == -1)
            {
                drawOffsetX = -60;
            }
            drawOriginOffsetY = -halfStandHeight;
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }
            if (SpecialKeyPressed() && !player.HasBuff(mod.BuffType("TheWorldBuff")) && timestopStartDelay <= 0)
            {
                if (JoJoStands.JoJoStandsSounds == null)
                {
                    timestopStartDelay = 120;
                }
                else
                {
                    Terraria.Audio.LegacySoundStyle zawarudo = JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/TheWorld");
                    zawarudo.WithVolume(MyPlayer.soundVolume);
                    Main.PlaySound(zawarudo, projectile.position);
                    timestopStartDelay = 1;
                }
            }
            if (timestopStartDelay != 0)
            {
                timestopStartDelay++;
                if (timestopStartDelay >= 120)
                {
                    Timestop(2);
                    timestopPoseTimer  = 60;
                    timestopStartDelay = 0;
                }
            }
            if (timestopPoseTimer > 0)
            {
                timestopPoseTimer--;
                normalFrames    = false;
                attackFrames    = false;
                abilityPose     = true;
                Main.mouseLeft  = false;
                Main.mouseRight = false;
                if (timestopPoseTimer <= 1)
                {
                    abilityPose = false;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
예제 #25
0
        public static ReLogic.Utilities.SlotId PlayVanillaSound(Terraria.Audio.LegacySoundStyle soundId, Player player = null, float volume = 1f, float pitchVariance = 0f)
        {
            Vector2 location = player != null ? player.Center : Vector2.Zero;

            return(PlayVanillaSound(soundId, location, volume, pitchVariance));
        }