Example #1
0
        //public void ModDebuffResistance(DamageTypeMask schools, float delta)
        //{
        //    foreach (var school in UnitMechanics.DamageTypeMasks) {
        //        if ((schools & school) != 0) {
        //            ModDebuffResistance(UnitMechanics.DamageTypeLookup[school], delta);
        //        }
        //    }
        //}
        #endregion

        #region Dispel Immunities
        public bool IsImmune(DispelType school)
        {
            if (m_dispelImmunities == null)
            {
                return(false);
            }
            return(m_dispelImmunities[(int)school] > 0);
        }
Example #2
0
File: Spell.cs Project: ariporz/sim
 public Spell(int id, string name, float cost, int duration, TargetType targetType, DispelType dispelType, List <Effect> effects)
 {
     Id         = id;
     Name       = name;
     Cost       = cost;
     Duration   = duration;
     TargetType = targetType;
     DispelType = dispelType;
     Effects    = effects;
 }
 public AuraEffect(ushort _id, int _customFlags1, int _add,
                   int _levelMin, int _levelMax, int _bonus1, int _bonus2, int _s1, int _s2, int _s3,
                   int _t1, int _t2, Resistances _res, DispelType _dis,
                   int _manacost, int _castingtime, byte _range, int _duration, int _cooldown,
                   int _aura, int _h, int _classe) : base(_id, _customFlags1, _add,
                                                          _levelMin, _levelMax, _bonus1, _bonus2, _s1, _s2, _s3, _t1, _t2, _res, _dis,
                                                          _manacost, _castingtime, _range, _duration, _cooldown, _h, 0, 0, 0, _classe)
 {
     aura = _aura;
 }
Example #4
0
        public AuraEffect( ushort _id,int _customFlags1,  int _add,
            int _levelMin, int _levelMax, int _bonus1, int _bonus2, int _s1, int _s2, int _s3,
            int _t1, int _t2, Resistances _res, DispelType _dis,
            int _manacost, int _castingtime, byte _range, int _duration, int _cooldown,
            int _aura, int _h, int _classe)
            : base(_id,_customFlags1,  _add,
			_levelMin, _levelMax, _bonus1, _bonus2, _s1, _s2, _s3, _t1, _t2, _res,_dis,
			_manacost, _castingtime, _range, _duration, _cooldown, _h, 0, 0, 0, _classe)
        {
            aura = _aura;
        }
 public ComboSpellTemplate(ushort _id, int _customFlags1,
                           int _levelMin, int _levelMax, int _bonus1, int _bonus2,
                           int _s1, int _s2, int _s3,
                           Resistances _res, DispelType _dis,
                           int _manacost, int _castingtime, byte _range, float _comboModifier, int _duration, int _cooldown,
                           int _h, int _classe) : base(_id, _customFlags1,
                                                       _levelMin, _levelMax, _bonus1, _bonus2, _s1, _s2, _s3, _res, _dis,
                                                       _manacost, _castingtime, _range, _duration, _cooldown, _h, 0, 0, 0, _classe)
 {
     comboModifier = _comboModifier;
 }
Example #6
0
        public ComboSpellTemplate( ushort _id, int _customFlags1,   
            int _levelMin, int _levelMax, int _bonus1, int _bonus2,
            int _s1, int _s2, int _s3,
            Resistances _res, DispelType _dis,
            int _manacost, int _castingtime, byte _range, float _comboModifier, int _duration, int _cooldown,
            int _h, int _classe)
            : base(_id, _customFlags1, 
			_levelMin, _levelMax, _bonus1, _bonus2, _s1, _s2, _s3, _res, _dis,
			_manacost, _castingtime, _range, _duration, _cooldown, _h, 0, 0, 0,_classe)
        {
            comboModifier = _comboModifier;
        }
Example #7
0
 public MountAuraEffect(ushort _id, int _customFlags1, int _mountid,
                        int _levelMin, int _levelMax, int _bonus1, int _bonus2, int _s1, int _s2, int _s3,
                        int _t1, int _t2, Resistances _res, DispelType _dis,
                        int _manacost, int _castingtime, int _duration, int _cooldown,
                        int _aura, int _h, int _classe) : base(_id, _customFlags1,
                                                               _levelMin, _levelMax, _bonus1, _bonus2, _s1, _s2, _s3, _t1, _t2, _res, _dis,
                                                               _manacost, _castingtime, 0, _duration, _cooldown, _aura, _h, _classe)
 {
     mountId                   = _mountid;
     speedModifier             = ((float)_s2) / 100f;
     World.MountsList[mountId] = this;
 }
Example #8
0
        public MountAuraEffect( ushort _id,int _customFlags1,   int _mountid,
            int _levelMin, int _levelMax, int _bonus1, int _bonus2, int _s1, int _s2, int _s3,
            int _t1, int _t2, Resistances _res, DispelType _dis,
            int _manacost, int _castingtime, int _duration, int _cooldown,
            int _aura, int _h, int _classe)
            : base(_id, _customFlags1, 
			_levelMin, _levelMax, _bonus1, _bonus2, _s1, _s2, _s3, _t1, _t2, _res,_dis,
			_manacost, _castingtime, 0, _duration, _cooldown, _aura, _h, _classe)
        {
            mountId = _mountid;
            speedModifier = ( (float)_s2 ) / 100f;
            World.MountsList[ mountId ] = this;
        }
Example #9
0
        //public void IncDispelImmunity( DispelType school )
        //{
        //    if ( m_dispelImmunities == null )
        //    {
        //        m_dispelImmunities = CreateDispelTypeArr();
        //    }
        //    int value = m_dispelImmunities[(uint)school];
        //    if ( value == 0 )
        //    {
        //        // new immunity: Gets rid of all Auras that use this DispelType
        //        m_owner.Auras.RemoveWhere( ( aura ) =>
        //        {
        //            return aura.Spell.DispelType == school;
        //        } );
        //    }
        //    m_dispelImmunities[(uint)school] = value + 1;
        //}

        public void DecDispelImmunity(DispelType school)
        {
            if (m_dispelImmunities == null)
            {
                return;
            }
            int value = m_dispelImmunities[(uint)school];

            if (value > 0)
            {
                m_dispelImmunities[(int)school] = value - 1;
            }
        }
Example #10
0
        /// <summary>
        /// Returns the amount of visible Auras that are casted by the given caster
        /// and have the given DispelType.
        /// </summary>
        public int GetVisibleAuraCount(ObjectReference caster, DispelType type)
        {
            var count = 0;

            foreach (var aura in m_visibleAuras)
            {
                if (aura != null && aura.CasterReference == caster && aura.Spell.DispelType == type)
                {
                    count++;
                }
            }
            return(count);
        }
Example #11
0
 public Ability(ushort _id, int _customFlags1,
                int _degatMin, int _degatMax, Resistances _res, DispelType _dis,
                int _manacost, int _castingtime, byte _range, int _duration, int _cooldown,
                int _classe) : base(_id, _customFlags1, _cooldown)
 {
     degatMin    = _degatMin;
     degatMax    = _degatMax;
     resistance  = _res;
     dispeltype  = _dis;
     classe      = _classe;
     manaCost    = _manacost;
     castingTime = _castingtime;
     range       = _range;
     duration    = _duration;
 }
Example #12
0
        /// <summary>
        /// Returns the amount of visible Auras that are casted by the given caster
        /// and have the given DispelType.
        /// </summary>
        public int GetVisibleAuraCount(ObjectReference caster, DispelType type)
        {
            int num = 0;

            foreach (Aura visibleAura in this.m_visibleAuras)
            {
                if (visibleAura != null && visibleAura.CasterReference == caster &&
                    visibleAura.Spell.DispelType == type)
                {
                    ++num;
                }
            }

            return(num);
        }
Example #13
0
		//int cooldown;	

		public Ability( ushort _id,int _customFlags1,    
			int _degatMin, int _degatMax, Resistances _res,DispelType _dis, 
			int _manacost, int _castingtime, byte _range, int _duration, int _cooldown, 
			int _classe	) : base( _id,_customFlags1,  _cooldown )
		{
			degatMin = _degatMin;
			degatMax = _degatMax;
			resistance = _res;
			dispeltype = _dis;
			classe = _classe;
			manaCost = _manacost;
			castingTime = _castingtime;
			range = _range;
			duration = _duration;
		}
Example #14
0
        protected override void Apply(WorldObject target, ref DamageAction[] actions)
        {
            DispelType miscValue = (DispelType)Effect.MiscValue;

            if (miscValue == DispelType.None)
            {
                throw new Exception("Invalid DispelType None in Spell: " + Effect.Spell);
            }
            Unit casterUnit1 = Cast.CasterUnit;
            int  num         = CalcEffectValue();

            foreach (Aura aura in ((Unit)target).Auras)
            {
                if (aura.Spell.DispelType == miscValue)
                {
                    Unit casterUnit2 = aura.CasterUnit;
                    if (casterUnit1 != null && casterUnit2 != null &&
                        (casterUnit1.MayAttack(casterUnit2) &&
                         casterUnit2.Auras.GetModifiedInt(SpellModifierType.DispelResistance, aura.Spell, 1) >
                         Utility.Random(100)))
                    {
                        if (--num == 0)
                        {
                            break;
                        }
                    }
                    else
                    {
                        aura.Remove(true);
                        if (--num == 0)
                        {
                            break;
                        }
                    }
                }
            }
        }
Example #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="unlocalizedName"></param>
        /// <param name="displayName"></param>
        /// <param name="abilityType"></param>
        /// <param name="abilityTargetType"></param>
        /// <param name="abilityTargetUnitFaction"></param>
        /// <param name="damageType"></param>
        /// <param name="abilitySlot"></param>
        /// <param name="unlockableAtLevel">At what level can the player start leveling this ability. A level of 0 means the player starts with the ability.</param>
        /// <param name="maxLevel">The maximum level that this ability can be leveled up to.</param>
        /// <param name="alwaysShowInAbilitesBar"></param>
        /// <param name="baseCastRange">The maximum distance between the target point and the player.</param>
        /// <param name="affectsTotalAbilityLevelCount">Should this ability contribute towards the total levels spent on abilities count.</param>
        protected AbilityDefinition(string unlocalizedName, string displayName, AbilityType abilityType, AbilityTargetType abilityTargetType, AbilityTargetFaction abilityTargetUnitFaction, AbilityTargetUnitType abilityTargetUnitType, DamageType damageType, AbilitySlot abilitySlot, int unlockableAtLevel, int maxLevel, bool alwaysShowInAbilitesBar = true, float baseCastRange = -1, bool affectsTotalAbilityLevelCount = true, DispelType baseDispelType = DispelType.None)
        {
            UnlocalizedName = unlocalizedName;
            DisplayName     = displayName;

            AbilityType              = abilityType;
            AbilityTargetType        = abilityTargetType;
            AbilityTargetUnitFaction = abilityTargetUnitFaction;
            AbilityTargetUnitType    = abilityTargetUnitType;

            DamageType = damageType;

            AbilitySlot = abilitySlot;

            UnlockableAtLevel = unlockableAtLevel;
            MaxLevel          = maxLevel;

            AlwaysShowInAbilitiesBar = alwaysShowInAbilitesBar;

            BaseCastRange = baseCastRange;
            AffectsTotalAbilityLevelCount = affectsTotalAbilityLevelCount;

            BaseDispelType = baseDispelType;
        }
Example #16
0
        /*
        [XmlAttribute]
        [DefaultValue(0)]
        public int value;
        */
        public override void Import(ClientEffect importObject, IEnumerable<FieldInfo> getters)
        {
            base.Import(importObject, getters);

            string dispelType = importObject.reserved[0].Trim().ToLower();
            bool skipAdd = false;

            if (dispelType == "effect_type")
                dispeltype = DispelType.EFFECTTYPE;
            else if (dispelType == "effect_id")
                dispeltype = DispelType.EFFECTID;
            else if (dispelType == "effect_id_range") {
                dispeltype = DispelType.EFFECTID;
                int from = Int32.Parse(importObject.reserved[1]);
                int to = Int32.Parse(importObject.reserved[2]);
                List<int> ids = new List<int>();
                for (int i = from; i <= to; i++)
                    ids.Add(i);
                effectids = ids.ToArray();
                skipAdd = true;
            }
            else if (dispelType == "slot_type") {
                dispeltype = DispelType.SLOTTYPE;
                //this.slottype = importObject.reserved[1].Trim().ToUpper();
                skipAdd = true;
            } else {
                Debug.Print("Unknown DispelType: '{0}'", dispelType);
                return;
            }

            if (!skipAdd) {
                List<string> dispels = new List<string>();
                for (int i = 1; i < 6; i++) {
                    string dispel = importObject.reserved[i];
                    if (dispel == null)
                        continue;
                    dispel = dispel.Trim().ToLower();
                    //if (dispel == "polymorph")
                    //    dispel = "shapechange";
                    dispels.Add(dispel.ToUpper());
                }

                if (dispeltype == DispelType.EFFECTTYPE)
                    effecttype = dispels.ToArray();
                else
                    effectids = dispels.Select(s => Int32.Parse(s)).ToArray();
            }
            /*
            if (importObject.reserved[13] != null)
                this.value = Int32.Parse(importObject.reserved[13].Trim());
            else if (importObject.reserved[12] != null)
                this.value = Int32.Parse(importObject.reserved[12].Trim());
            */
        }
Example #17
0
		public void DecDispelImmunity(DispelType school)
		{
			if (m_dispelImmunities == null)
			{
				return;
			}
			int value = m_dispelImmunities[(uint)school];
			if (value > 0)
			{
				m_dispelImmunities[(int)school] = value - 1;
			}
		}
Example #18
0
		public void IncDispelImmunity(DispelType school)
		{
			if (m_dispelImmunities == null)
			{
				m_dispelImmunities = CreateDispelTypeArr();
			}
			int value = m_dispelImmunities[(uint)school];
			if (value == 0)
			{
				// new immunity: Gets rid of all Auras that use this DispelType
				Auras.RemoveWhere(aura => aura.Spell.DispelType == school);
			}
			m_dispelImmunities[(uint)school] = value + 1;
		}
Example #19
0
		//public void ModDebuffResistance(DamageTypeMask schools, float delta)
		//{
		//    foreach (var school in UnitMechanics.DamageTypeMasks) {
		//        if ((schools & school) != 0) {
		//            ModDebuffResistance(UnitMechanics.DamageTypeLookup[school], delta);
		//        }
		//    }
		//}
		#endregion

		#region Dispel Immunities
		public bool IsImmune(DispelType school)
		{
			if (m_dispelImmunities == null)
			{
				return false;
			}
			return m_dispelImmunities[(int)school] > 0;
		}
Example #20
0
/*
 *              [XmlAttribute]
 *              [DefaultValue(0)]
 *              public int value;
 */
        public override void Import(ClientEffect importObject, IEnumerable <FieldInfo> getters)
        {
            base.Import(importObject, getters);

            string dispelType = importObject.reserved[0].Trim().ToLower();
            bool   skipAdd    = false;

            if (dispelType == "effect_type")
            {
                dispeltype = DispelType.EFFECTTYPE;
            }
            else if (dispelType == "effect_id")
            {
                dispeltype = DispelType.EFFECTID;
            }
            else if (dispelType == "effect_id_range")
            {
                dispeltype = DispelType.EFFECTID;
                int        from = Int32.Parse(importObject.reserved[1]);
                int        to   = Int32.Parse(importObject.reserved[2]);
                List <int> ids  = new List <int>();
                for (int i = from; i <= to; i++)
                {
                    ids.Add(i);
                }
                effectids = ids.ToArray();
                skipAdd   = true;
            }
            else if (dispelType == "slot_type")
            {
                dispeltype = DispelType.SLOTTYPE;
                //this.slottype = importObject.reserved[1].Trim().ToUpper();
                skipAdd = true;
            }
            else
            {
                Debug.Print("Unknown DispelType: '{0}'", dispelType);
                return;
            }

            if (!skipAdd)
            {
                List <string> dispels = new List <string>();
                for (int i = 1; i < 6; i++)
                {
                    string dispel = importObject.reserved[i];
                    if (dispel == null)
                    {
                        continue;
                    }
                    dispel = dispel.Trim().ToLower();
                    //if (dispel == "polymorph")
                    //    dispel = "shapechange";
                    dispels.Add(dispel.ToUpper());
                }

                if (dispeltype == DispelType.EFFECTTYPE)
                {
                    effecttype = dispels.ToArray();
                }
                else
                {
                    effectids = dispels.Select(s => Int32.Parse(s)).ToArray();
                }
            }

            /*
             * if (importObject.reserved[13] != null)
             *      this.value = Int32.Parse(importObject.reserved[13].Trim());
             * else if (importObject.reserved[12] != null)
             *      this.value = Int32.Parse(importObject.reserved[12].Trim());
             */
        }
Example #21
0
        private void DrawDescription(SpriteBatch spriteBatch, AbilityDefinition ability)
        {
            DoTariaPlayer doTariaPlayer = DoTariaPlayer.Get(Main.LocalPlayer);
            PlayerAbility currentPlayerAbility;

            if (doTariaPlayer.HasAbility(ability))
            {
                currentPlayerAbility = doTariaPlayer.GetPlayerAbility(ability);
            }
            else
            {
                currentPlayerAbility = new PlayerAbility(ability, 1, 0);
            }

            int
                panelWidth  = 300,
                panelHeight = 34;

            Vector2 position = Main.MouseWorld + new Vector2(Main.cursorTextures[0].Width, Main.cursorTextures[0].Height * 2) - Main.screenPosition;

            StringBuilder description = new StringBuilder("Ability: ");


            if (ability.AbilityTargetType == AbilityTargetType.NoTarget && ability.AbilityType == AbilityType.Passive)
            {
                description.Append(ability.AbilityType);
            }
            else
            {
                description.Append(ability.AbilityTargetType.ToString().AddSpaceBeforeCapitals());
            }

            description.AppendLine();

            if (ability.AbilityTargetUnitType != AbilityTargetUnitType.None)
            {
                description.Append("Affects: ");

                if (!(ability.AbilityTargetUnitFaction == AbilityTargetFaction.Self || ability.AbilityTargetUnitFaction == (AbilityTargetFaction.Enemies & AbilityTargetFaction.Allies)))
                {
                    description.Append(ability.AbilityTargetUnitFaction).Append(" ");
                }

                description.Append(ability.AbilityTargetUnitType.ToString().AddSpaceBeforeCapitals()).AppendLine();
            }

            description.Append(ability.GetAbilityTooltip(doTariaPlayer, currentPlayerAbility));

            DispelType dispelType = ability.GetDispelType(doTariaPlayer, currentPlayerAbility);

            if (dispelType != DispelType.None)
            {
                description.AppendLine().Append("Dispel type: ").Append(dispelType.ToString()).Append(" Dispel");
            }

            description.AppendLine();
            string finaliziedDescription = SpliceText(description.ToString(), 34);

            panelHeight += finaliziedDescription.Split('\n').Length * 26;

            spriteBatch.Draw(Main.magicPixel, position, new Rectangle(0, 0, panelWidth, panelHeight), Color.Black * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
            spriteBatch.Draw(Main.magicPixel, position + new Vector2(2, 2), new Rectangle(0, 0, panelWidth - 4, 32), Color.Gray * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
            spriteBatch.DrawString(Main.fontMouseText, ability.DisplayName, position + new Vector2(6, 8), Color.White);
            spriteBatch.DrawString(Main.fontMouseText, "Level: " + CurrentLevel, position + new Vector2(panelWidth - 56, 12), Color.White, 0, Vector2.Zero, 0.75f, SpriteEffects.None, 1f);

            spriteBatch.DrawString(Main.fontMouseText, finaliziedDescription, position + new Vector2(10, 40), Color.Gray, 0, Vector2.Zero, 0.85f, SpriteEffects.None, 1f);

            Texture2D manacostTexture = DoTariaMod.Instance.GetTexture("UserInterfaces/Abilities/ManacostIcon");
            Texture2D cooldownTexture = DoTariaMod.Instance.GetTexture("UserInterfaces/Abilities/CooldownIcon");

            Func <DoTariaPlayer, PlayerAbility, float> cooldownGetter = (player, playerAbility) => (float)Math.Round((double)playerAbility.Ability.InternalGetCooldown(player, playerAbility), 2);

            List <float> differentCooldowns = AbilitiesHelper.GetDifferentValues(cooldownGetter, doTariaPlayer, ability);

            if (!(differentCooldowns.Count == 1 && differentCooldowns[0] == 0f))
            {
                spriteBatch.Draw(cooldownTexture, position + new Vector2(10, panelHeight - 22), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
                spriteBatch.DrawString(Main.fontMouseText,
                                       AbilitiesHelper.GenerateCleanSlashedString(AbilitiesHelper.GetAllValues((player, pAbility) => (float)Math.Round((double)pAbility.Ability.InternalGetCooldown(player, pAbility), 2),
                                                                                                               doTariaPlayer, ability), differentCooldowns), position + new Vector2(30, panelHeight - 24), Color.Gray);
            }

            if (ability.AbilityType == AbilityType.Active)
            {
                spriteBatch.Draw(manacostTexture, position + new Vector2(panelWidth / 2, panelHeight - 22), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
                spriteBatch.DrawString(Main.fontMouseText, AbilitiesHelper.GenerateCleanSlashedString((player, playerAbility) => (float)Math.Ceiling(playerAbility.Ability.InternalGetManaCost(player, playerAbility)), doTariaPlayer, ability),
                                       position + new Vector2(panelWidth / 2 + 20, panelHeight - 24), Color.Gray);
            }
        }
Example #22
0
 public SpellTemplate( ushort _id, int _customFlags1, 
     int _levelMin, int _levelMax, int _bonus1, int _bonus2, int _s1, int _s2, int _s3,
     int _t1, int _t2, Resistances _res, DispelType _dis,
     int _manacost, int _castingtime, byte _range, int _duration, int _cooldown,
     int _h, int _radius1, int _radius2, int _radius3, int _classe)
     : base(_id,_customFlags1,  _cooldown)
 {
     h = _h;
     levelMin = _levelMin;
     levelMax = _levelMax;
     resistance = _res;
     dispeltype = _dis;
     classe = _classe;
     manaCost = _manacost;
     castingTime = _castingtime;
     range = _range;
     duration = _duration;
     s1 = _s1;
     s2 = _s2;
     s3 = _s3;
     bonus1 = _bonus1;
     bonus2 = _bonus2;
     t1 = _t1;
     t2 = _t2;
     radius1 = _radius1;
     radius2 = _radius2;
     radius3 = _radius3;
 }
Example #23
0
File: Spell.cs Project: ariporz/sim
 public Heal(int id, string name, float cost, int duration, TargetType targetType, DispelType dispelType, List <Effect> effects)
     : base(id, name, cost, duration, targetType, dispelType, effects)
 {
 }
Example #24
0
 public void Dispel(DispelType type, int num,Mobile from)
 {
     int number = num;
     foreach( Mobile.AuraReleaseTimer art in from.Auras )
     {
         if (number < 1) return;
         if(art.ae.Dispeltype == type) art.aura.Release(from);
         number--;
         if (number < 1) return;
     }
 }