#Crits

1 messages · Page 1 of 1 (latest)

versed mortar
#

I have a regular custom item code. These are normal crits. I have a 25% chance, but when I buy 4 of these, for some reason I don’t get a crit every hit. What is the reason for this and how to fix it?

#

LinkLuaModifier ("modifier_item_crystalys_custom", "items/item_crystalys_custom.lua", LUA_MODIFIER_MOTION_NONE)

function item_crystalys_custom:GetIntrinsicModifierName ()
    return "modifier_item_crystalys_custom"
end

modifier_item_crystalys_custom = class({}) 

function modifier_item_crystalys_custom:IsHidden() return true end
function modifier_item_crystalys_custom:IsPurgable() return false end
function modifier_item_crystalys_custom:IsPermanent() return true end
function modifier_item_crystalys_custom:GetAttributes() return MODIFIER_ATTRIBUTE_MULTIPLE end

function modifier_item_crystalys_custom:DeclareFunctions()
    local funcs = {
        MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE,
        MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE,
    }

    return funcs
end

function modifier_item_crystalys_custom:GetModifierPreAttack_BonusDamage()
    return self:GetAbility():GetSpecialValueFor("bonus_damage")
end

function modifier_item_crystalys_custom:GetModifierPreAttack_CriticalStrike(params)
    if IsServer() then
        local chance = self:GetAbility():GetSpecialValueFor("crit_chance")

        if RollPercentage(chance) then

            local hTarget = params.target

            return self:GetAbility():GetSpecialValueFor("crit_damage")
        end
    end
end```
wraith phoenix
#

Because that's not how statistics work.
Each crit item has its own separate chance to proc.
The odds of getting a crit with 4 25% crit items is 68.36%
1 - 0.75^4 ≈0.6836

small bear
#

It is not how items in dota work either. You have to implicitly count an amount of items in your backpack and use a diminishing returns crit chance formula based on that

olive geyser
#

To support the above arguments, buy 5 regular Dota Chrysalises (each being 20%, IIRC - been a while since I played) and check if you crit every time.