local ____lualib = require("lualib_bundle") local __TS__Class = ____lualib.__TS__Class local __TS__ClassExtends = ____lualib.__TS__ClassExtends local __TS__Decorate = ____lualib.__TS__Decorate local ____exports = {} local ____modifier_general_hunger = require("abilities.modifiers.modifier_general_hunger") local modifier_buff_food_slot = ____modifier_general_hunger.modifier_buff_food_slot local modifier_general_hunger = ____modifier_general_hunger.modifier_general_hunger local BUFF_FOOD_MAX_SLOTS = ____modifier_general_hunger.BUFF_FOOD_MAX_SLOTS local getBuffFoodSlotCount = ____modifier_general_hunger.getBuffFoodSlotCount local ____dota_ts_adapter = require("lib.dota_ts_adapter") local BaseItem = ____dota_ts_adapter.BaseItem local BaseModifier = ____dota_ts_adapter.BaseModifier local registerAbility = ____dota_ts_adapter.registerAbility local registerModifier = ____dota_ts_adapter.registerModifier local ____vampirism = require("utils.vampirism") local addMagicalVampirism = ____vampirism.addMagicalVampirism local reduceMagicalVampirism = ____vampirism.reduceMagicalVampirism --- Коктейль — бафф-еда: маг вампиризм, маг. усиление, +20% к манакосту ____exports.item_cocktail = __TS__Class() local item_cocktail = ____exports.item_cocktail item_cocktail.name = "item_cocktail" item_cocktail.____file_path = "scripts/vscripts/items/util_items/item_cocktail.lua" __TS__ClassExtends(item_cocktail, BaseItem) function item_cocktail.prototype.CastFilterResultTarget(self, target) if IsServer() then if not target:IsRealHero() then return UF_FAIL_CUSTOM end if getBuffFoodSlotCount(nil, target) >= BUFF_FOOD_MAX_SLOTS then return UF_FAIL_CUSTOM end if self:GetCurrentCharges() < self:GetInitialCharges() then return UF_FAIL_CUSTOM end return UF_SUCCESS end return UF_SUCCESS end function item_cocktail.prototype.GetCustomCastErrorTarget(self, target) if IsServer() then if not target:IsRealHero() then return "#dota_hud_error_cheese_bad_target" end if getBuffFoodSlotCount(nil, target) >= BUFF_FOOD_MAX_SLOTS then return "#dota_hud_error_ability_not_ready" end if self:GetCurrentCharges() < self:GetInitialCharges() then return "#dota_hud_error_havent_charges" end end return "" end function item_cocktail.prototype.OnSpellStart(self) local target = self:GetCursorTarget() local item = self if not target then return end target:EmitSound("DOTA_Item.Cheese.Activate") if target:IsRealHero() then local buffDuration = self:GetSpecialValueFor("buff_duration") local spellLifesteal = self:GetSpecialValueFor("spell_lifesteal") local spellAmp = self:GetSpecialValueFor("spell_amp") local manacostIncrease = self:GetSpecialValueFor("manacost_increase") local hungerModifier = target:AddNewModifier( self:GetCaster(), self, modifier_general_hunger.name, {} ) target:AddNewModifier( self:GetCaster(), self, modifier_buff_food_slot.name, {duration = buffDuration} ) target:AddNewModifier( self:GetCaster(), self, ____exports.modifier_item_cocktail_buff.name, {duration = buffDuration, spell_lifesteal = spellLifesteal, spell_amp = spellAmp, manacost_increase = manacostIncrease} ) if hungerModifier then local hunger_bonus = self:GetSpecialValueFor("hunger_bonus") do local i = 0 while i < hunger_bonus do hungerModifier:IncrementStackCount() i = i + 1 end end end if item:GetCurrentCharges() <= item:GetInitialCharges() then UTIL_Remove(item) return end item:SetCurrentCharges(item:GetCurrentCharges() - item:GetInitialCharges()) end end item_cocktail = __TS__Decorate( item_cocktail, item_cocktail, {registerAbility(nil)}, {kind = "class", name = "item_cocktail"} ) ____exports.item_cocktail = item_cocktail --- Бафф от коктейля: маг вампиризм, спелл амп, +% к манакосту ____exports.modifier_item_cocktail_buff = __TS__Class() local modifier_item_cocktail_buff = ____exports.modifier_item_cocktail_buff modifier_item_cocktail_buff.name = "modifier_item_cocktail_buff" modifier_item_cocktail_buff.____file_path = "scripts/vscripts/items/util_items/item_cocktail.lua" __TS__ClassExtends(modifier_item_cocktail_buff, BaseModifier) function modifier_item_cocktail_buff.prototype.____constructor(self, ...) BaseModifier.prototype.____constructor(self, ...) self.spellLifesteal = 0 self.spellAmp = 0 self.manacostIncrease = 0 end function modifier_item_cocktail_buff.prototype.IsHidden(self) return false end function modifier_item_cocktail_buff.prototype.IsPurgable(self) return true end function modifier_item_cocktail_buff.prototype.IsDebuff(self) return false end function modifier_item_cocktail_buff.prototype.GetAttributes(self) return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_item_cocktail_buff.prototype.GetTexture(self) return "../items/utils/cocktail" end function modifier_item_cocktail_buff.prototype.DeclareFunctions(self) return {MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, MODIFIER_PROPERTY_MANACOST_PERCENTAGE_STACKING} end function modifier_item_cocktail_buff.prototype.OnCreated(self, params) if (params and params.spell_lifesteal) ~= nil then self.spellLifesteal = params.spell_lifesteal end if (params and params.spell_amp) ~= nil then self.spellAmp = params.spell_amp end if (params and params.manacost_increase) ~= nil then self.manacostIncrease = params.manacost_increase end local ability = self:GetAbility() if ability then if self.spellLifesteal == 0 then self.spellLifesteal = ability:GetSpecialValueFor("spell_lifesteal") end if self.spellAmp == 0 then self.spellAmp = ability:GetSpecialValueFor("spell_amp") end if self.manacostIncrease == 0 then self.manacostIncrease = ability:GetSpecialValueFor("manacost_increase") end end if IsServer() then local caster = self:GetCaster() if caster and self.spellLifesteal > 0 then addMagicalVampirism(nil, caster, self.spellLifesteal) end end end function modifier_item_cocktail_buff.prototype.OnDestroy(self) if not IsServer() then return end local caster = self:GetCaster() if caster and self.spellLifesteal > 0 then reduceMagicalVampirism(nil, caster, self.spellLifesteal) end end function modifier_item_cocktail_buff.prototype.GetModifierSpellAmplify_Percentage(self) return self.spellAmp end function modifier_item_cocktail_buff.prototype.GetModifierPercentageManacostStacking(self) return -self.manacostIncrease end modifier_item_cocktail_buff = __TS__Decorate( modifier_item_cocktail_buff, modifier_item_cocktail_buff, {registerModifier(nil)}, {kind = "class", name = "modifier_item_cocktail_buff"} ) ____exports.modifier_item_cocktail_buff = modifier_item_cocktail_buff return ____exports