Advertisement
epitaque_

Untitled

Sep 29th, 2015
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.53 KB | None | 0 0
  1. // Problem: the lua modifier isnt being applied to creeps in the AOE. It is linked.
  2.  
  3. // Datadriven Ability
  4. "hlw_antimage_cleavify"
  5. {
  6.     // General
  7.     //-------------------------------------------------------------------------------------------------------------
  8.     "BaseClass"                     "ability_datadriven"
  9.     "AbilityTextureName"            "hlw_antimage_spell_shield"
  10.     "AbilityBehavior"               "DOTA_ABILITY_BEHAVIOR_POINT | DOTA_ABILITY_BEHAVIOR_AOE"
  11.     "AbilityUnitTargetTeam"         "DOTA_UNIT_TARGET_TEAM_ENEMY"
  12.     "AbilityUnitTargetType"         "DOTA_UNIT_TARGET_BASIC | DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_CREEP"
  13.     //"AbilityCastAnimation"            "ACT_DOTA_SPAWN"
  14.     "AOERadius"                     "%inflicton_radius"
  15.  
  16.  
  17.     // Casting
  18.     //-------------------------------------------------------------------------------------------------------------
  19.     "AbilityCastRange"              "800"
  20.     "AbilityCastPoint"              "0.3"
  21.  
  22.     // Time    
  23.     //-------------------------------------------------------------------------------------------------------------
  24.     "AbilityCooldown"               "30.0 29.0 28.0 27.0"
  25.  
  26.     // Cost
  27.     //-------------------------------------------------------------------------------------------------------------
  28.     "AbilityManaCost"               "200"
  29.  
  30.     "precache"
  31.     {
  32.         "particle"  "particles/units/heroes/hero_phoenix/phoenix_supernova_death.vpcf"
  33.     }
  34.  
  35.     "OnSpellStart"
  36.     {
  37.         "FireEffect"
  38.         {
  39.             "EffectName"        "particles/units/heroes/hero_phoenix/phoenix_supernova_death.vpcf"
  40.             "EffectAttachType"  "start_at_customorigin"
  41.             "TargetPoint"       "POINT"
  42.  
  43.             "ControlPoints"
  44.             {
  45.                 "00"    "POINT"
  46.                 "01"    "POINT"
  47.  
  48.             }
  49.         }
  50.         "ApplyModifier"
  51.         {
  52.             "ModifierName"  "modifier_cleavable_lua"
  53.             "Target"
  54.             {
  55.                 "Center"    "POINT"
  56.                 "Radius"    "%radius"
  57.                 "Teams"     "DOTA_UNIT_TARGET_TEAM_ENEMY"
  58.                 "Types"     "DOTA_UNIT_TARGET_CREEP | DOTA_UNIT_TARGET_HERO | DOTA_UNIT_TARGET_BASIC"
  59.             }
  60.             "Duration"      "%duration"
  61.         }
  62.     }
  63.  
  64.     // Special
  65.     //-------------------------------------------------------------------------------------------------------------
  66.     "AbilitySpecial"
  67.     {
  68.         "01"
  69.         {
  70.             "var_type"                  "FIELD_FLOAT"
  71.             "duration"                  "20.0 21.0 22.0 23.0"
  72.         }
  73.         "02"
  74.         {
  75.             "var_type"                  "FIELD_FLOAT"
  76.             "inflicton_radius"                  "350 450 550 650"
  77.         }
  78.         "03"
  79.         {
  80.             "var_type"                  "FIELD_FLOAT"
  81.             "cleave_percent"            "15 20 25 30"
  82.         }
  83.         "04"
  84.         {
  85.             "var_type"                  "FIELD_FLOAT"
  86.             "cleave_radius"             "300 325 350 375"
  87.         }
  88.     }
  89. }
  90.  
  91. // modifier_cleavable_lua
  92. modifier_cleavable_lua = class({})
  93. LinkLuaModifier("modifier_cleavable_lua", "modifiers/modifier_cleavable", LUA_MODIFIER_MOTION_NONE)
  94.  
  95. function modifier_cleavable_lua:DeclareFunctions()
  96.     local funcs = {
  97.         MODIFIER_EVENT_ON_ATTACKED
  98.     }
  99.  
  100.     return funcs
  101. end
  102.  
  103. function modifier_cleavable_lua:GetTexture()
  104.     print("Modifier cleavify added.")
  105.     return "beastmaster_wild_axes"
  106. end
  107.  
  108. function modifier_cleavable_lua:OnAttacked()
  109.     local caster = self:GetCaster()
  110.     local ability = caster:FindAbilityByName("hlw_antimage_cleavify")
  111.     local radius = ability:GetSpecialValueFor("cleave_radius")
  112.     local attDamage = ability:GetSpecialValueFor("cleave_percent")
  113.     local location = caster:GetForwardVector() * radius + caster:GetAbsOrigin()
  114.    
  115.     local units = FindUnitsInRadius(caster:GetTeamNumber(), location, nil, radius, ability:GetAbilityTargetTeam(), ability:GetAbilityDamageType(), ability:GetAbilityTargetFlags(), 0, false)
  116.  
  117.     for _, unit in pairs(units) do
  118.         local damageTable =
  119.         {
  120.             victim = unit,
  121.             attacker = caster,
  122.             damage = attDamage,
  123.             damage_type = DAMAGE_TYPE_PHYSICAL
  124.         }
  125.  
  126.         ApplyDamage(damageTable)
  127.     end
  128. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement