예제 #1
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));
        }
예제 #2
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);
        }
예제 #3
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));
        }
예제 #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);
        }
예제 #5
0
        public override void MidUpdatePlayerNPC()
        {
            if (EnemyA >= 0)
            {
                if (!Main.npc[EnemyA].active)
                {
                    EnemyA = -1;
                    EnemyB = -1;
                    Main.player[FakePlayer1].active = false;
                }
            }
            if (EnemyB >= 0)
            {
                if (!Main.npc[EnemyB].active)
                {
                    EnemyA = -1;
                    EnemyB = -1;
                    Main.player[FakePlayer2].active = false;
                }
            }

            if (EnemyA == -1)
            {
                Main.player[FakePlayer1].active = false;
            }
            if (EnemyB == -1)
            {
                Main.player[FakePlayer2].active = false;
            }

            if (EnemyA >= 0 && EnemyB >= 0)
            {
                FakePlayer.InitDummy1(Main.npc[EnemyA].Center);
                FakePlayer.InitDummy2(Main.npc[EnemyB].Center);
                Main.player[FakePlayer1].dead = false;
                Main.player[FakePlayer2].dead = false;
            }
        }