Esempio n. 1
0
        // Refresh with a new aura
        public void Refresh(IAura aura)
        {
            StartTime = DependencyContainer.Instance.GetInstance <IServer>().CurrentTime;

            // Refresh aura values
            Amount       = aura.Amount;
            TotalSeconds = aura.TotalSeconds;
        }
Esempio n. 2
0
        public override IActionOutputParameter Action(ActionParameter actionParameter)
        {
            IAura aura = (IAura)Activator.CreateInstance(typeof(T), AuraCard);

            aura.LocationFilter = GameActivator <F> .CreateInstance();

            return(aura.Action(actionParameter));
        }
Esempio n. 3
0
        public override bool Process(ICharacter source, ICharacter victim, IAbility ability, CombatHelpers.AttackResults attackResult)
        {
            // TODO: difference between buff/debuff to handle Offensive flag

            // Check periodic aura
            IPeriodicAura periodicAura = victim.PeriodicAuras.FirstOrDefault(x => x.Ability != null && x.Ability.DispelType == DispelType);

            if (periodicAura != null)
            {
                victim.RemovePeriodicAura(periodicAura);
                return(true);
            }

            // Check aura
            IAura aura = victim.Auras.FirstOrDefault(x => x.Ability != null && x.Ability.DispelType == DispelType);

            if (aura != null)
            {
                victim.RemoveAura(aura, true);
                return(true);
            }
            return(true);
        }
Esempio n. 4
0
        public override TaskState Process()
        {
            Minion target = (Minion)Target;

            if (target == null)
            {
                return(TaskState.STOP);
            }

            Minion source = (Minion)Source;

            if (source.Zone?.Type != Zone.PLAY)
            {
                return(TaskState.STOP);
            }

            var tags = new EntityData.Data
            {
                { GameTag.CREATOR, Source.Id },
            };

            if (Game.History)
            {
                tags.Add(GameTag.PREMIUM, target[GameTag.PREMIUM]);
            }

            Minion copy = (Minion)Entity.FromCard(Controller, target.Card, tags);

            Trigger trigger = target.ActivatedTrigger;
            IAura   aura    = target.OngoingEffect;

            // LINKED_ENTITY
            if (source == Game.CurrentEventData.EventSource)
            {
                Game.CurrentEventData.EventSource = copy;
            }
            source.Controller.BoardZone.Replace(source, copy);

            // Copy Enchantments
            if (target.AppliedEnchantments != null)
            {
                foreach (Enchantment e in target.AppliedEnchantments)
                {
                    Enchantment instance = Enchantment.GetInstance(Controller, copy, copy, e.Card);
                    if (e[GameTag.TAG_SCRIPT_DATA_NUM_1] > 0)
                    {
                        instance[GameTag.TAG_SCRIPT_DATA_NUM_1] = e[GameTag.TAG_SCRIPT_DATA_NUM_1];
                        if (e[GameTag.TAG_SCRIPT_DATA_NUM_2] > 0)
                        {
                            instance[GameTag.TAG_SCRIPT_DATA_NUM_2] = e[GameTag.TAG_SCRIPT_DATA_NUM_2];
                        }
                    }
                }
            }

            foreach (KeyValuePair <GameTag, int> kvp in target._data.Tags)
            {
                switch (kvp.Key)
                {
                case GameTag.ENTITY_ID:
                case GameTag.CONTROLLER:
                case GameTag.ZONE:
                case GameTag.ZONE_POSITION:
                case GameTag.CREATOR:
                case GameTag.PREMIUM:
                case GameTag.EXHAUSTED:
                    continue;

                default:
                    copy._data.Tags.Add(kvp.Key, kvp.Value);
                    break;
                }
            }

            if (aura != null && copy.OngoingEffect == null)
            {
                aura.Clone(copy);
            }

            if (!target.HasCharge)
            {
                copy.IsExhausted = true;
            }

            if (_addToStack)
            {
                Playables = new List <IPlayable> {
                    copy
                }
            }
            ;

            return(TaskState.COMPLETE);
        }
Esempio n. 5
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();
            }
        }
Esempio n. 6
0
        public void AddItem(ItemClass item)
        {
            if (!item.Bonus)
            {
                Items.Add(item);

                #region Применяем итем

                Agility      += item.Agility;
                Intelligence += item.Intelligence;
                Strength     += item.Strength;

                Health += item.Strength * StaticVaribl.StrConstant;
                Mana   += item.Intelligence * StaticVaribl.IntConstant;

                ItemArrmor += item.Armor;

                OrijAttackSpeed -= item.AttackSpeed;

                DemageItem += item.Demage;

                OrijHealth += item.HealthBonus;
                MaxHealth  += item.HealthBonus;
                Health     += item.HealthBonus;

                OrijHealthRegeneration += item.HealthRegen;

                OrijMana             += item.ManaBonus;
                MaxMana              += item.ManaBonus;
                OrijManaRegeneration += (int)item.ManaRegen;
                Mana += item.ManaBonus;

                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)
                {
                    Buffs.Add(item.Buff);
                }

                IAura aura = item.AuraItem as IAura;
                if (aura != null)
                {
                    aura.StartUseAura(CurrentMap, null, this, null);
                }

                #endregion
                item.ItemUsed = true;



                if (UpdateItemPlayerData != null)
                {
                    UpdateItemPlayerData(this, null);
                }
            }
            else
            {
                if (item.Name == "Shop")///Если это итем магазин
                {
                    ///Ставим паузу
                    CurrentMap.Pause();
                    if (ShowShop != null)
                    {
                        ShowShop(this, null);
                    }
                }

                Health += item.HealthBonus;
                Mana   += item.ManaBonus;

                if (item.HealthBonus != 0)
                {
                    (this.GameObject.View as IGameControl).GetDemage("+" + item.HealthBonus + " HP");
                }
                else if (item.ManaBonus != 0)
                {
                    (this.GameObject.View as IGameControl).GetDemage("+" + item.ManaBonus + " MP");
                }
            }
            UpdateView();
        }
Esempio n. 7
0
 /// <summary>
 /// Adds the given <paramref name="aura"/> to the system.
 /// </summary>
 public static void Add(IAura aura)
 {
     aura.Apply();
     periodicTrigger.Add(aura);
 }