Ejemplo n.º 1
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>();

            modPlayer.SilverEnchantActive = true;
            modPlayer.AddMinion(Item, player.GetToggleValue("Silver"), ModContent.ProjectileType <SilverSword>(), 20, 0);
        }
        public static void AncientHallowEffect(Player player, Item item)
        {
            FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>();

            modPlayer.AncientHallowEnchantActive = true;
            modPlayer.SilverEnchantActive        = true;

            modPlayer.AddMinion(item, player.GetToggleValue("Hallowed"), ModContent.ProjectileType <HallowSword>(), 50, 2);

            //reflect proj
            if (player.GetToggleValue("HallowS") && !modPlayer.noDodge && !player.HasBuff(ModContent.BuffType <HallowCooldown>()))
            {
                const int focusRadius = 50;

                float num14 = Main.GlobalTimeWrappedHourly % 3f / 3f;
                Color fairyQueenWeaponsColor = GetFairyQueenWeaponsColor(0f, 0f, num14);

                for (int i = 0; i < 20; i++)
                {
                    Vector2 offset = new Vector2();
                    double  angle  = Main.rand.NextDouble() * 2d * Math.PI;
                    offset.X += (float)(Math.Sin(angle) * focusRadius);
                    offset.Y += (float)(Math.Cos(angle) * focusRadius);
                    Dust dust = Main.dust[Dust.NewDust(
                                              player.Center + offset - new Vector2(4, 4), 0, 0,
                                              DustID.WhiteTorch, 0, 0, 100, fairyQueenWeaponsColor, 1f
                                              )];
                    dust.velocity  = player.velocity;
                    dust.noGravity = true;
                }

                Main.projectile.Where(x => x.active && x.hostile && x.damage > 0 && Vector2.Distance(x.Center, player.Center) <= focusRadius + Math.Min(x.width, x.height) / 2 && FargoSoulsUtil.CanDeleteProjectile(x)).ToList().ForEach(x =>
                {
                    for (int i = 0; i < 5; i++)
                    {
                        int dustId = Dust.NewDust(new Vector2(x.position.X, x.position.Y + 2f), x.width, x.height + 5, DustID.WhiteTorch, x.velocity.X * 0.2f, x.velocity.Y * 0.2f, 100, fairyQueenWeaponsColor, 3f);
                        Main.dust[dustId].noGravity = true;
                    }

                    // Set ownership
                    x.hostile  = false;
                    x.friendly = true;
                    x.owner    = player.whoAmI;

                    // Turn around
                    x.velocity *= -1f;

                    // Flip sprite
                    if (x.Center.X > player.Center.X)
                    {
                        x.direction       = 1;
                        x.spriteDirection = 1;
                    }
                    else
                    {
                        x.direction       = -1;
                        x.spriteDirection = -1;
                    }

                    // Don't know if this will help but here it is
                    x.netUpdate = true;

                    player.AddBuff(ModContent.BuffType <HallowCooldown>(), 600);
                });
            }
        }