Exemplo n.º 1
0
 public virtual float Call(Character caster, Character other,
                   DamageType damageType, float value)
 {
     if(caster == null)
         return value;
     return effect(caster, other, damageType, value);
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Gets the calculated damage based on the given damage type onto the target from source.
        /// </summary>
        /// <param name="source">
        ///     The source
        /// </param>
        /// <param name="target">
        ///     The target
        /// </param>
        /// <param name="damageType">
        ///     The damage type
        /// </param>
        /// <param name="amount">
        ///     The amount
        /// </param>
        /// <returns>
        ///     The estimated damage from calculations.
        /// </returns>
        public static double CalculateDamage(
            this Obj_AI_Base source,
            Obj_AI_Base target,
            DamageType damageType,
            double amount)
        {
            var damage = 0d;
            switch (damageType)
            {
                case DamageType.Magical:
                    damage = source.CalculateMagicDamage(target, amount);
                    break;
                case DamageType.Physical:
                    damage = source.CalculatePhysicalDamage(target, amount);
                    break;
                case DamageType.Mixed:
                    damage = source.CalculateMixedDamage(target, damage / 2, damage / 2);
                    break;
                case DamageType.True:
                    damage = Math.Max(Math.Floor(amount), 0);
                    break;
            }

            return damage;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new Enemy.
        /// </summary>
        /// <param name="gamePage">The GamePage that has the SpriteBatch the cat should use for rendering.</param>
        public td_Tower(string id, Game game, SpriteBatch spriteBatch, td_Level level, int x, int y)
            : base(game)
        {
            this.ID = id;

            this.spriteBatch = spriteBatch;

            this.level = level;

            this.TextureName = "Tower";

            //this.Bullets = new List<td_Bullet>();

            this.FireCooldown = 0;
            this.FireCooldownRate = 1;
            this.FireRate = 40;
            this.BulletRange = 700;
            this.BulletDamage = 10;
            this.BulletArmorPierce = 6;
            this.BulletDamageType = DamageType.Bullet;
            this.BulletSize = 10;

            // Generate a rotation offset
            //rotationOffset = (float)random.NextDouble() * MathHelper.Pi;

            // Generate a random position
            Position = new Vector2(x, y); // bottomish middle??

            // Generate a random velocity
            //int xDirection = random.Next() % 2 == 0 ? 1 : -1;
            //int yDirection = random.Next() % 2 == 0 ? 1 : -1;
            Angle = new Vector2(0, 0); // none?
            //     random.Next(100, 200) * xDirection,
            //    random.Next(100, 200) * yDirection);
        }
Exemplo n.º 4
0
 public Weapon()
 {
     _maxDamage = 0;
     _dmgVar = 0;
     _maxRange = 0;
     _dmgType = DamageType.Bludgeon;
 }
Exemplo n.º 5
0
 public Weapon()
 {
     _maxDamage = 0;
     _damageVariance = 0f;
     _maxRange = 0f;
     _dmgType = DamageType.Bludgeon;
 }
Exemplo n.º 6
0
 public Weapon(int mDmg, float dmgV, float mRange, DamageType dt)
 {
     _maxDamage = mDmg;
     _dmgVar = dmgV;
     _maxRange = mRange;
     _dmgType = dt;
 }
Exemplo n.º 7
0
 public SpellDamage(Spell.SpellBase spell, float[] spellDamageValue, float[] spellDamageModifier, DamageType damageType)
 {
     Spell = spell;
     SpellDamageValue = spellDamageValue;
     SpellDamageModifier = spellDamageModifier;
     DamageType = damageType;
 }
Exemplo n.º 8
0
        public static Obj_AI_Minion GetMinionTarget(float range, DamageType damagetype, bool isSkillShot = false, bool isAlly = false, bool isMonster = false, float ksdamage = -1)
        {

            var teamtype = EntityManager.UnitTeam.Enemy;
            if (isAlly)
                teamtype = EntityManager.UnitTeam.Ally;
            var miniontype = EntityManager.MinionsAndMonsters.GetLaneMinions(teamtype, Champion.ServerPosition, range).ToArray();
            if (isMonster)
                miniontype = EntityManager.MinionsAndMonsters.GetJungleMonsters(Champion.ServerPosition, range).ToArray();

            // Check list objects
            if (miniontype.Length == 0) return null;

            var target = miniontype
                .OrderByDescending(a => a.HealthPercent)
                .FirstOrDefault(a => a.IsValidTarget(range) && ((isAlly && a.IsAlly) || (!isAlly && a.IsEnemy))
                                     && ((isMonster && a.IsMonster) || (!isMonster && !a.IsMonster))
                                     && !a.IsDead && !a.IsZombie
                                     && TargetStatus(a)
                                     && (!isSkillShot || WillQHitEnemy(a))
                                     && ((ksdamage > -1 && a.Health <= Champion.CalculateDamageOnUnit(a, damagetype, ksdamage)) || ksdamage == -1)
                                     && !Champion.IsRecalling()
                                     && a.Distance(Champion) <= range);
            return target;
        }
Exemplo n.º 9
0
 public static bool Check(Obj_AI_Hero target, DamageType damageType = DamageType.True, bool ignoreShields = true)
 {
     try
     {
         if (target.HasBuffOfType(BuffType.Invulnerability) || target.IsInvulnerable)
         {
             return true;
         }
         foreach (var invulnerable in Items)
         {
             if (invulnerable.Champion == null || invulnerable.Champion == target.ChampionName)
             {
                 if (invulnerable.DamageType == null || invulnerable.DamageType == damageType)
                 {
                     if (!ignoreShields && invulnerable.IsShield && target.HasBuff(invulnerable.BuffName))
                     {
                         return true;
                     }
                     if (invulnerable.CustomCheck != null)
                     {
                         return CustomCheck(invulnerable, target, damageType);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return false;
 }
Exemplo n.º 10
0
 public void SetArmorValue(DamageType damType, int value)
 {
     if (armorStats.ContainsKey(damType))
         armorStats[damType] = value;
     else
         armorStats.Add(damType, value);
 }
Exemplo n.º 11
0
    /// <summary>
    /// Applies explosion damage to a list of found colliders, but makes sure to apply damage only once to the same gameobject.
    /// </summary>
    /// <param name="colliders"></param>
    /// <param name="amount"></param>
    /// <param name="damageType"></param>
    /// <param name="inflictor"></param>
    public static void ApplyExplosionDamage(Collider[] colliders, int amount, DamageType damageType = DamageType.Explosion, GameObject inflictor = null)
    {
        List<GameObject> seen = new List<GameObject>();
        DamageData dm = new DamageData(amount, damageType, inflictor);
        IDamagable[] damagables;
        IDamagable[] rigidBodyDamagables;

        foreach (Collider coll in colliders)
        {
            if (seen.Contains(coll.gameObject))
                continue;

            seen.Add(coll.gameObject); // avoid applying damage twice to the IDamagable components on the same game object

            damagables = coll.GetComponents(typeof (IDamagable)).Cast<IDamagable>().ToArray();
            Array.ForEach(damagables, damagable => damagable.TakeDamage(dm)); ;

            // Also apply damage to rigidbody of this collider, but only if they're different gameobjects (otherwise we already did)
            if (coll.attachedRigidbody != null && !seen.Contains(coll.attachedRigidbody.gameObject))
            {
                seen.Add(coll.attachedRigidbody.gameObject);

                rigidBodyDamagables = coll.attachedRigidbody.GetComponents(typeof(IDamagable)).Cast<IDamagable>().ToArray();
                Array.ForEach(rigidBodyDamagables, damagable => damagable.TakeDamage(dm));
            }
        }
    }
Exemplo n.º 12
0
	/// <summary>
	/// 
	/// </summary>
	public vp_DamageInfo(float damage, Transform source, Transform originalSource, DamageType type = DamageType.Unknown)
	{
		Damage = damage;
		Source = source;
		OriginalSource = originalSource;
		Type = type;
	}
Exemplo n.º 13
0
        private static void AddPassiveAttack(
            string championName,
            Func<AIHeroClient, Obj_AI_Base, bool> condition,
            DamageType damageType,
            Func<AIHeroClient, Obj_AI_Base, double> func,
            bool ignoreCalculation = false,
            bool @override = false)
        {
            var passive = new PassiveDamage
            {
                Condition = condition,
                Func = func,
                DamageType = damageType,
                Override = @override,
                IgnoreCalculation = ignoreCalculation
            };

            if (PassiveDamages.ContainsKey(championName))
            {
                PassiveDamages[championName].Add(passive);
                return;
            }

            PassiveDamages.Add(championName, new List<PassiveDamage> { passive });
        }
Exemplo n.º 14
0
 public Weapon()
 {
     this.id = -1;
     this.name = "Empty Handed";
     this.Equippable = false;
     this.weight = 0;
     this.value = 0;
     this.speed = 0;
     this.speedbonus = 0;
     this.strengthbonus = 0;
     this.hpbonus = 0;
     this.damage = 0;
     this.type = ItemType.Weapon;
     this.damageType = DamageType.Crushing;
     protection = new Dictionary<DamageType, int>();
     foreach (DamageType type in Enum.GetValues(typeof(DamageType)))
     {
         protection[type] = 0;
     }
     bonus = new Dictionary<Stat, int>();
     foreach (Stat stat in Enum.GetValues(typeof(Stat)))
     {
         bonus[stat] = 0;
     }
 }
Exemplo n.º 15
0
        public int InflictDamage(int amount, DamageType damageType = DamageType.Normal)
        {
            int delta = Health - amount;
            Health = delta < 0 ? 0 : delta;

            return Health;
        }
Exemplo n.º 16
0
        public override void OnDamage(float damage, DamageType type)
        {
            Debug.DrawText(string.Format("Took {0} points of {1} damage", damage, type), 3, Color.White, 3);

            if(OnDamaged != null)
                OnDamaged(damage, type);
        }
Exemplo n.º 17
0
 public Damage(int amount, GameObject source, Vector3 location, DamageType damageType = DamageType.Physical)
 {
     this.amount = amount;
     this.source = source;
     this.damageType = damageType;
     this.location = location;
 }
Exemplo n.º 18
0
 public static bool Check(AIHeroClient target, DamageType damageType = DamageType.True, bool ignoreShields = true)
 {
     try
     {
         if (target.HasBuffOfType(BuffType.Invulnerability) || target.IsInvulnerable)
         {
             return true;
         }
         foreach (var invulnerable in Items)
         {
             if (invulnerable.Champion == null || invulnerable.Champion == target.ChampionName)
             {
                 if (invulnerable.DamageType == null || invulnerable.DamageType == damageType)
                 {
                     if (!ignoreShields && invulnerable.IsShield && target.HasBuff(invulnerable.BuffName))
                     {
                         return true;
                     }
                     if (invulnerable.CustomCheck != null && CustomCheck(invulnerable, target, damageType))
                     {
                         return true;
                     }
                 }
             }
         }
         return false;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     return false;
 }
Exemplo n.º 19
0
 public Item(
     string itemName = "Default",
     ItemType itemType = ItemType.None,
     StatSystem itemStats = null,
     DamageType damageType = DamageType.None,
     AmmoType itemShoots = AmmoType.None,
     ItemQuality itemQuality = ItemQuality.None,
     double value = 0.0,
     int x = 0,
     int y = 0,
     int quantity = 1)
 {
     if (itemStats != null)
     {
         Stats = itemStats;
     }
     else
     {
         Stats = new StatSystem();
     }
     Name = itemName;
     type = itemType;
     ammo = itemShoots;
     Count = quantity;
     Quality = itemQuality;
     damage = damageType;
     Value = value;
     MapX = x;
     MapY = y;
 }
Exemplo n.º 20
0
        internal static bool IsKillableAndValidTarget(this Obj_AI_Minion target, double calculatedDamage,
            DamageType damageType, float distance = float.MaxValue)
        {
            if (target == null || !target.IsValidTarget(distance) || target.Health <= 0 ||
                target.HasBuffOfType(BuffType.SpellImmunity) || target.HasBuffOfType(BuffType.SpellShield) ||
                target.CharData.BaseSkinName == "gangplankbarrel")
                return false;

            if (ObjectManager.Player.HasBuff("summonerexhaust"))
                calculatedDamage *= 0.6;

            var dragonSlayerBuff = ObjectManager.Player.GetBuff("s5test_dragonslayerbuff");
            if (dragonSlayerBuff != null)
            {
                if (dragonSlayerBuff.Count >= 4)
                    calculatedDamage += dragonSlayerBuff.Count == 5 ? calculatedDamage*0.30 : calculatedDamage*0.15;

                if (target.CharData.BaseSkinName.ToLowerInvariant().Contains("dragon"))
                    calculatedDamage *= 1 - dragonSlayerBuff.Count*0.07;
            }

            if (target.CharData.BaseSkinName.ToLowerInvariant().Contains("baron") &&
                ObjectManager.Player.HasBuff("barontarget"))
                calculatedDamage *= 0.5;

            return target.Health + target.HPRegenRate +
                   (damageType == DamageType.Physical ? target.AttackShield : target.MagicShield) <
                   calculatedDamage - 2;
        }
Exemplo n.º 21
0
 public override float Call(Character caster, Character other,
                   DamageType damageType, float value)
 {
     var ae = generateEffect(caster, other, damageType, value, duration,
                             repeats, startEffect, endEffect);
     return ae.EffectStart();
 }
Exemplo n.º 22
0
 public static bool Check(Obj_AI_Hero target, DamageType damageType = DamageType.True, bool ignoreShields = true)
 {
     if (target.HasBuffOfType(BuffType.Invulnerability) || target.IsInvulnerable)
     {
         return true;
     }
     foreach (var invulnerable in Items)
     {
         if (invulnerable.Champion == null || invulnerable.Champion == target.ChampionName)
         {
             if (invulnerable.DamageType == null || invulnerable.DamageType == damageType)
             {
                 if (!ignoreShields && invulnerable.IsShield && target.HasBuff(invulnerable.BuffName))
                 {
                     return true;
                 }
                 if (invulnerable.CustomCheck != null && CustomCheck(invulnerable, target, damageType))
                 {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Exemplo n.º 23
0
 public Weapon()
 {
     _maxDamage = 0;
     _dmgVar = 0;
     _maxRange  = 0;
     _dmgType = DamageType.Heavy;
 }
Exemplo n.º 24
0
        private static float GetCalculatedDamage(Obj_AI_Base target, DamageType type, float rawdamage)
        {
            var damage = 0f;
            damage += target.CalculateDamageOnUnit(target, type, rawdamage);

            return damage;
        }
Exemplo n.º 25
0
 public Weapon(int maxDmg, float dmgVar, float maxRange, DamageType dmgType)
 {
     _maxDamage = maxDmg;
     _damageVariance = dmgVar;
     _maxRange = maxRange;
     _dmgType = dmgType;
 }
Exemplo n.º 26
0
 public RangedAttackSkill(int entityId, int level, DamageType damageType, string textureResourceId = "ranged_attack_skill_icon")
     : base(SkillType.RangedAttack, entityId, level, true, false)
 {
     _range = 8f;
     _damageType = damageType;
     _textureResourceId = textureResourceId;
 }
Exemplo n.º 27
0
 public DamageHistoryItem(Entity damager, int amount, DamageType damType)
 {
     Damager = damager;
     Amount = amount;
     DamType = damType;
     When = DateTime.Now;
 }
Exemplo n.º 28
0
 public Damage(DamageType type, int value)
 {
     this.type = type;
     this.value = value;
     this.armorPenetration = 0;
     this.shieldPenetration = 0;
 }
Exemplo n.º 29
0
 public Damage(DamageType type, int value, int armorPenetration, int shieldPenetration)
 {
     this.type = type;
     this.value = value;
     this.armorPenetration = armorPenetration;
     this.shieldPenetration = shieldPenetration;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlatformerPro.DamageInfo"/> class.
 /// </summary>
 /// <param name="amount">Amount.</param>
 /// <param name="damageType">Damage type.</param>
 /// <param name="direction">Direction.</param>
 public DamageInfo(int amount, DamageType damageType, Vector2 direction, IMob damageCauser)
 {
     Amount = amount;
     DamageType = damageType;
     Direction = direction;
     DamageCauser = damageCauser;
 }
Exemplo n.º 31
0
        public static bool GetAttackVerb(DamageType damageType, float percent, ref string single, ref string plural)
        {
            if (percent < 0.0f)
            {
                return(false);
            }

            switch (damageType)
            {
            default:
                single = "hit";
                plural = "hits";
                return(true);

            case DamageType.Slash:

                if (percent > 0.5f)
                {
                    single = "mangle";
                    plural = "mangles";
                }
                else if (percent > 0.25f)
                {
                    single = "slash";
                    plural = "slashes";
                }
                else if (percent > 0.1f)
                {
                    single = "cut";
                    plural = "cuts";
                }
                else
                {
                    single = "scratch";
                    plural = "scratches";
                }
                return(true);

            case DamageType.Pierce:

                if (percent > 0.5f)
                {
                    single = "gore";
                    plural = "gores";
                }
                else if (percent > 0.25f)
                {
                    single = "impale";
                    plural = "impales";
                }
                else if (percent > 0.1f)
                {
                    single = "stab";
                    plural = "stabs";
                }
                else
                {
                    single = "nick";
                    plural = "nicks";
                }
                return(true);

            case DamageType.Bludgeon:

                if (percent > 0.5f)
                {
                    single = "crush";
                    plural = "crushes";
                }
                else if (percent > 0.25f)
                {
                    single = "smash";
                    plural = "smashes";
                }
                else if (percent > 0.1f)
                {
                    single = "bash";
                    plural = "bashes";
                }
                else
                {
                    single = "graze";
                    plural = "grazes";
                }
                return(true);

            case DamageType.Fire:

                if (percent > 0.5f)
                {
                    single = "incinerate";
                    plural = "incinerates";
                }
                else if (percent > 0.25f)
                {
                    single = "burn";
                    plural = "burns";
                }
                else if (percent > 0.1f)
                {
                    single = "scorch";
                    plural = "scorches";
                }
                else
                {
                    single = "singe";
                    plural = "singes";
                }
                return(true);

            case DamageType.Cold:

                if (percent > 0.5f)
                {
                    single = "freeze";
                    plural = "freezes";
                }
                else if (percent > 0.25f)
                {
                    single = "frost";
                    plural = "frosts";
                }
                else if (percent > 0.1f)
                {
                    single = "chill";
                    plural = "chills";
                }
                else
                {
                    single = "numb";
                    plural = "numbs";
                }
                return(true);

            case DamageType.Acid:

                if (percent > 0.5f)
                {
                    single = "dissolve";
                    plural = "dissolves";
                }
                else if (percent > 0.25f)
                {
                    single = "corrode";
                    plural = "corrodes";
                }
                else if (percent > 0.1f)
                {
                    single = "sear";
                    plural = "sears";
                }
                else
                {
                    single = "blister";
                    plural = "blisters";
                }
                return(true);

            case DamageType.Electric:

                if (percent > 0.5f)
                {
                    single = "blast";
                    plural = "blasts";
                }
                else if (percent > 0.25f)
                {
                    single = "jolt";
                    plural = "jolts";
                }
                else if (percent > 0.1f)
                {
                    single = "shock";
                    plural = "shocks";
                }
                else
                {
                    single = "spark";
                    plural = "sparks";
                }
                return(true);

            case DamageType.Nether:

                if (percent > 0.5f)
                {
                    single = "eradicate";
                    plural = "eradicates";
                }
                else if (percent > 0.25f)
                {
                    single = "wither";
                    plural = "withers";
                }
                else if (percent > 0.1f)
                {
                    single = "twist";
                    plural = "twists";
                }
                else
                {
                    single = "scar";
                    plural = "scars";
                }
                return(true);

            case DamageType.Health:

                if (percent > 0.5f)
                {
                    single = "deplete";
                    plural = "depletes";
                }
                else if (percent > 0.25f)
                {
                    single = "siphon";
                    plural = "siphons";
                }
                else if (percent > 0.1f)
                {
                    single = "exhaust";
                    plural = "exhausts";
                }
                else
                {
                    single = "drain";
                    plural = "drains";
                }
                return(true);
            }
        }
Exemplo n.º 32
0
 public IStatBuilder HitDamageTakenAs(DamageType type) =>
 new StatBuilder(_statFactory,
                 CoreStat((e, t) => _statFactory.FromIdentity($"{t}.HitDamageTakenAs({type})", e, typeof(uint))));
Exemplo n.º 33
0
 public virtual void OnTargetDamaged(Mobile attacker, Mobile victim, DamageType type, ref int damage)
 {
 }
Exemplo n.º 34
0
 public virtual void OnDamaged(Mobile attacker, Mobile defender, DamageType type, ref int damage)
 {
 }
Exemplo n.º 35
0
 private bool IsMatchingDamageType(DamageType type)
 {
     return((allowedTypes & type) != 0);
 }
        public override bool OnGUI()
        {
            if (!base.OnGUI())
            {
                return(true);
            }

            if (window == null)
            {
                Init();
            }

            int startX = 0;
            int startY = 0;

            if (!DamageTable_DB.UpdatedToPost_2018_3())
            {
                GUI.color = new Color(0, 1f, 1f, 1f);
                if (GUI.Button(new Rect(window.position.width - 110, 10, 100, 30), "Copy Old DB"))
                {
                    DamageTable_DB.CopyFromOldDB();
                }
                GUI.color = Color.white;
            }

            if (GUI.Button(new Rect(10, 10, 100, 30), "New Armor"))
            {
                ArmorType armorType = new ArmorType();
                armorType.name = "New Armor";
                damageTableDB.armorTypeList.Add(armorType);
                UpdateLabel_DamageTable();
            }
            if (GUI.Button(new Rect(120, 10, 100, 30), "New Damage"))
            {
                DamageType damageType = new DamageType();
                damageType.name = "New Damage";
                damageTableDB.damageTypeList.Add(damageType);
                UpdateLabel_DamageTable();
            }


            List <DamageType> damageTypeList = damageTableDB.damageTypeList;
            List <ArmorType>  armorTypeList  = damageTableDB.armorTypeList;


            Rect visibleRect = new Rect(10, 50, window.position.width - 20, 185);
            Rect contentRect = new Rect(10, 50, 118 + damageTypeList.Count * 105, 5 + (armorTypeList.Count + 1) * 25);

            GUI.Box(visibleRect, "");
            scrollPos = GUI.BeginScrollView(visibleRect, scrollPos, contentRect);

            startY = 60;
            startX = 20;
            for (int i = 0; i < damageTypeList.Count; i++)
            {
                DamageType dmgType = damageTypeList[i];
                if (selectID == i && tab == _Tab.Damage)
                {
                    GUI.color = new Color(0, 1, 1, 1);
                }
                if (GUI.Button(new Rect(startX += 105, startY, 100, 20), dmgType.name))
                {
                    selectID = i;     tab = _Tab.Damage;
                    delete   = false;
                    GUI.FocusControl("");
                }
                GUI.color = Color.white;
            }



            startY = 60;
            for (int i = 0; i < armorTypeList.Count; i++)
            {
                startX = 20;

                ArmorType armorType = armorTypeList[i];
                if (selectID == i && tab == _Tab.Armor)
                {
                    GUI.color = new Color(0, 1, 1, 1);
                }
                if (GUI.Button(new Rect(startX, startY += 25, 100, 20), armorType.name))
                {
                    selectID = i;     tab = _Tab.Armor;
                    delete   = false;
                    GUI.FocusControl("");
                }
                GUI.color = Color.white;

                if (armorType.modifiers.Count != damageTypeList.Count)
                {
                    while (armorType.modifiers.Count < damageTypeList.Count)
                    {
                        armorType.modifiers.Add(1);
                    }
                    while (armorType.modifiers.Count > damageTypeList.Count)
                    {
                        armorType.modifiers.RemoveAt(armorType.modifiers.Count - 1);
                    }
                    SetDirtyTDS();
                }

                startX += 110;
                for (int j = 0; j < damageTypeList.Count; j++)
                {
                    armorType.modifiers[j] = EditorGUI.FloatField(new Rect(startX, startY, 90, 20), armorType.modifiers[j]);
                    startX += 105;
                }
            }



            GUI.EndScrollView();



            startX = 10;
            startY = 250;



            if (selectID >= 0)
            {
                DAType daInstance = null;
                if (tab == _Tab.Damage)
                {
                    selectID = Mathf.Min(selectID, damageTypeList.Count - 1);
                    if (selectID <= -1)
                    {
                        return(true);
                    }
                    daInstance = damageTypeList[selectID];
                }
                if (tab == _Tab.Armor)
                {
                    selectID = Mathf.Min(selectID, armorTypeList.Count - 1);
                    if (selectID <= -1)
                    {
                        return(true);
                    }
                    daInstance = armorTypeList[selectID];
                }

                GUI.Label(new Rect(startX, startY, 200, 17), "Name:");
                daInstance.name = EditorGUI.DelayedTextField(new Rect(startX + 80, startY, 150, 17), daInstance.name);


                GUIStyle styleL = new GUIStyle(GUI.skin.textArea);
                styleL.wordWrap  = true;
                styleL.clipping  = TextClipping.Clip;
                styleL.alignment = TextAnchor.UpperLeft;
                EditorGUI.LabelField(new Rect(startX, startY += 25, 150, 17), "Description: ");
                daInstance.desp = EditorGUI.DelayedTextField(new Rect(startX, startY += 17, window.position.width - 20, 50), daInstance.desp, styleL);


                string label = "";
                if (tab == _Tab.Damage)
                {
                    for (int i = 0; i < armorTypeList.Count; i++)
                    {
                        label += " - cause " + (armorTypeList[i].modifiers[selectID] * 100).ToString("f0") + "% damage to " + armorTypeList[i].name + "\n";
                    }
                }
                if (tab == _Tab.Armor)
                {
                    for (int i = 0; i < damageTypeList.Count; i++)
                    {
                        label += " - take " + (armorTypeList[selectID].modifiers[i] * 100).ToString("f0") + "% damage from " + damageTypeList[i].name + "\n";
                    }
                }
                GUI.Label(new Rect(startX, startY += 60, window.position.width - 20, 100), label);


                startX = 300;
                startY = 250;
                if (!delete)
                {
                    if (GUI.Button(new Rect(startX, startY, 80, 20), "delete"))
                    {
                        delete = true;
                    }
                }
                else if (delete)
                {
                    if (GUI.Button(new Rect(startX, startY, 80, 20), "cancel"))
                    {
                        delete = false;
                    }
                    GUI.color = Color.red;
                    if (GUI.Button(new Rect(startX += 90, startY, 80, 20), "confirm"))
                    {
                        if (tab == _Tab.Damage)
                        {
                            //damageTableDB.RemoveDamageType(selectID);
                            damageTypeList.RemoveAt(selectID);
                        }
                        if (tab == _Tab.Armor)
                        {
                            //damageTableDB.RemoveArmorType(selectID);
                            armorTypeList.RemoveAt(selectID);
                        }
                        UpdateLabel_DamageTable();
                        selectID = -1;
                    }
                    GUI.color = Color.white;
                }
            }



            if (GUI.changed)
            {
                SetDirtyTDS();
            }


            return(true);
        }
Exemplo n.º 37
0
 public DamageInfo(float damage, AttackType attackType, DamageType damageType)
 {
     DamageType = damageType;
     Damage     = damage;
     AttackType = attackType;
 }
Exemplo n.º 38
0
 public DestructionInfo(DamageType damageType, Integrity destroyed)
 {
     DamageType = damageType;
     Destroyed  = destroyed;
 }
Exemplo n.º 39
0
 /// <summary>
 ///     Executes the check function.
 /// </summary>
 /// <param name="entry">The entry.</param>
 /// <param name="hero">The target.</param>
 /// <param name="damageType">Type of the damage.</param>
 /// <returns></returns>
 private static bool ExecuteCheckFunction(InvulnerableEntry entry, AIHeroClient hero, DamageType damageType)
 {
     try
     {
         return(entry != null && entry.CheckFunction(hero, damageType));
     }
     catch (Exception ex)
     {
         Logging.Write()(LogLevel.Error, ex);
     }
     return(false);
 }
Exemplo n.º 40
0
 public DamageTypeBuilder(IStatFactory statFactory, DamageType damageType)
     : this(statFactory, CoreBuilder.Create(new[] { damageType }))
 {
 }
Exemplo n.º 41
0
        /// <summary>
        ///     Returns actual damage the unit takes
        /// </summary>
        /// <param name="target">damaged unit</param>
        /// <param name="dmg">amount of damage</param>
        /// <param name="dmgType">Type of damage (Magical/Physical/Pure/Health removal)</param>
        /// <param name="source">source of the damage</param>
        /// <param name="throughBKB">true if the damage pierces magic immunity</param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public static float DamageTaken(this Unit target, float dmg, DamageType dmgType, Unit source, bool throughBKB)
        {
            if (target.IsInvul())
            {
                return(0);
            }

            var tempDmg      = dmg;
            var amp          = 0d;
            var ampFromME    = 0d;
            var reduceProc   = 0d;
            var reduceOther  = 0d;
            var reduceStatic = 0d;
            var reduceBlock  = 0d;
            var ManaShield   = 0d;
            var MagOnly      = 0d;
            var AA           = 0d;

            foreach (var v in ExternalDmgAmps.Where(v => target.Modifiers.Any(x => x.Name == v.ModifierName)))
            {
                var ability = ObjectMgr.GetEntities <Ability>().FirstOrDefault(x => x.Name == v.SourceSpellName)
                              ?? ObjectMgr.GetEntities <Item>().FirstOrDefault(x => x.Name == v.SourceSpellName);
                var burst = 0f;
                if (ability == null)
                {
                    continue;
                }
                var firstOrDefault = ability.AbilityData.FirstOrDefault(x => x.Name == v.Amp);
                if (firstOrDefault != null)
                {
                    burst = firstOrDefault.GetValue(ability.Level - 1) / 100;
                }
                if (v.SourceTeam == -1 && ability.Owner.Team != target.Team)
                {
                    amp += burst;
                }
                else if (v.SourceTeam == -2)
                {
                    if (target.Distance2D(source) < 2200)
                    {
                        amp += burst;
                    }
                    else
                    {
                        amp += burst / 2;
                    }
                }
                else
                {
                    amp += burst;
                }
            }

            foreach (var v in ExternalDmgReductions.Where(v => target.Modifiers.Any(x => x.Name == v.ModifierName)))
            {
                var ability = ObjectMgr.GetEntities <Ability>().FirstOrDefault(x => x.Name == v.SourceSpellName)
                              ?? ObjectMgr.GetEntities <Item>().FirstOrDefault(x => x.Name == v.SourceSpellName);
                var burst = 0f;
                if (ability == null)
                {
                    continue;
                }
                var firstOrDefault = ability.AbilityData.FirstOrDefault(x => x.Name == v.Reduce);
                if (firstOrDefault != null)
                {
                    burst = firstOrDefault.GetValue(ability.Level - 1) / 100;
                }
                if (v.Type == 1)
                {
                    if (v.SourceTeam == 1 && ability.Owner.Team == target.Team)
                    {
                        reduceProc += burst;
                    }
                    else if (v.SourceTeam == 0)
                    {
                        reduceProc += burst;
                    }
                }
                else if (!v.MagicOnly || dmgType == DamageType.Magical)
                {
                    if (v.SourceTeam == 1 && ability.Owner.Team == target.Team)
                    {
                        if (!v.MagicOnly)
                        {
                            reduceStatic += burst;
                        }
                        else
                        {
                            MagOnly += burst;
                        }
                    }
                    else if (v.SourceTeam == 0)
                    {
                        if (!v.MagicOnly)
                        {
                            reduceStatic += burst;
                        }
                        else
                        {
                            MagOnly += burst;
                        }
                    }
                }
                else
                {
                    reduceStatic += burst;
                }
            }

            if (target.Modifiers.Any(x => x.Name == "modifier_bristleback_bristleback"))
            {
                var spell = target.FindSpell("bristleback_bristleback");
                if (spell != null)
                {
                    var burst = 0d;
                    var angle = ((target.FindRelativeAngle(source.Position)) % (2 * Math.PI)) * 180 / Math.PI;
                    if (angle >= 110 && angle <= 250)
                    {
                        burst = ((1 + spell.Level) * 0.08);
                    }
                    else if (angle >= 70 && angle <= 290)
                    {
                        burst = ((1 + spell.Level) * 0.04);
                    }
                    reduceProc += burst;
                }
            }

            if (target.Modifiers.Any(x => x.Name == "modifier_centaur_stampede"))
            {
                var heroes =
                    ObjectMgr.GetEntities <Hero>()
                    .Where(
                        x =>
                        !x.IsIllusion() &&
                        (x.ClassID == ClassID.CDOTA_Unit_Hero_Centaur ||
                         x.ClassID == ClassID.CDOTA_Unit_Hero_Rubick) && x.AghanimState());
                reduceProc = heroes.Aggregate(reduceProc, (current, hero) => (current + 0.7));
            }

            if (target.Modifiers.Any(x => x.Name == "modifier_medusa_mana_shield"))
            {
                var spell = target.FindSpell("medusa_mana_shield");
                if (spell != null)
                {
                    var firstOrDefault = spell.AbilityData.FirstOrDefault(x => x.Name == "damage_per_mana");
                    if (firstOrDefault != null)
                    {
                        var    treshold = firstOrDefault.GetValue(spell.Level - 1);
                        double burst;
                        if (target.Mana >= tempDmg * .6 / treshold)
                        {
                            burst = 0.6;
                        }
                        else
                        {
                            burst = target.Mana * treshold / tempDmg;
                        }
                        ManaShield = burst;
                    }
                }
            }

            if (target.Modifiers.Any(x => x.Name == "modifier_undying_flesh_golem_plague_aura"))
            {
                var spell = ObjectMgr.GetEntities <Ability>().FirstOrDefault(x => x.Name == "undying_flesh_golem");
                if (spell != null)
                {
                    var baseAmp = .05 * spell.Level;
                    var owner   = spell.Owner as Unit;
                    if (owner.AghanimState())
                    {
                        baseAmp = baseAmp + .1;
                    }
                    var distance = target.Distance2D(spell.Owner);
                    if (distance <= 200)
                    {
                        amp += (baseAmp + 0.15);
                    }
                    else if (distance > 750)
                    {
                        amp += baseAmp;
                    }
                    else
                    {
                        amp += (baseAmp + (750 - distance) * 0.03 / 110);
                    }
                }
            }

            if (target.Modifiers.Any(x => x.Name == "modifier_abaddon_borrowed_time_damage_redirect"))
            {
                reduceOther += 0.35;
            }
            else if (target.Modifiers.Any(x => x.Name == "modifier_kunkka_ghost_ship_damage_absorb"))
            {
                reduceOther += 0.5;
            }

            if (source.Modifiers.Any(x => x.Name == "modifier_bloodseeker_bloodrage"))
            {
                var spell = ObjectMgr.GetEntities <Ability>().FirstOrDefault(x => x.Name == "bloodseeker_bloodrage");
                if (spell != null)
                {
                    var firstOrDefault = spell.AbilityData.FirstOrDefault(x => x.Name == "damage_increase_pct");
                    if (firstOrDefault != null)
                    {
                        var bloodrite = firstOrDefault.GetValue(spell.Level - 1);
                        if (target.Distance2D(source) > 2200)
                        {
                            bloodrite /= 2;
                        }
                        ampFromME += bloodrite;
                    }
                }
            }

            if (source.Modifiers.Any(x => x.Name == "modifier_silver_edge_debuff"))
            {
                ampFromME -= 0.4;
            }

            if (target.Modifiers.Any(x => x.Name == "modifier_ice_blast"))
            {
                var spell =
                    ObjectMgr.GetEntities <Ability>()
                    .FirstOrDefault(x => x.Name == "ancient_apparition_ice_blast" && x.Owner.Team != target.Team);
                if (spell != null)
                {
                    var treshold = spell.AbilityData.FirstOrDefault(x => x.Name == "kill_pct").GetValue(spell.Level - 1)
                                   / 100;
                    AA = Math.Floor(treshold / target.MaximumHealth);
                }
            }

            switch (dmgType)
            {
            case DamageType.Magical:
                tempDmg =
                    (float)
                    (((tempDmg * (1 - ManaShield - reduceOther) - MagOnly) * (1 + amp - reduceProc)
                      * (1 + ampFromME)) * (1 - target.MagicDamageResist / 100) - reduceStatic + AA);
                break;

            case DamageType.Pure:
                if (!throughBKB && target.IsMagicImmune())
                {
                    tempDmg = 0;
                }
                else
                {
                    tempDmg =
                        (float)
                        (((tempDmg * (1 - ManaShield - reduceOther)) * (1 + amp - reduceProc) * (1 + ampFromME))
                         - reduceStatic + AA);
                }
                break;

            case DamageType.Physical:
                if (!throughBKB)
                {
                    //some calculations missing
                }
                tempDmg =
                    (float)
                    (((tempDmg * (1 - ManaShield - reduceOther) - reduceBlock) * (1 + amp - reduceProc)
                      * (1 + ampFromME)) * (1 - target.DamageResist / 100) - reduceStatic + AA);
                break;

            case DamageType.HealthRemoval:
                break;

            default:
                throw new ArgumentOutOfRangeException("dmgType", dmgType, null);
            }

            return(Math.Max(tempDmg, 0));
        }
Exemplo n.º 42
0
    public void Show(EnchantmentScript enchantment)
    {
        gameObject.GetComponent <Text>().text = enchantment.EnchantType + " " + enchantment.Strength.ToString();
        DamageType damageType = enchantment.damageItDeals;
        Color32    Type;

        switch (damageType)
        {
        case DamageType.Physical:
        {
            Type = Color.white;
            break;
        }

        case DamageType.Fire:
        {
            Type = Color.red;
            break;
        }

        case DamageType.Acid:
        {
            Type = new Color32(128, 255, 0, 255);
            break;
        }

        case DamageType.Ice:
        {
            Type = new Color32(153, 255, 255, 255);
            break;
        }

        case DamageType.Bleed:
        {
            Type = new Color32(122, 0, 0, 255);
            break;
        }

        case DamageType.Electric:
        {
            Type = new Color32(255, 255, 51, 255);
            break;
        }

        case DamageType.Positive:
        {
            Type = new Color32(0, 255, 122, 255);
            break;
        }

        case DamageType.Negative:
        {
            Type = new Color32(155, 0, 155, 255);
            break;
        }

        default:
        {
            Type = Color.black;
            Debug.Log("damageType not recognized");
            break;
        }
        }

        gameObject.GetComponent <Text>().color = Type;
    }
        public static Obj_AI_Hero GetTarget(Obj_AI_Base champion,
                                            float range,
                                            DamageType type,
                                            bool ignoreShieldSpells = true,
                                            IEnumerable <Obj_AI_Hero> ignoredChamps = null,
                                            Vector3?rangeCheckFrom = null)
        {
            try
            {
                if (ignoredChamps == null)
                {
                    ignoredChamps = new List <Obj_AI_Hero>();
                }

                var damageType = (Damage.DamageType)Enum.Parse(typeof(Damage.DamageType), type.ToString());

                if (_configMenu != null && IsValidTarget(
                        SelectedTarget, _configMenu.Item("ForceFocusSelected").GetValue <bool>() ? float.MaxValue : range,
                        type, ignoreShieldSpells, rangeCheckFrom))
                {
                    return(SelectedTarget);
                }

                if (_configMenu != null && _configMenu.Item("TargetingMode") != null &&
                    Mode == TargetingMode.AutoPriority)
                {
                    var menuItem = _configMenu.Item("TargetingMode").GetValue <StringList>();
                    Enum.TryParse(menuItem.SList[menuItem.SelectedIndex], out Mode);
                }

                var targets =
                    HeroManager.Enemies
                    .FindAll(
                        hero =>
                        ignoredChamps.All(ignored => ignored.NetworkId != hero.NetworkId) &&
                        IsValidTarget(hero, range, type, ignoreShieldSpells, rangeCheckFrom));

                switch (Mode)
                {
                case TargetingMode.LowHP:
                    return(targets.MinOrDefault(hero => hero.Health));

                case TargetingMode.MostAD:
                    return(targets.MaxOrDefault(hero => hero.BaseAttackDamage + hero.FlatPhysicalDamageMod));

                case TargetingMode.MostAP:
                    return(targets.MaxOrDefault(hero => hero.BaseAbilityDamage + hero.FlatMagicDamageMod));

                case TargetingMode.Closest:
                    return
                        (targets.MinOrDefault(
                             hero =>
                             (rangeCheckFrom.HasValue ? rangeCheckFrom.Value : champion.ServerPosition).Distance(
                                 hero.ServerPosition, true)));

                case TargetingMode.NearMouse:
                    return(targets.Find(hero => hero.Distance(Game.CursorPos, true) < 22500));    // 150 * 150

                case TargetingMode.AutoPriority:
                    return
                        (targets.MaxOrDefault(
                             hero =>
                             champion.CalcDamage(hero, damageType, 100) / (1 + hero.Health) * GetPriority(hero)));

                case TargetingMode.LessAttack:
                    return
                        (targets.MaxOrDefault(
                             hero =>
                             champion.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) *
                             GetPriority(hero)));

                case TargetingMode.LessCast:
                    return
                        (targets.MaxOrDefault(
                             hero =>
                             champion.CalcDamage(hero, Damage.DamageType.Magical, 100) / (1 + hero.Health) *
                             GetPriority(hero)));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return(null);
        }
Exemplo n.º 44
0
 public void setWeaponFocus(DamageType type)
 {
     weaponFocus = type;
 }
Exemplo n.º 45
0
 public virtual void OnTakeDamage(ref int damage, ref DamageType damageType, ref DamageSource source)
 {
 }
Exemplo n.º 46
0
        /// <summary>
        /// Called when a player dies, in conjunction with Die()
        /// </summary>
        /// <param name="lastDamager">The last damager that landed the death blow</param>
        /// <param name="damageType">The damage type for the death message</param>
        public override DeathMessage OnDeath(DamageHistoryInfo lastDamager, DamageType damageType, bool criticalHit = false)
        {
            var topDamager = DamageHistory.GetTopDamager(false);

            HandlePKDeathBroadcast(lastDamager, topDamager);

            var deathMessage = base.OnDeath(lastDamager, damageType, criticalHit);

            var lastDamagerObj = lastDamager?.TryGetAttacker();

            if (lastDamagerObj != null)
            {
                lastDamagerObj.EmoteManager.OnKill(this);
            }

            var playerMsg = "";

            if (lastDamager != null)
            {
                playerMsg = string.Format(deathMessage.Victim, Name, lastDamager.Name);
            }
            else
            {
                playerMsg = deathMessage.Victim;
            }

            var msgYourDeath = new GameEventYourDeath(Session, playerMsg);

            Session.Network.EnqueueSend(msgYourDeath);

            // broadcast to nearby players
            var nearbyMsg = "";

            if (lastDamager != null)
            {
                nearbyMsg = string.Format(deathMessage.Broadcast, Name, lastDamager.Name);
            }
            else
            {
                nearbyMsg = deathMessage.Broadcast;
            }

            var broadcastMsg = new GameMessageSystemChat(nearbyMsg, ChatMessageType.Broadcast);

            log.Debug("[CORPSE] " + nearbyMsg);

            var excludePlayers = new List <Player>();

            if (lastDamagerObj is Player lastDamagerPlayer)
            {
                excludePlayers.Add(lastDamagerPlayer);
            }

            var nearbyPlayers = EnqueueBroadcast(excludePlayers, false, broadcastMsg);

            excludePlayers.AddRange(nearbyPlayers);
            excludePlayers.Add(this); // exclude self

            if (Fellowship != null)
            {
                Fellowship.OnDeath(this);
            }

            // if the player's lifestone is in a different landblock, also broadcast their demise to that landblock
            if (PropertyManager.GetBool("lifestone_broadcast_death").Item&& Sanctuary != null && Location.Landblock != Sanctuary.Landblock)
            {
                // ActionBroadcastKill might not work if other players around lifestone aren't aware of this player yet...
                // this existing broadcast method is also based on the current visible objects to the player,
                // and the player hasn't entered portal space or teleported back to the lifestone yet, so this doesn't work
                //ActionBroadcastKill(nearbyMsg, Guid, lastDamager.Guid);

                // instead, we get all of the players in the lifestone landblock + adjacent landblocks,
                // and possibly limit that to some radius around the landblock?
                var lifestoneBlock = LandblockManager.GetLandblock(new LandblockId(Sanctuary.Landblock << 16 | 0xFFFF), true);
                lifestoneBlock.EnqueueBroadcast(excludePlayers, true, Sanctuary, LocalBroadcastRangeSq, broadcastMsg);
            }

            return(deathMessage);
        }
Exemplo n.º 47
0
 // Does this target have low enough Health to kill?
 public static bool CalculateKs(Obj_AI_Base target, DamageType damagetype, float damage)
 {
     return((damage > -1f && target.Health <= Program.Champion.CalculateDamageOnUnit(target, damagetype, damage)) || damage == -1);
 }
Exemplo n.º 48
0
 public virtual void OnKillMonster(ref Monster monster, ref DamageType type, ref DamageSource source)
 {
 }
Exemplo n.º 49
0
 public static AIHeroClient GetTarget(float Range, DamageType DamageType = DamageType.Physical)
 {
     return(Variables.TargetSelector.GetTarget(Range, DamageType));
 }
Exemplo n.º 50
0
 /// <summary>
 /// Gets <see cref="DamageType"/> dealt to <see cref="NwPlaceable"/>.
 /// </summary>
 public int GetDamageDealtByType(DamageType damageType)
 {
     return(NWScript.GetDamageDealtByType((int)damageType));
 }
Exemplo n.º 51
0
 public override string GetDeathAnim(WeaponType weapon, DamageType type)
 {
     string[] anims = { "death01", "death02" };
     return(anims[Random.Range(0, 100) % anims.Length]);
 }
Exemplo n.º 52
0
 public AbstractCard(string _cardId, string _name, string _imgURL, int _cost, string _rawDescription, CardType _cardType, CardRarity _cardRarity, CardTarget _cardTarget, DamageType _damageType)
 {
     ChargeCost            = -1;
     IsCostModified        = false;
     IsCostModifiedForTurn = false;
     IsRetain          = false;
     IsNotTriggerOnUse = false;
     IsInnate          = false;
     IsLocked          = false;
     IsShowEvokeValue  = false;
     ShowEvokeOrbCount = 0;
     KeyWords          = new List <string>();
     IsSelected        = false;
     IsExhaust         = false;
     IsEthereal        = false;
     IsUsed            = false;
     IsUpgraded        = false;
     TimesUpgraded     = 0;
     Misc                  = 0;
     IsSeen                = true;
     IsUpgradeCost         = false;
     IsUpgradeDamage       = false;
     IsUpgradeBlock        = false;
     IsUpgradeMagicNumber  = false;
     IsMultiDamage         = false;
     BaseDamage            = -1;
     BaseBlock             = -1;
     BaseMagicNumber       = -1;
     BaseHeal              = -1;
     BaseDraw              = -1;
     BaseDiscard           = -1;
     Damage                = -1;
     Block                 = -1;
     MagicNumber           = -1;
     Heal                  = -1;
     Draw                  = -1;
     Discard               = -1;
     IsDamageModified      = false;
     IsBlockModified       = false;
     IsMagicNumberModified = false;
     Target                = CardTarget.Enemy;
     IsPurgeOnUse          = false;
     IsExhaustOnUseOnce    = false;
     IsExhaustOnFire       = false;
     IsFreeToPlayOnce      = false;
     IsInBottleFlame       = false;
     IsInBottleLightning   = false;
     IsInBottleTornado     = false;
     Name                  = _name;
     CardID                = _cardId;
     Cost                  = _cost;
     CostForTurn           = _cost;
     RawDescription        = _rawDescription;
     Type                  = _cardType;
     Rarity                = _cardRarity;
     Target                = _cardTarget;
     CardDamageType        = _damageType;
     DamageTypeForTurn     = _damageType;
     CreateCardImage();
 }
Exemplo n.º 53
0
 public WoodenSword(int strength, Line damage, DamageType typeOfDamage, Texture2D texture, Rectangle rectangle, string name, int number, int persID) : base(strength, damage, typeOfDamage, texture, rectangle, name, number, persID)
 {
     ID       = 1;
     TextID   = "pers" + ID;
     GlobalID = GlobalIdCreator.CreateID();
 }
Exemplo n.º 54
0
 public override string GetInjuryAnim(WeaponType weapon, DamageType type)
 {
     string[] anims = { "injuryFront01", "injuryFront02", "injuryFront03", "injuryFront04" };
     return(anims[Random.Range(0, anims.Length)]);
 }
Exemplo n.º 55
0
 /// <summary>
 ///     Call to initialize all stuffs. If skills access the menu, this should be called after the menu creation
 /// </summary>
 public virtual void Initialize(DamageType damageType)
 {
     DamageType = damageType;
     Initialize();
 }
Exemplo n.º 56
0
 public CyclopsDamageInfoData(string receiverGuid, string dealerGuid, float originalDamage, float damage, Vector3 position, DamageType type)
 {
     ReceiverGuid   = receiverGuid;
     DealerGuid     = dealerGuid;
     OriginalDamage = originalDamage;
     Damage         = damage;
     Position       = position;
     Type           = type;
 }
Exemplo n.º 57
0
        public static bool IsInvulnerable(Obj_AI_Base target, DamageType damageType, bool ignoreShields = true)
        {
            var targetBuffs = new HashSet <string>(
                target.Buffs.Select(buff => buff.Name),
                StringComparer.OrdinalIgnoreCase);

            // Kindred's Lamb's Respite(R)
            if (targetBuffs.Contains("KindredRNoDeathBuff") && target.HealthPercent <= 10)
            {
                return(true);
            }

            // Vladimir W
            if (targetBuffs.Contains("VladimirSanguinePool"))
            {
                return(true);
            }

            // Tryndamere's Undying Rage (R)
            if (targetBuffs.Contains("UndyingRage") && target.Health <= target.MaxHealth * 0.10f)
            {
                return(true);
            }

            // Kayle's Intervention (R)
            if (targetBuffs.Contains("JudicatorIntervention"))
            {
                return(true);
            }

            if (ignoreShields)
            {
                return(false);
            }

            // Morgana's Black Shield (E)
            if (targetBuffs.Contains("BlackShield") && damageType.Equals(DamageType.Magical))
            {
                return(true);
            }

            // Banshee's Veil (PASSIVE)
            if (targetBuffs.Contains("bansheesveil") && damageType.Equals(DamageType.Magical))
            {
                return(true);
            }

            // Sivir's Spell Shield (E)
            if (targetBuffs.Contains("SivirE") && damageType.Equals(DamageType.Magical))
            {
                return(true);
            }

            // Nocturne's Shroud of Darkness (W)
            if (targetBuffs.Contains("NocturneShroudofDarkness") && damageType.Equals(DamageType.Magical))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 58
0
 private void ApplyDamage(float amount, DamageType damageType)
 {
     livingHealthBehaviour.ApplyDamage(null, amount, AttackType.Internal, damageType);
 }
Exemplo n.º 59
0
        /// <summary>
        /// Return the scalar damage absorbed by a shield
        /// </summary>
        public float GetShieldMod(WorldObject attacker, DamageType damageType, WorldObject weapon)
        {
            // ensure combat stance
            if (CombatMode == CombatMode.NonCombat)
            {
                return(1.0f);
            }

            // does the player have a shield equipped?
            var shield = GetEquippedShield();

            if (shield == null)
            {
                return(1.0f);
            }

            // phantom weapons ignore all armor and shields
            if (weapon != null && weapon.HasImbuedEffect(ImbuedEffectType.IgnoreAllArmor))
            {
                return(1.0f);
            }

            // is monster in front of player,
            // within shield effectiveness area?
            var effectiveAngle = 180.0f;
            var angle          = GetAngle(attacker);

            if (Math.Abs(angle) > effectiveAngle / 2.0f)
            {
                return(1.0f);
            }

            // get base shield AL
            var baseSL = shield.GetProperty(PropertyInt.ArmorLevel) ?? 0.0f;

            // shield AL item enchantment additives:
            // impenetrability, brittlemail
            var ignoreMagicArmor = (weapon?.IgnoreMagicArmor ?? false) || (attacker?.IgnoreMagicArmor ?? false);

            var modSL       = ignoreMagicArmor ? 0 : shield.EnchantmentManager.GetArmorMod();
            var effectiveSL = baseSL + modSL;

            // get shield RL against damage type
            var baseRL = GetResistance(shield, damageType);

            // shield RL item enchantment additives:
            // banes, lures
            var modRL       = ignoreMagicArmor ? 0 : shield.EnchantmentManager.GetArmorModVsType(damageType);
            var effectiveRL = (float)(baseRL + modRL);

            // resistance clamp
            effectiveRL = Math.Clamp(effectiveRL, -2.0f, 2.0f);

            // handle negative SL
            if (effectiveSL < 0)
            {
                effectiveRL = 1.0f / effectiveRL;
            }

            var effectiveLevel = effectiveSL * effectiveRL;

            // SL cap:
            // Trained / untrained: 1/2 shield skill
            // Spec: shield skill
            // SL cap is applied *after* item enchantments
            var shieldSkill = GetCreatureSkill(Skill.Shield);
            var shieldCap   = shieldSkill.Current;

            if (shieldSkill.AdvancementClass != SkillAdvancementClass.Specialized)
            {
                shieldCap = (uint)Math.Round(shieldCap / 2.0f);
            }

            effectiveLevel = Math.Min(effectiveLevel, shieldCap);

            var ignoreShieldMod = attacker.GetIgnoreShieldMod(weapon);

            //Console.WriteLine($"IgnoreShieldMod: {ignoreShieldMod}");

            effectiveLevel *= ignoreShieldMod;

            // SL is multiplied by existing AL
            var shieldMod = SkillFormula.CalcArmorMod(effectiveLevel);

            //Console.WriteLine("ShieldMod: " + shieldMod);
            return(shieldMod);
        }
Exemplo n.º 60
0
 /// <summary>
 ///     Returns true if the spell will kill the target.
 /// </summary>
 public static bool WillKill(this Spell.SpellBase spell, Obj_AI_Base target, float MultiplyDmgBy = 1, float ExtraDamage = 0, DamageType ExtraDamageType = DamageType.True)
 {
     return(Player.Instance.GetSpellDamage(target, spell.Slot) * MultiplyDmgBy + Player.Instance.CalculateDamageOnUnit(target, ExtraDamageType, ExtraDamage) >= Prediction.Health.GetPrediction(target, spell.CastDelay + Game.Ping / 2));
 }