Ejemplo n.º 1
0
        private bool SwitchPowerTreads(RecoveryAbility ability)
        {
            var powerTreads = (PowerTreads)this.owner.Hero.Abilities.FirstOrDefault(x => x.Id == AbilityId.item_power_treads);

            if (powerTreads?.CanBeCasted() != true)
            {
                return(false);
            }

            var currentAtt  = powerTreads.ActiveAttribute;
            var requiredAtt = ability.PowerTreadsAttribute;

            if (requiredAtt == Attribute.Invalid || currentAtt == requiredAtt)
            {
                return(false);
            }

            if (!this.powerTreadsChanged)
            {
                this.powerTreadsAttribute = currentAtt;
                this.powerTreadsChanged   = true;
            }

            powerTreads.UseAbility();
            return(true);
        }
Ejemplo n.º 2
0
        private bool DropItems(RecoveryAbility ability)
        {
            var items      = ability.Owner.Abilities.Where(x => x.IsItem && x.IsUsable && x.Handle != ability.Handle).ToList();
            var toBackPack = this.heroIsMoving;

            if (ability.RestoresHealth && items.Any(x => x.Id.HasHealthStats() && this.DropItem(x, toBackPack)))
            {
                return(true);
            }

            if (ability.RestoresMana && items.Any(x => x.Id.HasManaStats() && this.DropItem(x, toBackPack)))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        private bool IsAllItemsDropped(RecoveryAbility ability)
        {
            var dropped        = this.droppedItems.Values.ToArray();
            var remainingItems = ability.Owner.Abilities
                                 .Where(x => x.IsItem && x.IsUsable && x.Handle != ability.Handle && !dropped.Contains(x))
                                 .ToList();

            if (ability.RestoresHealth && remainingItems.Any(x => x.Id.HasHealthStats()))
            {
                return(false);
            }

            if (ability.RestoresMana && remainingItems.Any(x => x.Id.HasManaStats()))
            {
                return(false);
            }

            return(true);
        }