private int healthFromDamage(FishPlayer owner, int damage)
        {
            float ans = damage * vampiricPercent;

            ans += damage * owner.vampiricLinePercent;
            return((int)Math.Round(ans));
        }
        private int manaFromDamage(FishPlayer owner, int damage)
        {
            float ans = damage * syphonPercent;

            ans += damage * owner.syphonLinePercent;
            return((int)Math.Round(ans));
        }
Пример #3
0
        public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit)
        {
            if (projectile.modProjectile != null && (projectile.modProjectile is Bobber))
            {
                FishPlayer p = Main.player[projectile.owner].GetModPlayer <FishPlayer>(mod);
                if (p != null && Main.rand.Next(10000) < p.moneyPercent)
                {
                    int itmID    = ItemID.CopperCoin;
                    int itmQuant = 1;
                    if (NPC.downedPlantBoss || Main.rand.Next(50) == 0)
                    {
                        itmID    = ItemID.GoldCoin;
                        itmQuant = Main.rand.Next(20) + 1;
                    }
                    else if (Main.hardMode || Main.rand.Next(15) == 0)
                    {
                        itmID    = ItemID.SilverCoin;
                        itmQuant = Main.rand.Next(50) + 1;
                    }
                    else
                    {
                        itmQuant = Main.rand.Next(30, 90);
                    }

                    Item.NewItem(npc.Center, Vector2.Zero, itmID, itmQuant);
                }
            }
        }
Пример #4
0
        public override void RightClick(int i, int j)
        {
            FishPlayer f = Main.player[Main.myPlayer].GetModPlayer <FishPlayer>(mod);

            if (f == null || f.mimicToSpawn)
            {
                return;
            }

            if (Main.tile[i, j].frameX > 0)
            {
                i--;
            }
            if (Main.tile[i, j].frameY > 0)
            {
                j--;
            }

            Main.tile[i, j].ClearTile();
            Main.tile[i + 1, j].ClearTile();
            Main.tile[i, j + 1].ClearTile();
            Main.tile[i + 1, j + 1].ClearTile();
            NetMessage.SendTileSquare(Main.myPlayer, i, j, 2);

            f.mimicX       = i * 16 + 16;
            f.mimicY       = j * 16 + 32;
            f.mimicToSpawn = true;
        }
Пример #5
0
        public override void UpdateEquip(Player player)
        {
            player.fishingSkill += 5;
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.bobberSpeed += 0.06f;
        }
Пример #6
0
        public override void ModifyBuffTip(ref string tip, ref int rare)
        {
            tip = "";
            FishPlayer pl = Main.player[Main.myPlayer].GetModPlayer <FishPlayer>(mod);

            if (pl.hasAnyBaitBuffs())
            {
                tip += Description.GetTranslation(Language.ActiveCulture) + "\n";
                for (int i = 0; i < pl.baitBuff.Length; i++)
                {
                    if (pl.baitBuff[i] > 0)
                    {
                        tip += Lang.GetBuffName(pl.baitBuff[i]) + "\n";
                    }
                }
                tip += "\n";
            }
            if (pl.hasAnyBaitDebuffs())
            {
                tip += "You are inflicting the following Debuffs:" + "\n";
                for (int i = 0; i < pl.baitDebuff.Length; i++)
                {
                    if (pl.baitDebuff[i] > 0)
                    {
                        tip += Lang.GetBuffName(pl.baitDebuff[i]) + "\n";
                    }
                }
            }
        }
Пример #7
0
        public override void Update(Player player, ref int buffIndex)
        {
            FishPlayer    pl             = player.GetModPlayer <FishPlayer>(mod);
            List <Entity> hookedEntities = getHookedEntities(pl);

            if (pl.baitTimer < player.buffTime[buffIndex])
            {
                player.buffTime[buffIndex] = pl.baitTimer;
            }
            if (hookedEntities.Count == 0)
            {
                player.buffTime[buffIndex] = pl.baitTimer;
                return;
            }
            if (player.buffTime[buffIndex] > 0)
            {
                for (int i = 0; i < pl.baitBuff.Length; i++)
                {
                    if (pl.baitBuff[i] > 0)
                    {
                        pl.updateBuffByID(ref pl.baitBuff[i], player.buffTime[buffIndex], buffIndex);
                    }
                }
                pl.baitTimer = player.buffTime[buffIndex];
            }
        }
Пример #8
0
        public override void Update(Player player, ref int buffIndex)
        {
            List <int> recurringDebuffs = getBaitDebuffsFromPlayers(Bobber.getOwnersOfBobbersAttatchedTo(player));

            FishPlayer pl2 = player.GetModPlayer <FishPlayer>();

            if (recurringDebuffs.Count > 0)
            {
                player.buffTime[buffIndex] = 120;
                addAllBuffsToList(pl2, recurringDebuffs);
            }

            int id = 0;

            for (int i = 0; i < pl2.debuffsPresent.Count; i++)
            {
                id = pl2.debuffsPresent[i];
                pl2.updateBuffByID(ref id, 120, buffIndex);
            }

            if (player.buffTime[buffIndex] <= 2)
            {
                pl2.debuffsPresent.Clear();
            }
        }
Пример #9
0
        public virtual void addBuffToPlayer(Player player, int slot)
        {
            FishPlayer pl     = player.GetModPlayer <FishPlayer>();
            int        pbtype = mod.BuffType <PoweredBaitBuff>();

            for (int j = 0; j < 22; j++)
            {
                if (player.buffType[j] == pbtype)
                {
                    player.buffTime[j] = buffTime;
                    pl.baitTimer       = buffTime;
                    pl.addBaitBuffs(buffTime, slot, buffID);
                    pl.addBaitDebuffs(buffTime, slot, debuffID);
                    return;
                }
            }
            for (int i = 0; i < 22; i++)
            {
                if (player.buffType[i] <= 0)
                {
                    player.buffType[i] = pbtype;
                    player.buffTime[i] = buffTime;
                    pl.baitTimer       = buffTime;
                    pl.addBaitBuffs(buffTime, slot, buffID);
                    pl.addBaitDebuffs(buffTime, slot, debuffID);
                    return;
                }
            }
        }
Пример #10
0
        public override bool RecipeAvailable()
        {
            Player     p  = Main.player[Main.myPlayer];
            FishPlayer pl = p.GetModPlayer <FishPlayer>(this.mod);

            return(pl.MasterBaiter);
        }
Пример #11
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Adds 10% Mana Shyphoning when hooked.";
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.syphonLinePercent += 0.1f;
        }
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Increases Fishing Damage and Bob Speed by 5%";
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.bobberDamage += 0.05f;
            pl.bobberSpeed  += 0.05f;
        }
        public override void UpdateEquip(Player player)
        {
            FishPlayer p = player.GetModPlayer <FishPlayer>(mod);

            p.destroyBobber     = true;
            p.aimBobber         = true;
            p.bobberShootSpeed += 0.3f;
        }
Пример #14
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Spawns Fire Bees to help you";
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.fireBees         = true;
            pl.fireBeesCooldown = 300;
        }
Пример #15
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Increases Fishing Damage and Bob Speed by 5%. Werewolves like you.";
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.bobberDamage += 0.05f;
            pl.bobberSpeed  += 0.05f;
            player.npcTypeNoAggro[NPCID.Werewolf] = true;
        }
Пример #16
0
        public override void UpdateEquip(Player player)
        {
            player.fishingSkill += 30;
            player.moveSpeed    += 0.35f;
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.bobberSpeed  += 0.1f;
            pl.bobberDamage += 0.1f;
        }
Пример #17
0
        public override void UpdateEquip(Player player)
        {
            FishPlayer p = player.GetModPlayer <FishPlayer>(mod);

            p.escalation              = true;
            p.escalationManaCost     += 16;
            p.escalationFromMana      = true;
            p.escalationFromManaBonus = 0.07f;
            //p.escalationFromManaMax = 1.0f;
        }
Пример #18
0
        private bool hitAndAttachProjectile(Player p)
        {
            if (!attatchesToAllies && (!p.hostile || p.team == Main.player[projectile.owner].team))
            {
                return(false);
            }

            if (!attatchesToEnemies && (p.hostile && p.team != Main.player[projectile.owner].team))
            {
                return(false);
            }

            bool?b = PlayerHooks.CanHitPvpWithProj(projectile, p);

            if (b.HasValue && !b.Value)
            {
                return(false);
            }

            b = ProjectileLoader.CanHitPvp(projectile, p);
            if (b.HasValue && !b.Value)
            {
                return(false);
            }

            npcIndex = (short)(p.whoAmI + Main.npc.Length);
            FishPlayer fOwner = Main.player[projectile.owner].GetModPlayer <FishPlayer>(mod);

            p.GetModPlayer <FishPlayer>(mod).isHooked++;
            if (fOwner.seals)
            {
                p.GetModPlayer <FishPlayer>(mod).isSealed++;
            }

            projectile.Center = p.Center;
            updatePos         = false;

            if (Main.netMode != 0)
            {
                /*
                 * ModPacket pk = mod.GetPacket();
                 * pk.Write((byte)2);
                 * pk.Write((ushort)(projectile.whoAmI));
                 * pk.Write(npcIndex);
                 * pk.Write(projectile.ai[0]);
                 * pk.Send();*/
                NetMessage.SendData(27, -1, -1, null, projectile.whoAmI, 0f, 0f, 0f, 0, 0, 0);
            }

            /* if(projectile.damage > 0)
             * {
             *   damagePlayer(p);
             * }*/
            return(true);
        }
Пример #19
0
        public List <Entity> getHookedEntities(FishPlayer player)
        {
            List <Entity> ans     = new List <Entity>();
            List <Bobber> bobbers = player.getOwnedAttatchedBobbers();

            foreach (Bobber b in bobbers)
            {
                ans.Add(b.getStuckEntity());
            }
            return(ans);
        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            FishPlayer p     = player.GetModPlayer <FishPlayer>(mod);
            int        lures = noOfBobs + p.multilineFishing;

            Vector2 speedVector = new Vector2(speedX, speedY);
            float   trueSpeed   = speedVector.Length() * p.bobberShootSpeed;

            if (p.aimBobber && player.whoAmI == Main.myPlayer)
            {
                speedVector = Main.MouseWorld - position;
                speedVector.Normalize();
                speedX = speedVector.X;
                speedY = speedVector.Y;
            }
            else
            {
                speedVector.Normalize();
                speedX = speedVector.X;
                speedY = speedVector.Y;
            }
            speedX        *= trueSpeed;
            speedY        *= trueSpeed;
            speedVector.X *= trueSpeed;
            speedVector.Y *= trueSpeed;
            int trueDamage = 0;

            if (damage > 0)
            {
                trueDamage = (damage / lures < 1 ? 1 : damage / lures);
            }
            if (lures > 1)
            {
                if (p.aimBobber)
                {
                    for (int i = 0; i < lures - 1; i++)
                    {
                        Projectile.NewProjectile(position.X + Main.rand.Next(5), position.Y + Main.rand.Next(5), speedVector.X, speedVector.Y, type, trueDamage, knockBack, player.whoAmI);
                    }
                }
                else
                {
                    for (int i = 1; i < lures; i++)
                    {
                        Projectile.NewProjectile(position.X + Main.rand.Next(5), position.Y + Main.rand.Next(5), speedX + Main.rand.Next(lures) - lures / 2, speedY + Main.rand.Next(lures) - lures / 2, type, trueDamage, knockBack, player.whoAmI);
                    }
                }
                if (trueDamage * lures < damage)
                {
                    damage = damage - (trueDamage * (lures - 1));
                }
            }
            return(base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack));
        }
        private int getDamage()
        {
            float  dmg = item.damage;
            Player p   = Main.player[Main.myPlayer];

            FishPlayer f = p.GetModPlayer <FishPlayer>(mod);

            dmg *= f.bobberDamage;

            return((int)Math.Round(dmg));
        }
Пример #22
0
        public override void UpdateEquip(Player player)
        {
            player.fishingSkill += 8;
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.bobberDamage += 0.05f;
            if (Main.hardMode)
            {
                player.statDefense += item.defense;
            }
        }
Пример #23
0
        public override void UpdateEquip(Player player)
        {
            float statMultiplier = 1.0f;

            if (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)
            {
                statMultiplier = 5.0f;
            }
            else if (Main.bloodMoon)
            {
                if (Main.hardMode)
                {
                    statMultiplier = 2.0f;
                }
                else
                {
                    statMultiplier = 1.4f;
                }
            }
            else if (!Main.dayTime)
            {
                switch (Main.moonPhase)
                {
                case 0:
                    statMultiplier = 1.2f;
                    break;

                case 1:
                case 7:
                    statMultiplier = 1.1f;
                    break;

                case 3:
                case 5:
                    statMultiplier = 0.9f;
                    break;

                case 4:
                    statMultiplier = 0.8f;
                    break;

                default:
                    statMultiplier = 1.0f;
                    break;
                }
            }
            player.fishingSkill += (int)Math.Round(5 * statMultiplier);
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.bobberSpeed  += 0.05f * statMultiplier;
            pl.bobberDamage += 0.05f * statMultiplier;
            item.defense     = (int)Math.Round(item.defense * statMultiplier);
        }
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus      = "Adds 200 Max Health and Max Mana.\n10% chance to nullify a projectile.\nDoubles max flight time if you have wings. Otherwise, provides invisible wings.\nProduces a strong glow and night vision.";
            player.statManaMax2 += 200;
            player.statLifeMax2 += 200;
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.fractaliteArmorEffect        = true;
            pl.projectileDestroyPercentage += 1000;
            Lighting.AddLight(player.Center, 1f, 1f, 1.0f);
            player.nightVision = true;
        }
Пример #25
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus      = "Adds 50 Max Health and Max Mana.\nNinja Dodge effect.\n5% chance to nullify a projectile.\nProduces a glowing light.\nTruffle Worms won't flee from you.";
            player.blackBelt     = true;
            player.statManaMax2 += 50;
            player.statLifeMax2 += 50;
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            pl.lifeforceArmorEffect         = true;
            pl.projectileDestroyPercentage += 500;
            Lighting.AddLight(player.Center, 0.4f, 0.6f, 1.0f);
        }
Пример #26
0
        public override void UpdateEquip(Player player)
        {
            FishPlayer p = player.GetModPlayer <FishPlayer>(mod);

            p.knifeBaseDamage = baseDamage;
            p.knifeCooldown   = cooldown;
            p.knifeRadius     = radius;
            p.knifeKnockback  = baseKnockback;
            if (buffID > 0)
            {
                p.knifeDebuff = buffID;
            }
        }
 private float escalationBonus(FishPlayer owner)
 {
     if (owner.escalationBonus != 0)
     {
         float seconds = (timeBobMax * bobsSinceAttatched) / 60f;
         return(Math.Min(owner.escalationBonus * seconds, owner.escalationMax));
     }
     else
     {
         bobsSinceAttatched = 0;
     }
     return(0f);
 }
Пример #28
0
        public override void RightClick(Player player)
        {
            FishPlayer f = Main.player[Main.myPlayer].GetModPlayer <FishPlayer>(mod);

            if (f == null || f.mimicToSpawn)
            {
                return;
            }

            f.mimicX       = (int)player.Center.X;
            f.mimicY       = (int)player.Center.Y;
            f.mimicToSpawn = true;
        }
Пример #29
0
        public override bool UseItem(Player player)
        {
            FishPlayer pl = player.GetModPlayer <FishPlayer>();

            if (!pl.MasterBaiter)
            {
                pl.MasterBaiter = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public void healthAndManaRecovery(int damage)
        {
            Player     player = Main.player[projectile.owner];
            FishPlayer pl     = player.GetModPlayer <FishPlayer>(mod);

            int manaRec   = manaFromDamage(pl, damage);
            int healthRec = healthFromDamage(pl, damage);

            if (manaRec > 0 && player.statManaMax2 > player.statMana)
            {
                player.statMana += manaRec;
                if (player.statMana > player.statManaMax2)
                {
                    player.statMana = player.statManaMax2;
                }
                if (Main.netMode != 2)
                {
                    player.ManaEffect(manaRec);
                }
                else
                {
                    ModPacket pk = mod.GetPacket();
                    pk.Write((byte)UnuBattleRods.Message.ManaEffect);
                    pk.Write((ushort)projectile.owner);
                    pk.Write(manaRec);
                    pk.Send();
                }
            }
            if (healthRec > 0 && !Main.player[projectile.owner].moonLeech && player.statLifeMax2 > player.statLife)
            {
                player.statLife += healthRec;
                if (player.statLife > player.statLifeMax2)
                {
                    player.statLife = player.statLifeMax2;
                }
                if (Main.netMode != 2)
                {
                    player.HealEffect(healthRec);
                }
                else
                {
                    ModPacket pk = mod.GetPacket();
                    pk.Write((byte)UnuBattleRods.Message.HealEffect);
                    pk.Write((ushort)projectile.owner);
                    pk.Write(healthRec);
                    pk.Send();
                }
            }
        }