コード例 #1
0
        //public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        //{
        //    target.AddBuff(BuffID.OnFire, 120);
        //}

        public override void AI()
        {
            if (++projectile.frameCounter >= 3)
            {
                projectile.frameCounter = 0;
                if (++projectile.frame >= 2)
                {
                    projectile.frame = 0;
                }
            }

            if (!orbSpawn && projectile.owner == Main.myPlayer)
            {
                int maxOrbs = 8;
                for (int i = 0; i < maxOrbs; i++)
                {
                    float      radians = (360f / (float)maxOrbs) * i * (float)(Math.PI / 180);
                    Projectile orb     = EternalGlobalProjectile.NewProjectileDirectSafe(projectile.Center, Vector2.Zero, ModContent.ProjectileType <RadiantOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 5, radians);
                    orb.localAI[0] = projectile.whoAmI;
                }

                orbSpawn = true;
            }

            if (Main.player[projectile.owner].HeldItem.type == ModContent.ItemType <Items.Weapons.Magic.BookofRadiance>())
            {
                projectile.damage    = Main.player[projectile.owner].GetWeaponDamage(Main.player[projectile.owner].HeldItem);
                projectile.knockBack = Main.player[projectile.owner].GetWeaponKnockback(Main.player[projectile.owner].HeldItem, Main.player[projectile.owner].HeldItem.knockBack);
            }

            float maxDetectRadius = 400f;
            float projSpeed       = 18.6f;

            NPC closestNPC = FindClosestNPC(maxDetectRadius);

            if (closestNPC == null)
            {
                return;
            }

            projectile.velocity = (closestNPC.Center - projectile.Center).SafeNormalize(Vector2.Zero) * projSpeed;
        }
コード例 #2
0
        public override void AI()
        {
            if (!yoyoSpawn && projectile.owner == Main.myPlayer)
            {
                int maxYoyos = 8;
                for (int i = 0; i < maxYoyos; i++)
                {
                    float      radians = (360f / (float)maxYoyos) * i * (float)(Math.PI / 180);
                    Projectile yoyo    = EternalGlobalProjectile.NewProjectileDirectSafe(projectile.Center, Vector2.Zero, ModContent.ProjectileType <TheWheelOrbit>(), projectile.damage, projectile.knockBack, projectile.owner, 5, radians);
                    yoyo.localAI[0] = projectile.whoAmI;
                }

                yoyoSpawn = true;
            }


            if (Main.player[projectile.owner].HeldItem.type == ModContent.ItemType <Items.Weapons.Melee.TheTrinity>())
            {
                projectile.damage    = Main.player[projectile.owner].GetWeaponDamage(Main.player[projectile.owner].HeldItem);
                projectile.knockBack = Main.player[projectile.owner].GetWeaponKnockback(Main.player[projectile.owner].HeldItem, Main.player[projectile.owner].HeldItem.knockBack);
            }
        }