Пример #1
0
 void Crit(Player target, ref float damageMultiplier)
 {
     damageMultiplier += Type1.GetValue();
     PoMEffectHelper.Crit(target.position, target.width, target.height, 50);
     if (Main.netMode == NetmodeID.MultiplayerClient)
     {
         EffectPacketHandler.CSyncCrit(target, 50);
     }
     lastProcTime = Main.GameUpdateCount;
 }
Пример #2
0
 void Heal(Item item, Player player)
 {
     if (AffixItemItem.IsAccessoryEquipped(item, player))
     {
         int amount = (int)MathHelper.Clamp(player.statManaMax2 * Type1.GetValue(), 1, 9999999);
         if (amount > 0)
         {
             player.statMana += amount;
             PoMEffectHelper.HealMana(player, amount);
         }
     }
 }
Пример #3
0
        void HealPlayer(Player player)
        {
            int amount = (int)MathHelper.Clamp(player.statLifeMax2 * Type1.GetValue(), 1, 9999999);

            player.statLife += amount;
            PoMEffectHelper.Heal(player, amount);
            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                EffectPacketHandler.CSyncHeal(player.whoAmI, amount);
            }
            lastProcTime = Main.GameUpdateCount;
        }
Пример #4
0
        public override bool PreHurt(Item item, Player player, bool pvp, bool quiet, ref float damageMultiplier, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            if (AffixItemItem.IsAccessoryEquipped(item, player))
            {
                int manaAmount = (int)Math.Round(player.statManaMax2 * Type1.GetValue());
                player.statMana += manaAmount;
                PoMEffectHelper.HealMana(player, manaAmount);
                damageMultiplier += Type2.GetValue();
            }

            return(true);
        }
Пример #5
0
 void Hit(Item item, Player player, Player target)
 {
     if (item == player.HeldItem && target.statLife >= target.statLifeMax2)
     {
         int critDamage = (int)Math.Round(target.statLifeMax2 * Type1.GetValue());
         int direction  = (target.Center.X - player.Center.X) > 0 ? 1 : -1;
         target.Hurt(Terraria.DataStructures.PlayerDeathReason.ByPlayer(player.whoAmI), critDamage, direction, true, false, false);
         target.immune = false;
         PoMEffectHelper.Crit(target.position, target.width, target.height, 100);
         if (Main.netMode == NetmodeID.MultiplayerClient)
         {
             EffectPacketHandler.CSyncCrit(target, 100);
         }
     }
 }
Пример #6
0
        void Hit(Item item, Player player, NPC target)
        {
            NPC realTarget = target.realLife >= 0 ? Main.npc[target.realLife] : target;

            if (item == player.HeldItem && realTarget.life >= realTarget.lifeMax)
            {
                int critDamage = (int)Math.Round(realTarget.lifeMax * Type1.GetValue());
                int direction  = (target.Center.X - player.Center.X) > 0 ? 1 : -1;
                player.ApplyDamageToNPC(target, critDamage, 0, direction, false);
                PoMEffectHelper.Crit(target.position, target.width, target.height, 100);
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    EffectPacketHandler.CSyncCrit(target, 100);
                }
            }
        }
Пример #7
0
        void ReceiveSyncHealMana(BinaryReader reader, int fromWho)
        {
            int playerID = reader.ReadByte();
            int amount   = reader.ReadInt32();

            if (Main.netMode == NetmodeID.Server)
            {
                ModPacket packet = GetPacket((byte)PacketType.SyncHealMana);
                packet.Write((byte)playerID);
                packet.Write(amount);
                packet.Send(-1, fromWho);
            }
            else
            {
                Player player = Main.player[playerID];
                PoMEffectHelper.HealMana(player, amount);
            }
        }
Пример #8
0
 void Heal(Item item, Player player)
 {
     if (AffixItemItem.IsAccessoryEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type2.GetValue() * 60))
     {
         lastProcTime = Main.GameUpdateCount;
         int amount = Type1.GetValue();
         if (amount > 0)
         {
             player.statLife += amount;
             PoMEffectHelper.Heal(player, amount);
         }
         else
         {
             player.immune = false;
             player.Hurt(PlayerDeathReason.ByPlayer(player.whoAmI), -amount, 0, false);
         }
     }
 }
Пример #9
0
        void SReceiveSyncCrit(BinaryReader reader, int fromWho)
        {
            bool isPlayer = reader.ReadBoolean();
            int  targetID = isPlayer ? reader.ReadByte() : reader.ReadInt32();
            int  howMuch  = reader.ReadInt32();

            if (Main.netMode == NetmodeID.Server)
            {
                ModPacket packet = GetPacket((byte)PacketType.SyncCrit);
                packet.Write(isPlayer);
                if (isPlayer)
                {
                    packet.Write((byte)targetID);
                }
                else
                {
                    packet.Write(targetID);
                }
                packet.Write(howMuch);
                packet.Send(-1, fromWho);
            }
            else
            {
                Entity target;
                if (isPlayer)
                {
                    target = Main.player[targetID];
                }
                else
                {
                    target = Main.npc[targetID];
                }

                PoMEffectHelper.Crit(target.position, target.width, target.height, howMuch);
            }
        }