public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            Player   player  = Main.player[projectile.owner];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            target.immune[projectile.owner] = 0;
            if (projectile.ai[0] == 0f)
            {
                int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.GrenadeIII, (int)(350 * mPlayer.standDamageBoosts), 7f, projectile.owner);
                Main.projectile[proj].friendly  = true;
                Main.projectile[proj].timeLeft  = 2;
                Main.projectile[proj].netUpdate = true;
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(10));
            }
            if (projectile.ai[0] == 1f)
            {
                int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.GrenadeIII, (int)(724 * mPlayer.standDamageBoosts), 7f, projectile.owner);
                Main.projectile[proj].friendly  = true;
                Main.projectile[proj].timeLeft  = 2;
                Main.projectile[proj].netUpdate = true;
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(4));
            }
            enemiesHit++;
            if (enemiesHit >= 5)
            {
                projectile.Kill();
            }
            npcTarget = null;
        }
Beispiel #2
0
        public override void Update(Player player, ref int buffIndex)       //it should only affect the user with this buff on
        {
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            if (player.HasBuff(mod.BuffType(Name)))
            {
                player.statDefense += 99999;
                player.endurance    = 1f;
                player.lifeRegen   += 2;
                player.noKnockback  = true;
            }
            else
            {
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(35));
                if (Main.netMode == NetmodeID.SinglePlayer)
                {
                    mPlayer.BackToZero = false;
                }
                else
                {
                    for (int i = 0; i < Main.maxPlayers; i++)
                    {
                        Player otherPlayers = Main.player[i];
                        if (otherPlayers.active && otherPlayers.whoAmI != player.whoAmI)
                        {
                            if (otherPlayers.HasBuff(mod.BuffType(Name)))
                            {
                                sendFalse = false;      //don't send the packet and let the buff end if you weren't the only timestop owner
                            }
                            else
                            {
                                sendFalse = true;       //send the packet if no one is owning timestop
                            }
                        }
                        if (player.active && !otherPlayers.active)       //for those people who just like playing in multiplayer worlds by themselves... (why does this happen)
                        {
                            sendFalse = true;
                        }
                    }
                }
                if (Main.netMode == NetmodeID.MultiplayerClient && sendFalse)
                {
                    mPlayer.BackToZero = false;
                    ModNetHandler.effectSync.SendBTZ(256, player.whoAmI, false, player.whoAmI);
                }
                if (Main.netMode != NetmodeID.Server)
                {
                    if (Filters.Scene["GreenEffect"].IsActive())
                    {
                        Filters.Scene["GreenEffect"].Deactivate();
                    }
                }
            }
        }
        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 (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && projectile.owner == Main.myPlayer)
                {
                    Main.mouseLeft = false;
                    int proj = Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType("GEFrog"), 1, 0f, projectile.owner, tierNumber, tierNumber - 1f);
                    Main.projectile[proj].netUpdate = true;
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(6));
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
Beispiel #4
0
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            if (!player.HasBuff(mod.BuffType(Name)))
            {
                if (Main.netMode == NetmodeID.SinglePlayer)
                {
                    mPlayer.TheWorldEffect = false;
                }
                else
                {
                    for (int i = 0; i < Main.maxPlayers; i++)
                    {
                        Player otherPlayers = Main.player[i];
                        if (otherPlayers.active && otherPlayers.whoAmI != player.whoAmI)
                        {
                            if (otherPlayers.HasBuff(mod.BuffType(Name)))
                            {
                                sendFalse = false;      //don't send the packet and let the buff end if you weren't the only timestop owner
                            }
                            else
                            {
                                sendFalse = true;       //send the packet if no one is owning timestop
                            }
                        }
                        if (player.active && !otherPlayers.active)       //for those people who just like playing in multiplayer worlds by themselves... (why does this happen)
                        {
                            sendFalse = true;
                        }
                    }
                }
                if (Main.netMode == NetmodeID.MultiplayerClient && sendFalse)
                {
                    mPlayer.TheWorldEffect = false;
                    ModNetHandler.effectSync.SendTimestop(256, player.whoAmI, false, player.whoAmI);
                }
                Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/timestop_stop"));
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(30));
                if (Filters.Scene["GreyscaleEffect"].IsActive())
                {
                    Filters.Scene["GreyscaleEffect"].Deactivate();
                }
            }
        }
Beispiel #5
0
 public override void Update(Player player, ref int buffIndex)
 {
     if (!player.HasBuff(mod.BuffType(Name)))
     {
         MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();
         player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(30));
         if (Main.netMode == NetmodeID.SinglePlayer)
         {
             mPlayer.epitaphForesight = false;
         }
         else
         {
             for (int i = 0; i < Main.maxPlayers; i++)
             {
                 Player otherPlayers = Main.player[i];
                 if (otherPlayers.active && otherPlayers.whoAmI != player.whoAmI)
                 {
                     if (otherPlayers.HasBuff(mod.BuffType(Name)))
                     {
                         sendFalse = false;      //don't send the packet and let the buff end if you weren't the only timestop owner
                     }
                     else
                     {
                         sendFalse = true;       //send the packet if no one is owning timestop
                     }
                 }
                 if (player.active && !otherPlayers.active)       //for those people who just like playing in multiplayer worlds by themselves... (why does this happen)
                 {
                     sendFalse = true;
                 }
             }
         }
         if (Main.netMode == NetmodeID.MultiplayerClient && sendFalse)
         {
             mPlayer.epitaphForesight = false;
             ModNetHandler.effectSync.SendForesight(256, player.whoAmI, false, player.whoAmI);
         }
     }
 }
Beispiel #6
0
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            mPlayer.deathLoop = true;
            if (Main.netMode == NetmodeID.Server)
            {
                deathTimeAdd = 1;
            }
            if (Main.netMode == NetmodeID.SinglePlayer)
            {
                deathTimeAdd = 0;
            }
            if ((deathTimes < (3 + deathTimeAdd) && Looping3x) || (deathTimes < (10 + deathTimeAdd) && Looping10x))
            {
                player.AddBuff(mod.BuffType("DeathLoop"), 2);
            }
            if (deathLoopTimer >= 60)       //sometimes it w
            {
                deathLoopTimer = 0;
            }
            if (!player.GetModPlayer <MyPlayer>().TheWorldEffect)        //so the effect stops during a timestop
            {
                if (Looping3x)
                {
                    deathLoopTimer++;
                    if (deathLoopTimer >= 60 && deathTimes <= (1 + deathTimeAdd))
                    {
                        int spawnedNPC = NPC.NewNPC((int)deathPositionX, (int)deathPositionY, LoopNPC);
                        Main.npc[spawnedNPC].GetGlobalNPC <NPCs.JoJoGlobalNPC>().spawnedByDeathLoop = true;
                        deathTimes += 1;
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/GEDeathLoop"));
                        deathLoopTimer = 0;
                    }
                    if (deathLoopTimer >= 60 && deathTimes == (2 + deathTimeAdd))
                    {
                        deathTimes    += 1;
                        deathLoopTimer = 0;
                    }
                }
                if (Looping10x)
                {
                    deathLoopTimer++;
                    if (deathLoopTimer >= 30 && deathTimes <= (8 + deathTimeAdd))
                    {
                        int spawnedNPC = NPC.NewNPC((int)deathPositionX, (int)deathPositionY, LoopNPC);
                        Main.npc[spawnedNPC].GetGlobalNPC <NPCs.JoJoGlobalNPC>().spawnedByDeathLoop = true;
                        deathTimes += 1;
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/GEDeathLoop"));
                        deathLoopTimer = 0;
                    }
                    if (deathLoopTimer >= 30 && deathTimes == (9 + deathTimeAdd))
                    {
                        deathTimes    += 1;
                        deathLoopTimer = 0;
                    }
                }
            }
            if ((deathTimes >= (3 + deathTimeAdd) && Looping3x) || (deathTimes >= (10 + deathTimeAdd) && Looping10x))
            {
                mPlayer.deathLoop = false;
                deathTimes        = 0;
                Looping3x         = false;
                deathLoopTimer    = 0;
                Looping10x        = false;
                player.ClearBuff(mod.BuffType("DeathLoop"));
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(60));
                deathPositionX = 0f;
                deathPositionY = 0f;
                LoopNPC        = 0;
            }
        }
Beispiel #7
0
        public override void AI()
        {
            SelectFrame();
            UpdateStandInfo();
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            modPlayer.aerosmithWhoAmI = projectile.whoAmI;
            newProjectileDamage       = (int)(newProjectileDamage * MathHelper.Clamp(1f - (projectile.Distance(player.Center) / (350f * 16f)), 0.5f, 1f));

            if (projectile.position.Y < (Main.worldSurface * 0.35) * 16f)
            {
                fallingFromSpace = true;
            }
            else
            {
                fallingFromSpace = false;
            }
            if (fallingFromSpace)
            {
                projectile.frameCounter = 0;
                projectile.velocity.Y  += 0.3f;
                projectile.netUpdate    = true;
            }
            Vector2 rota = projectile.Center - Main.MouseWorld;

            projectile.rotation    = (-rota * projectile.direction).ToRotation();
            bombless               = player.HasBuff(mod.BuffType("AbilityCooldown"));
            projectile.tileCollide = true;

            if (!modPlayer.StandAutoMode)
            {
                projectile.tileCollide         = true;
                modPlayer.controllingAerosmith = true;
                float ScreenX = (float)Main.screenWidth / 2f;
                float ScreenY = (float)Main.screenHeight / 2f;
                modPlayer.aerosmithCamPosition = projectile.position + new Vector2(ScreenX, ScreenY);
                modPlayer.aerosmithCamPosition = new Vector2(projectile.position.X - ScreenX, projectile.position.Y - ScreenY);

                if (Main.mouseLeft && projectile.owner == Main.myPlayer && !fallingFromSpace)
                {
                    float mouseDistance = Vector2.Distance(Main.MouseWorld, projectile.Center);
                    if (mouseDistance > 40f)
                    {
                        projectile.velocity = Main.MouseWorld - projectile.Center;
                        projectile.velocity.Normalize();
                        projectile.velocity *= 10f;
                        if (Main.MouseWorld.X > projectile.position.X + 5f)
                        {
                            projectile.direction = 1;
                        }
                        if (Main.MouseWorld.X <= projectile.position.X - 5f)
                        {
                            projectile.direction = -1;
                        }
                        projectile.spriteDirection = projectile.direction;
                    }
                    else
                    {
                        projectile.velocity = Vector2.Zero;
                    }
                }
                else
                {
                    if (!fallingFromSpace)
                    {
                        projectile.velocity = Vector2.Zero;
                    }
                    projectile.rotation = 0f;
                }
                if (Main.mouseRight && projectile.owner == Main.myPlayer)
                {
                    Main.mouseRight = false;
                    if (shootCount <= 0)
                    {
                        shootCount += newShootTime;
                        Main.PlaySound(SoundID.Item11, projectile.position);
                        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, ProjectileID.Bullet, newProjectileDamage, 3f, projectile.owner);
                        Main.projectile[proj].netUpdate = true;
                    }
                }
                if (SpecialKeyPressedNoCooldown() && !bombless && player.whoAmI == Main.myPlayer)
                {
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10));
                    shootCount += newShootTime;
                    int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, mod.ProjectileType("AerosmithBomb"), 0, 3f, projectile.owner, (projectileDamage + 21f) * (float)modPlayer.standDamageBoosts);
                    Main.projectile[proj].netUpdate = true;
                }
            }
            if (modPlayer.StandAutoMode)
            {
                projectile.rotation = (projectile.velocity * projectile.direction).ToRotation();
                NPC     target     = null;
                Vector2 targetPos  = projectile.position;
                float   targetDist = 350f;
                if (target == null)
                {
                    if (projectile.Distance(player.Center) < 80f)
                    {
                        if (projectile.ai[0] == 0f)
                        {
                            projectile.velocity.X      = -2f;
                            projectile.spriteDirection = projectile.direction = -1;
                        }
                        if (projectile.ai[0] == 1f)
                        {
                            projectile.velocity.X      = 2f;
                            projectile.spriteDirection = projectile.direction = 1;
                        }
                        if (projectile.position.X >= player.position.X + 50f || WorldGen.SolidTile((int)(projectile.position.X / 16) - 3, (int)(projectile.position.Y / 16f) + 1))
                        {
                            projectile.ai[0] = 0f;
                        }
                        if (projectile.position.X < player.position.X - 50f || WorldGen.SolidTile((int)(projectile.position.X / 16) + 3, (int)(projectile.position.Y / 16f) + 1))
                        {
                            projectile.ai[0] = 1f;
                        }
                        if (projectile.position.Y > player.position.Y + 2f)
                        {
                            projectile.velocity.Y = -2f;
                        }
                        if (projectile.position.Y < player.position.Y - 2f)
                        {
                            projectile.velocity.Y = 2f;
                        }
                        if (projectile.position.Y < player.position.Y + 2f && projectile.position.Y > player.position.Y - 2f)
                        {
                            projectile.velocity.Y = 0f;
                        }
                    }
                    else
                    {
                        projectile.tileCollide = false;
                        projectile.velocity    = player.Center - projectile.Center;
                        projectile.velocity.Normalize();
                        projectile.velocity *= 8f;
                    }
                    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)
                {
                    if ((targetPos - projectile.Center).X > 0f)
                    {
                        projectile.spriteDirection = projectile.direction = 1;
                    }
                    else if ((targetPos - projectile.Center).X < 0f)
                    {
                        projectile.spriteDirection = projectile.direction = -1;
                    }
                    if (projectile.Distance(target.Center) > 45f)
                    {
                        projectile.velocity = targetPos - projectile.Center;
                        projectile.velocity.Normalize();
                        projectile.velocity *= 8f;
                    }
                    if (shootCount <= 0)
                    {
                        if (Main.myPlayer == projectile.owner)
                        {
                            shootCount += newShootTime;
                            Main.PlaySound(SoundID.Item11, projectile.position);
                            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, ProjectileID.Bullet, newProjectileDamage, 3f, projectile.owner);
                            Main.projectile[proj].netUpdate = true;
                        }
                    }
                }
            }
            projectile.netUpdate = true;
        }
        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 (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }

                if (projectile.owner == Main.myPlayer)
                {
                    if (SpecialKeyPressedNoCooldown())
                    {
                        modPlayer.GEAbilityNumber += 1;
                        saidAbility = false;
                    }
                    if (modPlayer.GEAbilityNumber >= 4)
                    {
                        modPlayer.GEAbilityNumber = 0;
                    }
                    if (modPlayer.GEAbilityNumber == 0)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Frog");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 1)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Tree");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 2)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Butterflies");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 3)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Limb Recreation");
                            saidAbility = true;
                        }
                    }

                    if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 0)
                    {
                        Main.mouseLeft = false;
                        int proj = Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType("GEFrog"), 1, 0f, projectile.owner, tierNumber, tierNumber - 1f);
                        Main.projectile[proj].netUpdate = true;
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(6));
                    }
                    if (Main.mouseRight && Collision.SolidCollision(Main.MouseWorld, 1, 1) && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 1)
                    {
                        Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y - 65f, 0f, 0f, mod.ProjectileType("GETree"), 1, 0f, projectile.owner, tierNumber);
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(12));
                    }
                    if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 2)
                    {
                        Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("GEButterfly"), 1, 0f, projectile.owner);
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(12));
                    }
                    if (Main.mouseRight && player.velocity == Vector2.Zero && modPlayer.GEAbilityNumber == 3)
                    {
                        regencounter++;
                    }
                    else
                    {
                        regencounter = 0;
                    }
                    if (regencounter >= 120)
                    {
                        int healamount = Main.rand.Next(25, 50);
                        player.statLife += healamount;
                        player.HealEffect(healamount);
                        regencounter = 0;
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
Beispiel #9
0
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            if (Main.netMode != NetmodeID.SinglePlayer)
            {
                for (int i = 0; i < Main.maxPlayers; i++)       //first, get rid of all effect owners
                {
                    Player otherPlayer = Main.player[i];
                    if (otherPlayer.active && otherPlayer.team != player.team)
                    {
                        if (otherPlayer.HasBuff(mod.BuffType("TheWorldBuff")))
                        {
                            otherPlayer.ClearBuff(mod.BuffType("TheWorldBuff"));
                        }
                        if (otherPlayer.HasBuff(mod.BuffType("SkippingTime")))
                        {
                            otherPlayer.ClearBuff(mod.BuffType("SkippingTime"));
                        }
                        if (otherPlayer.HasBuff(mod.BuffType("ForesightBuff")))
                        {
                            otherPlayer.ClearBuff(mod.BuffType("ForesightBuff"));
                        }
                    }
                }
            }
            mPlayer.TheWorldEffect    = false;  //second, get rid of the effects from everyone
            mPlayer.TimeSkipEffect    = false;
            mPlayer.TimeSkipPreEffect = false;
            mPlayer.Foresight         = false;
            if (Main.time != 1600)
            {
                player.AddBuff(mod.BuffType(Name), 2);       //to constantly refresh the buff
            }
            if (Main.time < 1600)
            {
                Main.time += 60;        //drag time down to 1600
            }
            if (Main.time > 1600)
            {
                Main.time -= 60;
            }
            if (Main.time == 1600)
            {
                if (!Main.dayTime)
                {
                    Main.dayTime = true;
                }
                player.statLife = player.statLifeMax;
                player.Spawn();
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(420));
                player.ClearBuff(mod.BuffType(Name));
            }
            for (int n = 0; n < Main.maxNPCs; n++)
            {
                NPC npc = Main.npc[n];
                if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.lifeMax > 5 && Main.rand.Next(1, 16) == 1)
                {
                    int bomb = Projectile.NewProjectile(npc.Center + new Vector2(Main.rand.NextFloat(0f, 10f), Main.rand.NextFloat(0f, 10f)), Vector2.Zero, ProjectileID.GrenadeIII, 102, 3f, player.whoAmI);
                    Main.projectile[bomb].timeLeft  = 2;
                    Main.projectile[bomb].netUpdate = true;
                }
            }
        }
Beispiel #10
0
        public override void AI()
        {
            if (scrapeFrames)
            {
                normalFrames           = false;
                attackFrames           = false;
                secondaryAbilityFrames = false;
            }
            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 (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && projectile.owner == Main.myPlayer)
                {
                    secondaryAbilityFrames = true;
                    if (chargeTimer < 150f)
                    {
                        chargeTimer++;
                    }
                }
                if (!Main.mouseRight && chargeTimer != 0 && projectile.owner == Main.myPlayer)
                {
                    scrapeFrames = true;
                }
                if (!Main.mouseRight && chargeTimer != 0 && projectile.owner == Main.myPlayer && scrapeFrames && projectile.frame == 1)
                {
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                    Vector2 distanceToTeleport = Main.MouseWorld - player.position;
                    distanceToTeleport.Normalize();
                    distanceToTeleport *= chargeTimer / 30f;
                    player.velocity    += distanceToTeleport * 5f;
                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(chargeTimer / 30));       //5s max cooldown
                    chargeTimer = 0;
                }
                if (SpecialKeyCurrent() && !player.HasBuff(mod.BuffType("AbilityCooldown")))
                {
                    specialTimer++;
                    secondaryAbilityFrames = true;
                }
                if (!SpecialKeyCurrent() && specialTimer != 0)
                {
                    scrapeFrames = true;
                    if (specialTimer <= 60)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                        for (int i = 0; i < Main.maxNPCs; i++)
                        {
                            NPC npc = Main.npc[i];
                            if (npc.active && Collision.CheckAABBvLineCollision(npc.position, new Vector2(npc.width, npc.height), projectile.position, Main.MouseWorld) && !npc.immortal && !npc.hide && !npc.townNPC)        //checking if the NPC collides with a line from The Hand to the mouse
                            {
                                Vector2 difference = player.position - npc.position;
                                npc.position = player.Center + (-difference / 2f);
                            }
                        }
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(15));
                    }
                    if (specialTimer > 60)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                        for (int i = 0; i < Main.maxNPCs; i++)
                        {
                            NPC npc = Main.npc[i];
                            if (npc.active && Collision.CheckAABBvLineCollision(npc.position, new Vector2(npc.width, npc.height), projectile.position, Main.MouseWorld) && !npc.immortal && !npc.hide && !npc.townNPC)
                            {
                                npc.StrikeNPC(60 * (specialTimer / 30), 0f, player.direction);      //damage goes up at a rate of 120dmg/s
                                npc.AddBuff(mod.BuffType("MissingOrgans"), 900);
                            }
                        }
                        for (int p = 0; p < Main.maxPlayers; p++)
                        {
                            Player otherPlayer = Main.player[p];
                            if (otherPlayer.active)
                            {
                                if (otherPlayer.team != player.team && otherPlayer.whoAmI != player.whoAmI && Collision.CheckAABBvLineCollision(otherPlayer.position, new Vector2(otherPlayer.width, otherPlayer.height), projectile.position, Main.MouseWorld))
                                {
                                    otherPlayer.Hurt(PlayerDeathReason.ByCustomReason(otherPlayer.name + " was scraped out of existence by " + player.name + "."), 60 * (specialTimer / 30), 1);
                                    otherPlayer.AddBuff(mod.BuffType("MissingOrgans"), 600);
                                }
                            }
                        }
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(25));
                    }
                    specialTimer = 0;
                }
                if (!attackFrames)
                {
                    if (!scrapeFrames && !secondaryAbilityFrames)
                    {
                        StayBehind();
                    }
                    else
                    {
                        GoInFront();
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
Beispiel #11
0
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            player.controlUseItem   = false;
            player.moveSpeed        = 0f;
            player.lifeRegen        = 0;
            player.immune           = true;
            player.manaRegen        = 0;
            player.dash             = 0;
            player.controlQuickHeal = false;
            player.controlQuickMana = false;
            player.controlRight     = false;
            player.controlUseTile   = false;
            player.maxRunSpeed      = 0f;
            player.noFallDmg        = true;

            if (!resetLimitTimer && limitTimer > 0)
            {
                limitTimer      = 0;
                resetLimitTimer = true;
            }
            if (MyPlayer.SecretReferences)
            {
                limitTimer--;
                if (player.wet)
                {
                    limitTimer -= 3;
                    if (player.ZoneSnow)
                    {
                        limitTimer -= 6;
                    }
                    if (breathSave == 0)
                    {
                        breathSave = player.breath;
                    }
                }
                if (breathSave != 0)
                {
                    player.breath = breathSave;
                }
                if (limitTimer <= 0)
                {
                    if (player.wet || (player.wet && player.ZoneSnow))
                    {
                        player.KillMe(PlayerDeathReason.ByCustomReason("The water kept it's constant rythm and " + player.name + " has stopped waiting. And stopped thinking."), player.statLife - 1, 1);
                    }
                    else
                    {
                        player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " has stopped thinking."), player.statLife - 1, 1);
                    }
                    limitTimer = 36000;
                }
            }
            if (Main.mouseRight && mPlayer.StandSlot.Item.type == mod.ItemType("CenturyBoyT2") && player.HasItem(ItemID.Dynamite) && !player.HasBuff(mod.BuffType("AbilityCooldown")))
            {
                Main.PlaySound(SoundID.Item62);
                var explosion = Projectile.NewProjectile(player.position, Vector2.Zero, ProjectileID.GrenadeIII, 49, 8f, Main.myPlayer);
                Main.projectile[explosion].timeLeft  = 2;
                Main.projectile[explosion].netUpdate = true;
                player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(12));
                player.ConsumeItem(ItemID.Dynamite);
            }
        }
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            if (shootCount > 0)
            {
                shootCount--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            Lighting.AddLight((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f), 0.6f, 0.9f, 0.3f);
            Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 35, projectile.velocity.X * -0.5f, projectile.velocity.Y * -0.5f);
            projectile.scale = ((50 - player.ownedProjectileCounts[mod.ProjectileType("EmeraldStringPoint2")]) * 2f) / 100f;

            Vector2 vector131 = player.Center;

            if (!attackFrames)
            {
                vector131.X -= (float)((15 + player.width / 2) * player.direction);
            }
            if (attackFrames)
            {
                vector131.X -= (float)((15 + player.width / 2) * (player.direction * -1));
            }
            vector131.Y         -= 5f;
            projectile.Center    = Vector2.Lerp(projectile.Center, vector131, 0.2f);
            projectile.velocity *= 0.8f;
            projectile.direction = (projectile.spriteDirection = player.direction);

            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.scale >= 0.5f && projectile.owner == Main.myPlayer)
                {
                    attackFrames         = true;
                    normalFrames         = false;
                    Main.mouseRight      = false;   //so that the player can't just stop time while punching
                    projectile.netUpdate = true;
                    if (shootCount <= 0)
                    {
                        Main.PlaySound(SoundID.Item21, projectile.position);
                        shootCount += newShootTime;
                        Vector2 shootVel = Main.MouseWorld - projectile.Center;
                        if (shootVel == Vector2.Zero)
                        {
                            shootVel = new Vector2(0f, 1f);
                        }
                        shootVel.Normalize();
                        shootVel *= shootSpeed;
                        float numberProjectiles = 6;
                        float rotation          = MathHelper.ToRadians(30);
                        float random            = Main.rand.NextFloat(-6f, 6f);
                        for (int i = 0; i < numberProjectiles; i++)
                        {
                            Vector2 perturbedSpeed = new Vector2(shootVel.X + Main.rand.NextFloat(-6f, 6f), shootVel.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f;
                            int     proj           = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Emerald"), newProjectileDamage, 3f, player.whoAmI);
                            Main.projectile[proj].netUpdate = true;
                        }
                    }
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        normalFrames = true;
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && shootCount <= 0 && !linkShot && projectile.scale >= 0.5f && projectile.owner == Main.myPlayer)
                {
                    Main.mouseLeft = false;
                    linkShot       = true;
                    Main.PlaySound(SoundID.Item21, projectile.position);
                    shootCount += 15;
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= shootSpeed;
                    Vector2 perturbedSpeed = new Vector2(shootVel.X + Main.rand.NextFloat(-3f, 3f), shootVel.Y);
                    int     proj           = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("EmeraldStringPoint"), 0, 3f, player.whoAmI);
                    Main.projectile[proj].netUpdate = true;
                }
                if (Main.mouseRight && shootCount <= 0 && linkShot && projectile.scale >= 0.5f && projectile.owner == Main.myPlayer)
                {
                    Main.mouseLeft = false;
                    linkShot       = false;
                    Main.PlaySound(SoundID.Item21, projectile.position);
                    shootCount += 15;
                    Vector2 shootVel = Main.MouseWorld - projectile.Center;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, 1f);
                    }
                    shootVel.Normalize();
                    shootVel *= shootSpeed;
                    Vector2 perturbedSpeed = new Vector2(shootVel.X + Main.rand.NextFloat(-3f, 3f), shootVel.Y);
                    int     proj           = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("EmeraldStringPoint2"), 0, 3f, player.whoAmI, 40f);
                    Main.projectile[proj].netUpdate = true;
                }
                if (SpecialKeyPressed() && player.ownedProjectileCounts[mod.ProjectileType("EmeraldStringPoint2")] <= 0 && !spawningField)
                {
                    spawningField = true;
                    formPosition  = projectile.position;
                    if (JoJoStands.SoundsLoaded)
                    {
                        Main.PlaySound(JoJoStands.JoJoStandsSounds.GetLegacySoundSlot(SoundType.Custom, "Sounds/SoundEffects/EmeraldSplash"));
                    }
                }
                if (spawningField)
                {
                    float randomRadius = Main.rand.NextFloat(-20f, 21f);
                    Main.mouseLeft  = false;
                    Main.mouseRight = false;
                    Vector2 offset = formPosition + (randomRadius.ToRotationVector2() * 288f); //33 tiles

                    if (numberSpawned < 100f && shootCount <= 0 && !linkShotForSpecial)        //50 tendrils, the number spawned limit /2 is the wanted amount
                    {
                        shootCount += 2;
                        int proj = Projectile.NewProjectile(offset, Vector2.Zero, mod.ProjectileType("EmeraldStringPoint"), 0, 2f, player.whoAmI);
                        Main.projectile[proj].netUpdate   = true;
                        Main.projectile[proj].tileCollide = false;
                        linkShotForSpecial = true;
                        numberSpawned++;
                    }
                    if (numberSpawned < 100f && shootCount <= 0 && linkShotForSpecial)
                    {
                        shootCount += 2;
                        int proj = Projectile.NewProjectile(offset, Vector2.Zero, mod.ProjectileType("EmeraldStringPoint2"), 0, 2f, player.whoAmI, 40f);
                        Main.projectile[proj].netUpdate   = true;
                        Main.projectile[proj].tileCollide = false;
                        linkShotForSpecial = false;
                        numberSpawned++;
                    }
                    if (numberSpawned >= 100f)
                    {
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(30));
                        spawningField = false;
                        formPosition  = Vector2.Zero;
                    }
                }
                else
                {
                    numberSpawned = 0;
                }
            }
            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 (shootCount <= 0)
                    {
                        shootCount += newShootTime;
                        Main.PlaySound(SoundID.Item21, projectile.position);
                        if (Main.myPlayer == projectile.owner)
                        {
                            Vector2 shootVel = targetPos - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            shootVel *= shootSpeed;
                            float numberProjectiles = 6;
                            float rotation          = MathHelper.ToRadians(30);
                            float random            = Main.rand.NextFloat(-6f, 6f);
                            for (int i = 0; i < numberProjectiles; i++)
                            {
                                Vector2 perturbedSpeed = new Vector2(shootVel.X + random, shootVel.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f;
                                int     proj           = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Emerald"), (int)((projectileDamage * modPlayer.standDamageBoosts) * 0.9f), 3f, player.whoAmI);
                                Main.projectile[proj].netUpdate = true;
                            }
                            projectile.netUpdate = true;
                        }
                    }
                }
                else
                {
                    normalFrames = true;
                    attackFrames = false;
                }
            }
        }
Beispiel #13
0
        public override void AI()
        {
            if (scrapeFrames)       //seems to not actually do this in SelectAnim
            {
                normalFrames           = false;
                attackFrames           = false;
                secondaryAbilityFrames = false;
            }
            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 (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && player.whoAmI == Main.myPlayer)
                {
                    secondaryAbilityFrames = true;
                    if (chargeTimer < 150f)
                    {
                        chargeTimer++;
                    }
                }
                if (!Main.mouseRight && chargeTimer != 0 && projectile.owner == Main.myPlayer)
                {
                    scrapeFrames = true;
                }
                if (!Main.mouseRight && chargeTimer != 0 && projectile.owner == Main.myPlayer && scrapeFrames && projectile.frame == 1)
                {
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/BRRR"));
                    Vector2 distanceToTeleport = Main.MouseWorld - player.position;
                    distanceToTeleport.Normalize();

                    /*distanceToTeleport *= 98f * (chargeTimer / 60f);
                     * player.position = player.Center + distanceToTeleport;*/
                    distanceToTeleport *= chargeTimer / 60f;
                    player.velocity    += distanceToTeleport * 5f;

                    player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(chargeTimer / 10));       //15s max cooldown
                    chargeTimer = 0;
                }

                /*if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")))
                 * {
                 *  chargingScrape = true;
                 *  secondaryAbilityFrames = true;
                 * }
                 * if (!Main.mouseRight && chargingScrape)
                 * {
                 *  chargingScrape = false;
                 *  scrapeFrames = true;
                 *  Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, mod.ProjectileType("TheHandMouse"), 0, 0f, Main.myPlayer, projectile.whoAmI);
                 * }
                 * if (projectile.ai[0] == 1f)     //teleport in that direction
                 * {
                 *  Vector2 distanceToTeleport = Main.MouseWorld - player.position;
                 *  distanceToTeleport.Normalize();
                 *  distanceToTeleport *= 98f;
                 *  player.position = player.Center + distanceToTeleport;
                 *  player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(5));
                 *  projectile.ai[0] = 0f;
                 * }
                 * if (projectile.ai[0] == 2f)     //pull the enemy
                 * {
                 *  projectile.ai[0] = 0f;
                 * }
                 * if (projectile.ai[0] == 3f)     //break tiles
                 * {
                 *  projectile.ai[0] = 0f;
                 * }*/
                if (!attackFrames)
                {
                    if (!scrapeFrames && !secondaryAbilityFrames)
                    {
                        StayBehind();
                    }
                    else
                    {
                        GoInFront();
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
Beispiel #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;
                }
            }
        }
        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);
            }
        }
Beispiel #16
0
 public override void Update(Player player, ref int buffIndex)
 {
     if (player.HasBuff(mod.BuffType("SkippingTime")))
     {
         player.immune         = true;
         player.controlUseItem = false;
         player.AddBuff(BuffID.NightOwl, 2);
         for (int i = 0; i < 255; i++)
         {
             if (Main.player[i].active && !Main.player[i].HasBuff(mod.BuffType("PreTimeSkip")) && !Main.player[i].HasBuff(mod.BuffType("SkippingTime")))
             {
                 Main.player[i].velocity = PreTimeSkip.playerVelocity[i];
                 Main.player[i].AddBuff(BuffID.Obstructed, 2);
                 Main.player[i].controlUseItem   = false;
                 Main.player[i].controlLeft      = false;
                 Main.player[i].controlJump      = false;
                 Main.player[i].controlRight     = false;
                 Main.player[i].controlDown      = false;
                 Main.player[i].controlQuickHeal = false;
                 Main.player[i].controlQuickMana = false;
                 Main.player[i].controlRight     = false;
                 Main.player[i].controlUseTile   = false;
                 Main.player[i].controlUp        = false;
                 Main.player[i].controlMount     = false;
                 Main.player[i].gravControl      = false;
                 Main.player[i].gravControl2     = false;
                 Main.player[i].controlTorch     = false;
             }
         }
         if (!setToTrue)
         {
             player.GetModPlayer <MyPlayer>().TimeSkipEffect = true;
             if (Main.netMode == NetmodeID.MultiplayerClient)
             {
                 ModNetHandler.effectSync.SendTimeskip(256, player.whoAmI, true, player.whoAmI);
             }
             setToTrue = true;
         }
     }
     else
     {
         MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();
         for (int i = 0; i < Main.maxNPCs; i++)
         {
             Main.npc[i].AddBuff(mod.BuffType("TimeSkipConfusion"), 120);
         }
         Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/timeskip_end"));
         player.AddBuff(mod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(30));
         if (Main.netMode == NetmodeID.SinglePlayer)
         {
             mPlayer.TimeSkipEffect = false;
         }
         else
         {
             for (int i = 0; i < Main.maxPlayers; i++)
             {
                 Player otherPlayers = Main.player[i];
                 if (otherPlayers.active && otherPlayers.whoAmI != player.whoAmI)
                 {
                     if (otherPlayers.HasBuff(mod.BuffType(Name)))
                     {
                         sendFalse = false;      //don't send the packet and let the buff end if you weren't the only timestop owner
                     }
                     else
                     {
                         sendFalse = true;       //send the packet if no one is owning timestop
                     }
                 }
                 if (player.active && !otherPlayers.active)       //for those people who just like playing in multiplayer worlds by themselves... (why does this happen)
                 {
                     sendFalse = true;
                 }
                 Array.Clear(PreTimeSkip.playerVelocity, i, 1);
                 if (Main.player[i].active && i != player.whoAmI)
                 {
                     Main.player[i].AddBuff(mod.BuffType("TimeSkipConfusion"), 240);
                 }
             }
         }
         if (Main.netMode == NetmodeID.MultiplayerClient && sendFalse)
         {
             mPlayer.TimeSkipEffect = false;
             ModNetHandler.effectSync.SendTimeskip(256, player.whoAmI, false, player.whoAmI);
         }
         PreTimeSkip.userIndex = -1;
     }
 }
        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();
            }
        }
        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;
            }
            modPlayer.Shirtless = Shirtless;
            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch(punchMovementSpeed);
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !attackFrames && !parryFrames && projectile.owner == Main.myPlayer)
                {
                    HandleDrawOffsets();
                    normalFrames           = false;
                    attackFrames           = false;
                    secondaryAbilityFrames = true;
                    Main.mouseLeft         = false;
                    projectile.netUpdate   = true;
                    Rectangle parryRectangle = new Rectangle((int)projectile.Center.X + (4 * projectile.direction), (int)projectile.Center.Y - 29, 16, 54);
                    for (int p = 0; p < Main.maxProjectiles; p++)
                    {
                        Projectile otherProj = Main.projectile[p];
                        if (otherProj.active)
                        {
                            if (parryRectangle.Intersects(otherProj.Hitbox) && otherProj.type != projectile.type && !otherProj.friendly)
                            {
                                parryFrames         = true;
                                otherProj.owner     = projectile.owner;
                                otherProj.damage   *= 2;
                                otherProj.velocity *= -1;
                                otherProj.hostile   = false;
                                otherProj.friendly  = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(3));
                            }
                        }
                    }
                    for (int n = 0; n < Main.maxNPCs; n++)
                    {
                        NPC npc = Main.npc[n];
                        if (npc.active)
                        {
                            if (!npc.townNPC && !npc.friendly && !npc.immortal && !npc.hide && parryRectangle.Intersects(npc.Hitbox))
                            {
                                npc.StrikeNPC(npc.damage * 2, 6f, player.direction);
                                secondaryAbilityFrames = false;
                                parryFrames            = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(3));
                            }
                        }
                    }
                }
                if (!Main.mouseRight)
                {
                    secondaryAbilityFrames = false;
                }
                if (!attackFrames && !parryFrames)
                {
                    if (!Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")))
                    {
                        StayBehind();
                    }
                    else
                    {
                        GoInFront();
                    }
                }
                if (SpecialKeyPressed())
                {
                    Shirtless = !Shirtless;

                    if (Shirtless)
                    {
                        punchMovementSpeed = 7.5f;
                        if (!player.HasBuff(mod.BuffType("AbilityCooldown")) && player.ownedProjectileCounts[mod.ProjectileType("SilverChariotAfterImage")] == 0)
                        {
                            for (int i = 0; i < afterImagesLimit; i++)
                            {
                                int proj = Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType("SilverChariotAfterImage"), 0, 0f, projectile.owner, i, afterImagesLimit);
                                Main.projectile[proj].netUpdate = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(5));
                            }
                        }
                    }
                    else
                    {
                        punchMovementSpeed = 5f;
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
        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 (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !parryFrames && projectile.owner == Main.myPlayer)
                {
                    normalFrames           = false;
                    attackFrames           = false;
                    secondaryAbilityFrames = true;
                    Main.mouseLeft         = false;
                    projectile.netUpdate   = true;
                    GoInFront();
                    Rectangle parryRectangle = new Rectangle((int)projectile.Center.X + (4 * projectile.direction), (int)projectile.Center.Y - 29, 16, 54);
                    for (int p = 0; p < Main.maxProjectiles; p++)
                    {
                        Projectile otherProj = Main.projectile[p];
                        if (otherProj.active)
                        {
                            if (parryRectangle.Intersects(otherProj.Hitbox) && otherProj.type != projectile.type && !otherProj.friendly)
                            {
                                parryFrames         = true;
                                otherProj.owner     = projectile.owner;
                                otherProj.damage   *= 2;
                                otherProj.velocity *= -1;
                                otherProj.hostile   = false;
                                otherProj.friendly  = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10));
                            }
                        }
                    }
                    for (int n = 0; n < Main.maxNPCs; n++)
                    {
                        NPC npc = Main.npc[n];
                        if (npc.active)
                        {
                            if (!npc.townNPC && !npc.friendly && !npc.immortal && !npc.hide && parryRectangle.Intersects(npc.Hitbox))
                            {
                                npc.StrikeNPC(npc.damage * 2, 6f, player.direction);
                                secondaryAbilityFrames = false;
                                parryFrames            = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10));
                            }
                        }
                    }
                }
                if (!Main.mouseRight)
                {
                    secondaryAbilityFrames = false;
                }
                if (!attackFrames && !Main.mouseRight && !parryFrames)
                {
                    StayBehind();
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
Beispiel #20
0
        public override void AI()
        {
            Player   player  = Main.player[projectile.owner];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            SelectAnimation();
            UpdateStandInfo();
            Lighting.AddLight(projectile.position, 1.78f, 2.21f, 2.54f);
            if (shootCount > 0)
            {
                shootCount--;
            }
            if (mPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (spearWhoAmI != -1)
            {
                Projectile spear = Main.projectile[spearWhoAmI];
                if (!spear.active)
                {
                    projectile.ai[0] = 0f;
                    spearWhoAmI      = -1;
                    letGoOfSpear     = false;
                }
            }
            if (slamCounter > 0)
            {
                slamCounter--;
                secondaryAbilityFrames = true;
                GoInFront();
            }
            else
            {
                secondaryAbilityFrames = false;
                StayBehind();
            }

            if (Main.mouseLeft)
            {
                attackFrames = true;
                if (shootCount <= 0f)
                {
                    Main.PlaySound(SoundID.Item28, projectile.position);
                    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, shootVel, mod.ProjectileType("IceBolt"), newProjectileDamage, 8f, Main.myPlayer);
                    Main.projectile[proj].netUpdate = true;
                    projectile.netUpdate            = true;
                }
            }
            else
            {
                normalFrames = true;
            }
            if (Main.mouseRight && shootCount <= 0f && player.ownedProjectileCounts[mod.ProjectileType("IceSpear")] == 0 && projectile.owner == Main.myPlayer && spearWhoAmI == -1)
            {
                projectile.ai[0] = 0.5f;
                spearWhoAmI      = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 10f, 0f, 0f, mod.ProjectileType("IceSpear"), (int)(altDamage * mPlayer.standDamageBoosts), 10f, Main.myPlayer, projectile.whoAmI);
                Main.projectile[spearWhoAmI].netUpdate = true;
                projectile.netUpdate = true;
            }
            if (Main.mouseRight && spearWhoAmI != -1 && !letGoOfSpear)
            {
                Projectile spear = Main.projectile[spearWhoAmI];
                projectile.ai[0] += 0.005f;     //used to change multiple things, that's why we're using this
                if (projectile.ai[0] >= 2f)
                {
                    player.AddBuff(BuffID.Chilled, 2);
                }
                Vector2 direction = Main.MouseWorld - projectile.Center;
                if (projectile.ai[0] <= 1.3f)
                {
                    spear.scale = projectile.ai[0];
                }
                direction.Normalize();
                spear.rotation = direction.ToRotation() + 1f;
                spear.velocity = Vector2.Zero;
                spear.position = projectile.Center + new Vector2(0f, -10f);
            }
            if (!Main.mouseRight && spearWhoAmI != -1 && !letGoOfSpear)
            {
                Projectile spear = Main.projectile[spearWhoAmI];
                spear.ai[0]  = 1f;
                spear.damage = (int)(altDamage * (projectile.ai[0] + 1));
                Vector2 direction = Main.MouseWorld - projectile.Center;
                direction.Normalize();
                spear.velocity = (direction * 12f) * projectile.ai[0];
                letGoOfSpear   = true;
            }
            if (SpecialKeyPressed() && shootCount <= 0f && !player.HasBuff(JoJoFanStands.JoJoStandsMod.BuffType("AbilityCooldown")))
            {
                secondaryAbilityFrames = true;
                Main.PlaySound(SoundID.Item28, projectile.position);
                slamCounter += 80;
                int proj = Projectile.NewProjectile(projectile.Center.X + 7f, projectile.Center.Y + 3f, 0f, 0f, mod.ProjectileType("IceSpike"), specialDamage, 2f, Main.myPlayer, projectile.whoAmI, projectile.direction);
                Main.projectile[proj].netUpdate = true;
                projectile.netUpdate            = true;
                player.AddBuff(JoJoFanStands.JoJoStandsMod.BuffType("AbilityCooldown"), mPlayer.AbilityCooldownTime(10));
            }
        }
        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 (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer && !secondaryAbilityFrames)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                if (!attackFrames && projectile.owner == Main.myPlayer)
                {
                    if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 0)
                    {
                        normalFrames           = false;
                        attackFrames           = false;
                        secondaryAbilityFrames = true;
                    }
                    if (Main.mouseRight && Collision.SolidCollision(Main.MouseWorld, 1, 1) && !player.HasBuff(mod.BuffType("AbilityCooldown")) && modPlayer.GEAbilityNumber == 1)
                    {
                        Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y - 65f, 0f, 0f, mod.ProjectileType("GETree"), 1, 0f, projectile.owner, tierNumber);
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(10));
                    }
                    if (Main.mouseRight && modPlayer.GEAbilityNumber == 2 && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !player.HasBuff(mod.BuffType("DeathLoop")))
                    {
                        player.AddBuff(mod.BuffType("DeathLoop"), 1500);
                    }
                    if (Main.mouseRight && player.velocity == Vector2.Zero && modPlayer.GEAbilityNumber == 3)
                    {
                        regencounter++;
                    }
                    else
                    {
                        regencounter = 0;
                    }
                    if (regencounter > 80)
                    {
                        int healamount = Main.rand.Next(25, 50);
                        player.statLife += healamount;
                        player.HealEffect(healamount);
                        regencounter = 0;
                    }
                    if (Main.mouseRight && modPlayer.GEAbilityNumber == 4 && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !player.HasBuff(mod.BuffType("BacktoZero")))
                    {
                        player.AddBuff(mod.BuffType("BacktoZero"), 1200);
                        modPlayer.BackToZero = true;
                        if (Main.netMode == NetmodeID.MultiplayerClient)
                        {
                            ModNetHandler.effectSync.SendBTZ(256, player.whoAmI, true, player.whoAmI);
                        }
                    }
                }

                if (projectile.owner == Main.myPlayer)
                {
                    if (SpecialKeyPressedNoCooldown())
                    {
                        modPlayer.GEAbilityNumber += 1;
                        saidAbility = false;
                    }
                    if (modPlayer.GEAbilityNumber >= 6)
                    {
                        modPlayer.GEAbilityNumber = 0;
                    }
                    if (modPlayer.GEAbilityNumber == 0)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Scorpion Rock");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 1)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Tree");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 2)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Death Loop");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 3)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Limb Recreation");
                            saidAbility = true;
                        }
                    }
                    if (modPlayer.GEAbilityNumber == 4)
                    {
                        if (!saidAbility)
                        {
                            Main.NewText("Ability: Back to Zero");
                            saidAbility = true;
                        }
                    }
                }
                if (secondaryAbilityFrames)
                {
                    normalFrames         = false;
                    attackFrames         = false;
                    projectile.netUpdate = true;
                    if (projectile.frame == 8 && shootCount <= 0)
                    {
                        shootCount += newPunchTime;
                        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.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("GoldExperienceRock"), newPunchDamage + 11, 6f, projectile.owner);
                        Main.projectile[proj].netUpdate = true;
                        projectile.netUpdate            = true;
                        player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(3));
                        secondaryAbilityFrames = false;
                    }
                }
            }
            if (modPlayer.StandAutoMode)
            {
                BasicPunchAI();
            }
        }
        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.Shirtless)
            {
                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 (parryCooldownTime == 0)
            {
                if (projectile.ai[1] == 3f)
                {
                    parryCooldownTime = 6;
                }
                else
                {
                    parryCooldownTime = 3;
                }
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && player.whoAmI == Main.myPlayer)
                {
                    Punch(7.5f);
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (Main.mouseRight && !player.HasBuff(mod.BuffType("AbilityCooldown")) && !attackFrames && !parryFrames && projectile.owner == Main.myPlayer)
                {
                    normalFrames           = false;
                    attackFrames           = false;
                    secondaryAbilityFrames = true;
                    Main.mouseLeft         = false;
                    projectile.netUpdate   = true;
                    Rectangle parryRectangle = new Rectangle((int)projectile.Center.X + (4 * projectile.direction), (int)projectile.Center.Y - 29, 16, 54);
                    for (int p = 0; p < Main.maxProjectiles; p++)
                    {
                        Projectile otherProj = Main.projectile[p];
                        if (otherProj.active)
                        {
                            if (parryRectangle.Intersects(otherProj.Hitbox) && otherProj.type != projectile.type && !otherProj.friendly)
                            {
                                parryFrames         = true;
                                otherProj.owner     = projectile.owner;
                                otherProj.damage   *= 2;
                                otherProj.velocity *= -1;
                                otherProj.hostile   = false;
                                otherProj.friendly  = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(parryCooldownTime));
                            }
                        }
                    }
                    for (int n = 0; n < Main.maxNPCs; n++)
                    {
                        NPC npc = Main.npc[n];
                        if (npc.active)
                        {
                            if (!npc.townNPC && !npc.friendly && !npc.immortal && !npc.hide && parryRectangle.Intersects(npc.Hitbox))
                            {
                                npc.StrikeNPC(npc.damage * 2, 6f, player.direction);
                                secondaryAbilityFrames = false;
                                parryFrames            = true;
                                player.AddBuff(mod.BuffType("AbilityCooldown"), modPlayer.AbilityCooldownTime(parryCooldownTime));
                            }
                        }
                    }

                    if (projectile.position.X > player.position.X)
                    {
                        projectile.direction = 1;
                    }
                    else
                    {
                        projectile.direction = -1;
                    }
                    projectile.spriteDirection = projectile.direction;
                }
                if (!Main.mouseRight)
                {
                    secondaryAbilityFrames = false;
                }

                if (!attackFrames)
                {
                    float angle = 360f / projectile.ai[1];
                    angle *= projectile.ai[0];

                    projectile.position = player.Center + (MathHelper.ToRadians(angle).ToRotationVector2() * (4f * 16f));
                    if (!secondaryAbilityFrames && !parryFrames)
                    {
                        normalFrames = true;
                        projectile.spriteDirection = projectile.direction = player.direction;
                    }
                    HandleDrawOffsets();
                }
            }
            else
            {
                BasicPunchAI();
            }
        }