diff --git a/HarmonySrc/BloodTide.cs b/HarmonySrc/BloodTide.cs index 7898827..ecc23a3 100644 --- a/HarmonySrc/BloodTide.cs +++ b/HarmonySrc/BloodTide.cs @@ -244,6 +244,37 @@ namespace NecromancerTome } } + /// + /// Крит меча (указание 10.10: «шанс на критический удар бы тоже повысить»). Случайного крита у ближнего боя в игре + /// нет: ItemActionDynamic помечает критическим каждый силовой удар (действие 1) и ни одного обычного, а + /// CriticalChance уходит в параметр _criticalHitChanceOLD функции Hit, которую та не читает. Сам крит урон не + /// поднимает - только чаще сбивает с ног и ставит на колено, вдвое быстрее копит урон по ногам, красит цифру урона. + /// Наш крит: в прилив обычный удар ножом по существу с шансом CritChance - критический, урон x CritMultiplier. + /// + [HarmonyPatch(typeof(ItemActionAttack), nameof(ItemActionAttack.Hit))] + public static class Patch_ItemActionAttack_Hit_BloodTideCrit + { + public const float CritChance = 0.25f; + public const float CritMultiplier = 2f; + + public static void Prefix(WorldRayHitInfo hitInfo, int _attackerEntityId, ref float _entityDamage, + ItemActionAttack.AttackHitInfo _attackDetails, ItemValue damagingItemValue, bool _isGrazingHit) + { + if (!BloodTide.Armed || _isGrazingHit || _attackDetails == null || _attackDetails.isCriticalHit || _entityDamage <= 0f || + hitInfo?.tag == null || !hitInfo.tag.StartsWith("E_") || damagingItemValue?.ItemClass?.Name != SnakeMode.KnifeName) + { + return; + } + World world = GameManager.Instance?.World; + if (world == null || world.GetPrimaryPlayer()?.entityId != _attackerEntityId || Random.value >= CritChance) + { + return; + } + _entityDamage *= CritMultiplier; + _attackDetails.isCriticalHit = true; + } + } + /// Пульс полосок здоровья и выносливости (прилив и нож в руке): цвет полосы (BarContent в HUDLeftStatBars /// игры, у здоровья 255,0,0,160, у выносливости 0,54,255,160) уходит в фиолетовый на каждом ударе сердца. [HarmonyPatch(typeof(XUiC_HUDStatBar), nameof(XUiC_HUDStatBar.Update))] diff --git a/NecromancerHarmony.dll b/NecromancerHarmony.dll index 3fff300..9538040 100644 Binary files a/NecromancerHarmony.dll and b/NecromancerHarmony.dll differ diff --git a/NecromancerHarmony.pdb b/NecromancerHarmony.pdb index b60ba91..be5e3a2 100644 Binary files a/NecromancerHarmony.pdb and b/NecromancerHarmony.pdb differ