Example #1
0
 public SpellBarPictureBox(int spellNumber)
     : base()
 {
     RelatedEffect = new EffectEntry();
     SpellNumber = spellNumber;
     IsPermanentSpell = false;
 }
Example #2
0
        public Effect(EffectEntry effectEntry, Unit target, Unit caster)
        {
            this.effectInfo = effectEntry;
            this.target = target;
            this.caster = caster;

            targetsList = new List<Unit>();
        }
Example #3
0
        public EffectHolder(EffectEntry effectEntry)
        {
            this.EffectInfo = effectEntry;
            this.pr_Duration = effectEntry.Duration;

            EffectState = EffectState.Applied;
        }
Example #4
0
File: Play.cs Project: scerdam/Maze
        /// <summary>
        /// Add new Spell into spell bar. If Spell Slot value is set and that slot is occupied, Spell is replaced.
        /// </summary>
        /// <param name="effectEntry">related EffectEntry of the spell</param>
        /// <param name="isPermanent">Is Spell Permanent or Disposable</param>
        /// <param name="spellSlotNumber">Spell slot on spell bar</param>
        public void AddSpell(EffectEntry effectEntry, bool isPermanent = false, int spellSlotNumber = -1)
        {
            // Check the validity of the input parameters
            if (spellSlotNumber < -1 || spellSlotNumber >= MAX_SPELLS_COUNT)
                return;

            int spellSlot = spellSlotNumber;
            bool isExist = false;

            // Find first free slot
            if (spellSlot == -1)
            {
                int firstFree = -1;
                for (int i = 0; i < MAX_SPELLS_COUNT; ++i)
                {
                    if (firstFree == -1 && this.pbSpellBars[i].RelatedEffect.ID == 0)
                        firstFree = i;

                    // Can not exist two Permanent/Disposable spells at the same time
                    if (effectEntry.ID == this.pbSpellBars[i].RelatedEffect.ID && isPermanent == this.pbSpellBars[i].IsPermanentSpell)
                    {
                        isExist = true;
                    }
                }

                spellSlot = firstFree;
            }

            // when free slot is found
            // and the played do not have this spell already
            if (!isExist && spellSlot != -1)
            {
                this.pbSpellBars[spellSlot].RelatedEffect = effectEntry;
                this.pbSpellBars[spellSlot].Image = PictureManager.EffectImages[effectEntry.ID].Aura;
                this.pbSpellBars[spellSlot].IsPermanentSpell = isPermanent;
                this.pbSpellBars[spellSlot].Show();
                this.toolTipAuras.SetToolTip(this.pbSpellBars[spellSlot], effectEntry.EffectName + "\n"
                    + effectEntry.Description);
            }
        }