Exemplo n.º 1
0
        private void StopAndRemoveBuff(Buff curentBuff)
        {
            if (curentBuff.BuffUsed)
            {
                ItemArrmor += curentBuff.MinusArmor;
                ItemArrmor -= curentBuff.Armor;


                OrijSpeed -= curentBuff.SpeedSlow;
                //Speed -= Buffs[i].SpeedSlow;

                // if (OrijAttackSpeed == AttackSpeed - Buffs[i].AttackSpeedSlow)
                ///Значит нет никаких воздействий на героя
                OrijAttackSpeed -= curentBuff.AttackSpeedSlow;
                OrijAttackSpeed += curentBuff.AttackSpeed;

                curentBuff.BuffUsed = false;
            }

            Buffs.Remove(curentBuff);    ///Время действия бафа истекло

            if (!Buffs.Any(p => p.Stun)) ///Если на юнит не воздействуют другие станы
            {
                IsUnitStun = false;
            }

            UpdateView();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Remove a Buff from the Monster
        /// </summary>
        /// <param name="buff">The buff to remove</param>
        /// <returns>Whether or not the Buff existed before removal</returns>
        public bool RemoveBuff(Buff buff)
        {
            bool retBool = Buffs.ContainsKey(buff);

            Buffs.Remove(buff);
            return(retBool);
        }
Exemplo n.º 3
0
 public void RemoveObject(CollectableObject collectableObject)
 {
     if (collectableObject.BuffObject != null)
     {
         Buffs.Remove(collectableObject.BuffObject);
     }
 }
Exemplo n.º 4
0
 public void RemoveBuff(string b)
 {
     lock (BuffsLock)
     {
         Buffs.Remove(b);
     }
 }
Exemplo n.º 5
0
 public void CleanBuffs()
 {
     foreach (Buff buff in SpentBuffs)
     {
         Buffs.Remove(buff);
     }
     SpentBuffs = new List <Buff>();
 }
Exemplo n.º 6
0
 public void BuffUpdate()
 {
     for (int i = 0; i < Buffs.Count(); ++i)
     {
         Buffs[i].Duration--;
         if (Buffs[i].Duration == 0)
         {
             Buffs.Remove(Buffs[i]);
         }
     }
 }
Exemplo n.º 7
0
    public void RemoveBuff(int id)
    {
        var node = Buffs.Find(i => { return(i.Data.Id == id); });

        if (node != null)
        {
            Buffs.Remove(node);
            var evt = new Evt_RemoveBuff()
            {
                Target = this, Data = node
            };
            EventManager.Instance.QueueEvent(evt);
        }
    }
Exemplo n.º 8
0
 public override bool DamageFilter()
 {
     for (int i = 0; i < Buffs.Count; i++)
     {
         if (Buffs[i].Bufftype.Equals(Bufftype.Shield))
         {
             Debug.Log("FindShieldBuff");
             Buffs[i].RemoveBuff(this);
             Buffs.Remove(Buffs[i]);
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 9
0
Arquivo: Unit.cs Projeto: rio900/voins
        private void StopAndRemoveBuff(Buff currentBuff)
        {
            if (currentBuff.BuffUsed)
            {
                Arrmor += currentBuff.MinusArmor;
                Arrmor -= currentBuff.Armor;
                currentBuff.BuffUsed = false;
                OrijAttackSpeed     -= currentBuff.AttackSpeedSlow;
                OrijAttackSpeed     += currentBuff.AttackSpeed;
                Speed = Speed - currentBuff.SpeedSlow;
            }
            Buffs.Remove(currentBuff);   ///Время действия бафа истекло

            if (!Buffs.Any(p => p.Stun)) ///Если на юнит не воздействуют другие станы
            {
                IsUnitStun = false;
            }
        }
Exemplo n.º 10
0
        private void ScheduleBuffExpiration(MobStatus buff, MobSkill skill)
        {
            TaskRunner.Run(() =>
            {
//                    using (var packet = new PacketWriter(ServerOperationCode.MobStatReset))
//                    {
//                        packet.WriteInt(ObjectId);
//                        packet.WriteLong(0);
//                        packet.WriteInt(0);
//                        packet.WriteInt((int)buff);
//                        packet.WriteInt(0);
//
//                        Map.Send(packet);
//                    }

                Buffs.Remove(buff);
            }, TimeSpan.FromSeconds(skill.CachedReference.Duration));
        }
Exemplo n.º 11
0
 public override bool DamageFilter()
 {
     if (_isRush)
     {
         return(false);
     }
     else
     {
         for (int i = 0; i < Buffs.Count; i++)
         {
             if (Buffs[i].Bufftype.Equals(Bufftype.Shield))
             {
                 Buffs[i].RemoveBuff(this);
                 Buffs.Remove(Buffs[i]);
                 return(false);
             }
         }
         return(true);
     }
 }
Exemplo n.º 12
0
        public override bool IsCritical(DamageTypes type, AbilityTypes ability)
        {
            var chance = CriticalChance;

            if (type == DamageTypes.Fire)
            {
                chance += this.SkillValue(SkillType.Devastation, false) / 100;
            }
            if (ability == AbilityTypes.Iceball)
            {
                chance += this.AbilityValue(AbilityUpgradeType.IceballCrit) / 100;
            }
            if ((ability == AbilityTypes.Iceball || ability == AbilityTypes.Fireball || ability == AbilityTypes.Wand) && Buffs.Any(b => b is RageBuff))
            {
                var buff = Buffs.First(b => b is RageBuff);
                Buffs.Remove(buff);
                chance += buff.CritChanceFactor;
            }
            return(Globals.Random.NextDouble() < chance);
        }
Exemplo n.º 13
0
        /// <summary> Updates the creature's ongoing effects </summary>
        public void HandleBuffs(DwarfTime time)
        {
            if (BuffsToAdd == null)
            {
                BuffsToAdd = new List <Buff>();
            }
            Buffs.AddRange(BuffsToAdd);
            BuffsToAdd.Clear();
            foreach (Buff buff in Buffs)
            {
                buff.Update(time, this);
            }

            List <Buff> doneBuffs = Buffs.FindAll(buff => !buff.IsInEffect);

            foreach (Buff buff in doneBuffs)
            {
                buff.OnEnd(this);
                Buffs.Remove(buff);
            }
        }
Exemplo n.º 14
0
 void RemoveBuff(Buff buff)
 {
     if (buff.BuffContainer.Asset != null)
     {
         HPBar.RemoveBuff(buff.BuffContainer.Asset);
     }
     buff.Finish();
     buff.Clear();
     if (Buffs.Remove(buff) == true)
     {
         switch (buff.ActionInfo.actionType)
         {
         case eActionType.buff:
         case eActionType.debuff:
         case eActionType.buff_percent:
         case eActionType.debuff_percent:
             RefreshStat();
             break;
         }
     }
 }
Exemplo n.º 15
0
    public void DropObject(CollectableObject collectableObject, Vector3 pos)
    {
        for (int i = 0; i < Inventory.Length; i++)
        {
            if (Inventory[i] != null)
            {
                if (Inventory[i].Equals(collectableObject))
                {
                    if (Inventory[i].GetComponent <CollectableObject>().BuffObject != null)
                    {
                        Buffs.Remove(Inventory[i].GetComponent <CollectableObject>().BuffObject);
                    }

                    Inventory[i] = null;
                    break;
                }
            }
        }
        collectableObject.transform.position   = new Vector3(pos.x, 11, pos.z);
        collectableObject.transform.localScale = new Vector3(1, 1, 1);
        collectableObject.ObjectTaken          = false;
        collectableObject.gameObject.SetActive(true);
    }
Exemplo n.º 16
0
        public void Buff(MobConstants.MobStatus buff, short value, Skill skill)
        {
            using (Packet oPacket = new Packet(ServerOperationCode.MobStatSet))
            {
                oPacket
                .WriteInt(ObjectID)
                .WriteLong()
                .WriteInt()
                .WriteInt((int)buff)
                .WriteShort(value)
                .WriteShort((short)skill.MapleID)
                .WriteShort(skill.CurrentLevel)
                .WriteShort(-1)
                .WriteShort(0)     // Delay
                .WriteInt();

                Map.Broadcast(oPacket);
            }

            Delay.Execute(() =>
            {
                using (Packet Packet = new Packet(ServerOperationCode.MobStatReset))
                {
                    Packet
                    .WriteInt(ObjectID)
                    .WriteLong()
                    .WriteInt()
                    .WriteInt((int)buff)
                    .WriteInt();

                    Map.Broadcast(Packet);
                }

                Buffs.Remove(buff);
            }, skill.BuffTime * 1000);
        }
Exemplo n.º 17
0
 protected override void Handle(BuffRemove args)
 {
     App.QueueOnMainThread(() => Buffs.Remove(args.BuffId));
 }
Exemplo n.º 18
0
        public void RemoveItem(ItemClass item, bool notUpdate)
        {
            if (item.ItemUsed == true)
            {
                #region Убираем действие итема

                Agility      -= item.Agility;
                Intelligence -= item.Intelligence;
                Strength     -= item.Strength;

                ItemArrmor -= item.Armor;

                OrijAttackSpeed += item.AttackSpeed;

                DemageItem -= item.Demage;
                OrijHealth -= item.HealthBonus;
                MaxHealth  -= item.HealthBonus;

                int health = Health - item.HealthBonus;
                if (health <= 0)
                {
                    health = 1;
                }
                Health = health;

                OrijHealthRegeneration -= item.HealthRegen;

                OrijMana -= item.ManaBonus;
                MaxMana  -= item.ManaBonus;

                int mana = Mana - item.ManaBonus;
                if (mana <= 0)
                {
                    mana = 1;
                }
                Mana = mana;


                OrijManaRegeneration -= (int)item.ManaRegen;

                if ((item.Boots && Items.Count(p => p.Boots) > 1) ||
                    (item.IsYasha && Items.Count(p => p.IsYasha) > 1))
                {
                }
                else
                {
                    OrijSpeed += item.Speed;
                }


                if (item.Buff != null)
                {
                    Buff buff = Buffs.FirstOrDefault(p => p.Name == item.Buff.Name);
                    if (buff != null)
                    {
                        Buffs.Remove(buff);
                    }
                }

                IAura aura = item.AuraItem as IAura;
                if (aura != null)
                {
                    aura.StopUseAura();
                }
            }
            #endregion
            Items.Remove(item);



            if (!notUpdate)
            {
                if (UpdateItemPlayerData != null)
                {
                    UpdateItemPlayerData(this, null);
                }

                UpdateView();
            }
        }