Example #1
0
        public static byte FindClosestHook(On.Terraria.Player.orig_FindClosest orig, Vector2 Position, int Width, int Height)
        {
            if (NewXXXState == "Projectile")
            {
                if (Main.projectile[NewXXXSource].GetGlobalProjectile <ProjectileOwnerGProj>().OwnerWMI != -1)
                {
                    if (Main.projectile[NewXXXSource].GetGlobalProjectile <ProjectileOwnerGProj>().OwnerWMI == EnemyA)
                    {
                        if (EnemyB != -1)
                        {
                            if (Main.npc[EnemyB].active && FakePlayer.Dummy2Available())
                            {
                                return(FakePlayer2);
                            }
                        }
                    }

                    if (Main.projectile[NewXXXSource].GetGlobalProjectile <ProjectileOwnerGProj>().OwnerWMI == EnemyB)
                    {
                        if (EnemyA != -1)
                        {
                            if (Main.npc[EnemyA].active && FakePlayer.Dummy1Available())
                            {
                                return(FakePlayer1);
                            }
                        }
                    }
                }
            }
            return(orig.Invoke(Position, Width, Height));
        }
Example #2
0
        public static NPCUtils.TargetSearchResults SearchForTargetHook(On.Terraria.Utilities.NPCUtils.orig_SearchForTarget_NPC_Vector2_TargetSearchFlag_SearchFilter1_SearchFilter1 orig, NPC searcher, Vector2 position, NPCUtils.TargetSearchFlag flags = NPCUtils.TargetSearchFlag.All, NPCUtils.SearchFilter <Player> playerFilter = null, NPCUtils.SearchFilter <NPC> npcFilter = null)
        {
            if (IsOrBelongsToNPCID(searcher) == EnemyA)
            {
                if (EnemyB != -1)
                {
                    if (Main.npc[EnemyB].active && FakePlayer.Dummy2Available())
                    {
                        Main.player[FakePlayer2].dead   = false;
                        Main.player[FakePlayer2].Center = Main.npc[EnemyB].Center;
                        return(AnotherDD2TargetSelect(searcher, position, FakePlayer2, flags, npcFilter));
                    }
                }
            }

            if (IsOrBelongsToNPCID(searcher) == EnemyB)
            {
                if (EnemyA != -1)
                {
                    if (Main.npc[EnemyA].active && FakePlayer.Dummy1Available())
                    {
                        Main.player[FakePlayer1].dead   = false;
                        Main.player[FakePlayer1].Center = Main.npc[EnemyA].Center;
                        return(AnotherDD2TargetSelect(searcher, position, FakePlayer1, flags, npcFilter));
                    }
                }
            }
            return(orig.Invoke(searcher, position, flags, playerFilter, npcFilter));
        }
Example #3
0
        public static void TargetClosestHook(On.Terraria.NPC.orig_TargetClosest orig, NPC self, bool faceTarget)
        {
            if (IsOrBelongsToNPCID(self) == EnemyA)
            {
                if (EnemyB != -1)
                {
                    if (Main.npc[EnemyB].active && FakePlayer.Dummy2Available())
                    {
                        Main.player[FakePlayer2].dead   = false;
                        Main.player[FakePlayer2].Center = Main.npc[EnemyB].Center;
                        AnotherTargetSelect(self, FakePlayer2, faceTarget);
                        return;
                    }
                }
            }

            if (IsOrBelongsToNPCID(self) == EnemyB)
            {
                if (EnemyA != -1)
                {
                    if (Main.npc[EnemyA].active && FakePlayer.Dummy1Available())
                    {
                        Main.player[FakePlayer1].dead   = false;
                        Main.player[FakePlayer1].Center = Main.npc[EnemyA].Center;
                        AnotherTargetSelect(self, FakePlayer1, faceTarget);
                        return;
                    }
                }
            }
            orig.Invoke(self, faceTarget);
        }
Example #4
0
        //private bool flag = false;

        public override bool PreAI(NPC npc)
        {
            if (EvE.IsOrBelongsToNPCID(npc) == EvE.EnemyA)
            {
                if (EvE.EnemyB != -1)
                {
                    if (Main.npc[EvE.EnemyB].active && FakePlayer.Dummy2Available())
                    {
                        npc.target = EvE.FakePlayer2;
                    }
                    else
                    {
                        if (npc.target == EvE.FakePlayer2)
                        {
                            npc.target = Main.myPlayer;
                        }
                    }
                }
                else
                {
                    if (npc.target == EvE.FakePlayer2)
                    {
                        npc.target = Main.myPlayer;
                    }
                }
            }

            if (EvE.IsOrBelongsToNPCID(npc) == EvE.EnemyB)
            {
                if (EvE.EnemyA != -1)
                {
                    if (Main.npc[EvE.EnemyA].active && FakePlayer.Dummy1Available())
                    {
                        npc.target = EvE.FakePlayer1;
                    }
                    else
                    {
                        if (npc.target == EvE.FakePlayer1)
                        {
                            npc.target = Main.myPlayer;
                        }
                    }
                }
                else
                {
                    if (npc.target == EvE.FakePlayer1)
                    {
                        npc.target = Main.myPlayer;
                    }
                }
            }
            return(true);
        }