public CratrosityInstancedCrate(Cratrosity boss, int crateType, float crateDist, int crateRing)
 {
     this.crateType = crateType;
     this.crateDist = crateDist;
     this.crateRing = crateRing;
     this.boss      = boss;
 }
 public override bool CheckDead()
 {
     if (npc.life < 1 && phase > 0)
     {
         npc.life = npc.lifeMax;
         phase   -= 1;
         if (phase < 4 && GetType() == typeof(Cratrosity))
         {
             npc.localAI[3]   = 1;
             npc.frameCounter = 1;
         }
         Cratrosity origin = npc.modNPC as Cratrosity;
         CrateRelease(phase);
         FalseDeath(phase);
         if (origin.postmoonlord > 0)
         {
             //do stuff here
         }
         npc.active = true;
         return(false);
     }
     else
     {
         return(true);
     }
 }
Beispiel #3
0
        public override void AI()
        {
            int        spawnedint = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Cratrogeddon"));
            NPC        spawned    = Main.npc[spawnedint];
            Cratrosity origin     = spawned.modNPC as Cratrosity;

            origin.postmoonlord = 1;
            npc.active          = false;
        }
Beispiel #4
0
        public override bool CheckDead()
        {
            if (npc.life < 1 && phase > 0)
            {
                npc.life = npc.lifeMax;
                phase   -= 1;
                Cratrosity origin = npc.modNPC as Cratrosity;
                CrateRelease(phase);
                FalseDeath(phase);
                if (origin.postmoonlord > 0)
                {
//do stuff here
                }
                npc.active = true;
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #5
0
        public override void AI()
        {
            Player     P      = Main.player[npc.target];
            Cratrosity origin = npc.modNPC as Cratrosity;

            pmlphasetimer--;
            npc.dontTakeDamage = false;
            if (pmlphasetimer > 0)
            {
                //phase 1
                if (pmlphase == 1)
                {
                    OrderOfTheCrates(P);
                    origin.compressvargoal = 4f;
                    origin.themode         = 1;
                    npc.rotation           = Idglib.LookAt(npc.Center, P.Center);
                    npc.dontTakeDamage     = true;
                    npc.velocity           = (npc.velocity * 0.97f);
                    if (pmlphasetimer < 1000)
                    {
                        Vector2 it = new Vector2(P.Center.X - npc.Center.X, P.Center.Y - npc.Center.Y);
                        it.Normalize();
                        if (pmlphasetimer % 120 == 0)
                        {
                            npc.velocity = (it * (30f - pmlphasetimer * 0.02f));
                        }
                        if (pmlphasetimer % 120 < 60 && pmlphasetimer % 20 == 0)
                        {
                            Idglib.Shattershots(npc.Center, npc.Center + it * 50, new Vector2(0, 0), ProjectileID.NanoBullet, 40, (float)6, 80, 3, true, 0, false, 600);
                            Idglib.PlaySound(13, npc.Center, 0);
                        }
                    }
                }
                //phase 2
                if (pmlphase == 2)
                {
                    npc.dontTakeDamage = true;
                    OrderOfTheCrates(P);
                    npc.velocity = (npc.velocity * 0.77f);
                    Vector2 it = new Vector2(P.Center.X - npc.Center.X, P.Center.Y - npc.Center.Y);
                    it.Normalize();
                    npc.velocity += it * 0.3f;
                    npc.Opacity  += (0.1f - npc.Opacity) / 30f;
                }

                //phase 3
                if (pmlphase == 3)
                {
                    npc.ai[0] = 0;

                    if (pmlphasetimer > 1000)
                    {
                        int spawnedint = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CratrosityNight"));
                        spawnedint    = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("CratrosityLight"));
                        pmlphasetimer = 105;
                        Idglib.Chat("Give in to Temptation!", 144, 79, 16);
                    }

                    if (NPC.CountNPCS(mod.NPCType("Cratrosity")) > 0)
                    {
                        pmlphasetimer = 100;
                    }

                    npc.dontTakeDamage = true;
                    base.OrderOfTheCrates(P);
                    npc.velocity = (npc.velocity * 0.77f);
                    Vector2 it = new Vector2(P.Center.X - npc.Center.X, P.Center.Y - npc.Center.Y);
                    it.Normalize();
                    npc.velocity += it * 0.3f;
                    npc.Opacity  += (0.1f - npc.Opacity) / 30f;
                }

                //phase 4
                if (pmlphase > 3)
                {
                    npc.velocity /= 1.5f;
                    if (pmlphasetimer > 1000)
                    {
                        pmlphasetimer = 100;
                    }
                }
            }
            else
            {
                npc.rotation = npc.rotation * 0.85f;
                npc.Opacity += (1f - npc.Opacity) / 30f;
                base.AI();
            }


            if (phase < 1)
            {
                int val;
                val = (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.WoodenCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.IronCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.GoldenCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.DungeonFishingCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.JungleFishingCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + evilcratetype.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.HallowedFishingCrate.ToString()))) +
                      (int)(NPC.CountNPCS(mod.NPCType("CratrosityCrate" + ItemID.FloatingIslandFishingCrate.ToString())));
                val += NPC.CountNPCS(mod.NPCType("CratrosityCrateOfWitheredWeapon")) +
                       NPC.CountNPCS(mod.NPCType("CratrosityCrateOfWitheredArmor")) +
                       NPC.CountNPCS(mod.NPCType("CratrosityCrateOfPoisoned")) +
                       NPC.CountNPCS(mod.NPCType("CratrosityCrateOfSlowing"));
                if (val > 0)
                {
                    npc.dontTakeDamage = true;
                }
            }
        }