Ejemplo n.º 1
0
        public override void AI()
        {
            projectile.timeLeft = 9999;
            projectile.hostile  = false;
            projectile.friendly = true;
            Lighting.AddLight(projectile.Center, 0.9f, 0.9f, 0.9f);
            Player owner = Main.player[projectile.owner];

            if (projectile.ai[0] != 2)
            {
                if (!owner.active || owner.dead || owner.ghost)
                {
                    projectile.ai[0] = 3;
                }
                if (owner.HeldItem.type != ModContent.ItemType <DaCapoItem>())
                {
                    projectile.ai[0] = 3;
                }
                if (!DaCapoPlayer.RightClickChannel(owner))
                {
                    projectile.ai[0] = 3;
                }
            }
            projectile.Center = owner.Center;
            if (projectile.ai[0] == 0)             //生成
            {
                projectile.rotation += 0.01f * RotDir;
                projectile.ai[1]++;
                projectile.scale = projectile.ai[1] / 40;
                if (projectile.ai[1] > 40)
                {
                    projectile.ai[0] = 1;
                    projectile.ai[1] = 0;
                }
            }
            else if (projectile.ai[0] == 1)            //正常
            {
                projectile.rotation += 0.01f * RotDir;
                projectile.scale     = 1;
            }
            else if (projectile.ai[0] == 2)         //终曲 0-30缩小 30-90拉伸
            {
                projectile.extraUpdates = 1;
                projectile.ai[1]++;
                if (projectile.ai[1] < 30)
                {
                    //projectile.rotation += 0.02f * RotDir;
                    projectile.scale = 1 - (projectile.ai[1] / 30f * 0.01f);
                }
                if (projectile.ai[1] >= 30)
                {
                    projectile.scale   = 0.9f;
                    projectile.Opacity = (90f - projectile.ai[1]) / 60f;
                    //Main.NewText(projectile.Opacity);
                    //Main.NewText(projectile.ai[1]);
                    if (projectile.ai[1] > 90)
                    {
                        projectile.Kill();
                        return;
                    }
                }
            }
            else if (projectile.ai[0] == 3)             //终止
            {
                projectile.rotation += 0.01f * RotDir;
                projectile.ai[1]     = 0;
                projectile.scale    -= 0.05f;
                if (projectile.scale < 0)
                {
                    projectile.scale = 0;
                    projectile.Kill();
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        public override void AI()
        {
            projectile.timeLeft = 9999;
            Lighting.AddLight(projectile.Center, 0.9f, 0.9f, 0.9f);
            Player owner = Main.player[projectile.owner];

            if (!owner.active || owner.dead || owner.ghost)
            {
                projectile.Kill();
                return;
            }
            if (owner.HeldItem.type != ModContent.ItemType <DaCapoItem>())
            {
                projectile.Kill();
                return;
            }
            if (!RightClickChannel(owner))
            {
                projectile.Kill();
                return;
            }
            owner.itemTime      = 2;
            owner.itemAnimation = 2;
            owner.heldProj      = projectile.whoAmI;
            int   dir = owner.direction;
            float rot = dir < 0 ? MathHelper.Pi : 0;

            owner.itemRotation = (float)Math.Atan2(rot.ToRotationVector2().Y *dir * 3, rot.ToRotationVector2().X *dir);
            owner.velocity     = Vector2.Zero;
            projectile.Center  = owner.Center - new Vector2(owner.direction, 0);

            projectile.ai[0]++;
            DaCapoPlayer daCapoPlayer = owner.GetModPlayer <DaCapoPlayer>();

            if (projectile.ai[0] < DaCapoTime.Movement1Begin)          //准备时无敌
            {
                daCapoPlayer.CurrentPlayingMusic = MusicType.Beginning;
                owner.GetModPlayer <DaCapoPlayer>().DaCapoImmune = DamageType.All;
            }
            else if (projectile.ai[0] < DaCapoTime.Movement2Begin)     //第一乐章免疫弹幕
            {
                daCapoPlayer.CurrentPlayingMusic = MusicType.Movement1;
                owner.GetModPlayer <DaCapoPlayer>().DaCapoImmune = DamageType.Projectile;
                owner.AddBuff(ModContent.BuffType <DaCapoMovement1Buff>(), 2);
            }
            else if (projectile.ai[0] < DaCapoTime.Movement3Begin)     //第二乐章免疫近战
            {
                daCapoPlayer.CurrentPlayingMusic = MusicType.Movement2;
                owner.GetModPlayer <DaCapoPlayer>().DaCapoImmune = DamageType.Melee;
                owner.AddBuff(ModContent.BuffType <DaCapoMovement2Buff>(), 2);
            }
            else if (projectile.ai[0] < DaCapoTime.Movement4Begin)       //第三乐章免疫弹幕
            {
                daCapoPlayer.CurrentPlayingMusic = MusicType.Movement3;
                owner.GetModPlayer <DaCapoPlayer>().DaCapoImmune = DamageType.Projectile;
                owner.AddBuff(ModContent.BuffType <DaCapoMovement3Buff>(), 2);
            }
            else if (projectile.ai[0] < DaCapoTime.FinalBegin)        //第四乐章免疫近战
            {
                daCapoPlayer.CurrentPlayingMusic = MusicType.Movement4;
                owner.GetModPlayer <DaCapoPlayer>().DaCapoImmune = DamageType.Melee;
                owner.AddBuff(ModContent.BuffType <DaCapoMovement4Buff>(), 2);
            }
            else                                     //终曲全免
            {
                owner.GetModPlayer <DaCapoPlayer>().DaCapoImmune = DamageType.All;
                if (projectile.ai[0] < DaCapoTime.FinalDamage)
                {
                    owner.GetModPlayer <CurtainPlayer>().ShakeScreen = true;
                    daCapoPlayer.CurrentPlayingMusic = MusicType.Final1;
                    owner.AddBuff(ModContent.BuffType <DaCapoFinalBuff>(), 2);
                }
                else if (projectile.ai[0] < DaCapoTime.EndClap)
                {
                    owner.GetModPlayer <CurtainPlayer>().ShakeScreen = true;
                    daCapoPlayer.CurrentPlayingMusic = MusicType.Final2;
                    owner.AddBuff(ModContent.BuffType <DaCapoFinalBuff>(), 2);
                }
                else
                {
                    daCapoPlayer.CurrentPlayingMusic = MusicType.End;
                }
            }

            if (projectile.ai[0] == DaCapoTime.Movement1Begin - 120)
            {
                Projectile.NewProjectile(owner.Bottom + new Vector2(-100, 5), Vector2.Zero, ModContent.ProjectileType <FirstChair>(), 0, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement1Begin)    //第一乐章     //150
            {
                CurtainPlayer.SetTitle(1);
                Projectile.NewProjectile(owner.Center, Vector2.Zero, ModContent.ProjectileType <MusicRing1>(), projectile.damage, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement2Begin - 120)
            {
                Projectile.NewProjectile(owner.Bottom + new Vector2(100, 5), Vector2.Zero, ModContent.ProjectileType <SecondChair>(), 0, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement2Begin)    //第二乐章
            {
                CurtainPlayer.SetTitle(2);
                Projectile.NewProjectile(owner.Center, Vector2.Zero, ModContent.ProjectileType <MusicRing2>(), projectile.damage, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement3Begin - 120)
            {
                Projectile.NewProjectile(owner.Bottom + new Vector2(-60, 5), Vector2.Zero, ModContent.ProjectileType <ThirdChair>(), 0, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement3Begin)     //第三乐章
            {
                CurtainPlayer.SetTitle(3);
                Projectile.NewProjectile(owner.Center, Vector2.Zero, ModContent.ProjectileType <MusicRing3>(), projectile.damage, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement4Begin - 120)
            {
                Projectile.NewProjectile(owner.Bottom + new Vector2(60, 5), Vector2.Zero, ModContent.ProjectileType <FourthChair>(), 0, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.Movement4Begin)       //第四乐章
            {
                CurtainPlayer.SetTitle(4);
                Projectile.NewProjectile(owner.Center, Vector2.Zero, ModContent.ProjectileType <MusicRing4>(), projectile.damage, 0, owner.whoAmI);
            }
            if (projectile.ai[0] == DaCapoTime.FinalBegin)         //终曲(出现字幕)1
            {
                CurtainPlayer.SetTitle(5);
                //CurtainPlayer.Finale(owner);
                BaseChair.EnterFinal();
            }
            if (projectile.ai[0] == DaCapoTime.FinalDamage)           //音乐开始扭曲2
            {
                CurtainPlayer.Finale(owner);
            }
            if (projectile.ai[0] == DaCapoTime.FinalDamage + 3)           //最终伤害
            {
                int protmp = Projectile.NewProjectile(Main.screenPosition, Vector2.Zero, ModContent.ProjectileType <MusicFinalDamage>(), projectile.damage * 60, 0, owner.whoAmI);
                Main.projectile[protmp].width  = Main.screenWidth;
                Main.projectile[protmp].height = Main.screenHeight;
            }
            if (projectile.ai[0] == DaCapoTime.EndClap)          //闭幕
            {
                CurtainPlayer.FinaleCurtain(owner);
            }
            if (projectile.ai[0] == DaCapoTime.End - 10)           //(提前十帧结束)
            {
                projectile.Kill();
                owner.itemTime      = 10;
                owner.itemAnimation = 10;
                return;
            }
        }