예제 #1
0
        public void UpdateSkill(Player player)
        {
            Owner = player.whoAmI;
            if (!Active)
            {
                if (Cooldown > 0)
                {
                    if (MainMod.DebugMode)
                    {
                        Cooldown = 0;
                    }
                    else
                    {
                        Cooldown--;
                    }
                }
                return;
            }
            if (CastTime < GetBase.CastTime)
            {
                switch (GetBase.PositionToTake)
                {
                case SkillBase.PositionToTakeOnCastEnum.Mouse:
                    CastPosition = SkillBase.GetMousePositionInTheWorld;
                    break;

                case SkillBase.PositionToTakeOnCastEnum.Player:
                    CastPosition = player.Center;
                    break;
                }
                return;
            }
            byte[] Keys = PlayerDamageCooldown.Keys.ToArray();
            foreach (byte key in Keys)
            {
                PlayerDamageCooldown[key]--;
                if (PlayerDamageCooldown[key] <= 0)
                {
                    PlayerDamageCooldown.Remove(key);
                }
            }
            Keys = NpcDamageCooldown.Keys.ToArray();
            foreach (byte key in Keys)
            {
                NpcDamageCooldown[key]--;
                if (NpcDamageCooldown[key] <= 0)
                {
                    NpcDamageCooldown.Remove(key);
                }
            }
            TargetTranslator.Translator[] Keys2 = ExtraTargetDamageCooldown.Keys.ToArray();
            foreach (TargetTranslator.Translator target in Keys2)
            {
                ExtraTargetDamageCooldown[target]--;
                if (ExtraTargetDamageCooldown[target] <= 0)
                {
                    ExtraTargetDamageCooldown.Remove(target);
                }
            }
        }
예제 #2
0
 public void RemovePlayerCooldown(Player player)
 {
     if (PlayerDamageCooldown.ContainsKey((byte)player.whoAmI))
     {
         PlayerDamageCooldown.Remove((byte)player.whoAmI);
     }
 }
예제 #3
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;
     }
 }
예제 #4
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);
        }
예제 #5
0
        public void UseSkill(Player player)
        {
            if (Active || Cooldown > 0)
            {
                return;
            }
            if (player.GetModPlayer <PlayerMod>().UsingPrivilegedSkill)
            {
                return;
            }
            if (MainMod.SaySkillNameOnUse && player.whoAmI == Main.myPlayer)
            {
                player.chatOverhead.NewMessage(GetBase.Name + "!!", 300);
            }
            Time     = 0;
            Step     = 0;
            CastTime = 0;
            Active   = true;
            Cooldown = GetBase.Cooldown;
            PlayerDamageCooldown.Clear();
            NpcDamageCooldown.Clear();
            ExtraTargetDamageCooldown.Clear();
            PlayerInteraction.Clear();
            NpcInteraction.Clear();
            OtherInteraction.Clear();
            switch (GetBase.PositionToTake)
            {
            case SkillBase.PositionToTakeOnCastEnum.Mouse:
                CastPosition = SkillBase.GetMousePositionInTheWorld;
                break;

            case SkillBase.PositionToTakeOnCastEnum.Player:
                CastPosition = player.Center;
                break;
            }
        }
예제 #6
0
 public bool ContainsPlayerCooldown(Player player)
 {
     return(PlayerDamageCooldown.ContainsKey((byte)player.whoAmI));
 }