Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added jingu mastery #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions game/scripts/npc/abilities/monkey_king_jingu_mastery_datadriven
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// Rewrite of the Monkey King Jingu Mastery
// Author: Yahnich
// Date: December 22th, 2016
// Version: 7.00
// Type: Datadriven
//
// ----- FILE REQUIREMENTS -----
// Script files:
// scripts/vscripts/heroes/hero_monkey_king/jingu_mastery.lua
"monkey_king_jingu_mastery_datadriven"
{
// General
//-------------------------------------------------------------------------------------------------------------
"BaseClass" "ability_datadriven"
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
"SpellImmunityType" "SPELL_IMMUNITY_ENEMIES_YES"
"FightRecapLevel" "1"

// Time
//-------------------------------------------------------------------------------------------------------------
"AbilityCooldown" "0"

// Special
//-------------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
"01"
{
"var_type" "FIELD_INTEGER"
"required_hits" "4"
}
"02"
{
"var_type" "FIELD_INTEGER"
"counter_duration" "10"
}
"03"
{
"var_type" "FIELD_INTEGER"
"charges" "4"
}
"04"
{
"var_type" "FIELD_INTEGER"
"bonus_damage" "80 120 160 200"
}
"05"
{
"var_type" "FIELD_INTEGER"
"lifesteal" "20 30 40 50"
}
}
"Modifiers"
{
"modifier_jingu_mastery_hit_registerer"
{
"Passive" "1"
"IsHidden" "1"
"OnAttackLanded"
{
"RunScript"
{
"ScriptFile" "heroes/hero_monkey_king/jingu_mastery.lua"
"Function" "CheckJingu"
"particle" "particles/units/heroes/hero_monkey_king/monkey_king_quad_tap_stack.vpcf"
}
}
}
"modifier_jingu_mastery_activated_damage"
{
"IsHidden" "1"
"IsPurgeable" "1"
"Properties"
{
"MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE" "%bonus_damage"
}
}
"modifier_jingu_mastery_activated"
{
"IsBuff" "1"
"IsPurgeable" "1"
"EffectName" "particles/units/heroes/hero_monkey_king/monkey_king_quad_tap_overhead.vpcf"
"EffectAttachType" "follow_overhead"

"OnAttackLanded"
{
"RunScript"
{
"ScriptFile" "heroes/hero_monkey_king/jingu_mastery.lua"
"Function" "JinguHit"
"particle" "particles/units/heroes/hero_monkey_king/monkey_king_quad_tap_hit.vpcf"
}
"FireEffect"
{
"EffectName" "particles/units/heroes/hero_monkey_king/monkey_king_quad_tap_hit.vpcf"
"EffectAttachType" "attach_hitloc"
"Target" "TARGET"

"ControlPointEntities"
{
"TARGET" "attach_hitloc"
"TARGET" "attach_hitloc"
}
}
"Lifesteal"
{
"Target" "ATTACKER"
"LifestealPercent" "%lifesteal"
}
}
}
"modifier_jingu_mastery_hitcount"
{
"IsDebuff" "1"
"OnCreated"
{
"RunScript"
{
"ScriptFile" "heroes/hero_monkey_king/jingu_mastery.lua"
"Function" "JinguOverheadInit"
"particle" "particles/units/heroes/hero_monkey_king/monkey_king_quad_tap_stack.vpcf"
}
}
"OnDestroy"
{
"RunScript"
{
"ScriptFile" "heroes/hero_monkey_king/jingu_mastery.lua"
"Function" "JinguOverheadDestroy"
}
}
}
}
}
}
53 changes: 53 additions & 0 deletions game/scripts/vscripts/heroes/hero_monkey_king/jingu_mastery.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function JinguHit(keys)
local caster = keys.caster
local ability = keys.ability

local jinguBuff = caster:FindModifierByName("modifier_jingu_mastery_activated")
if jinguBuff then
jinguBuff:DecrementStackCount()
if jinguBuff:GetStackCount() <= 0 then
jinguBuff:Destroy()
caster:RemoveModifierByName("modifier_jingu_mastery_activated_damage")
end
end
end

function CheckJingu(keys)
local caster = keys.caster
local ability = keys.ability
local target = keys.target
if caster:HasModifier("modifier_jingu_mastery_activated") or not target:IsRealHero() or not caster:IsRealHero() or caster:PassivesDisabled() then return
else
local jinguStack = target:FindModifierByName("modifier_jingu_mastery_hitcount")
if not jinguStack then
ability:ApplyDataDrivenModifier(caster, target, "modifier_jingu_mastery_hitcount", {duration = ability:GetTalentSpecialValueFor("counter_duration")})
jinguStack = target:FindModifierByName("modifier_jingu_mastery_hitcount")
jinguStack:SetStackCount(0)

end
jinguStack:SetStackCount(jinguStack:GetStackCount() + 1)
print(jinguStack:GetStackCount())
if not target.OverHeadJingu then
target.OverHeadJingu = ParticleManager:CreateParticle(keys.particle, PATTACH_OVERHEAD_FOLLOW, target)
ParticleManager:SetParticleControl(target.OverHeadJingu, 0, target:GetAbsOrigin())
end
ParticleManager:SetParticleControl(target.OverHeadJingu, 1, Vector(0,jinguStack:GetStackCount(),0))

if jinguStack:GetStackCount() == ability:GetTalentSpecialValueFor("required_hits") then
local jinguBuff = ability:ApplyDataDrivenModifier(caster, caster, "modifier_jingu_mastery_activated", {})
ability:ApplyDataDrivenModifier(caster, caster, "modifier_jingu_mastery_activated_damage", {})
jinguBuff:SetStackCount(ability:GetTalentSpecialValueFor("charges"))
jinguStack:Destroy()
end
end
end

function JinguOverheadDestroy(keys)
local caster = keys.caster
local ability = keys.ability
local target = keys.target

ParticleManager:DestroyParticle(target.OverHeadJingu, false)
ParticleManager:ReleaseParticleIndex(target.OverHeadJingu)
target.OverHeadJingu = nil
end