Beispiel #1
0
        public override bool?CanBeHitByProjectile(NPC npc, Projectile projectile)
        {
            ProjectileWrapper projectileWrapper = new ProjectileWrapper(projectile);
            NPCWrapper        npcWrapper        = new NPCWrapper(npc);

            Calc.OnHit(projectileWrapper, npcWrapper);
            return(Calc.CanBeHitBy(projectileWrapper, npcWrapper, base.CanBeHitByProjectile(npc, projectile), false));
        }
Beispiel #2
0
        public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            ProjectileWrapper projectileWrapper = new ProjectileWrapper(projectile);
            NPCWrapper        npcWrapper        = new NPCWrapper(npc);

            Calc.OnHit(projectileWrapper, npcWrapper);
            Calc.ModifyHitBy(projectileWrapper, npcWrapper, ref damage, ref knockback, ref crit);
        }
Beispiel #3
0
        public override bool CanBeHitByProjectile(Projectile proj)
        {
            ProjectileWrapper projWrapper   = new ProjectileWrapper(proj);
            PlayerWrapper     playerWrapper = new PlayerWrapper(player);

            Calc.OnHit(projWrapper, playerWrapper);
            return(Calc.CanBeHitBy(projWrapper, playerWrapper, base.CanBeHitByProjectile(proj), false));
        }
        public override bool PreAI(Projectile projectile)
        {
            ProjectileWrapper projWrapper = new ProjectileWrapper(projectile);

            if (projWrapper.GetTeam() == Team.PlayerFriendly || projWrapper.GetTeam() == Team.Unknown)
            {
                ClosestTarget closest = ClosestTarget.Null;
                for (int i = 0; i < Main.maxNPCs; i++)
                {
                    NPC npc = Main.npc[i];
                    if (npc != null && npc.active)
                    {
                        NPCWrapper npcWrapper = new NPCWrapper(npc);
                        if (npc.GetGlobalNPC <NPCTyping>().GetAbility().AttractProjectile(
                                new AbilityLookup.AttractProjectileParameters(projWrapper, npcWrapper)))
                        {
                            ClosestTarget newClosest = new ClosestTarget(npc, projectile);
                            if (newClosest.distance < closest.distance)
                            {
                                closest = newClosest;
                            }
                        }
                    }
                }
                if (closest.id >= 0)
                {
                    ProjectileHome(projectile, closest, Main.npc[closest.id].Center);
                }
            }
            else if (projWrapper.GetTeam() == Team.EnemyNPC)
            {
                ClosestTarget closest = ClosestTarget.Null;
                for (int i = 0; i < Main.maxPlayers; i++)
                {
                    Player player = Main.player[i];
                    if (player != null && player.active)
                    {
                        PlayerWrapper playerWrapper = new PlayerWrapper(player);
                        if (playerWrapper.GetModPlayer <PlayerTyping>().GetAbility().AttractProjectile(
                                new AbilityLookup.AttractProjectileParameters(projWrapper, playerWrapper)))
                        {
                            ClosestTarget newClosest = new ClosestTarget(player, projectile);
                            if (newClosest.distance < closest.distance)
                            {
                                closest = newClosest;
                            }
                        }
                    }
                }
                if (closest.id >= 0)
                {
                    ProjectileHome(projectile, closest, Main.player[closest.id].Center);
                }
            }

            return(base.PreAI(projectile));
        }
Beispiel #5
0
        public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
        {
            float             f             = default;
            ProjectileWrapper projWrapper   = new ProjectileWrapper(proj);
            PlayerWrapper     playerWrapper = new PlayerWrapper(player);

            Calc.OnHit(projWrapper, playerWrapper);
            Calc.ModifyHitBy(projWrapper, playerWrapper, ref damage, ref f, ref crit);
        }
 public AttractProjectileParameters(ProjectileWrapper projectileWrapper, Wrapper target)
 {
     projectile  = projectileWrapper;
     this.target = target;
 }