예제 #1
0
        public override bool CanUseItem(Item item, Player player)
        {
            if (ClickerSystem.IsClickerWeapon(item))
            {
                ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();
                if (clickerPlayer.clickerAutoClick || player.HasBuff(ModContent.BuffType <AutoClick>()))
                {
                    item.autoReuse = true;
                }
                else
                {
                    item.autoReuse = false;
                }

                if (!clickerPlayer.HasClickEffect(ClickEffect.PhaseReach))
                {
                    //collision
                    Vector2 motherboardPosition = clickerPlayer.setMotherboardPosition;
                    bool    inRange             = Vector2.Distance(Main.MouseWorld, player.Center) < clickerPlayer.ClickerRadiusReal && Collision.CanHit(new Vector2(player.Center.X, player.Center.Y - 12), 1, 1, Main.MouseWorld, 1, 1);
                    bool    inRangeMotherboard  = Vector2.Distance(Main.MouseWorld, motherboardPosition) < clickerPlayer.ClickerRadiusMotherboard && Collision.CanHit(motherboardPosition, 1, 1, Main.MouseWorld, 1, 1);
                    //bool allowMotherboard = player.GetModPlayer<ClickerPlayer>().clickerMotherboardSet && player.altFunctionUse == 2;

                    if (inRange || (inRangeMotherboard && player.altFunctionUse != 2))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(base.CanUseItem(item, player));
        }
예제 #2
0
 public override void GetWeaponCrit(Item item, Player player, ref int crit)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         crit += player.GetModPlayer <ClickerPlayer>().clickerCrit;
     }
 }
예제 #3
0
 /// <summary>
 /// Call in <see cref="ModItem.SetDefaults"/> for a clicker weapon to set its radius color
 /// </summary>
 /// <param name="item">The clicker weapon</param>
 /// <param name="color">The color</param>
 public static void SetColor(Item item, Color color)
 {
     if (ClickerSystem.IsClickerWeapon(item, out ClickerItemCore clickerItem))
     {
         clickerItem.clickerRadiusColor = color;
     }
 }
예제 #4
0
 /// <summary>
 /// Call in <see cref="ModItem.SetDefaults"/> for a clicker weapon to set its specific radius increase (1f means 100 pixel)
 /// </summary>
 /// <param name="item">The clicker weapon</param>
 /// <param name="radius">The additional radius</param>
 public static void SetRadius(Item item, float radius)
 {
     if (ClickerSystem.IsClickerWeapon(item, out ClickerItemCore clickerItem))
     {
         clickerItem.radiusBoost = radius;
     }
 }
예제 #5
0
 /// <summary>
 /// Call in <see cref="ModItem.SetDefaults"/> for a clicker weapon to set its dust type when it's used
 /// </summary>
 /// <param name="item">The clicker weapon</param>
 /// <param name="type">the dust type</param>
 public static void SetDust(Item item, int type)
 {
     if (ClickerSystem.IsClickerWeapon(item, out ClickerItemCore clickerItem))
     {
         clickerItem.clickerDustColor = type;
     }
 }
예제 #6
0
 public override bool CanRoll(Item item)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         return(item.maxStack == 1 && item.damage > 0 && item.useStyle > 0);
     }
     return(false);
 }
예제 #7
0
 public override void Apply(Item item)
 {
     if (ClickerSystem.IsClickerWeapon(item, out ClickerItemCore clickerItem))
     {
         clickerItem.radiusBoostPrefix = radiusBonus;
         clickerItem.clickBoostPrefix  = clickBonus;
     }
 }
예제 #8
0
 public override void ModifyShootStats(Item item, Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         var clickerPlayer = player.GetModPlayer <ClickerPlayer>();
         position = clickerPlayer.clickerPosition;
     }
 }
예제 #9
0
 private bool HasAltFunctionUse(Item item, Player player)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();
         return(clickerPlayer.setMice || clickerPlayer.setMotherboard);
     }
     return(false);
 }
예제 #10
0
 public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();
         flat += clickerPlayer.clickerDamageFlat;
         mult *= clickerPlayer.clickerDamage;
     }
 }
예제 #11
0
 public override bool NewPreReforge(Item item)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         radiusBoostPrefix = 0f;
         clickBoostPrefix  = 0;
     }
     return(base.NewPreReforge(item));
 }
예제 #12
0
 public override int ChoosePrefix(Item item, UnifiedRandom rand)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         if (item.maxStack == 1 && item.useStyle > 0)
         {
             return(rand.Next(ClickerPrefix.ClickerPrefixes));
         }
     }
     return(base.ChoosePrefix(item, rand));
 }
예제 #13
0
        public override bool?CanAutoReuseItem(Item item, Player player)
        {
            if (ClickerSystem.IsClickerWeapon(item))
            {
                ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();
                if (clickerPlayer.clickerAutoClick || player.HasBuff(ModContent.BuffType <AutoClick>()))
                {
                    return(true);
                }
            }

            return(base.CanAutoReuseItem(item, player));
        }
예제 #14
0
        public override void Kill(int timeLeft)
        {
            Player player = Main.player[Projectile.owner];
            Item   item   = player.HeldItem;

            int dustType = 0;

            if (ClickerSystem.IsClickerWeapon(item, out ClickerItemCore clickerItem))
            {
                dustType = clickerItem.clickerDustColor;
            }

            for (int k = 0; k < 5; k++)
            {
                Dust dust = Dust.NewDustDirect(Projectile.Center, 10, 10, dustType, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-3f, 3f), 75, default, 1f);
예제 #15
0
 public override bool AltFunctionUse(Item item, Player player)
 {
     if (ClickerSystem.IsClickerWeapon(item))
     {
         ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();
         if (clickerPlayer.setMice || clickerPlayer.setMotherboard)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     return(base.AltFunctionUse(item, player));
 }
예제 #16
0
 /// <summary>
 /// Call in <see cref="ModItem.SetDefaults"/> for a clicker weapon to add effects to it
 /// </summary>
 /// <param name="item">The clicker weapon</param>
 /// <param name="effects">the effect names</param>
 public static void AddEffect(Item item, IEnumerable <string> effects)
 {
     if (ClickerSystem.IsClickerWeapon(item, out ClickerItemCore clickerItem))
     {
         //Check against already added effects
         List <string> list = clickerItem.itemClickEffects;
         foreach (var name in effects)
         {
             if (!string.IsNullOrEmpty(name) && !list.Contains(name))
             {
                 if (ClickerSystem.IsClickEffect(name, out _))
                 {
                     list.Add(name);
                 }
             }
         }
     }
 }
예제 #17
0
        public override float UseTimeMultiplier(Item item, Player player)
        {
            ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();

            if (ClickerSystem.IsClickerWeapon(item))
            {
                //Current value calculation:
                //Use time 2
                //60 ticks per second
                //
                //Examples:
                //1f => 2 * 1 = 2 => 60 / 2 = 30 cps
                //6f = 2 * 6 = 12 => 60 / 12 = 5 cps
                if (!player.HasBuff(ModContent.BuffType <AutoClick>()))
                {
                    if (player.CanAutoReuseItem(item))
                    {
                        if (clickerPlayer.accHandCream)
                        {
                            return(6f);
                        }
                        else if (clickerPlayer.accIcePack)
                        {
                            return(8f);
                        }
                        else
                        {
                            return(10f);                            //non-clicker induced autoswing
                        }
                    }
                    else
                    {
                        return(1f);                        //No change
                    }
                }
                else
                {
                    return(3f);                    //AutoClick buff
                }
            }

            return(base.UseTimeMultiplier(item, player));
        }
예제 #18
0
        public override bool CanUseItem(Item item, Player player)
        {
            if (ClickerSystem.IsClickerWeapon(item))
            {
                ClickerPlayer clickerPlayer = player.GetModPlayer <ClickerPlayer>();

                if (!clickerPlayer.HasClickEffect(ClickEffect.PhaseReach))
                {
                    clickerPlayer.CheckPositionInRange(Main.MouseWorld, out bool inRange, out bool inRangeMotherboard);
                    if (inRange || (inRangeMotherboard && player.altFunctionUse != 2))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(base.CanUseItem(item, player));
        }
예제 #19
0
        public override float UseTimeMultiplier(Item item, Player player)
        {
            if (ClickerSystem.IsClickerWeapon(item))
            {
                if (!player.HasBuff(ModContent.BuffType <AutoClick>()))
                {
                    if (player.GetModPlayer <ClickerPlayer>().clickerAutoClick || item.autoReuse)
                    {
                        return(0.1f);
                    }
                    else
                    {
                        return(1f);
                    }
                }
                else
                {
                    return(0.15f);
                }
            }

            return(base.UseTimeMultiplier(item, player));
        }
예제 #20
0
 /// <summary>
 /// Helper method that determines when the cursor can be drawn/replaced
 /// </summary>
 public static bool CanDrawCursor(Item item)
 {
     return(!_lastMouseInterface && !_lastMouseText && ClickerSystem.IsClickerWeapon(item));
 }
예제 #21
0
        public override void ModifyTooltips(Item item, List <TooltipLine> tooltips)
        {
            if (ClickerSystem.IsClickerItem(item))
            {
                Player player        = Main.LocalPlayer;
                var    clickerPlayer = player.GetModPlayer <ClickerPlayer>();
                int    index;

                float alpha = Main.mouseTextColor / 255f;

                if (ClickerConfigClient.Instance.ShowClassTags)
                {
                    index = tooltips.FindIndex(tt => tt.mod.Equals("Terraria") && tt.Name.Equals("ItemName"));
                    if (index != -1)
                    {
                        tooltips.Insert(index + 1, new TooltipLine(mod, "ClickerTag", $"-{LangHelper.GetText("Tooltip.ClickerTag")}-")
                        {
                            overrideColor = Main.DiscoColor
                        });
                    }
                }

                if (isClickerDisplayTotal)
                {
                    index = tooltips.FindIndex(tt => tt.mod.Equals("Terraria") && tt.Name.Equals("Tooltip0"));

                    if (index != -1)
                    {
                        string color = (new Color(252, 210, 44) * alpha).Hex3();
                        tooltips.Add(new TooltipLine(mod, "TransformationText", $"{LangHelper.GetText("Tooltip.TotalClicks")}: [c/{color}:{clickerPlayer.clickerTotal}]"));
                    }
                }

                if (ClickerSystem.IsClickerWeapon(item))
                {
                    TooltipLine tooltip = tooltips.Find(tt => tt.mod.Equals("Terraria") && tt.Name.Equals("Damage"));
                    if (tooltip != null)
                    {
                        string number = tooltip.text.Split(' ')[0];
                        tooltip.text = LangHelper.GetText("Tooltip.ClickDamage", number);
                    }

                    //Show the clicker's effects
                    //Then show ones missing through the players enabled effects (respecting overlap, ignoring the currently held clickers effect if its not the same type)
                    List <string> effects = new List <string>(itemClickEffects);
                    foreach (var name in ClickerSystem.GetAllEffectNames())
                    {
                        if (clickerPlayer.HasClickEffect(name, out ClickEffect effect) && !effects.Contains(name))
                        {
                            if (!(player.HeldItem.type != item.type && player.HeldItem.type != ItemID.None && player.HeldItem.GetGlobalItem <ClickerItemCore>().itemClickEffects.Contains(name)))
                            {
                                effects.Add(name);
                            }
                        }
                    }

                    if (effects.Count > 0)
                    {
                        index = tooltips.FindIndex(tt => tt.mod.Equals("Terraria") && tt.Name.Equals("Knockback"));

                        if (index != -1)
                        {
                            //"Auto Select" key: player.controlTorch

                            var    keys = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus[TriggerNames.SmartSelect];
                            string key  = keys.Count == 0 ? null : keys[0];

                            //If has a key, but not pressing it, show the ForMoreInfo text
                            //Otherwise, list all effects

                            bool showDesc = key == null || player.controlTorch;

                            foreach (var name in effects)
                            {
                                if (ClickerSystem.IsClickEffect(name, out ClickEffect effect))
                                {
                                    tooltips.Insert(++index, effect.ToTooltip(clickerPlayer.GetClickAmountTotal(this, name), alpha, showDesc));
                                }
                            }

                            if (!showDesc && ClickerConfigClient.Instance.ShowEffectSuggestion)
                            {
                                //Add ForMoreInfo as the last line
                                index = tooltips.FindLastIndex(tt => tt.mod.Equals("Terraria") && tt.Name.StartsWith("Tooltip"));
                                var ttl = new TooltipLine(mod, "ForMoreInfo", LangHelper.GetText("Tooltip.ForMoreInfo", key))
                                {
                                    overrideColor = Color.Gray
                                };

                                if (index != -1)
                                {
                                    tooltips.Insert(++index, ttl);
                                }
                                else
                                {
                                    tooltips.Add(ttl);
                                }
                            }
                        }
                    }
                }


                if (item.prefix < PrefixID.Count || !ClickerPrefix.ClickerPrefixes.Contains(item.prefix))
                {
                    return;
                }

                int ttindex = tooltips.FindLastIndex(t => (t.mod == "Terraria" || t.mod == mod.Name) && (t.isModifier || t.Name.StartsWith("Tooltip") || t.Name.Equals("Material")));
                if (ttindex != -1)
                {
                    if (radiusBoostPrefix != 0)
                    {
                        TooltipLine tt = new TooltipLine(mod, "PrefixClickerRadius", (radiusBoostPrefix > 0 ? "+" : "") + LangHelper.GetText("Prefix.PrefixClickerRadius.Tooltip", (int)((radiusBoostPrefix / 2) * 100)))
                        {
                            isModifier    = true,
                            isModifierBad = radiusBoostPrefix < 0
                        };
                        tooltips.Insert(++ttindex, tt);
                    }
                    if (radiusBoostPrefix != 0)
                    {
                        TooltipLine tt = new TooltipLine(mod, "PrefixClickBoost", (clickBoostPrefix < 0 ? "" : "+") + LangHelper.GetText("Prefix.PrefixClickBoost.Tooltip", clickBoostPrefix))
                        {
                            isModifier    = true,
                            isModifierBad = clickBoostPrefix > 0
                        };
                        tooltips.Insert(++ttindex, tt);
                    }
                }
            }
        }
예제 #22
0
        public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            if (ClickerSystem.IsClickerWeapon(item))
            {
                var clickerPlayer = player.GetModPlayer <ClickerPlayer>();
                if (player.altFunctionUse == 2)
                {
                    //Right click
                    if (clickerPlayer.setAbilityDelayTimer <= 0)
                    {
                        //Mice armor
                        if (clickerPlayer.setMice)
                        {
                            bool canTeleport = false;
                            if (!clickerPlayer.HasClickEffect(ClickEffect.PhaseReach))
                            {
                                //collision
                                if (Vector2.Distance(Main.MouseWorld, player.Center) < clickerPlayer.ClickerRadiusReal && Collision.CanHitLine(new Vector2(player.Center.X, player.Center.Y - 12), 1, 1, Main.MouseWorld, 1, 1))
                                {
                                    canTeleport = true;
                                }
                            }
                            else
                            {
                                canTeleport = true;
                            }

                            if (canTeleport)
                            {
                                Main.PlaySound(SoundID.Item, (int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 115);
                                Main.SetCameraLerp(0.1f, 0);
                                player.Center = Main.MouseWorld;
                                NetMessage.SendData(MessageID.PlayerControls, number: player.whoAmI);
                                player.fallStart = (int)(player.position.Y / 16f);
                                clickerPlayer.setAbilityDelayTimer = 60;

                                float num102 = 50f;
                                int   num103 = 0;
                                while ((float)num103 < num102)
                                {
                                    Vector2 vector12 = Vector2.UnitX * 0f;
                                    vector12 += -Vector2.UnitY.RotatedBy((double)((float)num103 * (6.28318548f / num102)), default(Vector2)) * new Vector2(2f, 2f);
                                    vector12  = vector12.RotatedBy((double)Vector2.Zero.ToRotation(), default(Vector2));
                                    int num104 = Dust.NewDust(Main.MouseWorld, 0, 0, ModContent.DustType <MiceDust>(), 0f, 0f, 0, default(Color), 2f);
                                    Main.dust[num104].noGravity = true;
                                    Main.dust[num104].position  = Main.MouseWorld + vector12;
                                    Main.dust[num104].velocity  = Vector2.Zero * 0f + vector12.SafeNormalize(Vector2.UnitY) * 4f;
                                    int num = num103;
                                    num103 = num + 1;
                                }
                            }
                        }
                        else if (clickerPlayer.setMotherboard)
                        {
                            Main.PlaySound(SoundID.Camera, (int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 0);
                            clickerPlayer.SetMotherboardRelativePosition(Main.MouseWorld);
                            clickerPlayer.setAbilityDelayTimer = 60;
                        }
                    }
                    return(false);
                }

                //Base
                Main.PlaySound(SoundID.MenuTick, player.position);
                if (!player.HasBuff(ModContent.BuffType <AutoClick>()))
                {
                    clickerPlayer.Click();
                }

                //TODO dire: maybe "PreShoot" hook wrapping around the next NewProjectile

                //Spawn normal click damage
                Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0f, 0f, type, damage, knockBack, player.whoAmI);

                //Precursor armor set bonus
                if (clickerPlayer.setPrecursor)
                {
                    Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0f, 0f, ModContent.ProjectileType <PrecursorPro>(), (int)(damage * 0.25f), knockBack, player.whoAmI);
                }

                //Overclock armor set bonus
                if (clickerPlayer.clickAmount % 100 == 0 && clickerPlayer.setOverclock)
                {
                    Main.PlaySound(2, (int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 94);
                    player.AddBuff(ModContent.BuffType <OverclockBuff>(), 180, false);
                    for (int i = 0; i < 25; i++)
                    {
                        int num6 = Dust.NewDust(player.position, 20, 20, 90, 0f, 0f, 150, default(Color), 1.35f);
                        Main.dust[num6].noGravity = true;
                        Main.dust[num6].velocity *= 0.75f;
                        int  num7 = Main.rand.Next(-50, 51);
                        int  num8 = Main.rand.Next(-50, 51);
                        Dust dust = Main.dust[num6];
                        dust.position.X = dust.position.X + (float)num7;
                        Dust dust2 = Main.dust[num6];
                        dust2.position.Y           = dust2.position.Y + (float)num8;
                        Main.dust[num6].velocity.X = -(float)num7 * 0.075f;
                        Main.dust[num6].velocity.Y = -(float)num8 * 0.075f;
                    }
                }

                bool autoClick = player.HasBuff(ModContent.BuffType <AutoClick>());
                bool overclock = player.HasBuff(ModContent.BuffType <OverclockBuff>());

                foreach (var name in ClickerSystem.GetAllEffectNames())
                {
                    if (clickerPlayer.HasClickEffect(name, out ClickEffect effect))
                    {
                        //Find click amount
                        int  clickAmountTotal = clickerPlayer.GetClickAmountTotal(this, name);
                        bool reachedAmount    = clickerPlayer.clickAmount % clickAmountTotal == 0;

                        if (!autoClick && (reachedAmount || overclock))
                        {
                            effect.Action?.Invoke(player, position, type, damage, knockBack);
                        }
                    }
                }

                return(false);
            }
            return(base.Shoot(item, player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack));
        }
예제 #23
0
        public override bool Shoot(Item item, Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
        {
            if (ClickerSystem.IsClickerWeapon(item))
            {
                var clickerPlayer = player.GetModPlayer <ClickerPlayer>();

                //Base
                SoundEngine.PlaySound(SoundID.MenuTick, player.position);
                clickerPlayer.AddClick();

                bool hasAutoClick = player.HasBuff(ModContent.BuffType <AutoClick>());
                if (!hasAutoClick)
                {
                    clickerPlayer.AddClickAmount();
                }

                //TODO dire: maybe "PreShoot" hook wrapping around the next NewProjectile

                //Spawn normal click damage
                int projClick = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI);

                if (clickerPlayer.accEnlarge)
                {
                    Projectile extendedPro = Main.projectile[projClick];
                    extendedPro.height    = extendedPro.height * 2;
                    extendedPro.width     = extendedPro.width * 2;
                    extendedPro.position -= new Vector2(extendedPro.width / 4, extendedPro.height / 4);

                    Vector2 vec    = position;
                    float   num102 = 30f;
                    int     num103 = 0;
                    while ((float)num103 < num102)
                    {
                        Vector2 vector12 = Vector2.UnitX * 0f;
                        vector12 += -Vector2.UnitY.RotatedBy((double)((float)num103 * (6.28318548f / num102)), default(Vector2)) * new Vector2(30f, 30f);
                        vector12  = vector12.RotatedBy((double)player.velocity.ToRotation(), default(Vector2));
                        int num104 = Dust.NewDust(vec, 0, 0, 205, 0f, 0f, 0, default(Color), 1f);
                        Main.dust[num104].noGravity = true;
                        Main.dust[num104].position  = vec + vector12;
                        Main.dust[num104].velocity  = player.velocity * 0f + vector12.SafeNormalize(Vector2.UnitY) * 1f;
                        int num = num103;
                        num103 = num + 1;
                    }
                }

                //Portable Particle Accelerator acc
                if (clickerPlayer.IsPortableParticleAcceleratorActive)
                {
                    Vector2 vec    = position;
                    float   num102 = 25f;
                    int     num103 = 0;
                    while ((float)num103 < num102)
                    {
                        Vector2 vector12 = Vector2.UnitX * 0f;
                        vector12 += -Vector2.UnitY.RotatedBy((double)((float)num103 * (6.28318548f / num102)), default(Vector2)) * new Vector2(4f, 4f);
                        vector12  = vector12.RotatedBy((double)player.velocity.ToRotation(), default(Vector2));
                        int num104 = Dust.NewDust(vec, 0, 0, 229, 0f, 0f, 0, default(Color), 1f);
                        Main.dust[num104].noGravity = true;
                        Main.dust[num104].position  = vec + vector12;
                        Main.dust[num104].velocity  = player.velocity * 0f + vector12.SafeNormalize(Vector2.UnitY) * 1f;
                        int num = num103;
                        num103 = num + 1;
                    }
                }

                //Mouse Trap
                if (clickerPlayer.accMouseTrap)
                {
                    if (Main.rand.NextBool(50))
                    {
                        SoundEngine.PlaySound(2, (int)player.position.X, (int)player.position.Y, 153);
                        player.AddBuff(BuffID.Cursed, 60, false);
                    }
                }

                //Hot Keychain
                if (clickerPlayer.accHotKeychain2)
                {
                    int damageAmount = Math.Max(1, (int)(damage * 0.25f));
                    Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType <HotKeychainPro>(), damageAmount, knockback, player.whoAmI);
                }

                int overclockType = ModContent.BuffType <OverclockBuff>();
                //Overclock armor set bonus
                if (clickerPlayer.clickAmount % 100 == 0 && clickerPlayer.setOverclock)
                {
                    SoundEngine.PlaySound(2, (int)position.X, (int)position.Y, 94);
                    player.AddBuff(overclockType, 180, false);
                    for (int i = 0; i < 25; i++)
                    {
                        int num6 = Dust.NewDust(player.position, 20, 20, 90, 0f, 0f, 150, default(Color), 1.35f);
                        Main.dust[num6].noGravity = true;
                        Main.dust[num6].velocity *= 0.75f;
                        int  num7 = Main.rand.Next(-50, 51);
                        int  num8 = Main.rand.Next(-50, 51);
                        Dust dust = Main.dust[num6];
                        dust.position.X = dust.position.X + (float)num7;
                        Dust dust2 = Main.dust[num6];
                        dust2.position.Y           = dust2.position.Y + (float)num8;
                        Main.dust[num6].velocity.X = -(float)num7 * 0.075f;
                        Main.dust[num6].velocity.Y = -(float)num8 * 0.075f;
                    }
                }

                bool overclock = player.HasBuff(overclockType);

                if (!hasAutoClick)
                {
                    foreach (var name in ClickerSystem.GetAllEffectNames())
                    {
                        if (clickerPlayer.HasClickEffect(name, out ClickEffect effect))
                        {
                            //Find click amount
                            int  clickAmountTotal = clickerPlayer.GetClickAmountTotal(this, name);
                            bool reachedAmount    = clickerPlayer.clickAmount % clickAmountTotal == 0;

                            if (reachedAmount || overclock || (clickerPlayer.accTriggerFinger && clickerPlayer.OutOfCombat))
                            {
                                effect.Action?.Invoke(player, source, position, type, damage, knockback);

                                if (clickerPlayer.accTriggerFinger)
                                {
                                    //TODO looks like a hack
                                    clickerPlayer.outOfCombatTimer = ClickerPlayer.OutOfCombatTimeMax;
                                }
                            }
                        }
                    }
                }

                return(false);
            }
            return(base.Shoot(item, player, source, position, velocity, type, damage, knockback));
        }
예제 #24
0
 public static bool DoConditionsApply(Item item)
 {
     return(ClickerSystem.IsClickerWeapon(item) && item.maxStack == 1 && item.damage > 0 && item.useStyle > 0);
 }