Exemple #1
0
    //------------------------------------------------------------------------------------------------------------------/

    void OnSpellUsed(SpellBase spell, bool isStatic)
    {
        if (!isStatic)
        {
            Discard(spell);
        }
    }
Exemple #2
0
        private bool getUnitsInPath(AIHeroClient player, AIHeroClient target, SpellBase spell)
        {
            float distance        = player.Distance(target);
            var   minionList      = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, ObjectManager.Player.ServerPosition, spell.Range);
            int   numberOfMinions = (from Obj_AI_Minion minion in minionList
                                     let skillshotPosition =
                                         V2E(player.Position,
                                             V2E(player.Position, target.Position,
                                                 Vector3.Distance(player.Position, target.Position) - spell.Width() + 1).To3D(),
                                             Vector3.Distance(player.Position, minion.Position))
                                         where skillshotPosition.Distance(minion) <= spell.Width()
                                         select minion).Count();
            int numberOfChamps = (from minion in ObjectManager.Get <AIHeroClient>()
                                  let skillshotPosition =
                                      V2E(player.Position,
                                          V2E(player.Position, target.Position,
                                              Vector3.Distance(player.Position, target.Position) - spell.Width() + 1).To3D(),
                                          Vector3.Distance(player.Position, minion.Position))
                                      where skillshotPosition.Distance(minion) < spell.Width() && minion.IsEnemy
                                      select minion).Count();
            int totalUnits = numberOfChamps + numberOfMinions - 1;

            // total number of champions and minions the projectile will pass through.
            if (totalUnits == -1)
            {
                return(false);
            }
            double damageReduction = 0;

            damageReduction = ((totalUnits > 7)) ? 0.4 : (totalUnits == 0) ? 1.0 : (1 - ((totalUnits) / 12.5));
            // the damage reduction calculations minus percentage for each unit it passes through!
            return(spell.GetDamage(target) * damageReduction >= (target.Health + (distance / 2000) * target.HPRegenRate));
            // - 15 is a safeguard for certain kill.
        }
Exemple #3
0
 private void lstSpells_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lstSpells.SelectedIndex > -1)
     {
         cmbSpell.SelectedIndex = SpellBase.ListIndex(mEditorItem.Spells[lstSpells.SelectedIndex]);
     }
 }
Exemple #4
0
        private static List <uint> RandomizeVersion3(SpellBase spell, string accountName)
        {
            List <uint> comps = spell.Formula;

            uint key   = ComputeHash(accountName);
            uint seed1 = key % 0x13D573;
            uint seed2 = key % 0x4AEFD;
            uint seed3 = key % 0x96A7F;
            uint seed4 = key % 0x100A03;
            uint seed5 = key % 0xEB2EF;
            uint seed6 = key % 0x121E7D;

            uint compHash0 = (seed1 + comps[0]) % 0xC;
            uint compHash1 = (seed2 + comps[1]) % 0xC;
            uint compHash2 = (seed3 + comps[2]) % 0xC;
            uint compHash4 = (seed4 + comps[4]) % 0xC;
            uint compHash5 = (seed5 + comps[5]) % 0xC;

            // Some spells don't have the full number of comps. 2697 ("Aerfalle's Touch"), is one example.
            uint compHash7;

            if (comps.Count < 8)
            {
                compHash7 = (seed6 + 0) % 0xC;
            }
            else
            {
                compHash7 = (seed6 + comps[7]) % 0xC;
            }

            comps[3] = (compHash0 + compHash1 + compHash2 + compHash4 + compHash5 + compHash2 * compHash5 + compHash0 * compHash1 + compHash7 * (compHash4 + 1)) % 0xC + LOWEST_TAPER_ID;
            comps[6] = (compHash0 + compHash1 + compHash2 + compHash4 + key % 0x65039 % 0xC + compHash7 * (compHash4 * (compHash0 * compHash1 * compHash2 * compHash5 + 7) + 1) + compHash5 + 4 * compHash0 * compHash1 + compHash0 * compHash1 + 11 * compHash2 * compHash5) % 0xC + LOWEST_TAPER_ID;

            return(comps);
        }
Exemple #5
0
        /// <summary>
        /// Method for handling the removal of an item's spell from the Enchantment registry
        /// </summary>
        /// <param name="guidItem"></param>
        /// <param name="spellId"></param>
        public void RemoveItemSpell(ObjectGuid guidItem, uint spellId)
        {
            WorldObject item = GetWieldedItem(guidItem);

            if (item == null)
            {
                return;
            }

            SpellTable spellTable = DatManager.PortalDat.SpellTable;

            if (!spellTable.Spells.ContainsKey(spellId))
            {
                Session.Network.EnqueueSend(new GameEventUseDone(Session, errorType: WeenieError.MagicInvalidSpellType));
                return;
            }

            SpellBase spell = spellTable.Spells[spellId];

            // Retrieve enchantment
            if (EnchantmentManager.HasSpell(spellId))
            {
                EnchantmentManager.Dispel(EnchantmentManager.GetSpell(spellId));
            }
        }
 public SnowBall(SpellBase spel) : base(spel)
 {
     //spell.Range = 1200f;
     //spell.SetSkillshot(.33f, 50f, 1600, true, SkillshotType.SkillshotLine);
     //spell.MinHitChance = HitChance.High;
     Console.WriteLine("SummonerSpell Set");
 }
Exemple #7
0
 public Buff(SpellBase spell, int flatStats, int percentageStats, long expireTime)
 {
     Spell               = spell;
     FlatStatcount       = flatStats;
     PercentageStatcount = percentageStats;
     ExpireTime          = expireTime;
 }
        public GameEventMagicUpdateEnchantment(Session session, SpellBase spellBase, uint layer, uint spellCategory, uint cooldownId, uint enchantmentTypeFlag)
            : base(GameEventType.MagicUpdateEnchantment, GameMessageGroup.Group09, session)
        {
            const double startTime = 0;
            const double lastTimeDegraded = 0;
            const uint key = 0;
            const float val = 0;
            const uint spellSetId = 0;
            uint spellId = layer | spellCategory | cooldownId; // spellId is made up of these 3 components
            Writer.Write(spellId);
            Writer.Write(layer | spellCategory); // packed spell category
            Writer.Write(spellBase.Power);
            Writer.Write(startTime); // FIXME: this needs to be passed it.
            Writer.Write(spellBase.Duration);
            Writer.Write(session.Player.Guid.Full);
            Writer.Write(spellBase.DegradeModifier);
            Writer.Write(spellBase.DegradeLimit);
            Writer.Write(lastTimeDegraded);
            Writer.Write(enchantmentTypeFlag);

            // FIXME: These next 2 may be depreciated need more research.
            Writer.Write(key);
            Writer.Write(val);
            Writer.Write(spellSetId);

            Writer.Align();
        }
Exemple #9
0
    //------------------------------------------------------------------------------------------------------------------/

    void OnSpellSelected(SpellBase spell, bool isStatic)
    {
        if (!isActive && Inputs.isLocked)
        {
            Events.EmptyCall(InputEvent.OnInterrupt);
            if (Inputs.isLocked)
            {
                return;
            }
        }

        this.isStatic = isStatic;

        Inputs.isLocked = true;
        Extensions.ClearMarks();

        Active  = this;
        current = spell;
        Setup();

        if (!isActive)
        {
            Events.ZipCall(InterfaceEvent.OnSpellTilesAffect, this);

            isActive  = true;
            isWaiting = false;

            Events.Register(InputEvent.OnInterrupt, OnInterrupt);
            Events.RelayByValue <Tile>(InputEvent.OnTileSelected, OnTileSelected);
            Events.RelayByValue <Vector2>(InputEvent.OnMouseMove, OnMouseMove);
        }
    }
Exemple #10
0
    public void Pick(SpellBase spell)
    {
        marks[start].Show();
        current.Add(spell);

        Hide();
    }
Exemple #11
0
        public DoT(Entity attacker, Guid spellId, Entity target)
        {
            SpellBase = SpellBase.Get(spellId);

            Attacker = attacker;
            Target   = target;

            if (SpellBase == null || SpellBase.Combat.HotDotInterval < 1)
            {
                return;
            }

            // Does target have a cleanse buff? If so, do not allow this DoT when spell is unfriendly.
            if (!SpellBase.Combat.Friendly)
            {
                foreach (var status in Target.CachedStatuses)
                {
                    if (status.Type == StatusTypes.Cleanse)
                    {
                        return;
                    }
                }
            }


            mInterval = Globals.Timing.Milliseconds + SpellBase.Combat.HotDotInterval;
            Count     = SpellBase.Combat.Duration / SpellBase.Combat.HotDotInterval - 1;
            target.DoT.TryAdd(Id, this);
            target.CachedDots = target.DoT.Values.ToArray();

            //Subtract 1 since the first tick always occurs when the spell is cast.
        }
Exemple #12
0
        public GameEventMagicUpdateEnchantment(Session session, WorldObject target, SpellBase spellBase, uint layer, int cooldownId, uint enchantmentTypeFlag)
            : base(GameEventType.MagicUpdateEnchantment, GameMessageGroup.UIQueue, session)
        {
            const double startTime        = 0;
            const double lastTimeDegraded = 0;
            ////val is something that is currently not available directly from the spell tables. I am working on fixing this for the SpellManager that is being worked on.
            const float  val        = 35;
            const ushort spellSetId = 0;

            Writer.Write((ushort)spellBase.MetaSpellId);
            Writer.Write((ushort)layer);
            Writer.Write((ushort)spellBase.Category);
            Writer.Write(spellSetId);
            Writer.Write(spellBase.Power);
            Writer.Write(startTime); // FIXME: this needs to be passed it.
            Writer.Write(spellBase.Duration);
            Writer.Write(target.Guid.Full);
            Writer.Write(spellBase.DegradeModifier);
            Writer.Write(spellBase.DegradeLimit);
            Writer.Write(lastTimeDegraded);    ////This needs timer updates to work correctly
            Writer.Write(enchantmentTypeFlag); ////This is something that needs to be worked on. There is currently no way to get correct flags based on the spell table itself. They are in the logs though and we could eventually add this to the spell table.
            Writer.Write(spellBase.Category);
            Writer.Write(val);
            Writer.Write(spellSetId);

            Writer.Align();
        }
 private void OnSpellUsed(SpellBase spell, bool isStatic)
 {
     if (Spell == spell)
     {
         gameObject.SetActive(false);
     }
 }
Exemple #14
0
 public Buff(SpellBase spell, int flatStats, int percentageStats, int duration)
 {
     Spell               = spell;
     FlatStatcount       = flatStats;
     PercentageStatcount = percentageStats;
     Duration            = Globals.Timing.Milliseconds + duration;
 }
Exemple #15
0
        /// <summary>
        /// Method used for handling creature untargeted spell casts
        /// </summary>
        public void CreateCreatureSpell(uint spellId)
        {
            Creature creature = CurrentLandblock?.GetObject(Guid) as Creature;

            if (creature.IsBusy == true)
            {
                return;
            }
            else
            {
                creature.IsBusy = true;
            }

            SpellTable spellTable = DatManager.PortalDat.SpellTable;

            if (!spellTable.Spells.ContainsKey(spellId))
            {
                creature.IsBusy = false;
                return;
            }

            SpellBase spell = spellTable.Spells[spellId];

            float scale = SpellAttributes(null, spellId, out float castingDelay, out MotionCommand windUpMotion, out MotionCommand spellGesture);

            creature.IsBusy = false;
            return;
        }
Exemple #16
0
 public bool SetSpells(SpellBase[] updatedSpells, bool setFirstItemAsActive)
 {
     if (updatedSpells != null)
     {
         spells = updatedSpells;
         RenderInternal();
         if (setFirstItemAsActive && transform.childCount > 0)
         {
             // Make the first child the active one
             Transform firstChild = transform.GetChild(0);
             Toggle toggle = firstChild.GetComponent<Toggle>();
             toggle.isOn = true;
         }
         else
         {
             return setFirstItemAsActive;
         }
         return false; // Child was set
     }
     else
     {
         Debug.LogError ("Invalid set of spells");
     }
     return setFirstItemAsActive; // To give the next panel the option to set the gui.
 }
    protected virtual void LateUpdate()
    {
        // TODO: This works, so make cast animations based off it
        //if (casting != null)
        //transform.FindRecursively("hips").Translate(0F, .25F, 0F);

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            InterfaceController ic = InterfaceController.GetInstance();

            if (ic && (ic.IsInterfaceOpen(InterfaceController.Side.LEFT) || ic.IsInterfaceOpen(InterfaceController.Side.RIGHT)))
            {
                ic.CloseInterface(InterfaceController.Side.LEFT);
                ic.CloseInterface(InterfaceController.Side.RIGHT);
            }
            else if (casting != null)
            {
                casting = null;
                return;
            }
            else
            {
                TargetTracker.target = null;
                return;
            }
        }
    }
Exemple #18
0
        public object SpellsTake(LookupKey lookupKey, [FromBody] SpellInfo spell)
        {
            if (lookupKey.IsInvalid)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.BadRequest, lookupKey.IsIdInvalid ? @"Invalid player id." : @"Invalid player name."
                           ));
            }

            if (SpellBase.Get(spell.SpellId) == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, @"Invalid spell id."));
            }

            var(client, player) = Player.Fetch(lookupKey);
            if (player == null)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.NotFound,
                           lookupKey.HasId
                        ? $@"No player with id '{lookupKey.Id}'."
                        : $@"No player with name '{lookupKey.Name}'."
                           ));
            }

            if (player.TryForgetSpell(new Spell(spell.SpellId), true))
            {
                return(spell);
            }

            return(Request.CreateErrorResponse(
                       HttpStatusCode.InternalServerError, $@"Failed to remove player spell with id '{spell.SpellId}'."
                       ));
        }
Exemple #19
0
 public void SpawnTrap(Entity owner, SpellBase parentSpell, byte x, byte y, byte z)
 {
     lock (GetMapLock())
     {
         var trap = new MapTrapInstance(owner, parentSpell, Id, x, y, z);
         MapTraps.Add(trap);
     }
 }
Exemple #20
0
 public static PredictionResult GetPrediction(this SpellBase spell, Obj_AI_Base target, bool value = true)
 {
     if (target == null)
     {
         return(null);
     }
     return((spell as Skillshot).GetPrediction(target));
 }
Exemple #21
0
        private static List <uint> RandomizeVersion1(SpellBase spell, string accountName)
        {
            List <uint> comps     = spell.Formula;
            bool        hasTaper1 = false;
            bool        hasTaper2 = false;
            bool        hasTaper3 = false;

            uint key  = ComputeHash(accountName);
            uint seed = key % 0x13D573;

            uint scarab     = comps[0];
            int  herb_index = 1;

            if (comps.Count > 5)
            {
                herb_index = 2;
                hasTaper1  = true;
            }
            uint herb = comps[herb_index];

            int powder_index = herb_index + 1;

            if (comps.Count > 6)
            {
                powder_index++;
                hasTaper2 = true;
            }
            uint powder = comps[powder_index];

            int  potion_index = powder_index + 1;
            uint potion       = comps[potion_index];

            int talisman_index = potion_index + 1;

            if (comps.Count > 7)
            {
                talisman_index++;
                hasTaper3 = true;
            }
            uint talisman = comps[talisman_index];

            if (hasTaper1)
            {
                comps[1] = (powder + 2 * herb + potion + talisman + scarab) % 0xC + LOWEST_TAPER_ID;
            }

            if (hasTaper2)
            {
                comps[3] = (scarab + herb + talisman + 2 * (powder + potion)) * (seed / (scarab + (powder + potion))) % 0xC + LOWEST_TAPER_ID;
            }

            if (hasTaper3)
            {
                comps[6] = (powder + 2 * talisman + potion + herb + scarab) * (seed / (talisman + scarab)) % 0xC + LOWEST_TAPER_ID;
            }

            return(comps);
        }
Exemple #22
0
 public void AddSpellEffect(SpellBase effect)
 {
     if (effect != null)
     {
         var prefab = Instantiate(effectPrefab);
         prefab.SetEffect(effect, this);
         prefab.transform.SetParent(ActiveEffects.transform);
     }
 }
Exemple #23
0
 public void Init(SpellCastBase spellCastPrefab, CastPlaceholder spellCirclePrefab
                  , BaseSpellCastData spellCastData, SpellBase spellPrefab)
 {
     this.spellCastPrefab   = spellCastPrefab;
     this.spellCirclePrefab = spellCirclePrefab;
     this.spellCastData     = spellCastData;
     this.spellPrefab       = spellPrefab;
     spellElement           = spellPrefab.SpellElement;
 }
Exemple #24
0
 public Enchantment(WorldObject target, SpellBase spellBase, double duration, ushort layer, uint?enchantmentMask, float?statMod = null)
 {
     Target          = target;
     SpellBase       = spellBase;
     Layer           = layer;
     Duration        = duration;
     EnchantmentMask = (EnchantmentMask)(enchantmentMask ?? 0);
     StatMod         = statMod;
 }
Exemple #25
0
 /// <summary>
 /// Void Magic
 /// </summary>
 /// <param name="target"></param>
 /// <param name="spell"></param>
 /// <param name="spellStatMod"></param>
 protected void VoidMagic(WorldObject target, SpellBase spell, Database.Models.World.Spell spellStatMod)
 {
     if (WeenieClassId == 1)
     {
         Player player = (Player)this;
         player.Session.Network.EnqueueSend(new GameEventUseDone(player.Session, errorType: WeenieError.None),
                                            new GameMessageSystemChat($"{spell.Name} spell not implemented, yet!", ChatMessageType.System));
     }
 }
Exemple #26
0
    public void Initialize(int tier)
    {
        var key    = new SpellKey(category, tier);
        var spells = Repository.Get <Spells>(References.Spells);

        spell            = spells.GetRandom(key);
        title.text       = spell.Title;
        thumbnail.sprite = spell.Thumbnail;
    }
Exemple #27
0
        /// <summary>
        /// Method used for handling creature targeted spell casts
        /// </summary>
        public void CreateCreatureSpell(ObjectGuid guidTarget, uint spellId)
        {
            Creature creature = CurrentLandblock?.GetObject(Guid) as Creature;

            if (creature.IsBusy == true)
            {
                return;
            }

            creature.IsBusy = true;

            SpellTable spellTable = DatManager.PortalDat.SpellTable;

            if (!spellTable.Spells.ContainsKey(spellId))
            {
                creature.IsBusy = false;
                return;
            }

            SpellBase spell = spellTable.Spells[spellId];

            bool targetSelf = false || (int)Math.Floor(spell.BaseRangeConstant) == 0;
            var  target     = targetSelf ? this : CurrentLandblock?.GetObject(guidTarget);

            Database.Models.World.Spell spellStatMod = DatabaseManager.World.GetCachedSpell(spellId);
            if (spellStatMod == null)
            {
                creature.IsBusy = false;
                return;
            }

            float scale = SpellAttributes(null, spellId, out float castingDelay, out MotionCommand windUpMotion, out MotionCommand spellGesture);

            switch (spell.School)
            {
            case MagicSchool.ItemEnchantment:
                // if (!targetSelf && ResistSpell(Skill.CreatureEnchantment)) break;
                ItemMagic(target, spell, spellStatMod);
                EnqueueBroadcast(new GameMessageScript(target.Guid, (PlayScript)spell.TargetEffect, scale));
                break;

            case MagicSchool.LifeMagic:

                break;

            case MagicSchool.CreatureEnchantment:

                break;

            case MagicSchool.WarMagic:

                break;
            }

            creature.IsBusy = false;
            return;
        }
Exemple #28
0
 public Enchantment(WorldObject target, uint casterGuid, SpellBase spellBase, double duration, ushort layer, EnchantmentMask enchantmentMask, float?statMod = null)
 {
     Target          = target;
     CasterGuid      = casterGuid;
     Spell           = new Spell(spellBase.MetaSpellId);
     Layer           = layer;
     Duration        = duration;
     EnchantmentMask = enchantmentMask;
     StatMod         = statMod;
 }
Exemple #29
0
        public static void CastIfWillHit(this SpellBase spell, Obj_AI_Base target, int hitNumber)
        {
            var prediction          = (spell as Skillshot).GetPrediction(target);
            var enemiesInSpellRange = EntityManager.Heroes.Enemies.Count(x => !x.IsDead && x.Distance(prediction.CastPosition) <= spell.Range);

            if (hitNumber <= enemiesInSpellRange)
            {
                spell.Cast(prediction.CastPosition);
            }
        }
Exemple #30
0
        public override void setUpSpells()
        {
            Q1 = Q = new Spell.Skillshot(SpellSlot.Q, 850, SkillShotType.Circular, 300, 1700, 130);
            Q2 = new Spell.Skillshot(SpellSlot.Q, 1125, SkillShotType.Circular, 250 + Q1.CastDelay, 1700, 130);
            Q3 = new Spell.Skillshot(SpellSlot.Q, 1400, SkillShotType.Circular, 300 + Q2.CastDelay, 1700, 140);

            W = new Spell.Skillshot(SpellSlot.W, 1000, SkillShotType.Circular, 250, 1750, 275);
            E = new Spell.Skillshot(SpellSlot.E, 900, SkillShotType.Circular, 500, 1750, 100);
            R = new Spell.Skillshot(SpellSlot.R, 5300, SkillShotType.Circular, 2000, 1500, 500);
        }
 public MapTrapInstance(Entity owner, SpellBase parentSpell, Guid mapId, byte x, byte y, byte z)
 {
     Owner       = owner;
     ParentSpell = parentSpell;
     Duration    = Globals.Timing.Milliseconds + ParentSpell.Combat.TrapDuration;
     MapId       = mapId;
     X           = x;
     Y           = y;
     Z           = z;
 }
Exemple #32
0
 void Start()
 {
     if (AvailableSpells.Length > 0)
     {
         ActiveSpell = AvailableSpells[0];
     }
     else
     {
         ActiveSpell = new SpellBase();
     }
 }
Exemple #33
0
 static void AddByArt(SpellBase spellBase)
 {
     if (!_spellBasesByArts.ContainsKey(spellBase.ArtPair.Technique))
     {
         _spellBasesByArts[spellBase.ArtPair.Technique] = new Dictionary<Ability, List<SpellBase>>();
     }
     if (!_spellBasesByArts[spellBase.ArtPair.Technique].ContainsKey(spellBase.ArtPair.Form))
     {
         _spellBasesByArts[spellBase.ArtPair.Technique][spellBase.ArtPair.Form] = new List<SpellBase>();
     }
     _spellBasesByArts[spellBase.ArtPair.Technique][spellBase.ArtPair.Form].Add(spellBase);
 }
Exemple #34
0
 static void AddByEffect(SpellBase spellBase)
 {
     if (!_spellBasesByEffects.ContainsKey(spellBase.TechniqueEffects))
     {
         _spellBasesByEffects[spellBase.TechniqueEffects] = new Dictionary<FormEffects, SpellBase>();
     }
     if (!_spellBasesByEffects[spellBase.TechniqueEffects].ContainsKey(spellBase.FormEffects))
     {
         _spellBasesByEffects[spellBase.TechniqueEffects][spellBase.FormEffects] = spellBase;
     }
     else
     {
         throw new ArgumentException("Two spell bases with identical effects are not allowed");
     }
 }
Exemple #35
0
    public SpellInstance(UnitEntity unit, SpellBase spell)
    {
        mCurTime = 0;
        mTickStart = Time.fixedTime;
        mSpell = spell;

        if(unit.statusIndicator != null && unit.statusIndicator.curIcon != mSpell.icon) {
            unit.statusIndicator.Show(mSpell.icon, mSpell.duration);
        }

        if(mSpell.mod != null) {
            unit.stats.AddMod(mSpell.mod);
        }

        unit.StartCoroutine(DebuffUpdate(unit));
    }
 public void Launch(SpellBase spell, Transform caster, Action action)
 {
     //Debug.Log("Launch");
     spell.Activate(SpellOrb, caster,Stats, action);
 }
Exemple #37
0
 //TODO: refactor with a better system, this one sucks!
 ///<summary>check to see if this unit is suseptible to given spell</summary>
 public bool SpellCheck(SpellBase spell)
 {
     return (stats != null
         && mSpells.FindIndex(x => x.IsSpellMatch(spell)) == -1 //already affected
         && !stats.SpellImmuneCheck(spell.flags));
 }
Exemple #38
0
 public void SpellAdd(SpellBase spell)
 {
     SpellRemoveDead();
     if(mSpells.FindIndex(x => x.IsSpellMatch(spell)) == -1) {
         mSpells.Add(spell.Start(this));
         if(mSpells.Count > 1)
             Debug.LogWarning("more than one spell? spell count: " + mSpells.Count);
     }
 }
 public void UpdateUI(UnitBase unit)
 {
     if (unit.Spells.Length > 0 && unit.Spells[0].CooldownTimer == 0 && unit.Mana >= unit.Spells[0].ManaCost)
     {
         skillButton.SetActive(true);
         skillButton.GetComponent<UnityEngine.UI.Image>().sprite = unit.Spells[0].Icon;
         this.ActiveSpell = unit.Spells[0];
     }
     else
     {
         skillButton.SetActive(false);
     }
 }
Exemple #40
0
 void HandleSpellActivated(SpellBase spell, SpellBase.SpellActivatedEventArgs e)
 {
     // Update the player settings
     playerSettings.ActiveSpell = spell;
 }
Exemple #41
0
    //remove, basically (used by something like dispell)
    public void Stop(UnitEntity unit)
    {
        if(alive) {
            if(unit.statusIndicator != null && unit.statusIndicator.curIcon == mSpell.icon) {
                unit.statusIndicator.Hide();
            }

            if(mSpell.mod != null) {
                unit.stats.RemoveMod(mSpell.mod);
            }

            Remove(unit);
            mSpell = null;
        }
    }
Exemple #42
0
 public bool IsSpellMatch(SpellBase spell)
 {
     return spell.id == mSpell.id;
 }
Exemple #43
0
 static void Add(SpellBase spellBase)
 {
     AddByArt(spellBase);
     AddByEffect(spellBase);
 }