public static DamageList GetDamageList(List <SL_Damage> list) { var newlist = new DamageList(); foreach (var entry in list) { newlist.Add(entry.GetDamageType()); } return(newlist); }
// Token: 0x0600000F RID: 15 RVA: 0x000024CC File Offset: 0x000006CC public static void PreAmplifyDamage(Weapon weapon, ref DamageList _list) { bool flag = weapon == null; if (!flag) { bool flag2 = BehaviourManager.IsHolyWeaponMode(weapon); if (flag2) { float holyWeaponConvertionRate = CustomBehaviourFormulas.GetHolyWeaponConvertionRate(weapon); float totalDamage = _list.TotalDamage; _list *= 1f - holyWeaponConvertionRate; _list.Add(new DamageType(CustomBehaviourFormulas.GetHolyDamageType(), totalDamage * holyWeaponConvertionRate)); } bool flag3 = BehaviourManager.IsBastardMode(weapon); if (flag3) { _list *= 1f + CustomBehaviourFormulas.GetBastardDamageBonus(weapon); } } }
public static void Postfix(CharacterStats __instance, ref DamageList _damages) { Character character = At.GetValue(typeof(CharacterStats), __instance, "m_character") as Character; bool flag = character != null; if (flag) { bool flag2 = SkillRequirements.CanAddBonusRageDamage(character); if (flag2) { _damages *= 1f + JuggernautFormulas.GetRuthlessDamageBonus(character); } bool flag3 = SkillRequirements.CanConvertToRawDamage(character); if (flag3) { float totalDamage = _damages.TotalDamage; float ruthlessRawDamageRatio = JuggernautFormulas.GetRuthlessRawDamageRatio(character); _damages *= 1f - ruthlessRawDamageRatio; _damages.Add(new DamageType(DamageType.Types.Raw, totalDamage * ruthlessRawDamageRatio)); } } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); var hitArcaneBolt = 0.0f; if (target.IsVisible) { // AncientSeal var ancientSeal = Abilities.AncientSeal; if (ancientSeal.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(ancientSeal.ToString())) { abilities.Add(ancientSeal); } // Veil var veil = Abilities.Veil; if (veil != null && veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString())) { abilities.Add(veil); } // Ethereal var ethereal = Abilities.Ethereal; if (ethereal != null && ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString())) { abilities.Add(ethereal); } // Shivas var shivas = Abilities.Shivas; if (shivas != null && shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString())) { abilities.Add(shivas); } // ConcussiveShot var concussiveShot = Abilities.ConcussiveShot; if (concussiveShot.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(concussiveShot.ToString()) && target == concussiveShot.TargetHit) { abilities.Add(concussiveShot); } // ArcaneBolt var arcaneBolt = Abilities.ArcaneBolt; if (arcaneBolt.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(arcaneBolt.ToString())) { abilities.Add(arcaneBolt); if (MultiSleeper.Sleeping($"arcanebolt_{ target.Name }")) { hitArcaneBolt += arcaneBolt.GetDamage(target); } } // Dagon var dagon = Abilities.Dagon; if (dagon != null && dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5")) { abilities.Add(dagon); } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(target, heroes); var damageBlock = DamageBlock(target, heroes); var livingArmor = LivingArmor(target, heroes, damageCalculation.Abilities); var damage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target) + hitArcaneBolt) + damageBlock, 0, damageReduction) - livingArmor; var readyDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, true, false) + damageBlock, 0, damageReduction) - livingArmor; var totalDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, false, false) + damageBlock, 0, damageReduction) - livingArmor; if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers)) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => !x.IsIllusion && x.IsValid).ToList(); DamageList.Clear(); foreach (var hero in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); var damage = 0.0f; var readyDamage = 0.0f; var totalDamage = 0.0f; if (hero.IsVisible) { // Veil var Veil = Main.Veil; if (Veil != null && Veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Veil.ToString())) { abilities.Add(Veil); } // Ethereal var Ethereal = Main.Ethereal; if (Ethereal != null && Ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Ethereal.ToString())) { abilities.Add(Ethereal); } // Shivas var Shivas = Main.Shivas; if (Shivas != null && Shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Shivas.ToString())) { abilities.Add(Shivas); } // StaticField var StaticField = Main.StaticField; if (StaticField.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(StaticField.ToString())) { abilities.Add(StaticField); } // LightningBolt var LightningBolt = Main.LightningBolt; if (LightningBolt.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(LightningBolt.ToString())) { abilities.Add(LightningBolt); } // Dagon var Dagon = Main.Dagon; if (Dagon != null && Dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Dagon.ToString())) { abilities.Add(Dagon); } // ArcLightning var ArcLightning = Main.ArcLightning; if (ArcLightning.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(ArcLightning.ToString())) { abilities.Add(ArcLightning); } // Nimbus var Nimbus = Main.Nimbus; if (Nimbus.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(Nimbus.ToString())) { abilities.Add(Nimbus); } // Thundergods Wrath var ThundergodsWrath = Main.ThundergodsWrath; if (ThundergodsWrath.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(ThundergodsWrath.ToString())) { abilities.Add(ThundergodsWrath); } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(hero, heroes); var damageBlock = DamageBlock(hero, heroes); damage += DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(hero) + damageBlock, 0, damageReduction); readyDamage += DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(hero, true, false) + damageBlock, 0, damageReduction); totalDamage += DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(hero, false, false) + damageBlock, 0, damageReduction); damage -= LivingArmor(hero, heroes, damageCalculation.Abilities); readyDamage -= LivingArmor(hero, heroes, damageCalculation.Abilities); totalDamage -= LivingArmor(hero, heroes, damageCalculation.Abilities); if (hero.HasModifier("modifier_abaddon_borrowed_time") || hero.HasModifier("modifier_templar_assassin_refraction_absorb") || hero.HasAnyModifiers("modifier_winter_wyvern_winters_curse_aura", "modifier_winter_wyvern_winters_curse") || hero.IsInvulnerable()) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(hero, damage, readyDamage, totalDamage, hero.Health)); } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> magicalAbilities = new List <BaseAbility>(); List <BaseAbility> pureAbilities = new List <BaseAbility>(); var damage = 0.0f; var readyDamage = 0.0f; var totalDamage = 0.0f; if (target.IsVisible) { // Veil var Veil = Main.Veil; if (Veil != null && Veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Veil.ToString())) { magicalAbilities.Add(Veil); } // Ethereal var Ethereal = Main.Ethereal; if (Ethereal != null && Ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Ethereal.ToString())) { magicalAbilities.Add(Ethereal); } // Shivas var Shivas = Main.Shivas; if (Shivas != null && Shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Shivas.ToString())) { magicalAbilities.Add(Shivas); } // Dagon var Dagon = Main.Dagon; if (Dagon != null && Dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5")) { magicalAbilities.Add(Dagon); } // Impetus var Impetus = Main.Impetus; if (Impetus.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(Impetus.ToString())) { pureAbilities.Add(Impetus); } } Combo[] combo = { new Combo(magicalAbilities.ToArray()), new Combo(pureAbilities.ToArray()) }; float[] block = { MagicalDamageBlock(target, heroes), DamageBlock(target, heroes) }; var damageReduction = -DamageReduction(target, heroes); for (var i = 0; i < 2; i++) { var livingArmor = LivingArmor(target, heroes, combo[i].Abilities); damage += DamageHelpers.GetSpellDamage(Math.Max(0, combo[i].GetDamage(target) + block[i]), 0, damageReduction) - livingArmor; readyDamage += DamageHelpers.GetSpellDamage(Math.Max(0, combo[i].GetDamage(target, true, false) + block[i]), 0, damageReduction) - livingArmor; totalDamage += DamageHelpers.GetSpellDamage(Math.Max(0, combo[i].GetDamage(target, false, false) + block[i]), 0, damageReduction) - livingArmor; } if (target.HasAnyModifiers("modifier_abaddon_borrowed_time", "modifier_item_combo_breaker_buff") || target.HasModifier("modifier_templar_assassin_refraction_absorb") || target.HasAnyModifiers("modifier_winter_wyvern_winters_curse_aura", "modifier_winter_wyvern_winters_curse") || target.IsInvulnerable()) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); List <BaseAbility> abilityHook = new List <BaseAbility>(); if (target.IsVisible) { // Veil var veil = Main.Veil; if (veil != null && veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString())) { abilities.Add(veil); } // Ethereal var ethereal = Main.Ethereal; if (ethereal != null && ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString())) { abilities.Add(ethereal); } // Shivas var shivas = Main.Shivas; if (shivas != null && shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString())) { abilities.Add(shivas); } // hook var hook = Main.Hook; if (hook.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(hook.ToString())) { abilityHook.Add(hook); } // Dagon var dagon = Main.Dagon; if (dagon != null && dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5") && Extensions.ShouldCastHook(hook.GetPredictionOutput(hook.GetPredictionInput(target)))) { abilities.Add(dagon); } } Combo[] combo = { new Combo(abilities.ToArray()), new Combo(abilityHook.ToArray()) }; float[] block = { MagicalDamageBlock(target, heroes), DamageBlock(target, heroes) }; var damageReduction = -DamageReduction(target, heroes); var damage = 0.0f; var readyDamage = 0.0f; var totalDamage = 0.0f; for (var i = 0; i < 2; i++) { var livingArmor = LivingArmor(target, heroes, combo[i].Abilities); damage += DamageHelpers.GetSpellDamage(Math.Max(0, combo[i].GetDamage(target) + block[i]), 0, damageReduction) - livingArmor; readyDamage += DamageHelpers.GetSpellDamage(Math.Max(0, combo[i].GetDamage(target, true, false) + block[i]), 0, damageReduction) - livingArmor; totalDamage += DamageHelpers.GetSpellDamage(Math.Max(0, combo[i].GetDamage(target, false, false) + block[i]), 0, damageReduction) - livingArmor; } if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers)) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
static bool Prefix(ItemDetailsDisplay __instance) { int _index = 0; if ((bool)(UnityEngine.Object)__instance.m_lastItem && __instance.m_lastItem.IsEnchanted && __instance.m_lastItem is Equipment lastItem) { for (int i = 0; i < lastItem.ActiveEnchantments.Count; ++i) { Enchantment activeEnchantment = lastItem.ActiveEnchantments[i]; if (lastItem is Weapon weapon && (activeEnchantment.PresetID == 3 || activeEnchantment.PresetID == 4)) { int num1; switch (weapon.Type) { case Weapon.WeaponType.Dagger_OH: num1 = VampiricTransmutationTable.DAGGER_THIRST_THRESHOLD; break; case Weapon.WeaponType.Bow: num1 = VampiricTransmutationTable.BOW_THIRST_THRESHOLD; break; default: num1 = VampiricTransmutationTable.DEFAULT_THIRST_THRESHOLD; break; } float num2 = (float)weapon.DamageDealtTracking / (float)num1; if ((double)num2 >= 0.0 && (double)num2 < 0.330000013113022) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("Vampiric_01"), ""); ++_index; } else if ((double)num2 >= 0.330000013113022 && (double)num2 < 0.660000026226044) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("Vampiric_02"), ""); ++_index; } else if ((double)num2 >= 0.660000026226044 && (double)num2 < 1.0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("Vampiric_03"), ""); ++_index; } else if ((double)num2 >= 1.0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("Vampiric_04"), ""); ++_index; } if (MenuManager.Instance.DisplayDebugInfo) { __instance.GetEnchantmentRow(_index).SetInfo("DEBUG Damage", (float)weapon.DamageDealtTracking); ++_index; } } DamageList _damages1 = new DamageList(); for (int index = 0; index < activeEnchantment.Effects.Length; ++index) { if (activeEnchantment.Effects[index] is AddStatusEffectBuildUp effect) { string loc = LocalizationManager.Instance.GetLoc("EnchantmentDescription_InflictStatus", string.Empty); __instance.GetEnchantmentRow(_index).SetInfo(loc, effect.Status.StatusName); ++_index; } else if (activeEnchantment.Effects[index] is AffectStatusEffectBuildUpResistance effect1) { string loc = LocalizationManager.Instance.GetLoc("EnchantmentDescription_StatusResist", effect1.StatusEffect.StatusName); __instance.GetEnchantmentRow(_index).SetInfo(loc, effect1.Value.ToString() + "%"); ++_index; } else if (activeEnchantment.Effects[index] is ShootEnchantmentBlast effect2 && lastItem is Weapon weapon1) { DamageType.Types overrideDtype = effect2.BaseBlast.GetComponentInChildren <WeaponDamage>().OverrideDType; float _damage = weapon1.GetDisplayedDamage().TotalDamage *effect2.DamageMultiplier; _damages1.Add(new DamageType(overrideDtype, _damage)); } } if (_damages1.Count > 0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("EnchantmentDescription_Blast"), _damages1); ++_index; } DamageList _damages2 = new DamageList(); if (lastItem is Weapon weapon2) { _damages2 = weapon2.GetEnchantmentDamageBonuses(); } if (_damages2.Count > 0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_Damage"), _damages2); ++_index; } if (activeEnchantment.DamageModifier.Count != 0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_DamageModifier"), activeEnchantment.DamageModifier, _displayPercent: true); ++_index; } if (activeEnchantment.ElementalResistances.Count != 0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_DamageResistance"), activeEnchantment.ElementalResistances); ++_index; } if ((double)activeEnchantment.GlobalStatusResistance != 0.0) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_StatusResist"), activeEnchantment.GlobalStatusResistance); ++_index; } if ((double)activeEnchantment.ManaAbsorbRatio != 0.0) { string loc = LocalizationManager.Instance.GetLoc("EnchantmentDescription_Absorb", activeEnchantment.ManaAbsorbRatio.ToString(), LocalizationManager.Instance.GetLoc("CharacterStat_Mana")); __instance.GetEnchantmentRow(_index).SetInfo(loc, ""); ++_index; } if ((double)activeEnchantment.HealthAbsorbRatio != 0.0) { string loc = LocalizationManager.Instance.GetLoc("EnchantmentDescription_Absorb", activeEnchantment.HealthAbsorbRatio.ToString(), LocalizationManager.Instance.GetLoc("CharacterStat_Health")); __instance.GetEnchantmentRow(_index).SetInfo(loc, ""); ++_index; } if ((double)activeEnchantment.StaminaAbsorbRatio != 0.0) { string loc = LocalizationManager.Instance.GetLoc("EnchantmentDescription_Absorb", activeEnchantment.StaminaAbsorbRatio.ToString(), LocalizationManager.Instance.GetLoc("CharacterStat_Stamina")); __instance.GetEnchantmentRow(_index).SetInfo(loc, ""); ++_index; } for (int index = 0; index < activeEnchantment.StatModifications.Count; ++index) { float num = activeEnchantment.StatModifications[index].Value; if (activeEnchantment.StatModifications[index].Name == Enchantment.Stat.CooldownReduction) { num = -num; } string _dataValue = ((double)num > 0.0 ? "+" : "") + num.ToString(); if (activeEnchantment.StatModifications[index].Type == Enchantment.StatModification.BonusType.Modifier) { _dataValue += "%"; } switch (activeEnchantment.StatModifications[index].Name) { case Enchantment.Stat.Weight: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_Weight"), _dataValue); ++_index; break; case Enchantment.Stat.Durability: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_Durability"), _dataValue); ++_index; break; case Enchantment.Stat.ManaCostReduction: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_ManaCost"), _dataValue.Replace("+", "-")); ++_index; break; case Enchantment.Stat.StaminaCostReduction: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_StaminaCost"), _dataValue.Replace("+", "-")); ++_index; break; case Enchantment.Stat.CooldownReduction: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_CooldownReduction"), _dataValue); ++_index; break; case Enchantment.Stat.MovementSpeed: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_MovementPenalty"), _dataValue); ++_index; break; case Enchantment.Stat.AttackSpeed: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_AttackSpeed"), _dataValue); ++_index; break; case Enchantment.Stat.Impact: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_Impact"), _dataValue); ++_index; break; case Enchantment.Stat.StabilityRegen: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_StabilityRegen"), _dataValue); ++_index; break; case Enchantment.Stat.HealthRegen: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_HealthRegen"), _dataValue); ++_index; break; case Enchantment.Stat.ManaRegen: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_ManaRegen"), _dataValue); ++_index; break; case Enchantment.Stat.Protection: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_Defense_Protection"), _dataValue); ++_index; break; case Enchantment.Stat.CorruptionResistance: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_CorruptionResistance"), _dataValue); ++_index; break; case Enchantment.Stat.FoodDepletionRate: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_FoodEfficiency"), _dataValue); ++_index; break; case Enchantment.Stat.DrinkDepletionRate: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_DrinkEfficiency"), _dataValue); ++_index; break; case Enchantment.Stat.SleepDepletionRate: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_SleepEfficiency"), _dataValue); ++_index; break; case Enchantment.Stat.PouchCapacity: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_PouchCapacity"), _dataValue); ++_index; break; case Enchantment.Stat.ImpactResistance: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("CharacterStat_Defense_ImpactResistance"), _dataValue); ++_index; break; case Enchantment.Stat.HeatProtection: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_HeatProtection"), _dataValue); ++_index; break; case Enchantment.Stat.ColdProtection: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_ColdProtection"), _dataValue); ++_index; break; case Enchantment.Stat.Barrier: __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("ItemStat_Barrier"), _dataValue); ++_index; break; } } if (activeEnchantment.Indestructible) { __instance.GetEnchantmentRow(_index).SetInfo(LocalizationManager.Instance.GetLoc("EnchantmentDescription_Indestructible"), ""); ++_index; } } } for (int index = _index; index < __instance.m_enchantmentDetailRows.Count; ++index) { if (__instance.m_enchantmentDetailRows[index].IsDisplayed) { __instance.m_enchantmentDetailRows[index].Hide(); } } return(false); }
/// <summary> /// Handle any kind of Monster interaction /// </summary> private void monsterLife() { if (Monster == null) { return; } if ((DateTime.Now - LastEffect).TotalSeconds >= 5) { LastEffect = DateTime.Now; if (IsTarget) { MapInstance.Broadcast(StaticPacketHelper.GenerateEff(UserType.Monster, MapMonsterId, 824)); } if (IsBonus) { MapInstance.Broadcast(StaticPacketHelper.GenerateEff(UserType.Monster, MapMonsterId, 826)); } } if (IsBoss && IsAlive) { MapInstance.Broadcast(GenerateBoss()); } // handle hit queue while (HitQueue.TryDequeue(out HitRequest hitRequest)) { if (IsAlive && hitRequest.Session.Character.Hp > 0 && (ServerManager.Instance.ChannelId != 51 || MonsterVNum - (byte)hitRequest.Session.Character.Faction != 678)) { int hitmode = 0; bool isCaptureSkill = hitRequest.Skill.BCards.Any(s => s.Type.Equals((byte)CardType.Capture)); // calculate damage bool onyxWings = false; BattleEntity battleEntity = new BattleEntity(hitRequest.Session.Character, hitRequest.Skill); int damage = DamageHelper.Instance.CalculateDamage(battleEntity, new BattleEntity(this), hitRequest.Skill, ref hitmode, ref onyxWings); if (onyxWings) { short onyxX = (short)(hitRequest.Session.Character.PositionX + 2); short onyxY = (short)(hitRequest.Session.Character.PositionY + 2); int onyxId = MapInstance.GetNextMonsterId(); MapMonster onyx = new MapMonster() { MonsterVNum = 2371, MapX = onyxX, MapY = onyxY, MapMonsterId = onyxId, IsHostile = false, IsMoving = false, ShouldRespawn = false }; MapInstance.Broadcast(UserInterfaceHelper.Instance.GenerateGuri(31, 1, hitRequest.Session.Character.CharacterId, onyxX, onyxY)); onyx.Initialize(MapInstance); MapInstance.AddMonster(onyx); MapInstance.Broadcast(onyx.GenerateIn()); CurrentHp -= damage / 2; Observable.Timer(TimeSpan.FromMilliseconds(350)).Subscribe(o => { MapInstance.Broadcast(StaticPacketHelper.SkillUsed(UserType.Monster, onyxId, 3, MapMonsterId, -1, 0, -1, hitRequest.Skill.Effect, -1, -1, true, 92, damage / 2, 0, 0)); MapInstance.RemoveMonster(onyx); MapInstance.Broadcast(StaticPacketHelper.Out(UserType.Monster, onyx.MapMonsterId)); }); } if (hitmode != 1) { hitRequest.Skill.BCards.Where(s => s.Type.Equals((byte)CardType.Buff)).ToList().ForEach(s => s.ApplyBCards(this, hitRequest.Session)); hitRequest.Skill.BCards.Where(s => s.Type.Equals((byte)CardType.Capture)).ToList().ForEach(s => s.ApplyBCards(this, hitRequest.Session)); if (battleEntity?.ShellWeaponEffects != null) { foreach (ShellEffectDTO shell in battleEntity.ShellWeaponEffects) { switch (shell.Effect) { case (byte)ShellWeaponEffectType.Blackout: { Buff buff = new Buff(7, battleEntity.Level); if (ServerManager.Instance.RandomNumber() < shell.Value) { AddBuff(buff); } break; } case (byte)ShellWeaponEffectType.DeadlyBlackout: { Buff buff = new Buff(66, battleEntity.Level); if (ServerManager.Instance.RandomNumber() < shell.Value) { AddBuff(buff); } break; } case (byte)ShellWeaponEffectType.MinorBleeding: { Buff buff = new Buff(1, battleEntity.Level); if (ServerManager.Instance.RandomNumber() < shell.Value) { AddBuff(buff); } break; } case (byte)ShellWeaponEffectType.Bleeding: { Buff buff = new Buff(21, battleEntity.Level); if (ServerManager.Instance.RandomNumber() < shell.Value) { AddBuff(buff); } break; } case (byte)ShellWeaponEffectType.HeavyBleeding: { Buff buff = new Buff(42, battleEntity.Level); if (ServerManager.Instance.RandomNumber() < shell.Value) { AddBuff(buff); } break; } case (byte)ShellWeaponEffectType.Freeze: { Buff buff = new Buff(27, battleEntity.Level); if (ServerManager.Instance.RandomNumber() < shell.Value) { AddBuff(buff); } break; } } } } } if (DamageList.ContainsKey(hitRequest.Session.Character.CharacterId)) { DamageList[hitRequest.Session.Character.CharacterId] += damage; } else { DamageList.Add(hitRequest.Session.Character.CharacterId, damage); } if (isCaptureSkill) { damage = 0; } if (CurrentHp <= damage) { SetDeathStatement(); } else { CurrentHp -= damage; } // only set the hit delay if we become the monsters target with this hit if (Target == -1) { LastSkill = DateTime.Now; } int nearestDistance = 100; foreach (KeyValuePair <long, long> kvp in DamageList) { ClientSession session = MapInstance.GetSessionByCharacterId(kvp.Key); if (session != null) { int distance = Map.GetDistance(new MapCell { X = MapX, Y = MapY }, new MapCell { X = session.Character.PositionX, Y = session.Character.PositionY }); if (distance < nearestDistance) { nearestDistance = distance; Target = session.Character.CharacterId; } } } switch (hitRequest.TargetHitType) { case TargetHitType.SingleTargetHit: if (!isCaptureSkill) { MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, hitRequest.Skill.SkillVNum, hitRequest.Skill.Cooldown, hitRequest.Skill.AttackAnimation, hitRequest.SkillEffect, hitRequest.Session.Character.PositionX, hitRequest.Session.Character.PositionY, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, hitmode, (byte)(hitRequest.Skill.SkillType - 1))); } break; case TargetHitType.SingleTargetHitCombo: MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, hitRequest.Skill.SkillVNum, hitRequest.Skill.Cooldown, hitRequest.SkillCombo.Animation, hitRequest.SkillCombo.Effect, hitRequest.Session.Character.PositionX, hitRequest.Session.Character.PositionY, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, hitmode, (byte)(hitRequest.Skill.SkillType - 1))); break; case TargetHitType.SingleAOETargetHit: switch (hitmode) { case 1: hitmode = 4; break; case 3: hitmode = 6; break; default: hitmode = 5; break; } if (hitRequest.ShowTargetHitAnimation) { MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, hitRequest.Skill.SkillVNum, hitRequest.Skill.Cooldown, hitRequest.Skill.AttackAnimation, hitRequest.SkillEffect, hitRequest.Session.Character.PositionX, hitRequest.Session.Character.PositionY, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, hitmode, (byte)(hitRequest.Skill.SkillType - 1))); } else { MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, 0, 0, 0, 0, 0, 0, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, hitmode, (byte)(hitRequest.Skill.SkillType - 1))); } break; case TargetHitType.AOETargetHit: switch (hitmode) { case 1: hitmode = 4; break; case 3: hitmode = 6; break; default: hitmode = 5; break; } MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, hitRequest.Skill.SkillVNum, hitRequest.Skill.Cooldown, hitRequest.Skill.AttackAnimation, hitRequest.SkillEffect, hitRequest.Session.Character.PositionX, hitRequest.Session.Character.PositionY, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, hitmode, (byte)(hitRequest.Skill.SkillType - 1))); break; case TargetHitType.ZoneHit: MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, hitRequest.Skill.SkillVNum, hitRequest.Skill.Cooldown, hitRequest.Skill.AttackAnimation, hitRequest.SkillEffect, hitRequest.MapX, hitRequest.MapY, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, 5, (byte)(hitRequest.Skill.SkillType - 1))); break; case TargetHitType.SpecialZoneHit: MapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, hitRequest.Session.Character.CharacterId, 3, MapMonsterId, hitRequest.Skill.SkillVNum, hitRequest.Skill.Cooldown, hitRequest.Skill.AttackAnimation, hitRequest.SkillEffect, hitRequest.Session.Character.PositionX, hitRequest.Session.Character.PositionY, IsAlive, (int)((float)CurrentHp / (float)MaxHp * 100), damage, hitmode, (byte)(hitRequest.Skill.SkillType - 1))); break; } if (CurrentHp <= 0 && !isCaptureSkill) { // generate the kill bonus hitRequest.Session.Character.GenerateKillBonus(this); } } else { // monster already has been killed, send cancel hitRequest.Session.SendPacket(StaticPacketHelper.Cancel(2, MapMonsterId)); } if (IsBoss) { MapInstance.Broadcast(GenerateBoss()); } } // Respawn if (!IsAlive && ShouldRespawn != null && !ShouldRespawn.Value) { MapInstance.RemoveMonster(this); } if (!IsAlive && ShouldRespawn != null && ShouldRespawn.Value) { double timeDeath = (DateTime.Now - Death).TotalSeconds; if (timeDeath >= Monster.RespawnTime / 10d) { respawn(); } } // normal movement else if (Target == -1) { move(); } // target following else if (MapInstance != null) { GetNearestOponent(); HostilityTarget(); ClientSession targetSession = MapInstance.GetSessionByCharacterId(Target); // remove target in some situations if (targetSession == null || targetSession.Character.Invisible || targetSession.Character.Hp <= 0 || CurrentHp <= 0) { RemoveTarget(); return; } NpcMonsterSkill npcMonsterSkill = null; if (Skills != null && ServerManager.Instance.RandomNumber(0, 10) > 8) { npcMonsterSkill = Skills.Where(s => (DateTime.Now - s.LastSkillUse).TotalMilliseconds >= 100 * s.Skill?.Cooldown)?.OrderBy(rnd => _random.Next())?.FirstOrDefault(); } if (npcMonsterSkill?.Skill.TargetType == 1 && npcMonsterSkill?.Skill.HitType == 0) { targetHit(targetSession, npcMonsterSkill); } // check if target is in range if (!targetSession.Character.InvisibleGm && !targetSession.Character.Invisible && targetSession.Character.Hp > 0) { if (npcMonsterSkill != null && CurrentMp >= npcMonsterSkill.Skill.MpCost && Map.GetDistance(new MapCell { X = MapX, Y = MapY }, new MapCell { X = targetSession.Character.PositionX, Y = targetSession.Character.PositionY }) < npcMonsterSkill.Skill.Range) { targetHit(targetSession, npcMonsterSkill); } else if (Map.GetDistance(new MapCell { X = MapX, Y = MapY }, new MapCell { X = targetSession.Character.PositionX, Y = targetSession.Character.PositionY }) <= Monster.BasicRange) { targetHit(targetSession, npcMonsterSkill); } else { followTarget(targetSession); } } else { followTarget(targetSession); } } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); if (target.IsVisible) { // Veil var veil = Main.Veil; if (veil != null && veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString())) { abilities.Add(veil); } // Ethereal var ethereal = Main.Ethereal; if (ethereal != null && ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString())) { abilities.Add(ethereal); } // Shivas var shivas = Main.Shivas; if (shivas != null && shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString())) { abilities.Add(shivas); } // ConcussiveShot var soulAssumption = Main.SoulAssumption; if (soulAssumption.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(soulAssumption.ToString()) && soulAssumption.MaxCharges) { abilities.Add(soulAssumption); } // Dagon var dagon = Main.Dagon; if (dagon != null && dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5")) { abilities.Add(dagon); } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(target, heroes); var damageBlock = DamageBlock(target, heroes); var livingArmor = LivingArmor(target, heroes, damageCalculation.Abilities); var damage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target) + damageBlock, 0, damageReduction) - livingArmor; var readyDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, true, false) + damageBlock, 0, damageReduction) - livingArmor; var totalDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, false, false) + damageBlock, 0, damageReduction) - livingArmor; if (target.IsInvulnerable() || target.HasAnyModifiers("modifier_abaddon_borrowed_time", "modifier_item_combo_breaker_buff") || target.HasModifier("modifier_templar_assassin_refraction_absorb") || target.HasAnyModifiers("modifier_winter_wyvern_winters_curse_aura", "modifier_winter_wyvern_winters_curse")) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); var damageOdds = 0.0f; var readyDamageOdds = 0.0f; var totalDamageOdds = 0.0f; if (target.IsVisible) { // Veil var veil = Main.Veil; if (veil != null && veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString())) { abilities.Add(veil); } // Ethereal var ethereal = Main.Ethereal; if (ethereal != null && ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString())) { abilities.Add(ethereal); } // Shivas var shivas = Main.Shivas; if (shivas != null && shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString())) { abilities.Add(shivas); } // Dagon var dagon = Main.Dagon; if (dagon != null && dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5")) { abilities.Add(dagon); } // Overwhelming Odds var overwhelmingOdds = Main.OverwhelmingOdds; if (overwhelmingOdds.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(overwhelmingOdds.ToString())) { var input = new PredictionInput { Owner = Owner, AreaOfEffect = overwhelmingOdds.HasAreaOfEffect, AreaOfEffectTargets = UpdateMode.OverwhelmingOddsUnits, CollisionTypes = overwhelmingOdds.CollisionTypes, Delay = overwhelmingOdds.CastPoint + overwhelmingOdds.ActivationDelay, Speed = overwhelmingOdds.Speed, Range = float.MaxValue, Radius = overwhelmingOdds.Radius, PredictionSkillshotType = overwhelmingOdds.PredictionSkillshotType }; var castPosition = overwhelmingOdds.GetPredictionOutput(input.WithTarget(target)).CastPosition; var damageUnits = overwhelmingOdds.GetDamage(castPosition, target); if (overwhelmingOdds.IsReady && !Owner.IsStunned() && !Owner.IsMuted() && !Owner.IsSilenced()) { if (Owner.Distance2D(castPosition) <= overwhelmingOdds.CastRange) { damageOdds += damageUnits; } readyDamageOdds += damageUnits; } totalDamageOdds += damageUnits; } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(target, heroes); var damageBlock = MagicalDamageBlock(target, heroes); var livingArmor = LivingArmor(target, heroes, damageCalculation.Abilities); var damage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target) + damageOdds) + damageBlock, 0, damageReduction) - livingArmor; var readyDamage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target, true, false) + readyDamageOdds) + damageBlock, 0, damageReduction) - livingArmor; var totalDamage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target, false, false) + totalDamageOdds) + damageBlock, 0, damageReduction) - livingArmor; if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers)) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); var damage = 0.0f; var readyDamage = 0.0f; var totalDamage = 0.0f; if (target.IsVisible) { // Veil var Veil = Main.Veil; if (Veil != null && Veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Veil.ToString())) { abilities.Add(Veil); } // Ethereal var Ethereal = Main.Ethereal; if (Ethereal != null && Ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Ethereal.ToString())) { abilities.Add(Ethereal); } // Shivas var Shivas = Main.Shivas; if (Shivas != null && Shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(Shivas.ToString())) { abilities.Add(Shivas); } // Impale var Impale = Main.Impale; if (Impale.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(Impale.ToString())) { abilities.Add(Impale); } // ManaBurn var ManaBurn = Main.ManaBurn; if (ManaBurn.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(ManaBurn.ToString()) && target.Mana > 80) { abilities.Add(ManaBurn); } // Dagon var Dagon = Main.Dagon; if (Dagon != null && Dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5")) { abilities.Add(Dagon); } // Vendetta var Vendetta = Main.Vendetta; if (Vendetta.Ability.Level > 0) { if (Owner.HasModifier(Vendetta.ModifierName)) { damage += Vendetta.GetDamage(target); } else if (Vendetta.CanBeCasted) { readyDamage += Vendetta.GetDamage(target); } totalDamage += Vendetta.GetDamage(target); } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(target, heroes); var damageBlock = DamageBlock(target, heroes); damage += DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target) + damageBlock, 0, damageReduction); readyDamage += DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, true, false) + damageBlock, 0, damageReduction); totalDamage += DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, false, false) + damageBlock, 0, damageReduction); damage -= LivingArmor(target, heroes, damageCalculation.Abilities, damage); readyDamage -= LivingArmor(target, heroes, damageCalculation.Abilities, readyDamage); totalDamage -= LivingArmor(target, heroes, damageCalculation.Abilities, totalDamage); if (target.HasAnyModifiers("modifier_abaddon_borrowed_time", "modifier_item_combo_breaker_buff") || target.HasModifier("modifier_templar_assassin_refraction_absorb") || target.HasAnyModifiers("modifier_winter_wyvern_winters_curse_aura", "modifier_winter_wyvern_winters_curse") || target.IsInvulnerable()) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
public DamageList GetWeaponDamage(EnemyModel enemy, Dictionary <string, float[]> naturalHexes, bool useWeaponHex, bool useAxeSpecial = false) { float weaponMulti = 1.0f; if (useAxeSpecial && (MainWeapon.Type == Weapon.WeaponType.Axe_1H || MainWeapon.Type == Weapon.WeaponType.Axe_2H)) { weaponMulti = 1.3f; } float[] damages = new float[9]; for (int i = 0; i < 9; i++) { var type = (DamageType.Types)i; float dmgBonus = GetDamageMultiplier(type); if (MainWeapon.BaseDamage.TryGet(type, out DamageType dType)) { damages[i] += dType.Damage * weaponMulti * dmgBonus; } if (MainWeapon.EnchantmentDamage.TryGet(type, out DamageType eType)) { damages[i] += eType.Damage * dmgBonus; } if (MainWeapon.EnchantmentBlastDamage.TryGet(type, out DamageType bType)) { damages[i] += bType.Damage * dmgBonus; } if (!string.IsNullOrEmpty(Imbue.Name)) { if (type != DamageType.Types.Count && Imbue.OverrideType == type) { var totalBase = MainWeapon.BaseDamage.TotalDamage + MainWeapon.EnchantmentDamage.TotalDamage; damages[i] += totalBase * Imbue.DamageMultiplier * dmgBonus; } if (Imbue.BonusDamage.TryGet(type, out DamageType iType)) { damages[i] += iType.Damage * dmgBonus; } } } // calculate total hexes without doubling any var totalHex = new float[9]; foreach (var entry in naturalHexes) { for (int i = 0; i < 9; i++) { totalHex[i] += entry.Value[i]; } } if (useWeaponHex) { foreach (var entry in MainWeapon.m_alreadyAppliedHexes.Where(it => !naturalHexes.ContainsKey(it.Key))) { for (int i = 0; i < 9; i++) { totalHex[i] += entry.Value[i]; } } } // build output damage against enemy resistances DamageList dmgList = new DamageList(); for (int i = 0; i < 9; i++) { var dmg = (damages[i] - enemy.DamageProtection[i]) * (1 - (enemy.DamageResistance[i] + totalHex[i])); if (dmg > 0) { dmgList.Add(new DamageType((DamageType.Types)i, dmg)); } } return(dmgList); }
public void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); var damageByAura = 0.0f; var extendUltDamage = 0.0f; var damageByAttack = 0.0f; var damageOfMisc = 0f; bool canAttack = true; if (target.IsVisible) { // Veil var veil = _abilities.Veil; if (veil != null && veil.Ability.IsValid) { abilities.Add(veil); } // Ethereal var ethereal = _abilities.Ethereal; if (ethereal != null && ethereal.Ability.IsValid) { abilities.Add(ethereal); canAttack = false; } // Shivas var shivas = _abilities.Shivas; if (shivas != null && shivas.Ability.IsValid) { abilities.Add(shivas); } //1 var pulseSkill = _abilities.Pulse; if (pulseSkill.Ability.Level > 0) { abilities.Add(pulseSkill); } // Dagon var dagon = _abilities.Dagon; if (dagon != null && dagon.Ability.IsValid) { abilities.Add(dagon); } // ult var ultSkill = _abilities.Scythe; if (ultSkill.Ability.Level > 0) { abilities.Add(ultSkill); } var auraSkill = _abilities.HeartAura; if (auraSkill.Ability.Level > 0) { damageByAura = auraSkill.GetDamage(target, 1); } if (canAttack) { damageByAttack = Owner.GetAttackDamage(target, true); } if (ultSkill.CanBeCasted && ultSkill.CanHit(target)) { extendUltDamage = (damageByAttack + damageByAura) * ultSkill.DamagePerHealth; } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(target, heroes); var damageBlock = DamageBlock(target, heroes); //没有计算来自装备的伤害加深 damageOfMisc = damageByAttack + damageByAura + DamageHelpers.GetSpellDamage(extendUltDamage, Owner.GetSpellAmplification(), damageReduction); //Console.WriteLine($"{damageByAttack}/{damageByAura}/{extendUltDamage}/{DamageHelpers.GetSpellDamage(extendUltDamage, Owner.GetSpellAmplification(), damageReduction)}"); var livingArmor = LivingArmor(target, heroes, damageCalculation.Abilities); //目前就能打死的 var damage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target) + damageOfMisc) + damageBlock, 0, damageReduction) - livingArmor; //上去就能干死的 var readyDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, true, false) + damageOfMisc + damageBlock, 0, damageReduction) - livingArmor; //所有状态完美的总体伤害 var totalDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, false, false) + damageBlock, 0, damageReduction) - livingArmor; if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers)) { damage = 0.0f; readyDamage = 0.0f; } //Console.WriteLine($"{damage}/{readyDamage}/{totalDamage}"); DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health, abilities.ToArray())); } }
public bool TryAdd(ReadOnlySpan <char> logLine) { if (LevelLoad.TryParse(logLine, LogDate, out var ll)) { Current = ll; LoadLevelList.Add(ll); } else if (TestDriveStart.TryParse(logLine, LogDate, out var std)) { Current = std; StartTestDriveList.Add(std); } else if (TestDriveFinish.TryParse(logLine, LogDate, out var ftd)) { Current = ftd; FinishTestDriveList.Add(ftd); } else if (GameStart.TryParse(logLine, LogDate, out var sg)) { Current = sg; StartGameList.Add(sg); } else if (GameFinish.TryParse(logLine, LogDate, out var fg)) { Current = fg; FinishGameList.Add(fg); } else if (GameRound.TryParse(logLine, LogDate, out var rg)) { Current = rg; RoundGameList.Add(rg); } else if (ActiveBattleStart.TryParse(logLine, LogDate, out var sab)) { Current = sab; StartActiveBattleList.Add(sab); } else if (PlayerLoad.TryParse(logLine, LogDate, out var pl)) { Current = pl; PlayerLoadList.Add(pl); } else if (Damage.TryParse(logLine, LogDate, out var dmg)) { Current = dmg; DamageList.Add(dmg); } else if (Killing.TryParse(logLine, LogDate, out var kill)) { Current = kill; KillList.Add(kill); } else if (KillAssist.TryParse(logLine, LogDate, out var ka)) { Current = ka; KillAssistList.Add(ka); } else if (Score.TryParse(logLine, LogDate, out var sc)) { Current = sc; ScoreList.Add(sc); } else if (Decal.TryParse(logLine, LogDate, out var dec)) { Current = dec; DecalList.Add(dec); } else { Current = null; return(false); } //update datetimes var currentDateTime = new DateTime(Current.TimeStamp); if (currentDateTime > Last) { Last = currentDateTime; } if (currentDateTime < First) { First = currentDateTime; } return(true); }