コード例 #1
0
        public override void AI()
        {
            if (projectile.scale == bigScale)
            {
                glowCounter += 0.02f;
            }

            SafeAI();
            projectile.rotation = 0f;
            projectile.Center   = Main.player[projectile.owner].Center + ((projectile.ai[0] + (Main.GlobalTime * 0.5f) + extraSpin).ToRotationVector2() * MathHelper.Lerp(0, STARTOFFSET, EaseFunction.EaseCubicOut.Ease(offsetLerper)));

            GeomancerPlayer modPlayer = Main.player[projectile.owner].GetModPlayer <GeomancerPlayer>();

            projectile.timeLeft = 2;
            if ((modPlayer.DiamondStored && modPlayer.RubyStored && modPlayer.EmeraldStored && modPlayer.SapphireStored && modPlayer.TopazStored && modPlayer.AmethystStored) || released)
            {
                if (whiteCounter < 1)
                {
                    whiteCounter += 0.007f;
                }

                releaseCounter += 0.01f;
                extraSpin      += Math.Min(releaseCounter, 0.15f);
                released        = true;
                if (releaseCounter > 0.5f)
                {
                    offsetLerper -= 0.015f;
                }
                if (offsetLerper <= 0)
                {
                    Destroy();
                    projectile.active        = false;
                    modPlayer.AmethystStored = false;
                    modPlayer.TopazStored    = false;
                    modPlayer.EmeraldStored  = false;
                    modPlayer.SapphireStored = false;
                    modPlayer.RubyStored     = false;
                    modPlayer.DiamondStored  = false;

                    modPlayer.storedGem = StoredGem.All;
                    modPlayer.allTimer  = 400;

                    for (int i = 0; i < 3; i++)
                    {
                        float angle = Main.rand.NextFloat(6.28f);
                        Dust  dust  = Dust.NewDustPerfect(Main.player[projectile.owner].Center + (angle.ToRotationVector2() * 20), ModContent.DustType <GeoRainbowDust>());
                        dust.scale    = 1f;
                        dust.velocity = angle.ToRotationVector2() * Main.rand.NextFloat() * 4;
                    }
                }
            }
            if (!modPlayer.SetBonusActive)
            {
                projectile.active = false;
            }
        }
コード例 #2
0
        protected override void SetBonus(Player player)
        {
            GeomancerPlayer modPlayer = player.GetModPlayer <GeomancerPlayer>();

            if (!modPlayer.RubyStored && modPlayer.storedGem != StoredGem.All)
            {
                Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <GeoRubyProj>(), 0, 0, player.whoAmI, rotation);
                modPlayer.RubyStored        = true;
                modPlayer.storedGem         = StoredGem.Ruby;
                modPlayer.ActivationCounter = 1f;
            }
        }
コード例 #3
0
        protected override void SetBonus(Player player)
        {
            int healAmount = (int)MathHelper.Min(player.statManaMax2 - player.statMana, 200);

            player.ManaEffect(healAmount);
            player.statMana += healAmount;

            GeomancerPlayer modPlayer = player.GetModPlayer <GeomancerPlayer>();

            if (!modPlayer.SapphireStored && modPlayer.storedGem != StoredGem.All)
            {
                Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <GeoSapphireProj>(), 0, 0, player.whoAmI, rotation);
                modPlayer.SapphireStored    = true;
                modPlayer.storedGem         = StoredGem.Sapphire;
                modPlayer.ActivationCounter = 1f;
            }
        }
コード例 #4
0
        protected override void SetBonus(Player player)
        {
            int healAmount = (int)MathHelper.Min(player.statLifeMax2 - player.statLife, 20);

            player.HealEffect(20);
            player.statLife += healAmount;

            GeomancerPlayer modPlayer = player.GetModPlayer <GeomancerPlayer>();

            if (!modPlayer.EmeraldStored && modPlayer.storedGem != StoredGem.All)
            {
                Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType <GeoEmeraldProj>(), 0, 0, player.whoAmI, rotation);
                modPlayer.EmeraldStored     = true;
                modPlayer.storedGem         = StoredGem.Emerald;
                modPlayer.ActivationCounter = 1f;
            }
        }
コード例 #5
0
        public static void PickOldGem(Player player)
        {
            GeomancerPlayer  modPlayer = player.GetModPlayer <GeomancerPlayer>();
            List <StoredGem> gemTypes  = new List <StoredGem>();

            if (modPlayer.AmethystStored)
            {
                gemTypes.Add(StoredGem.Amethyst);
            }

            if (modPlayer.TopazStored)
            {
                gemTypes.Add(StoredGem.Topaz);
            }

            if (modPlayer.SapphireStored)
            {
                gemTypes.Add(StoredGem.Sapphire);
            }

            if (modPlayer.RubyStored)
            {
                gemTypes.Add(StoredGem.Ruby);
            }

            if (modPlayer.EmeraldStored)
            {
                gemTypes.Add(StoredGem.Emerald);
            }

            if (modPlayer.DiamondStored)
            {
                gemTypes.Add(StoredGem.Diamond);
            }

            if (gemTypes.Count == 0)
            {
                modPlayer.storedGem = StoredGem.None;
            }
            else
            {
                modPlayer.storedGem = gemTypes[Main.rand.Next(gemTypes.Count)];
            }
        }
コード例 #6
0
        private static void SpawnGem(NPC target, GeomancerPlayer modPlayer)
        {
            int        itemType  = -1;
            List <int> itemTypes = new List <int>();

            if (!modPlayer.AmethystStored)
            {
                itemTypes.Add(ModContent.ItemType <GeoAmethyst>());
            }

            if (!modPlayer.TopazStored)
            {
                itemTypes.Add(ModContent.ItemType <GeoTopaz>());
            }

            if (!modPlayer.EmeraldStored)
            {
                itemTypes.Add(ModContent.ItemType <GeoEmerald>());
            }

            if (!modPlayer.SapphireStored)
            {
                itemTypes.Add(ModContent.ItemType <GeoSapphire>());
            }

            if (!modPlayer.RubyStored)
            {
                itemTypes.Add(ModContent.ItemType <GeoRuby>());
            }

            if (!modPlayer.DiamondStored)
            {
                itemTypes.Add(ModContent.ItemType <GeoDiamond>());
            }

            if (itemTypes.Count == 0)
            {
                return;
            }

            itemType = itemTypes[Main.rand.Next(itemTypes.Count)];

            Item.NewItem(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), itemType, 1);
        }
コード例 #7
0
        protected override void SafeAI()
        {
            GeomancerPlayer modPlayer = Main.player[projectile.owner].GetModPlayer <GeomancerPlayer>();

            if (modPlayer.storedGem == StoredGem.Diamond && !released)
            {
                fade = Math.Min(1, modPlayer.timer / 40f);
                if (modPlayer.timer == 1)
                {
                    modPlayer.DiamondStored = false;
                    projectile.active       = false;
                    GeomancerPlayer.PickOldGem(Main.player[projectile.owner]);
                    modPlayer.timer = 1200;
                }
                projectile.scale = bigScale;
            }
            else
            {
                projectile.scale = 0.75f;
            }
        }