Ejemplo n.º 1
0
        public override void AI()
        {
            if (npc.localAI[3] == 0) //just spawned
            {
                npc.TargetClosest(false);
                Movement(Main.player[npc.target].Center, 0.8f, 32f);
                if (npc.Distance(Main.player[npc.target].Center) < 1500)
                {
                    npc.localAI[3] = 1;
                }
                else
                {
                    return;
                }

                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <EarthChampionHand>(), npc.whoAmI, 0, 0, npc.whoAmI, 1);
                    if (n < Main.maxNPCs)
                    {
                        Main.npc[n].velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(32f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }

                    n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <EarthChampionHand>(), npc.whoAmI, 0, 0, npc.whoAmI, -1);
                    if (n < Main.maxNPCs)
                    {
                        Main.npc[n].velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(32f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                }
            }

            EModeGlobalNPC.championBoss = npc.whoAmI;

            Player  player = Main.player[npc.target];
            Vector2 targetPos;

            if (npc.HasValidTarget && npc.Distance(player.Center) < 2500 && player.ZoneUnderworldHeight)
            {
                npc.timeLeft = 600;
            }

            npc.dontTakeDamage = false;

            switch ((int)npc.ai[0])
            {
            case -1:
                npc.localAI[2] = 1;

                //npc.dontTakeDamage = true;
                npc.ai[1]++;

                npc.velocity *= 0.95f;

                /*if (npc.ai[1] < 120)
                 * {
                 *  targetPos = player.Center;
                 *  targetPos.Y -= 375;
                 *  if (npc.Distance(targetPos) > 50)
                 *      Movement(targetPos, 0.6f, 24f, true);
                 * }
                 * else*/
                if (npc.ai[1] == 120)     //begin healing
                {
                    Main.PlaySound(SoundID.NPCDeath10, npc.Center);

                    const int num226 = 80;
                    for (int num227 = 0; num227 < num226; num227++)
                    {
                        Vector2 vector6 = Vector2.UnitX * 40f;
                        vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center;
                        Vector2 vector7 = vector6 - npc.Center;
                        int     num228  = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 3f);
                        Main.dust[num228].noGravity = true;
                        Main.dust[num228].velocity  = vector7;
                    }
                }
                else if (npc.ai[1] > 120)     //healing
                {
                    npc.velocity *= 0.9f;

                    int heal = (int)(npc.lifeMax / 2 / 120 * Main.rand.NextFloat(1f, 1.5f));
                    npc.life += heal;
                    if (npc.life > npc.lifeMax)
                    {
                        npc.life = npc.lifeMax;
                    }
                    CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                    for (int i = 0; i < 5; i++)
                    {
                        int d = Dust.NewDust(npc.Center, 0, 0, 174, 0f, 0f, 0, default(Color), 1.5f);
                        Main.dust[d].noGravity = true;
                        Main.dust[d].velocity *= 8f;
                    }

                    if (npc.ai[1] > 240)
                    {
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.netUpdate = true;
                    }
                }
                break;

            case 0:                               //float over player
                if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f ||
                    !player.ZoneUnderworldHeight) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   += 1f;

                    return;
                }
                else
                {
                    targetPos    = player.Center;
                    targetPos.Y -= 325;
                    if (npc.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.4f, 24f, true);
                    }
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 2)
                {
                    npc.ai[0] = -1;
                    npc.ai[1] = 0;
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;

                    for (int i = 0; i < Main.maxNPCs; i++)     //find hands, update
                    {
                        if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <EarthChampionHand>() && Main.npc[i].ai[2] == npc.whoAmI)
                        {
                            Main.npc[i].ai[0]      = -1;
                            Main.npc[i].ai[1]      = 0;
                            Main.npc[i].localAI[0] = 0;
                            Main.npc[i].localAI[1] = 0;
                            Main.npc[i].netUpdate  = true;
                        }
                    }
                }
                break;

            case 1:                               //fireballs
                if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f ||
                    !player.ZoneUnderworldHeight) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   += 1f;

                    return;
                }
                else
                {
                    targetPos = player.Center;
                    for (int i = 0; i < 22; i++)     //collision check above player's head
                    {
                        targetPos.Y -= 16;
                        Tile tile = Framing.GetTileSafely(targetPos);     //if solid, stay below it
                        if (tile.active() && !tile.inActive() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
                        {
                            targetPos.Y += 50 + 16;
                            break;
                        }
                    }
                    if (npc.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.2f, 24f, true);
                    }

                    if (++npc.ai[2] > 75)
                    {
                        npc.ai[2] = 0;
                        if (Main.netMode != NetmodeID.MultiplayerClient)     //shoot spread of fireballs
                        {
                            for (int i = -1; i <= 1; i++)
                            {
                                Projectile.NewProjectile(npc.Center + Vector2.UnitY * 60,
                                                         (npc.localAI[2] == 1 ? 12 : 8) * npc.DirectionTo(player.Center).RotatedBy(MathHelper.ToRadians(8 * i)),
                                                         ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer);
                            }
                        }
                    }

                    if (++npc.ai[1] > 480)
                    {
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.netUpdate = true;
                    }
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 2)
                {
                    npc.ai[0] = -1;
                    npc.ai[1] = 0;
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;

                    for (int i = 0; i < Main.maxNPCs; i++)     //find hands, update
                    {
                        if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <EarthChampionHand>() && Main.npc[i].ai[2] == npc.whoAmI)
                        {
                            Main.npc[i].ai[0]      = -1;
                            Main.npc[i].ai[1]      = 0;
                            Main.npc[i].localAI[0] = 0;
                            Main.npc[i].localAI[1] = 0;
                            Main.npc[i].netUpdate  = true;
                        }
                    }
                }
                break;

            default:
                npc.ai[0] = 0;
                goto case 0;
            }
        }
Ejemplo n.º 2
0
        public override void AI()
        {
            npc.wet         = false;
            npc.lavaWet     = false;
            npc.honeyWet    = false;
            npc.immune[255] = 30;
            string PirateHelp1  = Language.GetTextValue("Mods.Antiaris.PirateHelp1");
            string PirateHelp1F = Language.GetTextValue("Mods.Antiaris.PirateHelp1F");
            string PirateHelp2  = Language.GetTextValue("Mods.Antiaris.PirateHelp2");
            string PirateHelp3  = Language.GetTextValue("Mods.Antiaris.PirateHelp3");
            Player player       = Main.player[npc.target];

            if (player.Male)
            {
                switch (Main.rand.Next(0, 3))
                {
                case 0:
                    HelpText = PirateHelp1;
                    break;

                case 1:
                    HelpText = PirateHelp2;
                    break;

                case 2:
                    HelpText = PirateHelp3;
                    break;
                }
            }
            else
            {
                switch (Main.rand.Next(0, 3))
                {
                case 0:
                    HelpText = PirateHelp1F;
                    break;

                case 1:
                    HelpText = PirateHelp2;
                    break;

                case 2:
                    HelpText = PirateHelp3;
                    break;
                }
            }
            if (Main.rand.Next(300) == 0)
            {
                CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.White, HelpText, false, false);
                SoundEngine.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/NPCs/PirateVoice"), npc.position);
            }
            npc.spriteDirection = 1;
            foreach (Player player_ in Main.player)
            {
                if (!player_.active)
                {
                    continue;
                }
                if (player_.talkNPC == npc.whoAmI)
                {
                    WakeUp();
                    return;
                }
            }
            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                npc.homeless  = false;
                npc.homeTileX = -1;
                npc.homeTileY = -1;
                npc.netUpdate = true;
            }
        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY - 2)) * 38f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position += muzzleOffset;
            }
            float  spread      = MathHelper.ToRadians(4f);       //45 degrees converted to radians
            float  baseSpeed   = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
            double baseAngle   = Math.Atan2(speedX, speedY);
            double randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread;

            speedX = baseSpeed * (float)Math.Sin(randomAngle);
            speedY = baseSpeed * (float)Math.Cos(randomAngle);
            if (magazine == 0)
            {
                item.useStyle = 1;
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 1));
                item.noUseGraphic = true;
                if (throwType == 1)
                {
                    type = mod.ProjectileType("SureshotMIRV");
                }
                if (throwType == 2)
                {
                    type = mod.ProjectileType("SureshotBounce");
                }
                if (throwType == 3)
                {
                    type = mod.ProjectileType("SureshotLegs");
                }
                if (throwType == 4)
                {
                    type = mod.ProjectileType("SureshotGrenade");
                }
                if (throwType == 5)
                {
                    type = mod.ProjectileType("SureshotSticky");
                }
                CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y - 10, player.width, player.height), new Color(255, 255, 255, 100),
                                   "Reloading!");
                Main.PlaySound(SoundLoader.customSoundType, player.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Reload"));
                item.reuseDelay = 30;
            }
            else
            {
                item.noUseGraphic = false;
                item.useStyle     = 5;
                item.reuseDelay   = 0;
            }
            if (magazine < 0)
            {
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Dust.NewDust(player.position, player.width, player.height, 263, 0.0f, 0.0f, (int)byte.MaxValue, new Color(), (float)GloriousGuns.instance.gloriousRNG.Next(20, 26) * 0.1f);
                    Main.dust[index2].noLight   = true;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.5f;
                    Main.dust[index2].scale    *= .6f;
                }
                item.noUseGraphic = true;
                type     = mod.ProjectileType("");
                magazine = maxBullets;
            }
            magazine--;
            int projectileSlagd = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);

            Main.projectile[projectileSlagd].GetGlobalProjectile <GloriousGunsGProj>().shotFromSlagWeaponCommon = true;
            return(false);
        }
Ejemplo n.º 4
0
 public override void AI()
 {
     time += 1;
     if (time >= 60)
     {
         if (projectile.ai[1] == 0f)
         {
             projectile.friendly = true;
             int num568 = (int)projectile.ai[0];
             if (!Main.npc[num568].active)
             {
                 int[] array2 = new int[200];
                 int   num569 = 0;
                 for (int num570 = 0; num570 < 200; num570++)
                 {
                     if (Main.npc[num570].CanBeChasedBy(this, true))
                     {
                         float num571 = Math.Abs(Main.npc[num570].position.X + Main.npc[num570].width / 2 - projectile.position.X + projectile.width / 2) + Math.Abs(Main.npc[num570].position.Y + Main.npc[num570].height / 2 - projectile.position.Y + projectile.height / 2);
                         if (num571 < 800f)
                         {
                             array2[num569] = num570;
                             num569++;
                         }
                     }
                 }
                 if (num569 == 0)
                 {
                     projectile.Kill();
                     return;
                 }
                 num568           = array2[Main.rand.Next(num569)];
                 projectile.ai[0] = num568;
             }
             float   num572   = 4f;
             Vector2 vector44 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
             float   num573   = Main.npc[num568].Center.X - vector44.X;
             float   num574   = Main.npc[num568].Center.Y - vector44.Y;
             float   num575   = (float)Math.Sqrt(num573 * num573 + num574 * num574);
             num575  = num572 / num575;
             num573 *= num575;
             num574 *= num575;
             int num576 = 30;
             projectile.velocity.X = (projectile.velocity.X * (num576 - 1) + num573) / num576;
             projectile.velocity.Y = (projectile.velocity.Y * (num576 - 1) + num574) / num576;
         }
         else
         {
             int     num492   = (int)projectile.ai[0];
             float   num493   = 4f;
             Vector2 vector39 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
             float   num494   = Main.player[num492].Center.X - vector39.X;
             float   num495   = Main.player[num492].Center.Y - vector39.Y;
             float   num496   = (float)Math.Sqrt(num494 * num494 + num495 * num495);
             if (num496 < 50f && projectile.position.X < Main.player[num492].position.X + Main.player[num492].width && projectile.position.X + projectile.width > Main.player[num492].position.X && projectile.position.Y <Main.player[num492].position.Y + Main.player[num492].height && projectile.position.Y + projectile.height> Main.player[num492].position.Y)
             {
                 if (projectile.owner == Main.myPlayer)
                 {
                     Player player = Main.player[num492];
                     player.GetModPlayer <InvokerPlayer>().CaligulaSoul.Add((int)projectile.ai[1]);
                     CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.DarkGray, Language.GetTextValue("Mods.AAMod.Common.CaligulaSoul"), false, false);
                 }
                 projectile.Kill();
             }
             num496  = num493 / num496;
             num494 *= num496;
             num495 *= num496;
             projectile.velocity.X = (projectile.velocity.X * 15f + num494) / 16f;
             projectile.velocity.Y = (projectile.velocity.Y * 15f + num495) / 16f;
         }
     }
     for (int num577 = 0; num577 < 5; num577++)
     {
         float num578 = projectile.velocity.X * 0.2f * num577;
         float num579 = -(projectile.velocity.Y * 0.2f) * num577;
         int   num580 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 20, Color.DarkBlue, 2f);
         Main.dust[num580].noGravity  = true;
         Main.dust[num580].velocity  *= 0f;
         Main.dust[num580].position.X = Main.dust[num580].position.X - num578;
         Main.dust[num580].position.Y = Main.dust[num580].position.Y - num579;
     }
     return;
 }
Ejemplo n.º 5
0
        public override void AI()
        {
            if (!npc.HasPlayerTarget)
            {
                npc.TargetClosest();
            }

            Player player = Main.player[npc.target];

            npc.ai[0]++;

            if (npc.ai[0] == 120 && Main.netMode != NetmodeID.MultiplayerClient)
            {
                npc.netUpdate = true;
            }
            if (npc.ai[0] == 180)
            {
                CombatText.NewText(npc.Hitbox, Color.CadetBlue, SeraphBitching(), true);
                npc.netUpdate = true;
            }
            if (npc.ai[0] >= 240 && npc.dontTakeDamage && Main.netMode != NetmodeID.MultiplayerClient)
            {
                npc.dontTakeDamage = false;
                npc.netUpdate      = true;
            }

            if (npc.ai[0] >= 120 && npc.ai[0] < 240)
            {
                npc.velocity *= .97f;
            }
            else if (npc.ai[0] >= 240)
            {
                npc.noTileCollide  = true;
                npc.noGravity      = true;
                npc.dontTakeDamage = false;
                npc.velocity.Y    -= 0.5f;
                if (npc.velocity.Y < -8f)
                {
                    npc.velocity.Y = -8f;
                }

                if (player.Center.X > npc.Center.X)
                {
                    npc.velocity.X -= 0.2f;
                    if (npc.velocity.X < -8f)
                    {
                        npc.velocity.Y = -8f;
                    }
                    npc.spriteDirection = 1;
                }
                else
                {
                    npc.velocity.X += 0.2f;
                    if (npc.velocity.X > 8f)
                    {
                        npc.velocity.Y = 8f;
                    }
                    npc.spriteDirection = -1;
                }

                Vector2 Acropolis = new Vector2(Origin.X + (80 * 16), Origin.Y + (79 * 16));

                if (Vector2.Distance(npc.Center, Acropolis) > 90 * 16 && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    for (int a = 0; a < 8; a++)
                    {
                        Dust.NewDust(npc.Center, 60, 40, ModContent.DustType <Feather>(), Main.rand.Next(-1, 2), 1, 0);
                    }
                    BaseAI.KillNPC(npc);
                    npc.netUpdate = true;
                }
            }

            if (npc.ai[0] < 120 && npc.collideY)
            {
                npc.rotation += npc.velocity.X * 0.05f;
            }
            else
            {
                npc.spriteDirection = npc.direction;
                npc.rotation        = npc.velocity.X * 0.05f;
            }
        }
Ejemplo n.º 6
0
        public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
        {
            var modPlayer = player.GetModPlayer <QwertyPlayer>();

            if (target.life <= 0 && !target.SpawnedFromStatue && stormEnchantment)
            {
                if (modPlayer.charge >= 20)
                {
                    modPlayer.charge = 20;
                    CombatText.NewText(target.getRect(), Color.Cyan, "MAX!", true, false);
                }
                else
                {
                    modPlayer.charge++;
                    CombatText.NewText(target.getRect(), Color.Cyan, modPlayer.charge, true, false);
                }
            }

            if (aggroScroll && !target.immortal && target.life <= 0 && !target.SpawnedFromStatue && proj.magic && proj.type != mod.ProjectileType("AggroRuneFreindly"))
            {
                Projectile.NewProjectile(target.Center.X, target.Center.Y, 0, 0, mod.ProjectileType("AggroRuneFreindly"), (int)(420 * player.magicDamage), 3f, Main.myPlayer);
            }
            if (leechScroll && proj.ranged && proj.type != mod.ProjectileType("LeechRuneFreindly"))
            {
                runeRate = damage;

                while (runeRate > 200)
                {
                    float theta = MathHelper.ToRadians(Main.rand.Next(0, 360));
                    Projectile.NewProjectile(target.Center.X + (float)Math.Cos(theta) * 150, target.Center.Y + (float)Math.Sin(theta) * 150, -(float)Math.Cos(theta) * 10, -(float)Math.Sin(theta) * 10, mod.ProjectileType("LeechRuneFreindly"), (int)(25 * player.rangedDamage), 3f, Main.myPlayer);
                    runeRate -= 200;
                }
                if (runeRate >= Main.rand.Next(0, 199))
                {
                    float theta = MathHelper.ToRadians(Main.rand.Next(0, 360));
                    Projectile.NewProjectile(target.Center.X + (float)Math.Cos(theta) * 150, target.Center.Y + (float)Math.Sin(theta) * 150, -(float)Math.Cos(theta) * 10, -(float)Math.Sin(theta) * 10, mod.ProjectileType("LeechRuneFreindly"), (int)(25 * player.rangedDamage), 3f, Main.myPlayer);
                }
            }

            if (Metronome && !target.immortal && target.life <= 0 && !target.SpawnedFromStatue)
            {
                killCount++;
                if (killCount >= 100)
                {
                    killCount = 100;
                    CombatText.NewText(player.getRect(), Color.Purple, "Max!", true, false);
                }
                else
                {
                    CombatText.NewText(player.getRect(), Color.Purple, killCount, false, false);
                }
            }
            if (HydraCannon && !target.immortal && target.life <= 0 && proj.ranged == true && !target.SpawnedFromStatue)
            {
                Main.PlaySound(SoundID.Roar, player.position, 0);
                if (proj.type == mod.ProjectileType("DoomBreath"))
                {
                    if (crit)
                    {
                        Projectile.NewProjectile(player.Center.X, player.Center.Y, target.Center.X - player.Center.X, target.Center.Y - player.Center.Y, mod.ProjectileType("DoomBreath"), damage / 2, knockback, player.whoAmI);
                    }
                    else
                    {
                        Projectile.NewProjectile(player.Center.X, player.Center.Y, target.Center.X - player.Center.X, target.Center.Y - player.Center.Y, mod.ProjectileType("DoomBreath"), damage, knockback, player.whoAmI);
                    }
                }
                else
                {
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, target.Center.X - player.Center.X, target.Center.Y - player.Center.Y, mod.ProjectileType("DoomBreath"), damage * 5, knockback * 3, player.whoAmI);
                }
                Main.rand.NextFloat(player.width);
            }
            if (ninjaSabatoge)
            {
                if (proj.thrown == true)
                {
                    target.AddBuff(20, 999999);
                    target.AddBuff(31, 999999);
                }
            }
            if (minionIchor)
            {
                if (proj.minion)
                {
                    target.AddBuff(69, 120);
                }
            }
            if (siphon)
            {
                if (!target.immortal && !target.SpawnedFromStatue)
                {
                    if (proj.melee == true)
                    {
                        player.statMana += (damage / 2);
                        CombatText.NewText(player.getRect(), Color.Blue, damage / 2, false, false);
                    }
                }
            }

            if (circletSetBonus)
            {
                if (!target.immortal && !target.SpawnedFromStatue)
                {
                    if (proj.melee == true)
                    {
                        player.AddBuff(mod.BuffType("RhuthiniumMagic"), 600);
                    }
                    if (proj.magic == true)
                    {
                        player.AddBuff(mod.BuffType("RhuthiniumMight"), 600);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public override void AI()
        {
            string SoulReturned = Language.GetTextValue("Mods.Antiaris.SoulReturned");
            Player owner        = null;

            if (projectile.owner != -1)
            {
                owner = Main.player[projectile.owner];
            }
            else if (projectile.owner == 255)
            {
                owner = Main.LocalPlayer;
            }
            Player player = owner;

            projectile.frameCounter++;
            if (projectile.frameCounter > 4)
            {
                projectile.frame++;
                projectile.frameCounter = 0;
            }
            if (projectile.frame >= 3)
            {
                projectile.frame = 0;
            }

            var ProjRectangle   = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, 28, 30);
            var NPCRectangle    = new Rectangle();
            var PlayerRectangle = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height);

            foreach (NPC npc in Main.npc)
            {
                if (npc.type == ModContent.NPCType <DeadlyJones>())
                {
                    NPCRectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, 40, 58);
                }
                if (ProjRectangle.Intersects(NPCRectangle))
                {
                    if (!intersects)
                    {
                        intersects = true;
                        projectile.Kill();
                        int heal = player.statLife / 2;
                        CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.LightGreen, heal, false, false);
                        CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Red, heal, false, false);
                        player.statLife -= heal;
                        if (npc.life < npc.lifeMax)
                        {
                            npc.life += heal;
                        }
                    }
                }
                if (ProjRectangle.Intersects(PlayerRectangle))
                {
                    returnTimer++;
                    if (returnTimer == 6000)
                    {
                        projectile.Kill();
                        CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Cyan, SoulReturned, false, false);
                    }
                }
            }
        }
        public override void AI()
        {
            // Delete the projectile if the player dies, only important because the projectile is tied to player data
            if (Main.player[projectile.owner].dead)
            {
                projectile.Kill();
            }
            else
            {
                Main.player[projectile.owner].itemAnimation = 5;
                Main.player[projectile.owner].itemTime      = 5;
                // Only happens the first time this code executes
                if (initial == true)
                {
                    // Look at where the mouse is and change the player's direction to face it
                    // This is unnecisarry for custom weapons because there is already code to do that, but I'm spawning this boi manually
                    if (Main.mouseX - Main.screenWidth / 2 < 0)
                    {
                        Main.player[projectile.owner].ChangeDir(-1);
                    }
                    else
                    {
                        Main.player[projectile.owner].ChangeDir(1);
                    }
                    initial = false;

                    // Make a 'fwip' above the player
                    Rectangle lowPlayer = new Rectangle(Main.player[projectile.owner].getRect().X, Main.player[projectile.owner].getRect().Y + 40, Main.player[projectile.owner].getRect().Width, Main.player[projectile.owner].getRect().Height);
                    CombatText.NewText(lowPlayer, Color.White, "Fwip");

                    // Play the fwip sound
                    Main.PlaySound(SoundLoader.customSoundType, (int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/GumGumShoot"));
                }

                // determines projectile behavior by it's distance from the player, all that data is grabbed here
                Vector2 location  = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
                float   distanceX = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - location.X - 8;
                float   distanceY = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - location.Y;
                float   magnitude = (float)Math.Sqrt(distanceX * (double)distanceX + distanceY * (double)distanceY);

                // ai[0] == 0 is the first mode, fist extends until it either hits something or gets too far from player, then changes mode
                if (projectile.ai[0] == 0.0)
                {
                    // fist gets too far, so it changes mode, saves the flag that it didn't hit anything, and plays the retract sound
                    if (magnitude > 500.0)
                    {
                        projectile.ai[0] = 1f;
                        Main.PlaySound(SoundLoader.customSoundType, (int)projectile.position.X, (int)projectile.position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/GumGumRetract"));
                        hit = false;
                    }

                    // Uses fist's velocity to determine how it's rotated, calculated in radians
                    projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f;
                    if (projectile.velocity.X < 0.0)
                    {
                        projectile.spriteDirection = -1;
                    }
                    else
                    {
                        projectile.spriteDirection = 1;
                    }
                    return;
                }
                else // ai[0] == 1 is the second mode, where it comes back to the player and despawns
                {
                    // goes through all the walls
                    projectile.tileCollide = false;
                    // Make knuckles face away from player
                    projectile.rotation = (float)Math.Atan2(distanceY, distanceX) - 1.57f;
                    // get closer to player by ~20px per frame
                    float retractSpeed = 20f;
                    if (magnitude < 50.0) // Kill the projectile if it's too close
                    {
                        projectile.Kill();
                        // Play the snap sound if the retract sound was played. (Only when it doesn't hit anything do these sound fx sound good)
                        if (hit)
                        {
                            Main.PlaySound(SoundLoader.customSoundType, (int)projectile.position.X, (int)projectile.position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/GumGumSnap"));
                        }
                        DevilFruitMod.hands--;
                    }
                    float num5 = retractSpeed / magnitude;
                    float num6 = distanceX * num5;
                    float num7 = distanceY * num5;
                    projectile.velocity.X = num6;
                    projectile.velocity.Y = num7;
                    return;
                }
            }
        }
Ejemplo n.º 9
0
 public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
 {
     /*
      * if (target.HasBuff(mod.BuffType("LuneCurse")) && crit)
      * {
      *  damage = (int)(damage * 1.5f);
      * }
      */
     if (Metronome && !target.immortal && target.life <= 0 && !target.SpawnedFromStatue)
     {
         killCount++;
         if (killCount >= 100)
         {
             killCount = 100;
             CombatText.NewText(player.getRect(), Color.Purple, "Max!", true, false);
         }
         else
         {
             CombatText.NewText(player.getRect(), Color.Purple, killCount, false, false);
         }
     }
     if (meleeSiphon)
     {
         if (!target.immortal && !target.SpawnedFromStatue)
         {
             if (item.melee == true)
             {
                 player.statMana += (damage);
                 CombatText.NewText(player.getRect(), Color.Blue, damage / 2, false, false);
             }
         }
     }
     if (siphon2)
     {
         if (!target.immortal && !target.SpawnedFromStatue)
         {
             if (item.melee == true)
             {
                 player.statMana += (damage / 3);
                 CombatText.NewText(player.getRect(), Color.Blue, damage / 3, false, false);
             }
         }
     }
     if (meleeCircletSetBonus)
     {
         if (!target.immortal && !target.SpawnedFromStatue)
         {
             if (item.melee == true)
             {
                 player.AddBuff(mod.BuffType("RhuthiniumMagic"), 600);
             }
             if (item.magic == true)
             {
                 player.AddBuff(mod.BuffType("RhuthiniumMight"), 600);
             }
         }
     }
     if (visorSetBonus)
     {
         if (!target.immortal && !target.SpawnedFromStatue)
         {
             if (item.melee == true)
             {
                 player.AddBuff(mod.BuffType("VarguleMagic"), 600);
             }
             if (item.magic == true)
             {
                 player.AddBuff(mod.BuffType("VargulMight"), 600);
             }
         }
     }
     if (VarguleCrownSetBonus)
     {
         if (item.melee == true)
         {
             if (!target.immortal && !target.SpawnedFromStatue)
             {
                 VarguleRangedBoost += .02f;
             }
         }
     }
 }
Ejemplo n.º 10
0
        public void CheckRecords(NPC npc, Player player, PlayerAssist modplayer)
        {
            int recordIndex   = SpecialBossCheck(npc);
            int recordAttempt = modplayer.RecordTimers[recordIndex]; // Trying to set a new record
            int currentRecord = modplayer.AllBossRecords[recordIndex].stat.fightTime;
            int worstRecord   = modplayer.AllBossRecords[recordIndex].stat.fightTime2;

            modplayer.AllBossRecords[recordIndex].stat.fightTimeL = recordAttempt;

            int brinkAttempt = modplayer.BrinkChecker[recordIndex];             // Trying to set a new record
            int MaxLife      = modplayer.MaxHealth[recordIndex];
            int currentBrink = modplayer.AllBossRecords[recordIndex].stat.brink2;
            int worstBrink   = modplayer.AllBossRecords[recordIndex].stat.brink;

            modplayer.AllBossRecords[recordIndex].stat.brinkL = brinkAttempt;
            double lastHealth = (double)brinkAttempt / (double)MaxLife;

            modplayer.AllBossRecords[recordIndex].stat.brinkPercentL = (int)(lastHealth * 100);

            int dodgeTimeAttempt = modplayer.DodgeTimer[recordIndex];
            int currentDodgeTime = modplayer.AllBossRecords[recordIndex].stat.dodgeTime;
            int dodgeAttempt     = modplayer.AttackCounter[recordIndex];
            int currentDodges    = modplayer.AllBossRecords[recordIndex].stat.totalDodges;
            int worstDodges      = modplayer.AllBossRecords[recordIndex].stat.totalDodges2;

            modplayer.AllBossRecords[recordIndex].stat.dodgeTimeL   = dodgeTimeAttempt;
            modplayer.AllBossRecords[recordIndex].stat.totalDodgesL = dodgeAttempt;

            // Increase kill count
            modplayer.AllBossRecords[recordIndex].stat.kills++;

            if (recordAttempt < currentRecord && currentRecord != 0 && worstRecord <= 0)
            {
                // First make the current record the worst record if no worst record has been made and a new record was made
                modplayer.AllBossRecords[recordIndex].stat.fightTime2 = currentRecord;
            }
            if (recordAttempt < currentRecord || currentRecord <= 0)
            {
                //The player has beaten their best record, so we have to overwrite the old record with the new one
                modplayer.AllBossRecords[recordIndex].stat.fightTime = recordAttempt;
            }
            else if (recordAttempt > worstRecord || worstRecord <= 0)
            {
                //The player has beaten their worst record, so we have to overwrite the old record with the new one
                modplayer.AllBossRecords[recordIndex].stat.fightTime2 = recordAttempt;
            }

            if (brinkAttempt > currentBrink && currentBrink != 0 && worstBrink <= 0)
            {
                modplayer.AllBossRecords[recordIndex].stat.brink = currentBrink;
            }
            if (brinkAttempt > currentBrink || currentBrink <= 0)
            {
                modplayer.AllBossRecords[recordIndex].stat.brink2 = brinkAttempt;
                double newHealth = (double)brinkAttempt / (double)MaxLife;                 // Casts may be redundant, but this setup doesn't work without them.
                modplayer.AllBossRecords[recordIndex].stat.brinkPercent2 = (int)(newHealth * 100);
            }
            else if (brinkAttempt < worstBrink || worstBrink <= 0)
            {
                modplayer.AllBossRecords[recordIndex].stat.brink = brinkAttempt;
                double newHealth = (double)brinkAttempt / (double)MaxLife;                 // Casts may be redundant, but this setup doesn't work without them.
                modplayer.AllBossRecords[recordIndex].stat.brinkPercent = (int)(newHealth * 100);
            }

            if (dodgeTimeAttempt > currentDodgeTime || currentDodgeTime < 0)
            {
                // There is no "worse record" for this one so just overwrite any better records made
                modplayer.AllBossRecords[recordIndex].stat.dodgeTime = dodgeTimeAttempt;
            }

            if (dodgeAttempt < currentDodges || currentDodges < 0)
            {
                modplayer.AllBossRecords[recordIndex].stat.totalDodges = dodgeAttempt;
                if (worstDodges == 0)
                {
                    modplayer.AllBossRecords[recordIndex].stat.totalDodges2 = currentDodges;
                }
            }
            else if (dodgeAttempt > worstDodges || worstDodges < 0)
            {
                modplayer.AllBossRecords[recordIndex].stat.totalDodges2 = dodgeAttempt;
            }

            modplayer.DodgeTimer[recordIndex]    = 0;
            modplayer.AttackCounter[recordIndex] = 0;

            // If a new record was made, notify the player
            if ((recordAttempt < currentRecord || currentRecord <= 0) || (brinkAttempt > currentBrink || currentBrink <= 0) || (dodgeAttempt < currentDodges || dodgeAttempt <= 0))
            {
                CombatText.NewText(player.getRect(), Color.LightYellow, "New Record!", true);
            }
        }
Ejemplo n.º 11
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1)             //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140)
            {
                BattleMode.UI.splashText.SetText("");

                int adder;

                if (mon.projectile.spriteDirection == -1)
                {
                    adder = 10;
                }
                else
                {
                    adder = -10;
                }

                xposStart  = (int)mon.projectile.position.X;
                xposTarget = (int)mon.projectile.position.X + adder;

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
            }
            else if (AnimationFrame == 155)
            {
                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 175)
            {
                for (float k = 0; k < 2 * Math.PI; k += 0.4f)
                {
                    var d = Dust.NewDustPerfect(target.projectile.Center, 87, Vector2.One.RotatedBy(k) * 2f);
                    d.noGravity = true;
                }
            }
            else if (AnimationFrame == 205)
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                BattleMode.queueEndMove = true;
            }
            else if (AnimationFrame > 140 && AnimationFrame < 147)
            {
                mon.projectile.position.X = Interpolation.ValueAt(AnimationFrame, xposStart, xposTarget, 140, 146,
                                                                  Easing.None);
            }
            else if (AnimationFrame > 146 && AnimationFrame < 155)
            {
                mon.projectile.position.X = Interpolation.ValueAt(AnimationFrame, xposTarget, xposStart, 146, 154,
                                                                  Easing.None);
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                xposStart          = 0;
                xposTarget         = 0;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
        public override void AI()
        {
            if (Main.player[projectile.owner].dead)
            {
                projectile.Kill();
            }
            else
            {
                Main.player[projectile.owner].itemAnimation = 5;
                Main.player[projectile.owner].itemTime      = 5;
                if (this.initial == true)
                {
                    if (Main.mouseX - Main.screenWidth / 2 < 0)
                    {
                        Main.player[projectile.owner].ChangeDir(-1);
                    }
                    else
                    {
                        Main.player[projectile.owner].ChangeDir(1);
                    }
                    initial = false;

                    Rectangle lowPlayer = new Rectangle(Main.player[projectile.owner].getRect().X, Main.player[projectile.owner].getRect().Y + 40, Main.player[projectile.owner].getRect().Width, Main.player[projectile.owner].getRect().Height);
                    CombatText.NewText(lowPlayer, Color.White, "Fwip");

                    Main.PlaySound(SoundLoader.customSoundType, (int)Main.player[projectile.owner].position.X, (int)Main.player[projectile.owner].position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/GumGumShoot"));
                }
                Vector2 location  = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
                float   distanceX = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - location.X - 8;
                float   distanceY = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - location.Y;
                float   magnitude = (float)Math.Sqrt(distanceX * (double)distanceX + distanceY * (double)distanceY);
                if (projectile.ai[0] == 0.0)
                {
                    if (magnitude > 500.0)
                    {
                        projectile.ai[0] = 1f;
                        Main.PlaySound(SoundLoader.customSoundType, (int)projectile.position.X, (int)projectile.position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/GumGumRetract"));
                        hit = false;
                    }
                    projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f;
                    if (projectile.velocity.X < 0.0)
                    {
                        projectile.spriteDirection = -1;
                    }
                    else
                    {
                        projectile.spriteDirection = 1;
                    }
                    return;
                }
                else
                {
                    projectile.tileCollide = false;
                    projectile.rotation    = (float)Math.Atan2(distanceY, distanceX) - 1.57f;
                    float retractSpeed = 20f;
                    if (magnitude < 50.0)
                    {
                        projectile.Kill();
                        if (hit)
                        {
                            Main.PlaySound(SoundLoader.customSoundType, (int)projectile.position.X, (int)projectile.position.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/GumGumSnap"));
                        }
                    }
                    float num5 = retractSpeed / magnitude;
                    float num6 = distanceX * num5;
                    float num7 = distanceY * num5;
                    projectile.velocity.X = num6;
                    projectile.velocity.Y = num7;
                    return;
                }
            }
        }
Ejemplo n.º 13
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            if (!Fargowiltas.Instance.ThoriumLoaded)
            {
                return;
            }

            ThoriumPlayer thoriumPlayer = player.GetModPlayer <ThoriumPlayer>(thorium);

            if (Soulcheck.GetValue("Cyber Punk States"))
            {
                //cyber set bonus, good lord
                thoriumPlayer.cyberHeadAllowed = false;
                thoriumPlayer.cyberBodyAllowed = false;
                thoriumPlayer.cyberLegsAllowed = false;
                thoriumPlayer.cyberBard        = true;
                for (int i = 0; i < 255; i++)
                {
                    Player player2 = Main.player[i];
                    if (player2.active && Vector2.Distance(player2.Center, player.Center) < 400f)
                    {
                        if (thoriumPlayer.cyberBardValue == 0)
                        {
                            if (thoriumPlayer.empowerDamage < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(255, 0, 0), "+8% damage", false, false);
                                thoriumPlayer.empowerDamage = 2;
                            }
                            if (thoriumPlayer.empowerCriticalStrike < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(255, 215, 75), "+8% critical strike chance", false, false);
                                thoriumPlayer.empowerCriticalStrike = 2;
                            }
                            if (thoriumPlayer.empowerDamage == 2)
                            {
                                thoriumPlayer.empowerTimerDamage = 60;
                            }
                            if (thoriumPlayer.empowerCriticalStrike == 2)
                            {
                                thoriumPlayer.empowerTimerCriticalStrike = 60;
                            }
                        }
                        if (thoriumPlayer.cyberBardValue == 1)
                        {
                            if (thoriumPlayer.empowerAttackSpeed < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(225, 150, 50), "+8% attack speed", false, false);
                                thoriumPlayer.empowerAttackSpeed = 2;
                            }
                            if (thoriumPlayer.empowerMovementSpeed < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(102, 255, 0), "+15% movement speed", false, false);
                                thoriumPlayer.empowerMovementSpeed = 2;
                            }
                            if (thoriumPlayer.empowerAttackSpeed == 2)
                            {
                                thoriumPlayer.empowerTimerAttackSpeed = 60;
                            }
                            if (thoriumPlayer.empowerMovementSpeed == 2)
                            {
                                thoriumPlayer.empowerTimerMovementSpeed = 60;
                            }
                        }
                        if (thoriumPlayer.cyberBardValue == 2)
                        {
                            if (thoriumPlayer.empowerLifeRegen < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(255, 100, 175), "+2 life/sec", false, false);
                                thoriumPlayer.empowerLifeRegen = 2;
                            }
                            if (thoriumPlayer.empowerManaRegen < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(102, 102, 255), "+4 mana/sec", false, false);
                                thoriumPlayer.empowerManaRegen = 2;
                            }
                            if (thoriumPlayer.empowerLifeRegen == 2)
                            {
                                thoriumPlayer.empowerTimerLifeRegen = 60;
                            }
                            if (thoriumPlayer.empowerManaRegen == 2)
                            {
                                thoriumPlayer.empowerTimerManaRegen = 60;
                            }
                        }
                        if (thoriumPlayer.cyberBardValue == 3)
                        {
                            if (thoriumPlayer.empowerDamageReduction < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(100, 175, 255), "+8% damage reduction", false, false);
                                thoriumPlayer.empowerDamageReduction = 2;
                            }
                            if (thoriumPlayer.empowerDefense < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(160, 160, 160), "+8 defense", false, false);
                                thoriumPlayer.empowerDefense = 2;
                            }
                            if (thoriumPlayer.empowerDamageReduction == 2)
                            {
                                thoriumPlayer.empowerTimerDamageReduction = 60;
                            }
                            if (thoriumPlayer.empowerDefense == 2)
                            {
                                thoriumPlayer.empowerTimerDefense = 60;
                            }
                        }
                    }
                }
            }

            //auto tuner
            thoriumPlayer.autoTunerBool = true;
            //music player
            thoriumPlayer.musicPlayer = true;
            thoriumPlayer.MP3Damage   = 2;
        }
Ejemplo n.º 14
0
        public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
        {
            if (!SetBonusActive)
            {
                return;
            }

            if (!proj.magic)
            {
                return;
            }

            int odds = Math.Max(1, 15 - rngProtector);

            if ((crit || target.life <= 0) && storedGem != StoredGem.All)
            {
                rngProtector++;
                if (Main.rand.NextBool(odds))
                {
                    rngProtector = 0;
                    SpawnGem(target, player.GetModPlayer <GeomancerPlayer>());
                }
            }


            int critRate = Math.Min(player.HeldItem.crit, 4);

            critRate += player.magicCrit;

            if (Main.rand.Next(100) <= critRate && (storedGem == StoredGem.Sapphire || storedGem == StoredGem.All))
            {
                int numStars = Main.rand.Next(3) + 1;
                for (int i = 0; i < numStars; i++) //Doing a loop so they spawn separately
                {
                    Item.NewItem(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), ModContent.ItemType <SapphireStar>());
                }
            }

            if ((storedGem == StoredGem.Diamond || storedGem == StoredGem.All) && crit)
            {
                int extraDamage = target.defense / 2;
                extraDamage += (int)(proj.damage * 0.2f * (target.life / (float)target.lifeMax));
                CombatText.NewText(target.Hitbox, new Color(200, 200, 255), extraDamage);
                if (target.type != NPCID.TargetDummy)
                {
                    target.life -= extraDamage;
                }
                target.HitEffect(0, extraDamage);
            }

            if (Main.rand.Next(100) <= critRate && (storedGem == StoredGem.Emerald || storedGem == StoredGem.All))
            {
                Item.NewItem(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), ModContent.ItemType <EmeraldHeart>());
            }

            if ((storedGem == StoredGem.Ruby || storedGem == StoredGem.All) && Main.rand.NextFloat() > 0.3f && proj.type != ModContent.ProjectileType <RubyDagger>())
            {
                Projectile.NewProjectile(player.Center, Main.rand.NextVector2Circular(7, 7), ModContent.ProjectileType <RubyDagger>(), (int)(proj.damage * 0.3f) + 1, knockback, player.whoAmI, target.whoAmI);
            }

            if (storedGem == StoredGem.Amethyst || storedGem == StoredGem.All && target.GetGlobalNPC <GeoNPC>().amethystDebuff < 400)
            {
                if (Main.rand.Next(Math.Max(((10 / player.HeldItem.useTime) * (int)Math.Pow(target.GetGlobalNPC <GeoNPC>().amethystDebuff, 0.3f)) / 2, 1)) == 0)
                {
                    Projectile.NewProjectile(
                        target.position + new Vector2(Main.rand.Next(target.width), Main.rand.Next(target.height)),
                        Vector2.Zero,
                        ModContent.ProjectileType <AmethystShard>(),
                        0,
                        0,
                        player.whoAmI,
                        target.GetGlobalNPC <GeoNPC>().amethystDebuff,
                        target.whoAmI);
                    target.GetGlobalNPC <GeoNPC>().amethystDebuff += 100;
                }
            }
        }
Ejemplo n.º 15
0
        public override void PreUpdate()
        {
            ArmorFrameCounter++;
            if (Main.myPlayer == player.whoAmI)
            {
                //QwertyMethods.ServerClientCheck(Main.myPlayer);
                QwertysRandomContent.LocalCursor[Main.myPlayer] = Main.MouseWorld;

                if (Main.netMode == 1)
                {
                    ModPacket packet = mod.GetPacket();
                    packet.Write((byte)ModMessageType.UpdateLocalCursor); // Message type, you would need to create an enum for this
                    packet.Write((byte)Main.myPlayer);
                    packet.WriteVector2(QwertysRandomContent.LocalCursor[Main.myPlayer]);
                    packet.Send();
                }
            }
            mythrilPrismRotation += (float)Math.PI / 90f;
            if (grappleBoost)
            {
                //Main.NewText("double??");
            }
            //WorldGen.PlaceTile((int)player.Center.X/16, (int)player.Center.Y/16 - 4, TileID.Dirt);
            if (hyperRune)
            {
                if (hyperRuneTimer == 120)
                {
                    signalRune          = Main.projectile[Projectile.NewProjectile(player.Center.X, player.Center.Y, 0, 0, mod.ProjectileType("SignalRune"), 0, 0, player.whoAmI)];
                    signalRune.timeLeft = 2;
                    //CombatText.NewText(player.getRect(), new Color(39, 219, 219), "Recharged!", true, false);
                }
                if (hyperRuneTimer > 120)
                {
                    signalRune.timeLeft = 2;
                }
            }


            if (gemRegen)
            {
                regenTimer++;
                if (regenTimer == 300)
                {
                    for (int i = 0; i < 200; i++)
                    {
                        float theta = Main.rand.NextFloat(-(float)Math.PI, (float)Math.PI);

                        Dust dust = Dust.NewDustPerfect(player.Center + QwertyMethods.PolarVector(200, theta), mod.DustType("AncientGlow"), QwertyMethods.PolarVector(-200 / 10, theta));
                        dust.noGravity = true;
                    }
                    //CombatText.NewText(player.getRect(), Color.Green, "Reconstructed", true, false);
                    player.statLife += 999;
                }
            }

            if (usingVulcan)
            {
                player.accRunSpeed   = 0f;
                player.moveSpeed     = 0f;
                player.rangedDamage += 10;
            }

            if (Main.mouseRight)
            {
                while (RhuthiniumCharge > 0)
                {
                    float angle = (Main.MouseWorld - player.Center).ToRotation() + MathHelper.ToRadians(Main.rand.Next(-100, 101) * .05f);


                    Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)Math.Cos(angle) * 12f, (float)Math.Sin(angle) * 12f, mod.ProjectileType("RhuthiniumCharge"), 20, 2f, player.whoAmI);
                    RhuthiniumCharge--;
                }
            }


            if (iceScroll)
            {
                if (iceScrollCounter >= (int)(2 * Math.PI * 10))
                {
                    float startDistance = 100;
                    Projectile.NewProjectile(player.Center.X + (float)Math.Cos(0) * startDistance, player.Center.Y + (float)Math.Sin(0) * startDistance, 0, 0, mod.ProjectileType("IceRuneFreindly"), (int)(300 * player.meleeDamage), 3f, Main.myPlayer);
                    Projectile.NewProjectile(player.Center.X + (float)Math.Cos(Math.PI) * startDistance, player.Center.Y + (float)Math.Sin(Math.PI) * startDistance, 0, 0, mod.ProjectileType("IceRuneFreindly"), (int)(300 * player.meleeDamage), 3f, Main.myPlayer);
                    iceScrollCounter = 0;
                }
                iceScrollCounter++;
            }

            if (heldItemOld != player.inventory[player.selectedItem])
            {
                if (Metronome && killCount != 0)
                {
                    CombatText.NewText(player.getRect(), Color.DarkRed, "Reset!", true, false);
                }
                killCount = 0;
            }
            heldItemOld = player.inventory[player.selectedItem];
        }
Ejemplo n.º 16
0
        public override void ProcessTriggers(TriggersSet triggersSet)
        {
            UpdateSynchronizedControls(triggersSet);

            SyncTriggerSet();

            if (flyToggle.JustPressed)
            {
                if (flightUnlocked)
                {
                    isFlying = !isFlying;
                    if (!isFlying)
                    {
                        FlightSystem.AddKatchinFeetBuff(player);
                    }
                }
            }

            _mProgressionSystem.Update(player);

            // dropping the fist wireup here. Fingers crossed.
            if (player.HeldItem.Name.Equals("Fist"))
            {
                _mFistSystem.Update(triggersSet, player, mod);
            }

            if (armorBonus.JustPressed)
            {
                if (demonBonus && !player.HasBuff(mod.BuffType("ArmorCooldown")))
                {
                    player.AddBuff(mod.BuffType("DemonBonus"), 300);
                    demonBonusActive = true;
                    for (int i = 0; i < 3; i++)
                    {
                        Dust tDust = Dust.NewDustDirect(player.position - (Vector2.UnitY * 0.7f) - (Vector2.UnitX * 1.0f), 50, 50, 15, 0f, 0f, 5, default(Color), 2.0f);
                    }
                }
            }

            // handle ki charging
            if (ConfigModel.isChargeToggled)
            {
                if (energyCharge.JustPressed)
                {
                    isCharging = !isCharging;
                }
            }
            else
            {
                if (energyCharge.Current && !isCharging)
                {
                    isCharging = true;
                }
                if (!energyCharge.Current && isCharging)
                {
                    isCharging = false;
                }
            }

            TransformationDefinition transformation = GetCurrentTransformation();

            // most of the forms have a default light value, but charging isn't a buff. Let there be light
            if (isCharging && transformation == null)
            {
                Lighting.AddLight(player.Center, 1.2f, 1.2f, 1.2f);
            }

            // calls to handle transformation or kaioken powerups per frame

            HandleTransformations();

            HandleKaioken();

            if (speedToggle.JustPressed)
            {
                float oldSpeedMult = bonusSpeedMultiplier;
                bonusSpeedMultiplier = GetNextSpeedMultiplier();
                CombatText.NewText(player.Hitbox, new Color(255, 255, 255), string.Format("Speed bonus {0}!", (bonusSpeedMultiplier == 0f) ? "off" : ((int)Math.Ceiling(bonusSpeedMultiplier * 100f)) + "%"), false, false);
            }

            if (transMenu.JustPressed)
            {
                TransformationMenu.menuVisible = !TransformationMenu.menuVisible;
            }

            /*if (ProgressionMenuKey.JustPressed)
             * {
             *  ProgressionMenu.ToggleVisibility();
             * }*/

            // power down handling
            if (IsCompletelyPoweringDown() && IsPlayerTransformed())
            {
                var playerWasSuperKaioken = IsTransformedInto(TransformationDefinitionManager.SuperKaiokenDefinition);
                EndTransformations();

                // TODO Make this dynamic.
                if (playerWasSuperKaioken)
                {
                    DoTransform(TransformationDefinitionManager.SSJ1Definition);
                }

                kaiokenLevel = 0;
                SoundHelper.PlayCustomSound("Sounds/PowerDown", player, .3f);
            }


            if (wishActive)
            {
                WishMenu.menuVisible = true;
            }

            if (quickKi.JustPressed)
            {
                player.FindAndConsumeKiPotion();
            }

            // freeform instant transmission requires book 2.
            if (isInstantTransmission2Unlocked)
            {
                HandleInstantTransmissionFreeform();
            }
        }
Ejemplo n.º 17
0
        public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            if (blessedMedalion && damage > player.statLife && Main.rand.Next(100) < 30)
            {
                player.NinjaDodge();
                return(false);
            }
            int dodgeRng = Main.rand.Next(100);

            //Main.NewText(dodgeChance);
            if (dodgeRng < dodgeChance && dodgeRng < 80)
            {
                player.immune     = true;
                player.immuneTime = 80;
                if (player.longInvince)
                {
                    player.immuneTime += 40;
                }
                if (dodgeDamageBoost)
                {
                    damageBoostFromDodge = true;
                }
                if (dodgeImmuneBoost)
                {
                    player.immuneTime += 60;
                }
                for (int i = 0; i < player.hurtCooldowns.Length; i++)
                {
                    player.hurtCooldowns[i] = player.immuneTime;
                }
                for (int j = 0; j < 100; j++)
                {
                    int  num          = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 31, 0f, 0f, 100, default(Color), 2f);
                    Dust expr_A4_cp_0 = Main.dust[num];
                    expr_A4_cp_0.position.X = expr_A4_cp_0.position.X + (float)Main.rand.Next(-20, 21);
                    Dust expr_CB_cp_0 = Main.dust[num];
                    expr_CB_cp_0.position.Y  = expr_CB_cp_0.position.Y + (float)Main.rand.Next(-20, 21);
                    Main.dust[num].velocity *= 0.4f;
                    Main.dust[num].scale    *= 1f + (float)Main.rand.Next(40) * 0.01f;
                    Main.dust[num].shader    = GameShaders.Armor.GetSecondaryShader(player.cWaist, player);
                    if (Main.rand.Next(2) == 0)
                    {
                        Main.dust[num].scale    *= 1f + (float)Main.rand.Next(40) * 0.01f;
                        Main.dust[num].noGravity = true;
                    }
                }
                int num2 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num2].scale      = 1.5f;
                Main.gore[num2].velocity.X = (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity.Y = (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity  *= 0.4f;
                num2 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num2].scale      = 1.5f;
                Main.gore[num2].velocity.X = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity.Y = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity  *= 0.4f;
                num2 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num2].scale      = 1.5f;
                Main.gore[num2].velocity.X = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity.Y = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity  *= 0.4f;
                num2 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num2].scale      = 1.5f;
                Main.gore[num2].velocity.X = 1.5f + (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity.Y = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity  *= 0.4f;
                num2 = Gore.NewGore(new Vector2(player.position.X + (float)(player.width / 2) - 24f, player.position.Y + (float)(player.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num2].scale      = 1.5f;
                Main.gore[num2].velocity.X = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity.Y = -1.5f - (float)Main.rand.Next(-50, 51) * 0.01f;
                Main.gore[num2].velocity  *= 0.4f;
                if (player.whoAmI == Main.myPlayer)
                {
                    NetMessage.SendData(62, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0);
                }
                return(false);
            }


            if (damageSource.SourceProjectileType == mod.ProjectileType("SnowFlake"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by climate change!"); // change death message
            }
            if (damageSource.SourceProjectileType == mod.ProjectileType("DinoBomb") || damageSource.SourceProjectileType == mod.ProjectileType("DinoBombExplosion"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by dino bomb"); // change death message
            }
            if (damageSource.SourceProjectileType == mod.ProjectileType("TankCannonBall") || damageSource.SourceProjectileType == mod.ProjectileType("TankCannonBallExplosion"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by triceratank's cannon"); // change death message
            }
            if (damageSource.SourceProjectileType == mod.ProjectileType("MeteorFall"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by meteor!"); // change death message
            }
            if (damageSource.SourceProjectileType == mod.ProjectileType("MeteorLaunch"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by meteor!"); // change death message
            }
            if (damageSource.SourceNPCIndex >= 0 && Main.npc[damageSource.SourceNPCIndex].type == mod.NPCType("TheGreatTyrannosaurus"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by The Great Tyrannosaurus!");
            }
            if (damageSource.SourceNPCIndex >= 0 && Main.npc[damageSource.SourceNPCIndex].type == mod.NPCType("Triceratank"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by Triceratank");
            }
            if (damageSource.SourceNPCIndex >= 0 && Main.npc[damageSource.SourceNPCIndex].type == mod.NPCType("Utah"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by Utah");
            }
            if (damageSource.SourceNPCIndex >= 0 && Main.npc[damageSource.SourceNPCIndex].type == mod.NPCType("Velocichopper"))
            {
                damageSource = PlayerDeathReason.ByCustomReason(player.name + " was driven to extintion by Velocichopper");
            }

            if (Metronome && killCount != 0)
            {
                CombatText.NewText(player.getRect(), Color.DarkRed, "Reset!", true, false);
            }
            if (gemRegen)
            {
                regenTimer = 0;
            }
            killCount = 0;
            return(true);
        }
Ejemplo n.º 18
0
 // Token: 0x06001309 RID: 4873 RVA: 0x0041A248 File Offset: 0x00418448
 private void PerFrameSettings(FrameEventData evt)
 {
     CombatText.clearAll();
 }
Ejemplo n.º 19
0
        public override void AI()
        {
            int ai1 = (int)projectile.ai[1];

            if (projectile.ai[1] >= 0f && projectile.ai[1] < 200f &&
                Main.npc[ai1].active && Main.npc[ai1].type == NPCID.DukeFishron)
            {
                projectile.Center = Main.npc[ai1].Center;
            }
            else
            {
                projectile.Kill();
                return;
            }

            NPC fishron = Main.npc[ai1];

            if (projectile.localAI[0] == 0f)
            {
                projectile.localAI[0] = 1f;
                if (EModeGlobalNPC.fishBossEX != fishron.whoAmI)
                {
                    fishron.GetGlobalNPC <EModeGlobalNPC>().masoBool[3] = true;
                    fishron.GivenName   = "Duke Fishron EX";
                    fishron.defDamage   = (int)(fishron.defDamage * 1.5);
                    fishron.defDefense *= 2;
                    fishron.buffImmune[mod.BuffType("FlamesoftheUniverse")] = true;
                    fishron.buffImmune[mod.BuffType("LightningRod")]        = true;
                }
                projectile.netUpdate = true;
            }

            if (projectile.localAI[1] == 0f)
            {
                projectile.alpha -= 17;
                if (fishron.ai[0] % 5 == 1f)
                {
                    projectile.localAI[1] = 1f;
                }
            }
            else
            {
                projectile.alpha += 9;
            }

            if (projectile.alpha < 0)
            {
                projectile.alpha = 0;
            }
            if (projectile.alpha > 255)
            {
                if (fishron.ai[0] < 4f && Main.netMode == NetmodeID.Server) //ensure synchronized max life(?)
                {
                    var netMessage = mod.GetPacket();
                    netMessage.Write((byte)78);
                    netMessage.Write(ai1);
                    netMessage.Write((int)projectile.ai[0] * 25);
                    netMessage.Send();
                }
                projectile.Kill();
                return;
            }
            projectile.scale     = 1f - projectile.alpha / 255f;
            projectile.rotation += (float)Math.PI / 70f;

            if (projectile.alpha == 0)
            {
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    float num   = Main.rand.Next(2, 4);
                    float scale = projectile.scale * 0.6f;
                    if (index1 == 1)
                    {
                        scale *= 0.42f;
                        num   *= -0.75f;
                    }
                    Vector2 vector21 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
                    vector21.Normalize();
                    int index21 = Dust.NewDust(projectile.Center, 0, 0, 135, 0f, 0f, 100, new Color(), 2f);
                    Main.dust[index21].noGravity = true;
                    Main.dust[index21].noLight   = true;
                    Main.dust[index21].position += vector21 * 204f * scale;
                    Main.dust[index21].velocity  = vector21 * -num;
                    if (Main.rand.Next(8) == 0)
                    {
                        Main.dust[index21].velocity *= 2f;
                        Main.dust[index21].scale    += 0.5f;
                    }
                }
            }

            //while fishron is first spawning, has made the noise, and every 6 ticks
            if (fishron.ai[0] < 4f && projectile.timeLeft <= 240 && projectile.timeLeft > 180 && projectile.timeLeft % 6 == 0)
            {
                int heal = /*9*/ 49 * (int)(projectile.ai[0] * Main.rand.NextFloat(0.1f, 0.12f));
                fishron.lifeMax += heal;
                int max = (int)projectile.ai[0] * 10;
                if (fishron.lifeMax > max)
                {
                    fishron.lifeMax = max;
                }
                fishron.life = fishron.lifeMax;
                CombatText.NewText(fishron.Hitbox, CombatText.HealLife, heal);
                fishron.netUpdate = true;
            }

            int     num1    = (300 - projectile.timeLeft) / 60;
            float   num2    = projectile.scale * 0.4f;
            float   num3    = Main.rand.Next(1, 3);
            Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));

            vector2.Normalize();
            int index2 = Dust.NewDust(projectile.Center, 0, 0, 135, 0f, 0f, 100, new Color(), 2f);

            Main.dust[index2].noGravity = true;
            Main.dust[index2].noLight   = true;
            Main.dust[index2].velocity  = vector2 * num3;
            if (Main.rand.Next(2) == 0)
            {
                Main.dust[index2].velocity *= 2f;
                Main.dust[index2].scale    += 0.5f;
            }
            Main.dust[index2].fadeIn = 2f;

            Lighting.AddLight(projectile.Center, 0.4f, 0.9f, 1.1f);
        }
Ejemplo n.º 20
0
        public static double StrikeNPCHook(On.Terraria.NPC.orig_StrikeNPC orig, NPC self, int Damage, float knockBack, int hitDirection, bool crit = false, bool noEffect = false, bool fromNet = false)
        {
            if ((!self.townNPC && self.type != NPCID.SkeletonMerchant) || SomeUtils.NoMode())
            {
                return(orig.Invoke(self, Damage, knockBack, hitDirection, crit, noEffect, fromNet));
            }

            bool flag          = Main.netMode == NetmodeID.SinglePlayer;
            var  ReflectTarget = typeof(NPC).GetField("ignorePlayerInteractions", BindingFlags.NonPublic | BindingFlags.Static);

            if (flag && (int)ReflectTarget.GetValue(new NPC()) > 0)
            {
                ReflectTarget.SetValue(new NPC(), (int)ReflectTarget.GetValue(new NPC()) - 1);
                flag = false;
            }
            if (!self.active || self.life <= 0)
            {
                return(0.0);
            }
            double num  = Damage;
            int    num2 = self.defense;

            if (self.ichor)
            {
                num2 -= 20;
            }
            if (self.betsysCurse)
            {
                num2 -= 40;
            }
            if (num2 < 0)
            {
                num2 = 0;
            }
            if (NPCLoader.StrikeNPC(self, ref num, num2, ref knockBack, hitDirection, ref crit))
            {
                num = Main.CalculateDamage((int)num, num2);
                if (crit)
                {
                    num *= 2.0;
                }
                if (self.takenDamageMultiplier > 1f)
                {
                    num *= self.takenDamageMultiplier;
                }
            }
            if ((self.takenDamageMultiplier > 1f || Damage != 9999) && self.lifeMax > 1)
            {
                if (self.friendly)
                {
                    Color color = crit ? CombatText.DamagedFriendlyCrit : CombatText.DamagedFriendly;
                    CombatText.NewText(new Rectangle((int)self.position.X, (int)self.position.Y, self.width, self.height), color, (int)num, crit, false);
                }
                else
                {
                    Color color2 = crit ? CombatText.DamagedHostileCrit : CombatText.DamagedHostile;
                    if (fromNet)
                    {
                        color2 = (crit ? CombatText.OthersDamagedHostileCrit : CombatText.OthersDamagedHostile);
                    }
                    CombatText.NewText(new Rectangle((int)self.position.X, (int)self.position.Y, self.width, self.height), color2, (int)num, crit, false);
                }
            }
            if (num >= 1.0)
            {
                if (flag)
                {
                    self.PlayerInteraction(Main.myPlayer);
                }
                self.justHit = true;
                if (!SomeUtils.BuffNPC())
                {
                    if (self.townNPC)
                    {
                        bool flag2 = self.aiStyle == 7 && (self.ai[0] == 3f || self.ai[0] == 4f || self.ai[0] == 16f || self.ai[0] == 17f);
                        if (flag2)
                        {
                            NPC npc = Main.npc[(int)self.ai[2]];
                            if (npc.active)
                            {
                                npc.ai[0]      = 1f;
                                npc.ai[1]      = 300 + Main.rand.Next(300);
                                npc.ai[2]      = 0f;
                                npc.localAI[3] = 0f;
                                npc.direction  = hitDirection;
                                npc.netUpdate  = true;
                            }
                        }
                        self.ai[0]      = 1f;
                        self.ai[1]      = 300 + Main.rand.Next(300);
                        self.ai[2]      = 0f;
                        self.localAI[3] = 0f;
                        self.direction  = hitDirection;
                        self.netUpdate  = true;
                    }
                }

                if (self.townNPC && SomeUtils.AttackMode())
                {
                    if (NPCID.Sets.AttackType[self.type] == 3)
                    {
                        knockBack = 0;
                    }
                }
                if (self.aiStyle == 8 && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    if (self.type == NPCID.RuneWizard)
                    {
                        self.ai[0] = 450f;
                    }
                    else if (self.type == NPCID.Necromancer || self.type == NPCID.NecromancerArmored)
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            self.ai[0]     = 390f;
                            self.netUpdate = true;
                        }
                    }
                    else if (self.type == NPCID.DesertDjinn)
                    {
                        if (Main.rand.Next(3) != 0)
                        {
                            self.ai[0]     = 181f;
                            self.netUpdate = true;
                        }
                    }
                    else
                    {
                        self.ai[0] = 400f;
                    }
                    self.TargetClosest(true);
                }
                if (self.aiStyle == 97 && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    self.localAI[1] = 1f;
                    self.TargetClosest(true);
                }
                if (self.type == NPCID.DetonatingBubble)
                {
                    num                 = 0.0;
                    self.ai[0]          = 1f;
                    self.ai[1]          = 4f;
                    self.dontTakeDamage = true;
                }
                if (self.type == NPCID.SantaNK1 && self.life >= self.lifeMax * 0.5 && self.life - num < self.lifeMax * 0.5)
                {
                    Gore.NewGore(self.position, self.velocity, 517, 1f);
                }
                if (self.type == NPCID.SpikedIceSlime)
                {
                    self.localAI[0] = 60f;
                }
                if (self.type == NPCID.SlimeSpiked)
                {
                    self.localAI[0] = 60f;
                }
                if (self.type == NPCID.SnowFlinx)
                {
                    self.localAI[0] = 1f;
                }
                if (!self.immortal)
                {
                    if (self.realLife >= 0)
                    {
                        Main.npc[self.realLife].life -= (int)num;
                        self.life    = Main.npc[self.realLife].life;
                        self.lifeMax = Main.npc[self.realLife].lifeMax;
                    }
                    else
                    {
                        self.life -= (int)num;
                    }
                }
                if (knockBack > 0f && self.knockBackResist > 0f)
                {
                    float num3 = knockBack * self.knockBackResist;
                    if (num3 > 8f)
                    {
                        float num4 = num3 - 8f;
                        num4 *= 0.9f;
                        num3  = 8f + num4;
                    }
                    if (num3 > 10f)
                    {
                        float num5 = num3 - 10f;
                        num5 *= 0.8f;
                        num3  = 10f + num5;
                    }
                    if (num3 > 12f)
                    {
                        float num6 = num3 - 12f;
                        num6 *= 0.7f;
                        num3  = 12f + num6;
                    }
                    if (num3 > 14f)
                    {
                        float num7 = num3 - 14f;
                        num7 *= 0.6f;
                        num3  = 14f + num7;
                    }
                    if (num3 > 16f)
                    {
                        num3 = 16f;
                    }
                    if (crit)
                    {
                        num3 *= 1.4f;
                    }
                    int num8 = (int)num * 10;
                    if (Main.expertMode)
                    {
                        num8 = (int)num * 15;
                    }
                    if (num8 > self.lifeMax)
                    {
                        if (hitDirection < 0 && self.velocity.X > -num3)
                        {
                            if (self.velocity.X > 0f)
                            {
                                self.velocity.X -= num3;
                            }
                            self.velocity.X -= num3;
                            if (self.velocity.X < -num3)
                            {
                                self.velocity.X = -num3;
                            }
                        }
                        else if (hitDirection > 0 && self.velocity.X < num3)
                        {
                            if (self.velocity.X < 0f)
                            {
                                self.velocity.X += num3;
                            }
                            self.velocity.X += num3;
                            if (self.velocity.X > num3)
                            {
                                self.velocity.X = num3;
                            }
                        }
                        if (self.type == NPCID.SnowFlinx)
                        {
                            num3 *= 1.5f;
                        }
                        if (!self.noGravity)
                        {
                            num3 *= -0.75f;
                        }
                        else
                        {
                            num3 *= -0.5f;
                        }
                        if (self.velocity.Y > num3)
                        {
                            self.velocity.Y += num3;
                            if (self.velocity.Y < num3)
                            {
                                self.velocity.Y = num3;
                            }
                        }
                    }
                    else
                    {
                        if (!self.noGravity)
                        {
                            self.velocity.Y = -num3 * 0.75f * self.knockBackResist;
                        }
                        else
                        {
                            self.velocity.Y = -num3 * 0.5f * self.knockBackResist;
                        }
                        self.velocity.X = num3 * hitDirection * self.knockBackResist;
                    }
                }

                if ((self.type == NPCID.WallofFlesh || self.type == NPCID.WallofFleshEye) && self.life <= 0)
                {
                    for (int i = 0; i < 200; i++)
                    {
                        if (Main.npc[i].active && (Main.npc[i].type == NPCID.WallofFlesh || Main.npc[i].type == NPCID.WallofFleshEye))
                        {
                            Main.npc[i].HitEffect(hitDirection, num);
                        }
                    }
                }
                else
                {
                    self.HitEffect(hitDirection, num);
                }
                if (self.HitSound != null)
                {
                    Main.PlaySound(self.HitSound, self.position);
                }
                if (self.realLife >= 0)
                {
                    Main.npc[self.realLife].checkDead();
                }
                else
                {
                    self.checkDead();
                }
                return(num);
            }
            return(0.0);
        }
Ejemplo n.º 21
0
        public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height);

            double Realdamage = Main.CalculateDamage(projectile.damage, 0);

            if (Main.player[projectile.owner].GetModPlayer <InvokerPlayer>().SpringInvoker)
            {
                if (target.realLife >= 0)
                {
                    if (Main.npc[target.realLife].StrikeNPC((int)(damage * .1f), knockback, hitDirection, crit, false, false) < .01f * projectile.damage && Realdamage < Main.npc[target.realLife].lifeMax * .01f)
                    {
                        Realdamage = Main.npc[target.realLife].lifeMax * .034f;
                    }
                }
                else
                {
                    if (target.StrikeNPC(damage, knockback, hitDirection, crit, false, false) < .01f * projectile.damage)
                    {
                        Realdamage = target.lifeMax * .034f;
                    }
                }
            }

            Realdamage = Main.DamageVar((int)Realdamage);

            //Main.player[Main.myPlayer].dpsDamage += (int)Realdamage;
            Main.player[projectile.owner].addDPS((int)Realdamage);

            Color damagecolor = crit ? CombatText.DamagedHostileCrit : CombatText.DamagedHostile;

            CombatText.NewText(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), damagecolor, (int)Realdamage, false, false);

            if (!target.immortal)
            {
                if (target.realLife >= 0)
                {
                    Main.npc[target.realLife].life -= (int)Realdamage;
                    target.life    = Main.npc[target.realLife].life;
                    target.lifeMax = Main.npc[target.realLife].lifeMax;
                }
                else
                {
                    target.life -= (int)Realdamage;
                }
            }

            /*
             * if(target.life <= Realdamage) target.life -= target.life;
             * else target.life -= (int)Realdamage;
             *
             * if(target.realLife >= 0)
             * {
             *      if(Main.npc[target.realLife].life <= Realdamage) Main.npc[target.realLife].life -= Main.npc[target.realLife].life;
             *      else Main.npc[target.realLife].life -= (int)Realdamage;
             * }
             */

            if (target.realLife >= 0)
            {
                Main.npc[target.realLife].checkDead();
            }
            else
            {
                target.checkDead();
            }

            if (projectile.owner == Main.myPlayer)
            {
                for (int i = 0; i < 200; i++)
                {
                    if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1) && (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i])))
                    {
                        bool flag;
                        if (Main.npc[i].type == 414)
                        {
                            Rectangle rect = Main.npc[i].getRect();
                            int       num  = 8;
                            rect.X      -= num;
                            rect.Y      -= num;
                            rect.Width  += num * 2;
                            rect.Height += num * 2;
                            flag         = projectile.Colliding(rectangle, rect);
                        }
                        else
                        {
                            flag = projectile.Colliding(rectangle, Main.npc[i].getRect());
                        }
                        if (flag)
                        {
                            if (Main.npc[i].reflectingProjectiles && projectile.CanReflect())
                            {
                                Main.npc[i].ReflectProjectile(projectile.whoAmI);
                                return;
                            }
                            projectile.ai[0]     = 1f;
                            projectile.ai[1]     = i;
                            projectile.velocity  = (Main.npc[i].Center - projectile.Center) * 0.75f;
                            projectile.netUpdate = true;
                            projectile.StatusNPC(i);
                            projectile.damage = 0;
                            Point[] array = new Point[10];
                            int     num2  = 0;
                            for (int j = 0; j < 1000; j++)
                            {
                                if (j != projectile.whoAmI && Main.projectile[j].active && Main.projectile[j].owner == Main.myPlayer && Main.projectile[j].type == projectile.type && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == i)
                                {
                                    array[num2++] = new Point(j, Main.projectile[j].timeLeft);
                                    if (num2 >= array.Length)
                                    {
                                        break;
                                    }
                                }
                            }
                            if (num2 >= array.Length)
                            {
                                int num3 = 0;
                                for (int k = 1; k < array.Length; k++)
                                {
                                    if (array[k].Y < array[num3].Y)
                                    {
                                        num3 = k;
                                    }
                                }
                                Main.projectile[array[num3].X].Kill();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 22
0
        public override void AI()
        {
            EModeGlobalNPC.championBoss = npc.whoAmI;

            if (npc.localAI[3] == 0) //just spawned
            {
                if (!npc.HasValidTarget)
                {
                    npc.TargetClosest(false);
                }

                if (npc.ai[1] == 0)
                {
                    npc.Center = Main.player[npc.target].Center + new Vector2(500 * Math.Sign(npc.Center.X - Main.player[npc.target].Center.X), -250);
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center + Vector2.UnitY * 1000, Vector2.Zero, ModContent.ProjectileType <EarthChainBlast2>(), 0, 0f, Main.myPlayer, -Vector2.UnitY.ToRotation(), 10);
                        Projectile.NewProjectile(npc.Center - Vector2.UnitY * 1000, Vector2.Zero, ModContent.ProjectileType <EarthChainBlast2>(), 0, 0f, Main.myPlayer, Vector2.UnitY.ToRotation(), 10);
                    }
                }

                if (++npc.ai[1] > 6 * 9) //nice
                {
                    npc.localAI[3] = 1;
                    npc.ai[1]      = 0;
                    npc.netUpdate  = true;

                    if (!Main.dedServ && Main.LocalPlayer.active)
                    {
                        Main.LocalPlayer.GetModPlayer <FargoPlayer>().Screenshake = 30;
                    }

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        const int   max          = 8;
                        const float baseRotation = MathHelper.TwoPi / max;
                        for (int i = 0; i < max; i++)
                        {
                            float rotation = baseRotation * (i + Main.rand.NextFloat(-0.5f, 0.5f));
                            Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <EarthChainBlast2>(), 0, 0f, Main.myPlayer, rotation, 3);
                        }

                        int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <EarthChampionHand>(), npc.whoAmI, 0, 0, npc.whoAmI, 1);
                        if (n < Main.maxNPCs && Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }

                        n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <EarthChampionHand>(), npc.whoAmI, 0, 0, npc.whoAmI, -1);
                        if (n < Main.maxNPCs && Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                }
                return;
            }

            Player  player = Main.player[npc.target];
            Vector2 targetPos;

            if (npc.HasValidTarget && npc.Distance(player.Center) < 2500 && player.ZoneUnderworldHeight)
            {
                npc.timeLeft = 600;
            }

            npc.dontTakeDamage = false;
            npc.alpha          = 0;

            switch ((int)npc.ai[0])
            {
            case -1:
                npc.localAI[2] = 1;

                //npc.dontTakeDamage = true;
                npc.ai[1]++;

                npc.velocity *= 0.95f;

                /*if (npc.ai[1] < 120)
                 * {
                 *  targetPos = player.Center;
                 *  targetPos.Y -= 375;
                 *  if (npc.Distance(targetPos) > 50)
                 *      Movement(targetPos, 0.6f, 24f, true);
                 * }
                 * else*/
                if (npc.ai[1] == 120)     //begin healing
                {
                    Main.PlaySound(SoundID.NPCDeath10, npc.Center);

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        //Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType<Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, npc.whoAmI, -3);

                        if (!Main.dedServ && Main.LocalPlayer.active)
                        {
                            Main.LocalPlayer.GetModPlayer <FargoPlayer>().Screenshake = 30;
                        }

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            const int max          = 8;
                            float     baseRotation = MathHelper.TwoPi / max * Main.rand.NextFloat();
                            for (int i = 0; i < max; i++)
                            {
                                float rotation = baseRotation + MathHelper.TwoPi / max * (i + Main.rand.NextFloat(-0.5f, 0.5f));
                                Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <EarthChainBlast2>(), 0, 0f, Main.myPlayer, rotation, 3);
                            }
                        }
                    }
                }
                else if (npc.ai[1] > 120)     //healing
                {
                    npc.velocity *= 0.9f;

                    int heal = (int)(npc.lifeMax / 2 / 120 * Main.rand.NextFloat(1f, 1.5f));
                    npc.life += heal;
                    if (npc.life > npc.lifeMax)
                    {
                        npc.life = npc.lifeMax;
                    }
                    CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                    for (int i = 0; i < 5; i++)
                    {
                        int d = Dust.NewDust(npc.Center, 0, 0, 174, 0f, 0f, 0, default(Color), 1.5f);
                        Main.dust[d].noGravity = true;
                        Main.dust[d].velocity *= 8f;
                    }

                    if (npc.ai[1] > 240)
                    {
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.netUpdate = true;
                    }
                }
                break;

            case 0:                               //float over player
                if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f ||
                    !player.ZoneUnderworldHeight) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   += 1f;

                    return;
                }
                else
                {
                    targetPos    = player.Center;
                    targetPos.Y -= 325;
                    if (npc.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.4f, 16f, true);
                    }
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 2)
                {
                    npc.ai[0] = -1;
                    npc.ai[1] = 0;
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;

                    for (int i = 0; i < Main.maxNPCs; i++)     //find hands, update
                    {
                        if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <EarthChampionHand>() && Main.npc[i].ai[2] == npc.whoAmI)
                        {
                            Main.npc[i].ai[0]      = -1;
                            Main.npc[i].ai[1]      = 0;
                            Main.npc[i].localAI[0] = 0;
                            Main.npc[i].localAI[1] = 0;
                            Main.npc[i].netUpdate  = true;
                        }
                    }
                }
                break;

            case 1:                               //fireballs
                if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f ||
                    !player.ZoneUnderworldHeight) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   += 1f;

                    return;
                }
                else
                {
                    targetPos = player.Center;
                    for (int i = 0; i < 22; i++)     //collision check above player's head
                    {
                        targetPos.Y -= 16;
                        Tile tile = Framing.GetTileSafely(targetPos);     //if solid, stay below it
                        if (tile.active() && !tile.inActive() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
                        {
                            targetPos.Y += 50 + 16;
                            break;
                        }
                    }

                    if (npc.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.2f, 12f, true);
                        npc.position += (targetPos - npc.Center) / 30;
                    }

                    if (--npc.ai[2] < 0)
                    {
                        npc.ai[2] = 75;
                        Main.PlaySound(4, npc.Center, 13);
                        if (npc.ai[1] > 10 && Main.netMode != NetmodeID.MultiplayerClient)     //shoot spread of fireballs, but not the first time
                        {
                            for (int i = -1; i <= 1; i++)
                            {
                                Projectile.NewProjectile(npc.Center + Vector2.UnitY * 60,
                                                         (npc.localAI[2] == 1 ? 12 : 8) * npc.DirectionTo(player.Center).RotatedBy(MathHelper.ToRadians(8 * i)),
                                                         ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer);
                            }
                        }
                    }

                    if (++npc.ai[1] > 480)
                    {
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.netUpdate = true;
                    }
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 2)
                {
                    npc.ai[0] = -1;
                    npc.ai[1] = 0;
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;

                    for (int i = 0; i < Main.maxNPCs; i++)     //find hands, update
                    {
                        if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <EarthChampionHand>() && Main.npc[i].ai[2] == npc.whoAmI)
                        {
                            Main.npc[i].ai[0]      = -1;
                            Main.npc[i].ai[1]      = 0;
                            Main.npc[i].localAI[0] = 0;
                            Main.npc[i].localAI[1] = 0;
                            Main.npc[i].netUpdate  = true;
                        }
                    }
                }
                break;

            default:
                npc.ai[0] = 0;
                goto case 0;
            }
        }
Ejemplo n.º 23
0
        private void ThoriumModifyNPC(NPC target, Item item, int damage, bool crit)
        {
            ThoriumPlayer thoriumPlayer = player.GetModPlayer <ThoriumPlayer>();

            if (FungusEnchant && !ThoriumSoul && Main.rand.Next(5) == 0)
            {
                target.AddBuff(thorium.BuffType("Mycelium"), 120);
            }

            if (TideTurnerEnchant)
            {
                //tide turner daggers
                if (SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.TideDaggers) && player.ownedProjectileCounts[thorium.ProjectileType("TideDagger")] < 24 && target.type != NPCID.TargetDummy && Main.rand.Next(5) == 0)
                {
                    FargoGlobalProjectile.XWay(4, player.position, thorium.ProjectileType("TideDagger"), 3, (int)(item.damage * 0.75), 3);
                    Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 43, 1f, 0f);
                }
                //mini crits
                if (thoriumPlayer.tideOrb > 0 && !crit)
                {
                    float num  = 30f;
                    int   num2 = 0;
                    while ((float)num2 < num)
                    {
                        Vector2 vector = Vector2.UnitX * 0f;
                        vector += -Utils.RotatedBy(Vector2.UnitY, (double)((float)num2 * (6.28318548f / num)), default(Vector2)) * new Vector2(12f, 12f);
                        vector  = Utils.RotatedBy(vector, (double)Utils.ToRotation(target.velocity), default(Vector2));
                        int num3 = Dust.NewDust(target.Center, 0, 0, 176, 0f, 0f, 0, default(Color), 1f);
                        Main.dust[num3].scale     = 1.5f;
                        Main.dust[num3].noGravity = true;
                        Main.dust[num3].position  = target.Center + vector;
                        Main.dust[num3].velocity  = target.velocity * 0f + Utils.SafeNormalize(vector, Vector2.UnitY) * 1f;
                        int num4 = num2;
                        num2 = num4 + 1;
                    }
                    crit   = true;
                    damage = (int)((double)damage * 0.75);
                    thoriumPlayer.tideOrb--;
                }
            }

            if (AssassinEnchant)
            {
                //assassin duplicate damage
                if (SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.AssassinDamage) && Utils.NextFloat(Main.rand) < 0.1f)
                {
                    Main.PlaySound(SoundID.Item, (int)target.position.X, (int)target.position.Y, 92, 1f, 0f);
                    Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasmaDamage"), (int)((float)item.damage * 1.15f), 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasma"), 0, 0f, Main.myPlayer, 0f, 0f);
                }
                //insta kill
                if (target.type != NPCID.TargetDummy && target.lifeMax < 100000 && Utils.NextFloat(Main.rand) < 0.05f)
                {
                    if ((target.boss || NPCID.Sets.BossHeadTextures[target.type] > -1) && target.life < target.lifeMax * 0.05)
                    {
                        CombatText.NewText(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), new Color(135, 255, 45), "ERADICATED", false, false);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasmaDamage"), (int)(target.lifeMax * 1.25f), 0f, Main.myPlayer, 0f, 0f);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasma"), 0, 0f, Main.myPlayer, 0f, 0f);
                    }
                    else if (NPCID.Sets.BossHeadTextures[target.type] < 0)
                    {
                        CombatText.NewText(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), new Color(135, 255, 45), "ERADICATED", false, false);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasmaDamage"), (int)(target.lifeMax * 1.25f), 0f, Main.myPlayer, 0f, 0f);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasma"), 0, 0f, Main.myPlayer, 0f, 0f);
                    }
                }
            }

            if (PyroEnchant)
            {
                //pyro
                target.AddBuff(24, 300, true);
                target.AddBuff(thorium.BuffType("Singed"), 300, true);

                if (SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.PyromancerBursts))
                {
                    Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("PyroBurst"), 100, 1f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("PyroExplosion2"), 0, 0f, Main.myPlayer, 0f, 0f);
                }
            }

            if (BronzeEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.BronzeLightning) && Main.rand.Next(5) == 0)
            {
                target.immune[player.whoAmI] = 5;
                Projectile.NewProjectile(target.Center.X, target.Center.Y - 600f, 0f, 15f, thorium.ProjectileType("LightStrike"), (int)(item.damage / 4), 1f, player.whoAmI, 0f, 0f);
            }

            //malignant
            if (MalignantEnchant && crit)
            {
                target.AddBuff(24, 900, true);
                target.AddBuff(thorium.BuffType("lightCurse"), 900, true);
                for (int i = 0; i < 8; i++)
                {
                    int num5 = Dust.NewDust(target.position, target.width, target.height, 127, (float)Main.rand.Next(-6, 6), (float)Main.rand.Next(-10, 10), 0, default(Color), 1.2f);
                    Main.dust[num5].noGravity = true;
                }
                for (int j = 0; j < 8; j++)
                {
                    int num6 = Dust.NewDust(target.position, target.width, target.height, 65, (float)Main.rand.Next(-6, 6), (float)Main.rand.Next(-10, 10), 0, default(Color), 1.2f);
                    Main.dust[num6].noGravity = true;
                }
            }

            //white dwarf
            if (WhiteDwarfEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.WhiteDwarf) && crit)
            {
                Main.PlaySound(SoundID.Item, (int)target.position.X, (int)target.position.Y, 92, 1f, 0f);
                Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("WhiteFlare"), (int)((float)target.lifeMax * 0.001f), 0f, Main.myPlayer, 0f, 0f);
            }

            //yew wood
            if (YewEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.YewCrits) && !crit)
            {
                thoriumPlayer.yewChargeTimer = 120;
                if (player.ownedProjectileCounts[thorium.ProjectileType("YewVisual")] < 1)
                {
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, thorium.ProjectileType("YewVisual"), 0, 0f, player.whoAmI, 0f, 0f);
                }
                if (thoriumPlayer.yewCharge < 4)
                {
                    thoriumPlayer.yewCharge++;
                }
                else
                {
                    crit   = true;
                    damage = (int)((double)damage * 0.75);
                    thoriumPlayer.yewCharge = 0;
                }
            }

            if (CryoEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.CryoDamage))
            {
                target.AddBuff(ModContent.BuffType <EnemyFrozen>(), 120, false);
                Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType <ReactionNitrogen>(), 0, 0f, Main.myPlayer, 0f, 0f);
            }

            if (WarlockEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.WarlockWisps))
            {
                //warlock
                if (crit && player.ownedProjectileCounts[thorium.ProjectileType("ShadowWisp")] < 15)
                {
                    Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, -2f, thorium.ProjectileType("ShadowWisp"), (int)((float)item.damage * 0.75f), 0f, Main.myPlayer, 0f, 0f);
                }
            }
        }
Ejemplo n.º 24
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140)
            {
                BattleMode.UI.splashText.SetText("");

                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);

                startingZoom = Main.GameZoomTarget;
            }
            else if (AnimationFrame == 176)
            {
                TerramonMod.ZoomAnimator.GameZoom(zoomOutTarget, 700, Easing.None);
            }
            else if (AnimationFrame == 225)
            {
                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                TerramonMod.ZoomAnimator.GameZoom(zoomInTarget, 320, Easing.OutExpo);
                Main.LocalPlayer.GetModPlayer <TerramonPlayer>().battleScreenShake = true;
                Projectile.NewProjectile(target.projectile.Center, Vector2.Zero, ModContent.ProjectileType <MegaPunchFist>(), 0, 0);

                for (int i = 0; i < 18; i++)
                {
                    Dust.NewDust(target.projectile.Center - (target.projectile.Size / 2), target.projectile.height, target.projectile.height,
                                 DustID.DiamondBolt, 0, 0, 0, Color.Red);
                }
            }
            else if (AnimationFrame == 310)
            {
                Main.LocalPlayer.GetModPlayer <TerramonPlayer>().battleScreenShake = false;
                TerramonMod.ZoomAnimator.GameZoom(startingZoom, 320, Easing.OutExpo);
            }
            else if (AnimationFrame == 340)
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                BattleMode.queueEndMove = true;
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 25
0
        public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            if (Main.rand.Next(1, 100) < projectile.ai[0])
            {
                crit = true;
            }
            if (target.HasBuff(mod.BuffType("MarkedForDeath")))
            {
                Player player = Main.player[projectile.owner];
                int    projid = Projectile.NewProjectile(target.Center, Vector2.Zero, mod.ProjectileType("DeathMark"), 0, 0, projectile.owner);
                Main.projectile[projid].Center = target.Center;
                target.DelBuff(target.FindBuffIndex(mod.BuffType("MarkedForDeath"))); CombatText.NewText(target.getRect(), Color.Purple, damage, true); if (target.CanBeChasedBy(this))
                {
                    target.StrikeNPCNoInteraction(damage, 0, 0, true, true);
                    if (Main.netMode != NetmodeID.SinglePlayer)
                    {
                        NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, target.whoAmI, damage, 0, player.direction, crit ? 1 : 0);
                    }
                }
                int healing = (int)(RetractSpeed * (DRGNModWorld.MentalMode ? 3f : Main.expertMode ? 2.25f : 1.5f)) + (int)(damage * (DRGNModWorld.MentalMode ? 0.05f : Main.expertMode ? 0.0375f : 0.025f));
                if (player.statLifeMax2 > player.statLife + healing)
                {
                    player.HealEffect(healing);
                    player.statLife += healing;
                }
                else if (player.statLife != player.statLifeMax2)
                {
                    player.HealEffect(player.statLifeMax2 - player.statLife);
                    player.statLife = player.statLifeMax2;
                }

                target.GetGlobalNPC <ReaperGlobalNPC>().AddSoulReward(target, 3, player);
            }
        }
Ejemplo n.º 26
0
        public override void AI()
        {
            int ai0 = (int)projectile.ai[0];

            if (!(ai0 > -1 && ai0 < 200 && Main.npc[ai0].active && Main.npc[ai0].type == MasomodeEX.Souls.NPCType("MutantBoss")))
            {
                projectile.Kill();
                return;
            }
            NPC npc = Main.npc[ai0];

            projectile.Center   = npc.Center;
            projectile.timeLeft = 2;
            if (projectile.localAI[0] == 0)
            {
                projectile.localAI[0] = 1;

                if (ModLoader.GetMod("FargowiltasSouls") != null && npc.type == ModLoader.GetMod("FargowiltasSouls").NPCType("MutantBoss"))
                {
                    npc.HitSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/MutantHit").WithPitchVariance(0.25f).WithVolume(1.5f);
                }

                //SpawnAllBosses(npc);

                if (MasomodeEXWorld.MutantSummons < 1)
                {
                    EdgyBossText(npc, "Big mistake, kid. You'll pay for that.");
                }
                else if (MasomodeEXWorld.MutantSummons < 3)
                {
                    EdgyBossText(npc, "Back for more? Really now.");
                }
                else if (MasomodeEXWorld.MutantSummons < 5)
                {
                    EdgyBossText(npc, "You really like going through hell don't you? Have it your way.");
                }
                else if (MasomodeEXWorld.MutantSummons < 7)
                {
                    EdgyBossText(npc, "You brought this upon yourself. I'll just have to keep ripping you to bloody pieces.");
                }
                else if (MasomodeEXWorld.MutantSummons < 10)
                {
                    EdgyBossText(npc, "Luck won't help you here. I'm barely responsive to prayers.");
                }
                else if (MasomodeEXWorld.MutantSummons < 15)
                {
                    EdgyBossText(npc, "You have some real commitment... to being a wretched fool, that is.");
                }
                else if (MasomodeEXWorld.MutantSummons < 20)
                {
                    EdgyBossText(npc, "Nothing's sticking. It's no use, TAKE THIS!");
                }
                else if (MasomodeEXWorld.MutantSummons < 50)
                {
                    EdgyBossText(npc, "I bore of dealing with you. Focus, slow down.");
                }
                else if (MasomodeEXWorld.MutantSummons < 75)
                {
                    EdgyBossText(npc, "Give my brother a break, damn it.");
                }
                else if (MasomodeEXWorld.MutantSummons < 100)
                {
                    EdgyBossText(npc, "Honestly, the guide deserved this, but not us.");
                }
                else if (MasomodeEXWorld.MutantSummons < 250)
                {
                    EdgyBossText(npc, "...");
                }
                else if (MasomodeEXWorld.MutantSummons < 500)
                {
                    EdgyBossText(npc, "This is just getting ridiculous...");
                }
                else if (MasomodeEXWorld.MutantSummons < 1000)
                {
                    EdgyBossText(npc, "I’ll make you suffer for an eternity. You deserve as much. Die over and over again until you break in rage and insanity.");
                }
                else
                {
                    EdgyBossText(npc, "Ech.");
                }

                MasomodeEXWorld.MutantSummons++;
                if (Main.netMode == 2)
                {
                    NetMessage.SendData(7); //sync world
                }
            }
            EdgyBossText(npc, ref p1[0], 0.9, "I could recite all the digits of Pi before you beat me.");
            EdgyBossText(npc, ref p1[1], 0.8, "Not even the Great Tyrant is a worthy opponent.");
            EdgyBossText(npc, ref p1[2], 0.7, "The eroded spirits have failed... Yet, you will still fail against me.");
            EdgyBossText(npc, ref p1[3], 0.65, "This is just the beginning of true hell.");
            EdgyBossText(npc, ref p1[4], 0.6, "No matter how well you use your weapons, the result, still, will not be in your favor.");
            EdgyBossText(npc, ref p1[5], 0.55, "This fight is already impossible... you think it'll be over that easily?");
            EdgyBossText(npc, ref p1[6], 0.5, "So this is the rampage that killed the Moon Lord...");
            if (p1[7])
            {
                EdgyBossText(npc, ref p2[0], 0.9, "This is barely the beginning!");
                EdgyBossText(npc, ref p2[1], 0.8, "Power is in the eye of the beholder. Absolute power is a fact.");
                EdgyBossText(npc, ref p2[2], 0.7, "Never has else anyone advanced as much as you... there can only be one.");
                EdgyBossText(npc, ref p2[3], 0.6, "This has dragged on too long... prepare for my unbound power.");
                EdgyBossText(npc, ref p2[4], 0.5, "The tyrant and the witch failed to stop you. No matter, you'll end here.");
                EdgyBossText(npc, ref p2[5], 0.4, "Fall beneath the emissary of justice, kid.");
                EdgyBossText(npc, ref p2[6], 0.3, "There’s so much blood on your hands...");
                EdgyBossText(npc, ref p2[7], 0.25, "I may be a mutant, but thank Terry I’m no pushover.");
                EdgyBossText(npc, ref p2[8], 0.2, "Still not worthy, but these are tough times... no longer on your side.");
                EdgyBossText(npc, ref p2[9], 0.15, "Savagery, barbarism, bloodthirst... you have too much.");
                EdgyBossText(npc, ref p2[10], 0.1, "Don’t tell me I’m not creative, the other guy's purple!");
                EdgyBossText(npc, ref p2[11], 0.05, "I shouldn’t have let you buy in bulk.");
                EdgyBossText(npc, ref p2[12], 0.04, "WHY AREN’T YOU DEAD?! FACE TRUE HELL!!!");
                EdgyBossText(npc, ref p2[13], 0.03, "YOU ARE POWERLESS, HERO.");
                EdgyBossText(npc, ref p2[14], 0.02, "ALL YOU FOUGHT FOR WILL BE LOST IN THE INFINITE ABYSS!!!!");
                EdgyBossText(npc, ref p2[15], 0.01, "FALL BENEATH MY FIERY WRATH, FOOLISH HERO! THE ABYSS CONSUMES ALL!");
            }
            if (npc.ai[0] < -1)
            {
                if (++projectile.localAI[1] > 20)
                {
                    projectile.localAI[1] = 0;
                    if (projectile.ai[1] < spam.Length)
                    {
                        EdgyBossText(npc, spam[(int)projectile.ai[1]++]);
                    }
                }
            }
            switch ((int)npc.ai[0])
            {
            case -7:
                if (npc.HasValidTarget)
                {
                    if (Main.rand.Next(30) == 0)
                    {
                        Vector2 speed = npc.DirectionTo(Main.player[npc.target].Center) * 25f;
                        if (Main.rand.Next(2) == 0)
                        {
                            for (int i = 0; i < 16; i++)
                            {
                                int p = Projectile.NewProjectile(npc.Center, speed.RotatedBy(System.Math.PI * 2 / 16 * i), MasomodeEX.Souls.ProjectileType("MutantSpearThrown"), npc.damage, 0f, Main.myPlayer);
                                if (p != Main.maxProjectiles)
                                {
                                    Main.projectile[p].timeLeft = 60;
                                }
                            }
                        }
                        else
                        {
                            for (int i = -1; i <= 1; i++)
                            {
                                int p = Projectile.NewProjectile(npc.Center, speed.RotatedBy(MathHelper.ToRadians(10) * i), MasomodeEX.Souls.ProjectileType("MutantSpearThrown"), npc.damage, 0f, Main.myPlayer);
                                if (p != Main.maxProjectiles)
                                {
                                    Main.projectile[p].timeLeft = 60;
                                }
                            }
                        }
                    }
                }
                else
                {
                    npc.TargetClosest();
                }

                if (npc.alpha == 0)
                {
                    if (MasomodeEXWorld.MutantDefeats < 3)
                    {
                        EdgyBossText(npc, "At least I'll get to see my brother again...");
                    }
                    else if (MasomodeEXWorld.MutantDefeats < 5)
                    {
                        EdgyBossText(npc, "With some luck, maybe my brother can catch a break...");
                    }
                    else if (MasomodeEXWorld.MutantDefeats < 10)
                    {
                        EdgyBossText(npc, "Cut me some slack...");
                    }
                    else if (MasomodeEXWorld.MutantDefeats < 15)
                    {
                        EdgyBossText(npc, "Now do it without getting hit.");
                    }
                    else if (MasomodeEXWorld.MutantDefeats < 50)
                    {
                        EdgyBossText(npc, "Showoff... now do it with a copper shortsword.");
                    }
                    else if (MasomodeEXWorld.MutantDefeats < 100)
                    {
                        EdgyBossText(npc, "How annoying.");
                    }
                    else
                    {
                        EdgyBossText(npc, "By the way, I'm out of death text now.");
                    }

                    MasomodeEXWorld.MutantDefeats++;
                    if (Main.netMode == 2)
                    {
                        NetMessage.SendData(7);     //sync world
                    }
                }
                break;

            case -1:
                if (npc.ai[1] == 120)
                {
                    if (Main.netMode != 1)
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("BossRush"), 0, 0f, Main.myPlayer, npc.whoAmI);
                    }
                }
                break;

            case 0:
                if (npc.ai[1] == 1)
                {
                    EdgyBossText(npc, "Now. Prepare to wish death as to your escape in suffering.");
                }
                break;

            case 1:
                if (projectile.ai[1] == 0)
                {
                    projectile.ai[1] = 1;
                    EdgyBossText(npc, "Just try to harm me. Your pathetic peashooters have proven nothing!");
                }
                break;

            case 2:
                projectile.ai[1] = 0;
                if (npc.ai[1] == 1)
                {
                    EdgyBossText(npc, "I've watched your journey...");
                }
                break;

            case 4:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "I've seen you fail.");
                }
                break;

            case 6:
                if (npc.ai[1] == 0 && projectile.ai[1] == 0)
                {
                    projectile.ai[1] = 1;
                    EdgyBossText(npc, "Eviscerate under my hands!");
                }
                break;

            case 7:
                projectile.ai[1] = 0;
                if (npc.ai[2] == 0)
                {
                    EdgyBossText(npc, "Die, you rat!");
                }
                break;

            case 9:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "How long can you survive?");
                }
                break;

            case 10:
                if (npc.ai[1] == 1)
                {
                    EdgyBossText(npc, "No... it can't... be... How could I fall... to a mere human...");
                }
                if (npc.ai[1] == 120)
                {
                    Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("BossRush"), 0, 0f, Main.myPlayer, npc.whoAmI);
                    EdgyBossText(npc, "Foolish Terrarian. Your powers aren't even 28.5714 percent as strong as mine. Witness a true cataclysm. THIS ISN'T EVEN MY FINAL FORM!");
                }
                break;

            case 11:
                p1[7] = true;
                if (npc.ai[2] == 1)
                {
                    EdgyBossText(npc, "Still think this move is that bad?");
                }
                break;

            case 13:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "Fall beneath true power!");
                }
                break;

            case 15:
                if (npc.ai[1] == 0 && projectile.ai[1] == 0)
                {
                    projectile.ai[1] = 1;
                    EdgyBossText(npc, "Don't even try to dodge!");
                }
                break;

            case 16:
                projectile.ai[1] = 0;
                if (npc.ai[2] == 1)
                {
                    EdgyBossText(npc, "He who watches only gains suffering.");
                }
                break;

            case 18:
                EdgyBossText(npc, "Thought you had a hard enough time dodging one?");
                break;

            case 19:
                if (npc.ai[1] == 240)
                {
                    EdgyBossText(npc, "Such a beautiful day outside, isn't it?");
                }
                break;

            case 20:
                if (npc.ai[1] == 0 && npc.ai[2] == 1)
                {
                    EdgyBossText(npc, "You know, I was that \"evil presence\" watching...");
                }
                break;

            case 21:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "Fall beneath true power!");
                }
                break;

            case 23:
                if (npc.ai[1] == 0 && projectile.ai[1] == 0)
                {
                    projectile.ai[1] = 1;
                    EdgyBossText(npc, "Don't even try to dodge!");
                }
                break;

            case 24:
                projectile.ai[1] = 0;
                if (npc.ai[1] == 1)
                {
                    EdgyBossText(npc, "Worm bosses... worm everywhere.");
                }
                break;

            case 25:
                if (npc.ai[1] == 1 && projectile.ai[1] == 0)
                {
                    projectile.ai[1] = 1;
                    EdgyBossText(npc, "Exterminating the weak is a hobby of mine.");
                }
                break;

            case 26:
                projectile.ai[1] = 0;
                if (npc.ai[1] == 120)
                {
                    EdgyBossText(npc, "Time to light it up!");
                }
                break;

            case 28:
                if (npc.ai[3] == 30)
                {
                    EdgyBossText(npc, "Now this is how we use our HEADS. Is this a bad enough time for you!?");
                }
                break;

            case 29:
                EdgyBossText(npc, "ASSIST ME, FELLOW MUTANTS!");
                break;

            case 31:
                if (npc.ai[1] == 1)
                {
                    EdgyBossText(npc, "I've watched your journey...");
                }
                break;

            case 33:
                if (npc.ai[1] == 180)
                {
                    EdgyBossText(npc, "And now it's time to light you up!");
                }
                break;

            case 35:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "Lovely weather, isn't it?");
                }
                break;

            case 36:
                if (npc.ai[1] == 60)
                {
                    EdgyBossText(npc, "ASSIST ME, FELLOW MUTANTS!");
                }
                break;

            case 38:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "Lovely weather, isn't it?");
                }
                break;

            case 39:
                if (npc.ai[3] == 0)
                {
                    EdgyBossText(npc, "Burn in hell!");
                }
                break;

            case 40:
                if (npc.ai[1] == 179)
                {
                    EdgyBossText(npc, "Exterminating the weak is a hobby of mine.");
                }
                break;

            case 41:
                EdgyBossText(npc, "This'll leave a few Marx.");
                break;

            default:
                break;
            }

            float lifeIntensity = 1f - (float)npc.life / npc.lifeMax;

            if (--delay < 0)
            {
                delay = Main.rand.Next(5 + (int)(115f * (1f - lifeIntensity)));
                int max = (int)(77 * lifeIntensity);
                for (int i = 0; i < max; i++)
                {
                    Rectangle rectangle = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight);
                    CombatText.NewText(rectangle, Color.LimeGreen, currentText, Main.rand.Next(2) == 0, Main.rand.Next(2) == 0);
                }
            }
        }
Ejemplo n.º 27
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 origVect = new Vector2(speedX, speedY);

            SMGBullets--;
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY - 2)) * 38f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position += muzzleOffset;
            }
            float  spread      = MathHelper.ToRadians(12f);       //45 degrees converted to radians
            float  baseSpeed   = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
            double baseAngle   = Math.Atan2(speedX, speedY);
            double randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread;

            speedX = baseSpeed * (float)Math.Sin(randomAngle);
            speedY = baseSpeed * (float)Math.Cos(randomAngle);
            if (SMGBullets == 1)
            {
                CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y - 20, player.width, player.height), new Color(255, 255, 255, 100),
                                   "Reloading!");
                Main.PlaySound(SoundLoader.customSoundType, player.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Reload"));
                item.reuseDelay = 100;
            }
            else
            {
                item.reuseDelay = 0;
            }
            if (SMGBullets <= 1)
            {
                SMGBullets = SMGBulletsMax;
            }
            if (Main.mouseRight)
            {
                if (SMGBullets > 3)
                {
                    SMGBullets--;
                }
                for (int index = 0; index < 58; ++index)
                {
                    if (player.inventory[index].ammo == item.useAmmo && player.inventory[index].stack > 1)
                    {
                        player.inventory[index].stack -= 1;
                        break;
                    }
                }
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 11));
                if (Main.rand.Next(2) == 1)
                {
                    newVect = origVect.RotatedBy(System.Math.PI / (Main.rand.Next(82, 600) / 14));
                }
                else
                {
                    newVect = origVect.RotatedBy(-System.Math.PI / (Main.rand.Next(82, 600) / 14));
                }
                int        proj2    = Projectile.NewProjectile(position.X, position.Y, newVect.X, newVect.Y, type, damage, 0, player.whoAmI);
                Projectile newProj2 = Main.projectile[proj2];
            }
            return(true);
        }
Ejemplo n.º 28
0
        public override bool NewRightClick(int i, int j)
        {
            Player player         = Main.LocalPlayer;
            Tile   tile           = Main.tile[i, j];
            bool   anycursedarmor = false;

            for (int indexX = -70; indexX <= 70; indexX++)
            {
                for (int indexY = -90; indexY <= 90; indexY++)
                {
                    if (Framing.GetTileSafely(indexX + i, indexY + j).type == mod.TileType("CursedArmor"))
                    {
                        WorldGen.KillTile(indexX + i, indexY + j);

                        if (Main.netMode != NetmodeID.SinglePlayer)
                        {
                            NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, indexX + i, indexY + j);
                        }

                        anycursedarmor = true;
                    }
                }
            }
            if (anycursedarmor)
            {
                CombatText.NewText(new Rectangle(i * 16, j * 16, 20, 10), Color.GreenYellow, "Trapped!");
                return(true);
            }
            else if (NPC.AnyNPCs(ModContent.NPCType <Enchanted_Armor>()))
            {
                Main.PlaySound(new LegacySoundStyle(SoundID.NPCKilled, 6).WithPitchVariance(0.2f).WithVolume(0.5f), new Vector2(i * 16, j * 16));
                foreach (NPC npc in Main.npc.Where(x => x.active && x.type == ModContent.NPCType <Enchanted_Armor>()))
                {
                    npc.ai[1] = 30;
                }

                return(true);
            }

            Main.mouseRightRelease = false;
            int left = i;
            int top  = j;

            if (tile.frameX % 36 != 0)
            {
                left--;
            }
            if (tile.frameY != 0)
            {
                top--;
            }
            if (player.sign >= 0)
            {
                Main.PlaySound(SoundID.MenuClose);
                player.sign      = -1;
                Main.editSign    = false;
                Main.npcChatText = "";
            }
            if (Main.editChest)
            {
                Main.PlaySound(SoundID.MenuTick);
                Main.editChest   = false;
                Main.npcChatText = "";
            }
            if (player.editedChestName)
            {
                NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0);
                player.editedChestName = false;
            }
            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                if (left == player.chestX && top == player.chestY && player.chest >= 0)
                {
                    player.chest = -1;
                    Recipe.FindRecipes();
                    Main.PlaySound(SoundID.MenuClose);
                }
                else
                {
                    NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, top, 0f, 0f, 0, 0, 0);
                    Main.stackSplit = 600;
                }
            }
            else
            {
                int chest = Chest.FindChest(left, top);
                if (chest >= 0)
                {
                    Main.stackSplit = 600;
                    if (chest == player.chest)
                    {
                        player.chest = -1;
                        Main.PlaySound(SoundID.MenuClose);
                    }
                    else
                    {
                        player.chest         = chest;
                        Main.playerInventory = true;
                        Main.recBigList      = false;
                        player.chestX        = left;
                        player.chestY        = top;
                        Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick);
                    }
                    Recipe.FindRecipes();
                }
            }
            return(true);
        }
Ejemplo n.º 29
0
        public override void AI()
        {
            EModeGlobalNPC.championBoss = npc.whoAmI;

            if (npc.localAI[3] == 0) //just spawned
            {
                if (!npc.HasValidTarget)
                {
                    npc.TargetClosest(false);
                }

                if (npc.ai[2] < 0.1f)
                {
                    npc.Center = Main.player[npc.target].Center - Vector2.UnitY * 300;
                }

                npc.ai[2] += 1f / 180f;

                npc.alpha = (int)(255f * (1 - npc.ai[2]));
                if (npc.alpha < 0)
                {
                    npc.alpha = 0;
                }
                if (npc.alpha > 255)
                {
                    npc.alpha = 255;
                }

                if (npc.ai[2] > 1f)
                {
                    npc.localAI[3] = 1;
                    npc.ai[2]      = 0;
                    npc.netUpdate  = true;

                    npc.velocity = -20f * Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2);

                    Main.PlaySound(SoundID.Roar, npc.Center, 2); //arte scream

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, -1, -4);

                        if (FargoSoulsWorld.EternityMode)
                        {
                            Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <LifeRitual>(), npc.damage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI);
                        }
                    }
                }
                return;
            }

            npc.dontTakeDamage = false;
            npc.alpha          = 0;

            Player  player = Main.player[npc.target];
            Vector2 targetPos;

            if (npc.HasValidTarget && npc.Distance(player.Center) < 2500)
            {
                npc.timeLeft = 600;
            }

            switch ((int)npc.ai[0])
            {
            case -3:                                                                                                       //final phase
                if (!Main.dayTime || !player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   -= 1f;

                    break;
                }

                npc.velocity = Vector2.Zero;

                npc.ai[1] -= (float)Math.PI * 2 / 447;
                npc.ai[3] += (float)Math.PI * 2 / 447;     //spin deathrays both ways

                if (--npc.ai[2] < 0)
                {
                    npc.localAI[1] = npc.localAI[1] == 0 ? 1 : 0;
                    npc.ai[2]      = npc.localAI[1] == 1 ? 90 : 30;

                    if (npc.ai[1] < 360 && Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        int type = npc.localAI[1] == 1 ? ModContent.ProjectileType <LifeDeathraySmall2>() : ModContent.ProjectileType <LifeDeathray2>();
                        int max  = 3;
                        for (int i = 0; i < max; i++)
                        {
                            float offset = (float)Math.PI * 2 / max * i;
                            Projectile.NewProjectile(npc.Center, Vector2.UnitX.RotatedBy(npc.ai[3] + offset),
                                                     type, npc.damage / 4, 0f, Main.myPlayer, (float)Math.PI * 2 / 447, npc.whoAmI);
                            Projectile.NewProjectile(npc.Center, Vector2.UnitX.RotatedBy(npc.ai[1] + offset),
                                                     type, npc.damage / 4, 0f, Main.myPlayer, -(float)Math.PI * 2 / 447, npc.whoAmI);
                        }
                    }
                }

                if (--npc.localAI[0] < 0)
                {
                    npc.localAI[0] = 47;
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        int   max      = 14;
                        float rotation = Main.rand.NextFloat((float)Math.PI * 2);
                        for (int i = 0; i < max; i++)
                        {
                            Projectile.NewProjectile(npc.Center, new Vector2(4f, 0).RotatedBy(rotation + Math.PI / max * 2 * i),
                                                     ModContent.ProjectileType <ChampionBee>(), npc.damage / 4, 0f, Main.myPlayer);
                        }
                    }
                }
                break;

            case -2:     //final phase transition
                npc.velocity *= 0.97f;

                if (npc.ai[1] > 180)
                {
                    npc.localAI[0] = 0;
                    npc.localAI[2] = 2;
                }

                if (++npc.ai[1] == 180)                          //heal up
                {
                    Main.PlaySound(SoundID.Roar, npc.Center, 2); //arte scream

                    int heal = npc.lifeMax / 3 - npc.life;
                    npc.life += heal;
                    CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, npc.whoAmI, -4);
                    }
                }
                else if (npc.ai[1] > 240)
                {
                    npc.ai[0]     = -3;
                    npc.ai[1]     = npc.DirectionTo(player.Center).ToRotation();
                    npc.ai[2]     = 0;
                    npc.ai[3]     = npc.DirectionTo(player.Center).ToRotation();
                    npc.netUpdate = true;
                }
                break;

            case -1:     //heal
                npc.velocity *= 0.97f;

                if (npc.ai[1] > 180)
                {
                    npc.localAI[2] = 1;
                }

                if (++npc.ai[1] == 180)                          //heal up
                {
                    Main.PlaySound(SoundID.Roar, npc.Center, 2); //arte scream

                    int heal = npc.lifeMax - npc.life;
                    npc.life += heal;
                    CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRing>(), 0, 0f, Main.myPlayer, npc.whoAmI, -4);
                    }
                }
                else if (npc.ai[1] > 240)
                {
                    npc.ai[0]     = npc.ai[3];
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                break;

            case 0:                                                                                                        //float over player
                if (!Main.dayTime || !player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   -= 1f;

                    break;
                }

                targetPos    = player.Center;
                targetPos.Y -= 300;
                if (npc.Distance(targetPos) > 50)
                {
                    Movement(targetPos, 0.18f, 24f, true);
                }
                if (npc.Distance(player.Center) < 200)     //try to avoid contact damage
                {
                    Movement(targetPos, 0.24f, 24f, true);
                }

                if (++npc.ai[1] > 150)
                {
                    npc.TargetClosest();
                    npc.ai[0]++;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 3)
                {
                    float buffer = npc.ai[0];
                    npc.ai[0]     = -1;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = buffer;
                    npc.netUpdate = true;
                }

                if (npc.localAI[2] == 1 && npc.life < npc.lifeMax / 3 && FargoSoulsWorld.EternityMode)
                {
                    npc.ai[0]     = -2;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                break;

            case 1:     //boundary
                npc.velocity *= 0.95f;
                if (++npc.ai[1] > (npc.localAI[2] == 1 ? 2 : 3))
                {
                    Main.PlaySound(SoundID.Item12, npc.Center);
                    npc.ai[1]  = 0;
                    npc.ai[2] -= (float)Math.PI / 4 / 457 * npc.ai[3];
                    if (npc.ai[2] < -(float)Math.PI)
                    {
                        npc.ai[2] += (float)Math.PI * 2;
                    }
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        int max = npc.localAI[2] == 1 ? 4 : 3;
                        for (int i = 0; i < max; i++)
                        {
                            Projectile.NewProjectile(npc.Center, new Vector2(6f, 0).RotatedBy(npc.ai[2] + Math.PI / max * 2 * i),
                                                     ModContent.ProjectileType <ChampionBee>(), npc.damage / 4, 0f, Main.myPlayer);
                        }
                    }
                }
                if (++npc.ai[3] > 300)
                {
                    npc.TargetClosest();
                    npc.ai[0]++;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                break;

            case 2:     //dash attack
                if (npc.ai[3] == 0)
                {
                    if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f)     //despawn code
                    {
                        npc.TargetClosest(false);
                        if (npc.timeLeft > 30)
                        {
                            npc.timeLeft = 30;
                        }

                        npc.noTileCollide = true;
                        npc.noGravity     = true;
                        npc.velocity.Y   -= 1f;

                        return;
                    }

                    if (npc.ai[2] == 0)
                    {
                        npc.ai[2] = npc.Center.Y;     //store arena height

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.GlowRingHollow>(), 0, 0f, Main.myPlayer, 7, npc.whoAmI);
                        }
                    }

                    if (npc.Center.Y > npc.ai[2] + 1000)     //now below arena, track player
                    {
                        targetPos = new Vector2(player.Center.X, npc.ai[2] + 1100);
                        Movement(targetPos, 1.2f, 24f);

                        if (Math.Abs(player.Center.X - npc.Center.X) < npc.width / 2 &&
                            ++npc.ai[1] > (npc.localAI[2] == 1 ? 30 : 60))        //in position under player
                        {
                            Main.PlaySound(SoundID.Item92, npc.Center);

                            npc.ai[3]++;
                            npc.ai[1]     = 0;
                            npc.netUpdate = true;
                        }
                    }
                    else     //drop below arena
                    {
                        npc.velocity.X *= 0.95f;
                        npc.velocity.Y += 0.6f;
                    }
                }
                else
                {
                    npc.velocity.X = 0;
                    npc.velocity.Y = -36f;

                    if (++npc.ai[1] > 1)     //spawn pixies
                    {
                        npc.ai[1]      = 0;
                        npc.localAI[0] = npc.localAI[0] == 1 ? -1 : 1;     //alternate sides
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <LesserFairy>(), npc.whoAmI, Target: npc.target);
                            if (n != Main.maxNPCs)
                            {
                                Main.npc[n].velocity    = 5f * Vector2.UnitX.RotatedBy(Math.PI * (Main.rand.NextDouble() - 0.5));
                                Main.npc[n].velocity.X *= npc.localAI[0];

                                if (Main.netMode == NetmodeID.Server)
                                {
                                    NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                                }
                            }
                        }
                    }

                    if (npc.Center.Y < player.Center.Y - 600)     //dash ended
                    {
                        npc.velocity.Y *= -0.25f;
                        npc.localAI[0]  = 0f;

                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.ai[3]     = 0;
                        npc.netUpdate = true;
                    }
                }
                break;

            case 3:
                goto case 0;

            case 4:     //beetle swarm
                npc.velocity *= 0.9f;

                if (npc.ai[3] == 0)
                {
                    npc.ai[3] = npc.Center.X < player.Center.X ? -1 : 1;
                }

                if (++npc.ai[2] > (npc.localAI[2] == 1 ? 40 : 60))
                {
                    npc.ai[2] = 0;
                    Main.PlaySound(SoundID.Item92, npc.Center);

                    if (npc.localAI[0] > 0)
                    {
                        npc.localAI[0] = -1;
                    }
                    else
                    {
                        npc.localAI[0] = 1;
                    }

                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Vector2 projTarget = npc.Center;
                        projTarget.X += 1200 * npc.ai[3];
                        projTarget.Y += 1200 * -npc.localAI[0];
                        int max       = npc.localAI[2] == 1 ? 30 : 20;
                        int increment = npc.localAI[2] == 1 ? 180 : 250;
                        projTarget.Y += Main.rand.NextFloat(increment);
                        for (int i = 0; i < max; i++)
                        {
                            projTarget.Y += increment * npc.localAI[0];
                            Vector2 speed = (projTarget - npc.Center) / 40;
                            float   ai0   = (npc.localAI[2] == 1 ? 8 : 6) * -npc.ai[3]; //x speed of beetles
                            float   ai1   = 6 * -npc.localAI[0];                        //y speed of beetles
                            Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType <ChampionBeetle>(), npc.damage / 4, 0f, Main.myPlayer, ai0, ai1);
                        }
                    }
                }

                if (++npc.ai[1] > 440)
                {
                    npc.localAI[0] = 0;

                    npc.TargetClosest();
                    npc.ai[0]++;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                break;

            case 5:
                goto case 0;

            case 6:
                npc.velocity *= 0.98f;

                if (++npc.ai[2] > (npc.localAI[2] == 1 ? 45 : 60))
                {
                    if (++npc.ai[3] > (npc.localAI[2] == 1 ? 4 : 7))     //spray fireballs that home down
                    {
                        npc.ai[3] = 0;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            //spawn anywhere above self
                            Vector2 target       = new Vector2(Main.rand.NextFloat(1000), 0).RotatedBy(Main.rand.NextDouble() * -Math.PI);
                            Vector2 speed        = 2 * target / 60;
                            float   acceleration = -speed.Length() / 60;
                            Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType <LifeFireball>(),
                                                     npc.damage / 4, 0f, Main.myPlayer, 60f, acceleration);
                        }
                    }

                    if (npc.ai[2] > (npc.localAI[2] == 1 ? 120 : 100))
                    {
                        npc.netUpdate = true;
                        npc.ai[2]     = 0;
                    }
                }

                if (++npc.ai[1] > 480)
                {
                    npc.TargetClosest();
                    npc.ai[0]++;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                break;

            case 7:
                goto case 0;

            case 8:
                goto case 2;

            case 9:     //deathray spin
                npc.velocity *= 0.95f;

                npc.ai[3] += (float)Math.PI * 2 / (npc.localAI[2] == 1 ? -300 : 360);

                if (--npc.ai[2] < 0)
                {
                    npc.ai[2] = 59;
                    if (npc.ai[1] > 90)     //longer telegraph on first attack
                    {
                        npc.localAI[1] = npc.localAI[1] == 0 ? 1 : 0;
                    }

                    if (npc.ai[1] < 420 && Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        int type = npc.localAI[1] == 0 ? ModContent.ProjectileType <LifeDeathraySmall>() : ModContent.ProjectileType <LifeDeathray>();
                        int max  = npc.localAI[2] == 1 ? 6 : 4;
                        for (int i = 0; i < max; i++)
                        {
                            float offset = (float)Math.PI * 2 / max * i;
                            Projectile.NewProjectile(npc.Center, Vector2.UnitX.RotatedBy(npc.ai[3] + offset),
                                                     type, npc.damage / 4, 0f, Main.myPlayer, offset, npc.whoAmI);
                        }
                    }
                }

                if (++npc.ai[1] > 450)
                {
                    npc.TargetClosest();
                    npc.ai[0]++;
                    npc.ai[1]      = 0;
                    npc.ai[2]      = 0;
                    npc.ai[3]      = 0;
                    npc.localAI[1] = 0;
                    npc.netUpdate  = true;
                }
                break;

            case 10:
                goto case 0;

            case 11:     //cactus mines
                npc.velocity *= 0.98f;

                if (++npc.ai[2] > (npc.localAI[2] == 1 ? 75 : 100))
                {
                    if (++npc.ai[3] > 5)     //spray mines that home down
                    {
                        npc.ai[3] = 0;

                        Main.PlaySound(SoundID.Item12, npc.Center);

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Vector2 target = player.Center - npc.Center;
                            target.X += Main.rand.Next(-75, 76);
                            target.Y += Main.rand.Next(-75, 76);

                            Vector2 speed        = 2 * target / 90;
                            float   acceleration = -speed.Length() / 90;

                            Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType <CactusMine>(),
                                                     npc.damage / 4, 0f, Main.myPlayer, 0f, acceleration);
                        }
                    }

                    if (npc.ai[2] > 130)
                    {
                        npc.netUpdate = true;
                        npc.ai[2]     = 0;
                    }
                }

                if (++npc.ai[1] > 480)
                {
                    npc.TargetClosest();
                    npc.ai[0]++;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                break;

            default:
                npc.ai[0] = 0;
                goto case 0;
            }

            for (int i = 0; i < 3; i++)
            {
                Vector2 origin = npc.Center - new Vector2(300, 200) * npc.scale;
                int     d      = Dust.NewDust(origin, (int)(600 * npc.scale), (int)(400 * npc.scale), 87, 0f, 0f, 0, default(Color), 1.5f);
                Main.dust[d].noGravity = true;
                Main.dust[d].velocity *= 4f;
            }

            //npc.rotation += (float)Math.PI * 2 / 90;

            if (npc.velocity.Length() > 1f && npc.ai[0] != 2 && npc.ai[0] != 8 && npc.HasValidTarget)
            {
                npc.position.Y += player.velocity.Y / 3f;
            }
        }
Ejemplo n.º 30
0
 public void OffCooldownMessage(string abilityName)
 {
     CombatText.NewText(player.getRect(), ExperienceAndClasses.MESSAGE_COLOUR_OFF_COOLDOWN, abilityName + " Ready!");
 }