Пример #1
0
 public override bool PreDraw(Projectile projectile, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Color lightColor)
 {
     drawBackupUsed = false;
     if (IsGuardianProjectile(projectile.whoAmI))
     {
         TerraGuardian tg = GuardianProj[projectile.whoAmI];
         drawBackup     = new PlayerDataBackup(Main.player[projectile.owner], tg);
         drawBackupUsed = true;
     }
     return(true);
 }
Пример #2
0
 public override bool PreAI(Projectile projectile)
 {
     if (SpawnClearOwnership)
     {
         if (IsGuardianProjectile(projectile.whoAmI))
         {
             GuardianProj.Remove(projectile.whoAmI);
         }
         SpawnClearOwnership = false;
     }
     BackupUsed = false;
     if (MyParent > -1 && GuardianProj.ContainsKey(MyParent))
     {
         if (GuardianProj.ContainsKey(projectile.whoAmI))
         {
             GuardianProj[projectile.whoAmI] = GuardianProj[MyParent];
         }
         else
         {
             GuardianProj.Add(projectile.whoAmI, GuardianProj[MyParent]);
         }
         MyParent = -1;
     }
     ProjParent = projectile.whoAmI;
     if (IsGuardianProjectile(projectile.whoAmI))
     {
         if (IsHook(projectile) || (projectile.minion && projectile.minionSlots < 0))
         {
             if (GuardianProj[projectile.whoAmI].KnockedOut)
             {
                 projectile.Kill();
                 return(false);
             }
         }
         TerraGuardian g = GuardianProj[projectile.whoAmI];
         if (projectile.position.X < 5 * 16 || projectile.position.X > (Main.maxTilesX - 5) * 16 ||
             projectile.position.Y < 5 * 16 || projectile.position.Y > (Main.maxTilesY - 5) * 16)
         {
             projectile.Kill();
             GuardianProj.Remove(projectile.whoAmI);
             return(false);
         }
         if (projectile.minion)
         {
             Main.player[projectile.owner].slotsMinions += projectile.minionSlots; //Was -projectile.minionSlots
             if (!g.Active || (g.MinionSlotCount + projectile.minionSlots > g.MaxMinions && projectile.owner == Main.myPlayer))
             {
                 if (projectile.type == 627 || projectile.type == 628)
                 {
                     int byUuid = Projectile.GetByUUID(projectile.owner, projectile.ai[0]);
                     if (byUuid > -1)
                     {
                         Projectile proj = Main.projectile[byUuid];
                         if (proj.type != 625)
                         {
                             proj.localAI[1] = projectile.localAI[1];
                         }
                         proj           = Main.projectile[(int)projectile.localAI[1]];
                         proj.ai[0]     = projectile.ai[0];
                         proj.ai[1]     = 1;
                         proj.netUpdate = true;
                     }
                 }
                 projectile.Kill();
             }
             else
             {
                 projectile.minionPos = g.NumMinions;
                 g.NumMinions++;
                 g.MinionSlotCount += -projectile.minionSlots;
             }
         }
         if (projectile.sentry)
         {
             Main.player[projectile.owner].maxTurrets--;
             if (!g.Active || (g.NumSentries + 1 > g.MaxSentries && projectile.owner == Main.myPlayer))
             {
                 projectile.Kill();
             }
             else
             {
                 g.NumSentries++;
             }
         }
         if (projectile.aiStyle == 62)
         {
             HornetSummonAI(projectile);
             return(false);
         }
         if (projectile.aiStyle == 26)
         {
             GroundPetsAndBabySlimeAI(projectile);
             return(false);
         }
         if (projectile.aiStyle == 52)
         {
             LifeDrainBlobAI(projectile);
             return(false);
         }
         if (projectile.aiStyle == 75)
         {
             PhantasmAI(projectile);
             return(false);
         }
         if (projectile.aiStyle == 100)
         {
             MedusaRayAI(projectile);
             return(false);
         }
         backup     = new PlayerDataBackup(Main.player[projectile.owner], g);
         BackupUsed = true;
     }
     else
     {
         if (IsHook(projectile) || (projectile.minion && projectile.minionSlots > 0))
         {
             if (Main.player[projectile.owner].GetModPlayer <PlayerMod>().KnockedOut)
             {
                 projectile.Kill();
                 return(false);
             }
         }
         if (Main.player[projectile.owner].GetModPlayer <PlayerMod>().Guardian.Active)
         {
             TerraGuardian g = Main.player[projectile.owner].GetModPlayer <PlayerMod>().Guardian;
             //Main.player[projectile.owner].numMinions += g.MaxMinions;
             //Main.player[projectile.owner].maxMinions += g.MaxMinions;
         }
     }
     return(base.PreAI(projectile));
 }