Как выдать Status Resistance?

AlexInCube

Пользователь
31 Окт 2018
17
0
1
20
Реакции
0 0 0
#1
Хочу чтобы пт на силе давало статус резист.
//////////////Код в Datadriven:
"item_power_treads_strength_datadriven"
{
// General
//-------------------------------------------------------------------------------------------------------------
"BaseClass" "item_datadriven"
"ID" "1063" //Valve's version of this item uses the ID "63".
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET"
"Model" "models/props_gameplay/red_box.vmdl"
"Effect" "particles/generic_gameplay/dropped_item.vpcf"
"AbilityTextureName" "item_power_treads_str"

// Item Info
//-------------------------------------------------------------------------------------------------------------
"ItemCost" "1400"
"ItemShopTags" "attack_speed;move_speed;int;agi;str"
"ItemQuality" "common"
"ItemAliases" "power treads"
"ItemDeclarations" "DECLARE_PURCHASES_TO_SPECTATORS"

// Special
//-------------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
"01"
{
"var_type" "FIELD_INTEGER"
"bonus_movement_speed" "50"
}
"02"
{
"var_type" "FIELD_INTEGER"
"bonus_stat" "8"
}
"03"
{
"var_type" "FIELD_INTEGER"
"bonus_attack_speed" "30"
}
"04"
{
"var_type" "FIELD_INTEGER"
"statusresist" "30"
}
}

"OnSpellStart" //Switch to the next version of Power Treads (Intelligence).
{
"RunScript"
{
"ScriptFile" "items/item_power_treads.lua"
"Function" "item_power_treads_strength_datadriven_on_spell_start"
}

"RunScript"
{
"ScriptFile" "items/item_power_treads.lua"
"Function" "modifier_powertreadsstrength_passive"
}
}

"Modifiers"
{
"modifier_item_power_treads_strength_datadriven"
{
"Passive" "1"
"IsHidden" "1"
"Attributes" "MODIFIER_ATTRIBUTE_MULTIPLE"

"Properties"
{
"MODIFIER_PROPERTY_STATS_STRENGTH_BONUS" "%bonus_stat"
"MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "%bonus_attack_speed"
"MODIFIER_PROPERTY_MOVESPEED_BONUS_UNIQUE" "%bonus_movement_speed"

}
}
}
}
///////////////Код Lua:
function swap_to_item(keys, ItemName)
for i=0, 5, 1 do
local current_item = keys.caster:GetItemInSlot(i)
if current_item == nil then
keys.caster:AddItem(CreateItem("item_dummy", keys.caster, keys.caster))
end
end

keys.caster:RemoveItem(keys.ability)
keys.caster:AddItem(CreateItem(ItemName, keys.caster, keys.caster))

for i=0, 5, 1 do
local current_item = keys.caster:GetItemInSlot(i)
if current_item ~= nil then
if current_item:GetName() == "item_dummy_datadriven" then
keys.caster:RemoveItem(current_item)
end
end
end
end

if not modifier_powertreadsstrength_passive then modifier_powertreadsstrength_passive = class({}) end

function modifier_powertreadsstrength_passive:IsHidden( )
return true
end

function modifier_powertreadsstrength_passive:IsPurgable( )
return false
end

function modifier_powertreadsstrength_passive:DeclareFunctions( )
return {MODIFIER_PROPERTY_STATUS_RESISTANCE,MODIFIER_PROPERTY_STATS_AGILITY_BONUS,MODIFIER_PROPERTY_STATS_STRENGTH_BONUS,MODIFIER_PROPERTY_STATS_INTELLECT_BONUS}
end

function modifier_powertreadsstrength_passive:OnCreated( )
local ability = self:GetAbility()
self.statusresist = ability:GetSpecialValueFor("statusresist")
end

function modifier_powertreadsstrength_passive:GetModifierStatusResistance( )
return self.statusresist
end


]
function item_power_treads_strength_datadriven_on_spell_start(keys)
swap_to_item(keys, "item_power_treads_agility_datadriven")
end



function item_power_treads_agility_datadriven_on_spell_start(keys)
swap_to_item(keys, "item_power_treads_intelligence_datadriven")
end



function item_power_treads_intelligence_datadriven_on_spell_start(keys)
swap_to_item(keys, "item_power_treads_strength_datadriven")
end
 
Реклама: