Ejemplo n.º 1
0
        public override void PostAI()
        {
            if (Main.hardMode)
            {
                npc.defense = 12;
            }

            ++updateTime;

            if (target == null)
            {
                target = getClosestPlayer();
            }
            else
            {
                Vector2 distance = (target.Center - npc.Center);
                Vector2 rd       = distance;

                if (target.dead || !target.active)
                {
                }

                if (updateTime % 120 > 90)
                {
                    if (updateTime % (Main.expertMode ? 3 : 4) == 2 && TrueEater.FireHostileProj())
                    {
                        fireFeather();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void CustomBehavior()
        {
            if (npc.realLife <= 0)
            {
                return;
            }
            if ((float)Main.npc[npc.realLife].life / (float)Main.npc[npc.realLife].lifeMax < 0.5f)
            {
                npc.knockBackResist = 0.0f;
                ai4 = 1.0f;
            }
            if (ai4 == 1.0f)
            {
                ++ai1;
                if (ai1 >= 10 - (Main.expertMode ? 5 : 0) && TrueEater.FireHostileProj())
                {
                    ai1 = 0;

                    float ang   = npc.rotation + (3.14f / 2.0f) + Main.rand.NextFloat() * 0.25f - 0.125f;
                    float speed = (Main.expertMode ? 0.1f : 1.0f) * (4.5f + Main.rand.NextFloat() * 3.0f);
                    int   p     = Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 32, (float)Math.Cos(ang) * speed, (float)Math.Sin(ang) * speed, ProjectileID.CursedFlameHostile, 50 + Main.rand.Next(26), 4.0f, Main.myPlayer, npc.whoAmI, 0.25f);
                    Main.projectile[p].timeLeft = Main.expertMode ? 360 : 1000;
                }
            }
            if (Main.player[npc.target] != null && Main.player[npc.target].statLife > 0 && !Main.player[npc.target].dead && ai4 < 1.0f)
            {
                Player target = Main.player[npc.target];
                npc.rotation = (ai3 + (float)(Math.Atan2(target.Center.Y - npc.Center.Y, target.Center.X - npc.Center.X) - (3.14f / 2.0f)) * 7.0f) / 8.0f;
                ai3          = npc.rotation;
                ++ai1;
                if (ai1 >= 45 || ai3 >= 0.0f && ai1 >= 15)
                {
                    ++ai2;
                    ai3 -= 0.0675f;
                    if (ai2 >= 10)
                    {
                        ai3 = 1.0f;
                    }
                    if (ai3 >= 0.0f)
                    {
                        ai2 = -1;
                    }
                    ai1 = 0;
                    float ang   = npc.rotation + (3.14f / 2.0f) + Main.rand.NextFloat() * 0.1f - 0.05f;
                    float speed = 10.5f + Main.rand.NextFloat() * 2.0f;
                    int   p     = Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 32, (float)Math.Cos(ang) * speed, (float)Math.Sin(ang) * speed, ProjectileID.CursedFlameHostile, 50 + Main.rand.Next(26), 4.0f, Main.myPlayer, npc.whoAmI, 0.25f);
                    Main.projectile[p].tileCollide = Main.expertMode ? false : true;
                }
            }
        }
Ejemplo n.º 3
0
        public override void PostAI()
        {
            ++updateTime;
            if (target == null || updateTime % 60 == 0)
            {
                target = getClosestPlayer();
            }

            if (attackTime > 0)
            {
                if (attackType == 0)
                {
                    if (attackTime < 180 && Main.rand.Next(5) < 3 && attackTime % 10 == 0)
                    {
                        for (int i = 0; i < 1 + Main.rand.Next(3) + (Main.expertMode ? 4 : Main.rand.Next(4)); ++i)
                        {
                            if (TrueEater.FireHostileProj())
                            {
                                spitSword();
                            }
                        }
                    }
                }
                else if (attackType == 1)
                {
                    npc.velocity.X *= 0.0f;
                    if (attackTime % 60 == 0)
                    {
                        lashTongue();
                    }
                }
            }
            else
            {
                int c = 0;
                if (npc.life / npc.lifeMax < 0.3f)
                {
                    c = 5;
                }

                if (attackTime % 60 == -50 && Main.rand.Next(10 - c) <= 4 + (Main.expertMode ? 2 : 0))
                {
                    attackTime = 200;
                    attackType = 0;
                }
            }

            --attackTime;
        }
Ejemplo n.º 4
0
        public override void CustomBehavior()
        {
            if ((float)npc.life / (float)npc.lifeMax < 0.5f)
            {
                ai1 = 1;
                ai2 = 120;
                npc.knockBackResist = 0.0f;
                ai3 = npc.position.X;
                ai4 = npc.position.Y;
                if (Main.expertMode)
                {
                    speed       = 15.0f;
                    npc.defense = npc.defense * 2;
                }
            }

            if (ai2 >= 0 && ai1 == 1)
            {
                --ai2;
                if (ai2 == 60)
                {
                    ai1 = 2;
                    TrueEater.PlaySound(SoundID.Roar, npc);
                }
                if (ai2 <= 0)
                {
                    ai3 = 0;
                    ai4 = 0;
                }
                else
                {
                    float size   = (float)Math.Abs(120 - ai2) / 4.0f;
                    float offset = (float)ai2 / (size + 1.0f) * 6.28f * 5.0f;                     // Do 5 circles in radians
                    npc.position = new Vector2(ai3, ai4) + new Vector2((float)Math.Cos(offset) * size, (float)Math.Sin(offset) * size);
                }
            }

            if (ai1 == 2)
            {
                float ang   = npc.rotation - (3.14f / 2.0f) + Main.rand.NextFloat() * 0.1f - 0.05f;
                float speed = 0.1f;
                int   p     = Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 32, (float)Math.Cos(ang) * speed, (float)Math.Sin(ang) * speed, ProjectileID.CursedFlameHostile, 50 + Main.rand.Next(26), 4.0f, Main.myPlayer, npc.whoAmI, 0.25f);
            }

            if (Main.player[npc.target] != null && Main.player[npc.target].statLife > 0 && !Main.player[npc.target].dead)
            {
                Player target = Main.player[npc.target];
            }
        }
Ejemplo n.º 5
0
        public override void PostAI()
        {
            ++updateTime;

            if (updateTime % 60 == 0)
            {
                Player targ = getClosestPlayer();

                if ((Math.Abs(targ.Center.X - npc.Center.X) + Math.Abs(targ.Center.Y - npc.Center.Y)) / 2 < 2000)
                {
                    float d = targ.Center.X - npc.Center.X;
                    if (d > 1000.0f)
                    {
                        d = 1000.0f;
                    }
                    if (d < -1000.0f)
                    {
                        d = -1000.0f;
                    }

                    npc.velocity.X += d / (100.0f);
                }
                else
                {
                    npc.velocity.X += Main.rand.NextFloat() * 10.0f - 5.0f;
                }
                npc.velocity.Y += Main.rand.NextFloat() * -10.0f - 10.0f;
            }

            if (updateTime % 60 == 30)
            {
                npc.velocity.Y -= Main.rand.NextFloat() * -10.0f - 10.0f;
            }

            if (updateTime % 60 == 0 && getClosestPlayer() != null && TrueEater.FireHostileProj())
            {
                if (Main.expertMode)
                {
                    fire();
                    fire();
                    fire();
                    fire();
                }

                fire();
            }
        }
Ejemplo n.º 6
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret = 1.0f / 90.0f;

            if (Main.bloodMoon)
            {
                ret += 0.1f;
            }
            if (Main.hardMode)
            {
                ret += 0.1f;
            }
            if (Main.expertMode)
            {
                ret += 10.0f / 90.0f;
            }
            ret /= 2.0f;
            return(spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
        }
Ejemplo n.º 7
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret  = 1.0f / 400.0f;
            int   x    = spawnInfo.spawnTileX;
            int   y    = spawnInfo.spawnTileY;
            bool  flag = false;

            for (int l = -2; l < 2; ++l)
            {
                for (int k = -2; k < 2; ++k)
                {
                    if (Main.tile[x + l, y + k].active())
                    {
                        if (Main.tile[x + l, y + k].type == TileID.IceBlock || Main.tile[x + l, y + k].type == TileID.SnowBlock)
                        {
                            flag = true;
                        }
                    }
                }
            }
            return(flag && Main.player[Main.myPlayer].statLifeMax > 160 ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0.0f);//return spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? ret : 0f;
        }
Ejemplo n.º 8
0
        public override void PostAI()
        {
            if (Main.expertMode)
            {
                npc.defense = 0;
            }

            int count = 0;

            for (int k = 0; k < 200; k++)
            {
                if (Main.npc[k].active && isGoblin(Main.npc[k]))
                {
                    ++count;
                }
            }

            if (count < (Main.expertMode ? 30 : 16) && updateTime % 90 == 0 && Main.rand.Next(5) < 3)
            {
                attackAnim = 60;
            }

            if (attackAnim > 0)
            {
                --attackAnim;

                if (attackAnim == 20 && count < (Main.expertMode ? 40 : 16))
                {
                    TrueEater.PlaySound(15, npc);
                    for (int i = 0; i < (Main.expertMode ? 7 : 3); ++i)
                    {
                        spawnGoblin();
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret = 0.4f;

            return(Main.player[Main.myPlayer].ZoneDesert ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
        }
Ejemplo n.º 10
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret = 1.0f / 1000.0f;

            if (Main.bloodMoon)
            {
                ret += 0.01f;
            }
            if (Main.hardMode)
            {
                ret += 0.01f;
            }
            if (Main.expertMode)
            {
                ret += 19.0f / 1000.0f;
            }
            return(spawnInfo.spawnTileY < Main.rockLayer && Main.invasionType == InvasionID.GoblinArmy && !NPC.AnyNPCs(mod.NPCType("GoblinKing")) ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
        }
Ejemplo n.º 11
0
        public override void PostAI()
        {
            npc.velocity *= 0.975f;
            Vector2 Rpos = npc.Center + new Vector2(32, -30);
            Vector2 Lpos = npc.Center + new Vector2(-32 - 44, -30);

            npc.defense = 30 + (isRightHandAlive() ? 50 : 0) + (isLeftHandAlive() ? 50 : 0);
            float rightAngle = (float)Math.Cos(npc.localAI[2] / 30.0) * 20 - 25;
            float leftAngle  = 180 + (float)Math.Cos((npc.localAI[2] + 7) / 30.0) * 20 + 25;

            npc.ai[2] = getClosestPlayer();

            if (!hasInitialized)
            {
                hasInitialized = true;
                int left = NPC.NewNPC((int)Lpos.X - 90, (int)Lpos.Y - 40, mod.NPCType("IchorBlasterHand"), 0, npc.whoAmI, Lpos.X, Lpos.Y);
                leftHand = left;
                Main.npc[left].localAI[0] = 1;
                Main.npc[left].ai[0]      = npc.whoAmI;
                int right = NPC.NewNPC((int)Rpos.X + 90, (int)Rpos.Y - 40, mod.NPCType("IchorBlasterHand"), 0, npc.whoAmI, Rpos.X, Rpos.Y);
                rightHand             = right;
                Main.npc[right].ai[0] = npc.whoAmI;
            }
            else
            {
                if ((int)npc.ai[2] != -1 && Main.player[(int)npc.ai[2]] != null)
                {
                    Player target = Main.player[(int)npc.ai[2]];
                    ++npc.localAI[3];
                    float   off  = (float)Math.Cos(npc.localAI[3] / (45.0f - (30.0f - (float)npc.defense / 130.0f * 30.0f)));
                    float   off2 = (float)Math.Sin(npc.localAI[3] / (45.0f - (30.0f - (float)npc.defense / 130.0f * 30.0f)));
                    Vector2 targ = (target.Center + new Vector2(off * 90.0f, off2 * 30.0f - 180.0f)) - (npc.Center);

                    if (npc.ai[3] == 0 && Main.rand.Next(30) == 0 && target.position.Y - npc.position.Y > 160.0 && Math.Abs(target.position.X - npc.position.X) < 64)
                    {
                        npc.ai[3] = Main.rand.Next(3) + 1;
                        TrueEater.PlaySound(SoundID.Roar, npc);
                    }

                    if (npc.ai[3] == 1 || npc.ai[3] == 2)
                    {
                        targ         = new Vector2(0, 0);
                        npc.velocity = new Vector2(0.0f, updateTime < 90 ? 0.5f : 0.0f);
                        ++updateTime;
                        float ang = updateTime < 45 ? -updateTime * 1.3f : updateTime > 90 ? 360 - (updateTime - 45) * 4 : (updateTime - 45) * 6 - 60;

                        if (isLeftHandAlive() && npc.ai[3] == 1)
                        {
                            leftAngle = 180 - ang;
                        }
                        else if (npc.ai[3] == 1)
                        {
                            npc.ai[3]  = 3;
                            updateTime = 0;
                        }

                        if (isRightHandAlive() && npc.ai[3] == 2)
                        {
                            rightAngle = ang;
                        }
                        else if (npc.ai[3] == 2)
                        {
                            npc.ai[3]  = 3;
                            updateTime = 0;
                        }

                        if (updateTime >= 120)
                        {
                            npc.ai[3]  = 0;
                            updateTime = 0;
                        }
                    }

                    if (npc.ai[3] == 3)
                    {
                        ++updateTime;
                        if (updateTime % 20 == 0 && updateTime <= 100)
                        {
                            int space = Main.rand.Next(5);
                            for (int i = 0; i < 4; ++i)
                            {
                                if (i != space)
                                {
                                    float ang   = DtoR(250.0f + (110.0f / 4.0f) * i);
                                    float speed = 3.0f + Main.rand.NextFloat() * 2.0f;
                                    int   p     = Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 32, (float)Math.Cos(ang) * speed, (float)Math.Sin(ang) * speed, 288, 50 + Main.rand.Next(26), 4.0f, Main.myPlayer, npc.whoAmI, 0.25f);
                                }
                            }
                        }

                        if (updateTime >= 120)
                        {
                            npc.ai[3]  = 0;
                            updateTime = 0;
                        }
                    }

                    if (target.statLife <= 0)
                    {
                        targ         = new Vector2(0.0f, 3.0f * target.respawnTimer);
                        npc.timeLeft = 1;
                    }

                    npc.velocity = npc.velocity * new Vector2(0.9f, 0.9f) + targ * new Vector2((1 / 120.0f), (1 / 120.0f));
                }
                else
                {
                    npc.ai[2] = getClosestPlayer();
                }
            }

            if (isRightHandAlive())
            {
                NPC right = Main.npc[(int)rightHand];
                if (right != null)
                {
                    ++npc.localAI[2];
                    curRight  = curRight + rightAngle;
                    curRight /= 2.0f;
                    float off = (float)(DtoR(curRight));
                    right.position = Rpos + new Vector2(145 * (float)Math.Cos(off), 160 * (float)Math.Sin(off));
                }
            }
            else
            {
                npc.localAI[0] += 0.1f;
                if (npc.localAI[0] >= 1.0f && TrueEater.FireHostileProj())
                {
                    npc.localAI[0] -= 1.0f;
                    float speed = 2.0f + Main.rand.NextFloat() * 10.0f;
                    int   p     = Projectile.NewProjectile(Rpos.X, Rpos.Y, (float)Math.Cos(DtoR(0 + 30 - Main.rand.Next(60))) * speed, (float)Math.Sin(DtoR(0 + 30 - Main.rand.Next(60))) * speed, 288, 70 + Main.rand.Next(10), 4.0f, Main.myPlayer, npc.whoAmI, 0.25f);
                }
            }

            if (isLeftHandAlive())
            {
                NPC left = Main.npc[(int)leftHand];
                if (left != null)
                {
                    curLeft  = curLeft + leftAngle;
                    curLeft /= 2.0f;
                    float off = (float)(DtoR(curLeft));
                    left.position = Lpos + new Vector2(145 * (float)Math.Cos(off), 160 * (float)Math.Sin(off));
                }
            }
            else
            {
                npc.localAI[1] += 0.1f;
                if (npc.localAI[1] >= 1.0f && TrueEater.FireHostileProj())
                {
                    npc.localAI[1] -= 1.0f;
                    float speed = 2.0f + Main.rand.NextFloat() * 10.0f;
                    Lpos.X += 44;
                    int p = Projectile.NewProjectile(Lpos.X, Lpos.Y, (float)Math.Cos(DtoR(180 + 30 - Main.rand.Next(60))) * speed, (float)Math.Sin(DtoR(180 + 30 - Main.rand.Next(60))) * speed, ProjectileID.GoldenShowerHostile, 70 + Main.rand.Next(10), 4.0f, Main.myPlayer, npc.whoAmI, 0.25f);
                }
            }
        }
Ejemplo n.º 12
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret = 1.0f / 2400.0f;

            if (Main.bloodMoon)
            {
                ret += 0.0125f;
            }
            if (Main.hardMode)
            {
                ret += 0.0025f;
            }
            if (Main.expertMode)
            {
                ret += 59.0f / 2400.0f;
            }
            return(spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime && NPC.downedBoss3 && !NPC.AnyNPCs(mod.NPCType("BigZombie")) ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
        }
Ejemplo n.º 13
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret = 1.0f / 1200.0f;

            return(Main.player[Main.myPlayer].ZoneCorrupt && Main.hardMode ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
        }
Ejemplo n.º 14
0
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            float ret = 1.0f / 300.0f;

            if (Main.bloodMoon)
            {
                ret += 0.0125f;
            }
            if (Main.hardMode)
            {
                ret += 0.0125f;
            }
            if (Main.expertMode)
            {
                ret += 19.0f / 300.0f;
            }
            ret /= 2.0f;
            return(spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime && NPC.downedMechBossAny && Main.hardMode ? ret * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
        }
Ejemplo n.º 15
0
 public override float SpawnChance(NPCSpawnInfo spawnInfo)
 {
     return(spawnInfo.spawnTileY < Main.rockLayer && !Main.dayTime ? 0.15f * TrueEater.GetSpawnModifier(npc, spawnInfo) : 0f);
 }