- 28 Апр 2016
- 231
- 0
- Проект
- Защитники Изобилия | Defenders of Abundance
Помогите найти проблему:
Код:
function mana_cost_f(keys)
local caster = keys.caster
local ability = keys.ability
local mana_cost = ability:GetLevelSpecialValueFor("mana_cost", (ability:GetLevel() - 1))
local caster_current_mana = caster:GetMana()
if caster_current_mana >= mana_cost then
caster:ReduceMana(mana_cost)
caster:ApplyDataDrivenModifier("modifier_coup_de_grace_crit_2")
else caster:RemoveModifierByName("modifier_coup_de_grace_crit_2")
end
end
function modifier_coup_de_grace_1_f(keys)
local caster = keys.caster
local ability = keys.ability
local mana_cost = ability:GetLevelSpecialValueFor("mana_cost", (ability:GetLevel() - 1))
local caster_current_mana = caster:GetMana()
if caster_current_mana < mana_cost then
ability:ToggleAbility()
end
end


Код:
//=================================================================================================================
// Ability: Phantom Coup de Grace
//=================================================================================================================
"phantom_assassin_coup_de_grace_1"
{
// General
//-------------------------------------------------------------------------------------------------------------
"BaseClass" "ability_datadriven"
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_TOGGLE | DOTA_ABILITY_BEHAVIOR_IMMEDIATE"
"AbilityType" "DOTA_ABILITY_TYPE_ULTIMATE"
"AbilityTextureName" "phantom_assassin_coup_de_grace"
// Cost
//-------------------------------------------------------------------------------------------------------------
"AbilityManaCost" "0"
// Precache
//-------------------------------------------------------------------------------------------------------------
"precache"
{
"soundfile" "soundevents/game_sounds_heroes/game_sounds_phantom_assassin.vsndevts"
"particle" "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf"
}
// Special
//-------------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
"01"
{
"var_type" "FIELD_INTEGER"
"crit_bonus" "230 340 450"
}
"02"
{
"var_type" "FIELD_INTEGER"
"crit_chance" "50 60 70"
}
"03"
{
"var_type" "FIELD_INTEGER"
"mana_cost" "20 25 30"
}
}
"OnToggleOn"
{
"ApplyModifier"
{
"ModifierName" "modifier_coup_de_grace_1"
"Target" "CASTER"
}
"RunScript"
{
"ScriptFile" "heroes/modifier_coup_de_grace_1.lua"
"Function" "modifier_coup_de_grace_1_f"
}
}
"OnToggleOff"
{
"RemoveModifier"
{
"ModifierName" "modifier_coup_de_grace_1"
"Target" "CASTER"
}
}
"Modifiers"
{
"modifier_coup_de_grace_1"
{
"Passive" "1"
"IsHidden" "0"
"OnAttackStart"
{
"RemoveModifier"
{
"ModifierName" "modifier_coup_de_grace_crit_1"
"Target" "CASTER"
}
"Random"
{
"Chance" "%crit_chance"
"PseudoRandom" "DOTA_PSEUDO_RANDOM_PHANTOMASSASSIN_CRIT"
"OnSuccess"
{
"ApplyModifier"
{
"ModifierName" "modifier_coup_de_grace_crit_1"
"Target" "CASTER"
}
}
}
}
}
"modifier_coup_de_grace_crit_1"
{
"IsHidden" "0"
"OnAttackLanded"
{
"RunScript"
{
"ScriptFile" "heroes/modifier_coup_de_grace_1.lua"
"Function" "mana_cost_f"
}
"RemoveModifier"
{
"ModifierName" "modifier_coup_de_grace_crit_1"
"Target" "CASTER"
}
}
}
"modifier_coup_de_grace_crit_2"
{
"IsHidden" "0"
"Properties"
{
"MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE" "%crit_bonus"
}
"OnAttackLanded"
{
"RemoveModifier"
{
"ModifierName" "modifier_coup_de_grace_crit_2"
"Target" "CASTER"
}
"FireEffect"
{
"EffectName" "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf"
"EffectAttachType" "start_at_customorigin"
"ControlPointEntities"
{
"TARGET" "follow_origin"
"TARGET" "follow_origin"
}
}
"FireSound"
{
"EffectName" "Hero_PhantomAssassin.CoupDeGrace"
"Target" "TARGET"
}
}
}
}
}
Последнее редактирование модератором: