Beispiel #1
0
        public async void SetBuff(SkillStates effect, TimeSpan time, Character source = null)
        {
            if (_buffs.Any(x => x.State == effect))
            {
                return;
            }

            var buff = new Buff {
                State = effect, EndAt = DateTimeOffset.Now.Add(time), Source = source
            };
            var @char = Player?.Character ?? null;

            switch (effect)
            {
            case SkillStates.ShadowPhantom:
                if (@char == null)
                {
                    break;
                }
                buff.AttackAdd  = @char.Level / 3 + 45;
                buff.DefenseAdd = @char.Level / 3 + 50;
                break;

            case SkillStates.SoulBarrier:
                buff.DefenseAddRate = 10 + source.AgilityTotal / 50 + source.EnergyTotal / 200;
                break;

            case SkillStates.Defense:
                buff.DefenseAdd = source.EnergyTotal / 8;
                break;

            case SkillStates.Attack:
                buff.AttackAdd = source.EnergyTotal / 7;
                break;

            case SkillStates.SwellLife:
                buff.LifeAdd         = 12 + source.EnergyTotal / 10 + source.VitalityTotal / 100;
                Character.MaxHealth += buff.LifeAdd;
                break;

            case SkillStates.HAttackPower:
                buff.AttackAdd = 25;
                break;

            case SkillStates.HAttackSpeed:
                break;

            case SkillStates.HDefensePower:
                buff.DefenseAdd = 100;
                break;

            case SkillStates.HMaxLife:
                buff.LifeAdd = 500;
                break;

            case SkillStates.HMaxMana:
                buff.ManaAdd = 500;
                break;

            case SkillStates.Poison:
                buff.PoisonDamage = 12 + source.EnergyTotal / 10;
                break;
            }

            _buffs.Add(buff);
            if (Monster != null)
            {
                var m2 = new SViewSkillState(1, Monster.Index, (byte)effect);

                if (Monster.Info.ViewRange <= 0)
                {
                    await Monster.Map.SendAsync(m2);
                }
                else
                {
                    await Monster.ViewPort.Select(x => x.Session).SendAsync(m2);
                }
                return;
            }
            var m = new SViewSkillState(1, (ushort)Player.Session.ID, (byte)effect);

            await Player.Session.SendAsync(m);

            await Player.SendV2Message(m);
        }
Beispiel #2
0
        public async void SetBuff(SkillStates effect, TimeSpan time, Character source = null)
        {
            if (_buffs.Any(x => x.State == effect))
            {
                return;
            }

            var buff = new Buff {
                State = effect, EndAt = DateTimeOffset.Now.Add(time),
            };
            var @char = Player.Character;

            switch (effect)
            {
            case SkillStates.ShadowPhantom:
                buff.AttackAdd  = @char.Level / 3 + 45;
                buff.DefenseAdd = @char.Level / 3 + 50;
                break;

            case SkillStates.SoulBarrier:
                buff.DefenseAddRate = 10 + source.AgilityTotal / 50 + source.EnergyTotal / 200;
                break;

            case SkillStates.Defense:
                buff.DefenseAdd = source.EnergyTotal / 8;
                break;

            case SkillStates.Attack:
                buff.AttackAdd = source.EnergyTotal / 7;
                break;

            case SkillStates.SwellLife:
                buff.LifeAdd = 0;
                break;

            case SkillStates.HAttackPower:
                buff.AttackAdd = 25;
                break;

            case SkillStates.HAttackSpeed:
                break;

            case SkillStates.HDefensePower:
                buff.DefenseAdd = 100;
                break;

            case SkillStates.HMaxLife:
                buff.LifeAdd = 500;
                break;

            case SkillStates.HMaxMana:
                buff.ManaAdd = 500;
                break;
            }

            _buffs.Add(buff);

            var m = new SViewSkillState(1, (ushort)Player.Session.ID, (byte)effect);

            await Player.Session.SendAsync(m);

            await Player.SendV2Message(m);
        }