Esempio n. 1
0
        /// <summary>
        /// Debuff le personnage de tous les effets
        /// </summary>
        /// <returns></returns>
        public int Debuff()
        {
            foreach (var Buff in this.BuffsDec[BuffDecrementType.TYPE_BEGINTURN])
            {
                if (Buff.IsDebuffable)
                {
                    if (Buff.RemoveEffect() == -3)
                    {
                        return(-3);
                    }
                }
            }

            foreach (var Buff in this.BuffsDec[BuffDecrementType.TYPE_ENDTURN])
            {
                if (Buff.IsDebuffable)
                {
                    if (Buff.RemoveEffect() == -3)
                    {
                        return(-3);
                    }
                }
            }

            this.BuffsDec[BuffDecrementType.TYPE_BEGINTURN].RemoveAll(x => x.IsDebuffable);
            this.BuffsDec[BuffDecrementType.TYPE_ENDTURN].RemoveAll(x => x.IsDebuffable);

            foreach (var BuffList in this.BuffsAct.Values)
            {
                BuffList.RemoveAll(x => x.IsDebuffable);
            }

            return(-1);
        }
Esempio n. 2
0
        public int EndTurn()
        {
            var Damage = 0;

            foreach (var Buff in BuffsAct[BuffActiveType.ACTIVE_ENDTURN])
            {
                if (Buff.ApplyEffect(ref Damage) == -3)
                {
                    return(-3);
                }
            }

            foreach (var Buff in this.BuffsDec[BuffDecrementType.TYPE_ENDTURN])
            {
                if (Buff.DecrementDuration() <= 0)
                {
                    if (Buff.RemoveEffect() == -3)
                    {
                        return(-3);
                    }
                }
            }

            this.BuffsDec[BuffDecrementType.TYPE_ENDTURN].RemoveAll(x => x.Duration <= 0);

            foreach (var BuffList in this.BuffsAct.Values)
            {
                BuffList.RemoveAll(Buff => Buff.DecrementType == BuffDecrementType.TYPE_ENDTURN && Buff.Duration <= 0);
            }

            return(-1);
        }
Esempio n. 3
0
    public void Tick(float dt, IResultControl control)
    {
        //此处用for是因为方便buff的tick中添加buff,但删除buff只能在所有buff的tick之后
        bool isCalcProperty = false;

        for (int i = 0; i < BuffList.Count; ++i)
        {
            BuffList[i].IsRemoveBuff(dt, control);
            BuffList[i].Tick(control, dt);
            if (BuffList[i].IsNeedRemove && BuffList[i].IsCalcProperty)
            {
                isCalcProperty = true;
            }
        }

        int removedBuffCount = BuffList.RemoveAll(Temp_Remove_Buff);

        if (isCalcProperty || removedBuffCount > 0)
        {
            if (isCalcProperty)
            {
                BuffResult();
            }
            else
            {
                RefreshBuffGraphics();
            }
        }
    }
Esempio n. 4
0
        public void RemoveBuff(IBuff b)
        {
            lock (_buffsLock)
            {
                if (b.BuffAddType == BuffAddType.STACKS_AND_OVERLAPS && b.StackCount > 1)
                {
                    b.DecrementStackCount();

                    RemoveBuff(b.Name);
                    BuffList.Remove(b);
                    RemoveBuffSlot(b);

                    var tempbuffs = GetBuffsWithName(b.Name);

                    tempbuffs.ForEach(tempbuff => tempbuff.SetStacks(b.StackCount));

                    BuffSlots[b.Slot] = tempbuffs[0];
                    Buffs.Add(b.Name, tempbuffs[0]);

                    var newestBuff = tempbuffs[tempbuffs.Count - 1];

                    if (!b.IsHidden)
                    {
                        if (b.BuffType == BuffType.COUNTER)
                        {
                            _game.PacketNotifier.NotifyNPC_BuffUpdateNumCounter(Buffs[b.Name]);
                        }
                        else
                        {
                            if (b.StackCount == 1)
                            {
                                _game.PacketNotifier.NotifyNPC_BuffUpdateCount(newestBuff, b.Duration - newestBuff.TimeElapsed, newestBuff.TimeElapsed);
                            }
                            else
                            {
                                _game.PacketNotifier.NotifyNPC_BuffUpdateCountGroup(this, tempbuffs, b.Duration - newestBuff.TimeElapsed, newestBuff.TimeElapsed);
                            }
                        }
                    }
                }
                else
                {
                    BuffList.RemoveAll(buff => buff.Elapsed());
                    RemoveBuff(b.Name);
                    RemoveBuffSlot(b);
                    if (!b.IsHidden)
                    {
                        _game.PacketNotifier.NotifyNPC_BuffRemove2(b);
                    }
                }
            }
        }