Exemplo n.º 1
0
            public State(AspectAbility ability, BaseAspect aspect, Mobile target, TimeSpan duration)
            {
                Ability = ability;
                Aspect  = aspect;
                Target  = target;

                Expire = DateTime.UtcNow + duration;
            }
Exemplo n.º 2
0
        public override void OnThink()
        {
            base.OnThink();

            if (!this.InCombat())
            {
                return;
            }

            if (EnrageThreshold > 0 && Enraged)
            {
                var old = GetStatMod(EnrageBuffName);

                if (old != null && old.Type != EnrageBuffType && old.Offset != EnrageBuffOffset && RemoveStatMod(EnrageBuffName))
                {
                    old = null;
                }

                if (old == null && EnrageBuffOffset != 0 && !String.IsNullOrWhiteSpace(EnrageBuffName))
                {
                    AddStatMod(_EnrageStatBuff);
                }
            }

            DateTime now = DateTime.UtcNow;

            if (Aspects == Aspects.None || now <= _NextAbility)
            {
                _NextAbility = now.AddSeconds(1.0);
                return;
            }

            AspectAbility ability = GetRandomAbility(true);

            if (ability == null || !ability.TryInvoke(this))
            {
                _NextAbility = now.AddSeconds(1.0);
                return;
            }

            TimeSpan cooldown = GetAbilityCooldown(ability);

            _NextAbility = cooldown > TimeSpan.Zero ? now.Add(cooldown) : now;
        }
Exemplo n.º 3
0
        protected virtual TimeSpan GetAbilityCooldown(AspectAbility ability)
        {
            if (ability != null)
            {
                var cool = ability.Cooldown.TotalSeconds;

                if (cool > 0)
                {
                    cool -= Scale(cool * 0.10);
                    cool  = Math.Max(0, cool);
                }

                if (cool > 0)
                {
                    return(TimeSpan.FromSeconds(cool));
                }
            }

            return(TimeSpan.Zero);
        }
Exemplo n.º 4
0
 public virtual AspectAbility[] GetAbilities(bool checkLock)
 {
     return(AspectAbility.GetAbilities(this, checkLock));
 }
Exemplo n.º 5
0
 protected virtual TimeSpan GetAbilityCooldown(AspectAbility ability)
 {
     return(ability != null ? ability.Cooldown : TimeSpan.Zero);
 }
Exemplo n.º 6
0
 public virtual void OnAbility(AspectAbility ability)
 {
 }
Exemplo n.º 7
0
 public virtual bool CanUseAbility(AspectAbility ability)
 {
     return(true);
 }