initial commit

This commit is contained in:
2021-10-24 15:36:18 -04:00
commit b9a5a8fe23
11982 changed files with 220468 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
--[[ abilities/traps/arrow.lua ]]
arrow = class({})
----------------------------------------------------------------------------------------
function arrow:Precache( context )
PrecacheResource( "particle", "particles/traps/temple_trap_arrow.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf", context )
end
--------------------------------------------------------------------------------
function arrow:OnSpellStart()
self.start_radius = self:GetSpecialValueFor( "start_radius" )
self.end_radius = self:GetSpecialValueFor( "end_radius" )
self.speed = self:GetLevelSpecialValueFor( "speed", GameRules.Aghanim:GetAscensionLevel() )
self.max_hp_pct_damage = self:GetLevelSpecialValueFor( "max_hp_pct_damage", GameRules.Aghanim:GetAscensionLevel() )
--printf( "ascension level: %d; speed: %d; percent damage: %d", GameRules.Aghanim:GetAscensionLevel(), self.speed, self.max_hp_pct_damage )
local vPos = nil
if self:GetCursorTarget() then
vPos = self:GetCursorTarget():GetOrigin()
else
vPos = self:GetCursorPosition()
end
local fRangeToTarget = ( self:GetCaster():GetOrigin() - vPos ):Length2D()
local vDirection = vPos - self:GetCaster():GetOrigin()
vDirection.z = 0.0
vDirection = vDirection:Normalized()
self.speed = self.speed * ( ( fRangeToTarget ) / ( fRangeToTarget -self.start_radius ) )
local info = {
EffectName = "particles/traps/temple_trap_arrow.vpcf",
Ability = self,
vSpawnOrigin = self:GetCaster():GetOrigin(),
fStartRadius = self.start_radius,
fEndRadius = self.end_radius,
vVelocity = vDirection * self.speed,
fDistance = fRangeToTarget,
Source = self:GetCaster(),
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
}
ProjectileManager:CreateLinearProjectile( info )
EmitSoundOn( "AghanimsFortress.FireTrap", self:GetCaster() )
end
--------------------------------------------------------------------------------
function arrow:OnProjectileHit( hTarget, vLocation )
if hTarget ~= nil and ( not hTarget:IsMagicImmune() ) and ( not hTarget:IsInvulnerable() ) then
if hTarget:HasModifier( "modifier_treasure_chest" ) then
return false
end
--[[
local modifierKnockback =
{
center_x = vLocation.x,
center_y = vLocation.y,
center_z = vLocation.z,
duration = 0.3,
knockback_duration = 0.3,
knockback_distance = 450,
knockback_height = 50,
}
hTarget:AddNewModifier( hTarget, nil, "modifier_knockback", modifierKnockback )
]]
local fMaxHealth = hTarget:GetMaxHealth()
local fDamage = math.ceil( fMaxHealth * ( self.max_hp_pct_damage / 100.0 ) )
--printf( "arrow:OnProjectileHit - applying %.2f damage to target with %.2f max health", fDamage, fMaxHealth )
local damageSource = self:GetCaster()
local damage = {
victim = hTarget,
attacker = damageSource,
damage = fDamage,
damage_type = DAMAGE_TYPE_PURE,
ability = self
}
ApplyDamage( damage )
if not ( hTarget:IsNull() ) and hTarget ~= nil then
local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf", PATTACH_CUSTOMORIGIN, nil )
ParticleManager:SetParticleControlEnt( nFXIndex, 0, hTarget, PATTACH_POINT_FOLLOW, "attach_hitloc", hTarget:GetOrigin(), true )
ParticleManager:SetParticleControl( nFXIndex, 1, hTarget:GetOrigin() )
ParticleManager:SetParticleControlForward( nFXIndex, 1, -self:GetCaster():GetForwardVector() )
ParticleManager:SetParticleControlEnt( nFXIndex, 10, hTarget, PATTACH_ABSORIGIN_FOLLOW, nil, hTarget:GetOrigin(), true )
ParticleManager:ReleaseParticleIndex( nFXIndex )
EmitSoundOn( "Dungeon.BloodSplatterImpact", hTarget )
end
return true
end
return false
end
--------------------------------------------------------------------------------

View File

@@ -0,0 +1,81 @@
breathe_fire = class({})
----------------------------------------------------------------------------------------
function breathe_fire:Precache( context )
PrecacheResource( "particle", "particles/fire_trap/trap_breathe_fire.vpcf", context )
end
--------------------------------------------------------------------------------
function breathe_fire:ProcsMagicStick()
return false
end
--------------------------------------------------------------------------------
function breathe_fire:OnSpellStart()
self.start_radius = self:GetSpecialValueFor( "start_radius" )
self.end_radius = self:GetSpecialValueFor( "end_radius" )
self.speed = self:GetSpecialValueFor( "speed" )
self.fire_damage = self:GetSpecialValueFor( "fire_damage" )
--self.range = self:GetSpecialValueFor( "range" )
local vPos = nil
if self:GetCursorTarget() then
vPos = self:GetCursorTarget():GetOrigin()
else
vPos = self:GetCursorPosition()
end
local fRangeToTarget = ( self:GetCaster():GetOrigin() - vPos ):Length2D()
local vDirection = vPos - self:GetCaster():GetOrigin()
vDirection.z = 0.0
vDirection = vDirection:Normalized()
self.speed = self.speed * ( ( fRangeToTarget ) / ( fRangeToTarget -self.start_radius ) )
local info = {
EffectName = "particles/fire_trap/trap_breathe_fire.vpcf",
Ability = self,
vSpawnOrigin = self:GetCaster():GetOrigin(),
fStartRadius = self.start_radius,
fEndRadius = self.end_radius,
vVelocity = vDirection * self.speed,
fDistance = fRangeToTarget,
Source = self:GetCaster(),
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
}
ProjectileManager:CreateLinearProjectile( info )
EmitSoundOn( "AghanimsFortress.FireTrap", self:GetCaster() )
end
--------------------------------------------------------------------------------
function breathe_fire:OnProjectileHit( hTarget, vLocation )
local fireDamage = self.fire_damage
if hTarget ~= nil and ( not hTarget:IsMagicImmune() ) and ( not hTarget:IsInvulnerable() ) then
local damageSource = self:GetCaster()
local damage = {
victim = hTarget,
attacker = damageSource,
damage = fireDamage,
damage_type = DAMAGE_TYPE_MAGICAL,
ability = self
}
ApplyDamage( damage )
end
return false
end
--------------------------------------------------------------------------------

View File

@@ -0,0 +1,83 @@
breathe_fire = class({})
----------------------------------------------------------------------------------------
function breathe_fire:Precache( context )
PrecacheResource( "particle", "particles/fire_trap/trap_breathe_fire.vpcf", context )
end
--------------------------------------------------------------------------------
function breathe_fire:ProcsMagicStick()
return false
end
--------------------------------------------------------------------------------
function breathe_fire:OnSpellStart()
self.start_radius = self:GetSpecialValueFor( "start_radius" )
self.end_radius = self:GetSpecialValueFor( "end_radius" )
self.speed = self:GetSpecialValueFor( "speed" )
self.max_hp_pct_damage = self:GetLevelSpecialValueFor( "max_hp_pct_damage", GameRules.Aghanim:GetAscensionLevel() )
--printf( "ascension level: %d; percent damage: %d", GameRules.Aghanim:GetAscensionLevel(), self.max_hp_pct_damage )
local vPos = nil
if self:GetCursorTarget() then
vPos = self:GetCursorTarget():GetOrigin()
else
vPos = self:GetCursorPosition()
end
local fRangeToTarget = ( self:GetCaster():GetOrigin() - vPos ):Length2D()
local vDirection = vPos - self:GetCaster():GetOrigin()
vDirection.z = 0.0
vDirection = vDirection:Normalized()
self.speed = self.speed * ( ( fRangeToTarget ) / ( fRangeToTarget -self.start_radius ) )
local info = {
EffectName = "particles/fire_trap/trap_breathe_fire.vpcf",
Ability = self,
vSpawnOrigin = self:GetCaster():GetOrigin(),
fStartRadius = self.start_radius,
fEndRadius = self.end_radius,
vVelocity = vDirection * self.speed,
fDistance = fRangeToTarget,
Source = self:GetCaster(),
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
}
ProjectileManager:CreateLinearProjectile( info )
EmitSoundOn( "AghanimsFortress.FireTrap", self:GetCaster() )
end
--------------------------------------------------------------------------------
function breathe_fire:OnProjectileHit( hTarget, vLocation )
if hTarget ~= nil and ( not hTarget:IsMagicImmune() ) and ( not hTarget:IsInvulnerable() ) then
local fMaxHealth = hTarget:GetMaxHealth()
local fDamage = math.ceil( fMaxHealth * ( self.max_hp_pct_damage / 100.0 ) )
--printf( "breathe_fire:OnProjectileHit - applying %.2f damage to target with %.2f max health", fDamage, fMaxHealth )
local damageSource = self:GetCaster()
local damage = {
victim = hTarget,
attacker = damageSource,
damage = fDamage,
damage_type = self:GetAbilityDamageType(),
ability = self
}
ApplyDamage( damage )
end
return false
end
--------------------------------------------------------------------------------

View File

@@ -0,0 +1,120 @@
pendulum_swing = class({})
--------------------------------------------------------------------------------
function pendulum_swing:Precache( context )
PrecacheResource( "particle", "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf", context )
PrecacheResource( "particle", "particles/econ/courier/courier_mechjaw/mechjaw_death_sparks.vpcf", context )
self.HitEntsThisSwing = {}
self.bDamagePathOutgoing = false
self.bDamagePathReturning = false
end
--------------------------------------------------------------------------------
function pendulum_swing:GetChannelAnimation()
return ACT_DOTA_CHANNEL_ABILITY_1
end
--------------------------------------------------------------------------------
function pendulum_swing:OnChannelThink( flInterval )
if IsServer() then
if self.max_hp_pct_damage == nil then
self.max_hp_pct_damage = self:GetLevelSpecialValueFor( "max_hp_pct_damage", GameRules.Aghanim:GetAscensionLevel() )
--printf( "ascension level: %d; percent damage: %d", GameRules.Aghanim:GetAscensionLevel(), self.max_hp_pct_damage )
self.radius = self:GetSpecialValueFor( "radius" )
self.attachHitloc = self:GetCaster():ScriptLookupAttachment( "attach_hitloc" )
self.attachLeftBlade = self:GetCaster():ScriptLookupAttachment( "attach_leftblade" )
self.attachRightBlade = self:GetCaster():ScriptLookupAttachment( "attach_rightblade" )
self.attachFrontBlade = self:GetCaster():ScriptLookupAttachment( "attach_frontblade" )
self.attachBackBlade = self:GetCaster():ScriptLookupAttachment( "attach_backblade" )
end
-- We're checking which part of the pendulum_swing_loop animation we're in.
local flCycle = self:GetCaster():GetCycle()
local bDamagePathOutgoing = ( flCycle > 0.19 and flCycle < 0.26 )
local bDamagePathReturning = ( flCycle > 0.69 and flCycle < 0.76 )
if self.bDamagePathOutgoing ~= bDamagePathOutgoing then
self.bDamagePathOutgoing = bDamagePathOutgoing
self.HitEntsThisSwing = {}
end
if self.bDamagePathReturning ~= bDamagePathReturning then
self.bDamagePathReturning = bDamagePathReturning
self.HitEntsThisSwing = {}
end
if bDamagePathOutgoing or bDamagePathReturning then
if ( flCycle > 0.15 and flCycle < 0.16 ) or ( flCycle > 0.70 and flCycle < 0.71 ) then
-- Ugly: we're relying on the speed of the pendulum and the length of our channelthink interval in order to not play this sound more than once per outgoing or returning swing
EmitSoundOn( "Pendulum.Swing", self:GetCaster() )
end
local Locations = {
self:GetCaster():GetAttachmentOrigin( self.attachHitloc ),
self:GetCaster():GetAttachmentOrigin( self.attachLeftBlade ),
self:GetCaster():GetAttachmentOrigin( self.attachRightBlade ),
self:GetCaster():GetAttachmentOrigin( self.attachFrontBlade ),
self:GetCaster():GetAttachmentOrigin( self.attachBackBlade ),
}
for i = 1, #Locations do
local enemies = FindUnitsInRadius( self:GetCaster():GetTeamNumber(), Locations[i], self:GetCaster(), self.radius, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES, 0, false )
--DebugDrawCircle( Locations[i], Vector( 0, 255, 0 ), 255, self.radius, false, 0.1 )
for _,enemy in pairs( enemies ) do
local bAlreadyHit = false
for _,HitEnt in pairs ( self.HitEntsThisSwing ) do
if HitEnt == enemy then
bAlreadyHit = true
break
end
end
if not ( enemy:IsNull() ) and enemy ~= nil and enemy:IsInvulnerable() == false and not bAlreadyHit then
local fMaxHealth = enemy:GetMaxHealth()
local fDamage = math.ceil( fMaxHealth * ( self.max_hp_pct_damage / 100.0 ) )
--printf( "pendulum_swing:OnChannelThink - applying %.2f damage to target with %.2f max health", fDamage, fMaxHealth )
local damageInfo =
{
victim = enemy,
attacker = self:GetCaster(),
damage = fDamage,
damage_type = DAMAGE_TYPE_PURE,
ability = self,
}
table.insert( self.HitEntsThisSwing, enemy )
ApplyDamage( damageInfo )
if not ( enemy:IsNull() ) and enemy ~= nil then
local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_phantom_assassin/phantom_assassin_crit_impact.vpcf", PATTACH_CUSTOMORIGIN, nil )
ParticleManager:SetParticleControlEnt( nFXIndex, 0, enemy, PATTACH_POINT_FOLLOW, "attach_hitloc", enemy:GetOrigin(), true )
ParticleManager:SetParticleControl( nFXIndex, 1, enemy:GetOrigin() )
ParticleManager:SetParticleControlForward( nFXIndex, 1, -self:GetCaster():GetForwardVector() )
ParticleManager:SetParticleControlEnt( nFXIndex, 10, enemy, PATTACH_ABSORIGIN_FOLLOW, nil, enemy:GetOrigin(), true )
ParticleManager:ReleaseParticleIndex( nFXIndex )
EmitSoundOn( "Dungeon.BloodSplatterImpact", enemy )
end
end
end
end
local nFXIndex2 = ParticleManager:CreateParticle( "particles/econ/courier/courier_mechjaw/mechjaw_death_sparks.vpcf", PATTACH_CUSTOMORIGIN, nil )
ParticleManager:SetParticleControlEnt( nFXIndex2, 0, self:GetCaster(), PATTACH_POINT_FOLLOW, "attach_leftblade", self:GetCaster():GetOrigin(), true )
local nFXIndex3 = ParticleManager:CreateParticle( "particles/econ/courier/courier_mechjaw/mechjaw_death_sparks.vpcf", PATTACH_CUSTOMORIGIN, nil )
ParticleManager:SetParticleControlEnt( nFXIndex3, 0, self:GetCaster(), PATTACH_POINT_FOLLOW, "attach_rightblade", self:GetCaster():GetOrigin(), true )
end
end
end
--------------------------------------------------------------------------------

View File

@@ -0,0 +1,37 @@
spike_trap = class({})
LinkLuaModifier( "modifier_spike_trap_lua", "modifiers/modifier_spike_trap_lua", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_spike_trap_thinker_lua", "modifiers/modifier_spike_trap_thinker_lua", LUA_MODIFIER_MOTION_NONE )
function spike_trap:Precache( context )
PrecacheResource( "particle", "particles/traps/spikes/spiketrap_anticipate.vpcf", context )
PrecacheResource( "particle", "particles/traps/spikes/spiketrap_anticipate_base.vpcf", context )
PrecacheResource( "particle", "particles/traps/spikes/spiketrap_pull.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_axe/axe_culling_blade.vpcf", context )
end
--------------------------------------------------------------------------------
function spike_trap:GetAOERadius()
return self:GetSpecialValueFor( "light_strike_array_aoe" )
end
--------------------------------------------------------------------------------
function spike_trap:OnSpellStart()
self.light_strike_array_aoe = self:GetSpecialValueFor( "light_strike_array_aoe" )
self.light_strike_array_delay_time = self:GetSpecialValueFor( "light_strike_array_delay_time" )
local kv = {}
CreateModifierThinker( self:GetCaster(), self, "modifier_spike_trap_thinker_lua", kv, self:GetCursorPosition(), self:GetCaster():GetTeamNumber(), false )
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------