Exemplo n.º 1
0
 public void RemovePlayerCooldown(Player player)
 {
     if (PlayerDamageCooldown.ContainsKey((byte)player.whoAmI))
     {
         PlayerDamageCooldown.Remove((byte)player.whoAmI);
     }
 }
Exemplo n.º 2
0
 public void ApplyCooldownToPlayer(Player player, int CooldownTime)
 {
     if (!PlayerDamageCooldown.ContainsKey((byte)player.whoAmI))
     {
         PlayerDamageCooldown.Add((byte)player.whoAmI, CooldownTime);
     }
     else
     {
         PlayerDamageCooldown[(byte)player.whoAmI] = CooldownTime;
     }
 }
Exemplo n.º 3
0
        public int HurtPlayer(Player player, int Damage, int DamageDirection, int Cooldown = 8, bool Critical = false)
        {
            if (PlayerDamageCooldown.ContainsKey((byte)player.whoAmI))
            {
                return(0);
            }
            int NewDamage = Damage - player.statDefense / 2;

            if (NewDamage < 1)
            {
                NewDamage = 1;
            }
            if (Critical)
            {
                NewDamage *= 2;
            }
            player.statLife -= NewDamage;
            if (player.statLife <= 0)
            {
                player.KillMe(Terraria.DataStructures.PlayerDeathReason.ByPlayer(Owner), NewDamage, DamageDirection, true);
            }
            else
            {
                if (player.stoned)
                {
                    Main.PlaySound(0, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f);
                }
                else if (player.frostArmor)
                {
                    Main.PlaySound(Terraria.ID.SoundID.Item27, player.position);
                }
                else if ((player.wereWolf || player.forceWerewolf) && !player.hideWolf)
                {
                    Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 6, 1f, 0f);
                }
                else if (player.boneArmor)
                {
                    Main.PlaySound(3, (int)player.position.X, (int)player.position.Y, 2, 1f, 0f);
                }
                else if (!player.Male)
                {
                    Main.PlaySound(20, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f);
                }
                else
                {
                    Main.PlaySound(1, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f);
                }
            }
            CombatText.NewText(player.getRect(), Microsoft.Xna.Framework.Color.MediumPurple, NewDamage);
            ApplyCooldownToPlayer(player, Cooldown);
            return(NewDamage);
        }
Exemplo n.º 4
0
 public bool ContainsPlayerCooldown(Player player)
 {
     return(PlayerDamageCooldown.ContainsKey((byte)player.whoAmI));
 }