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

Swiper: Boss - Code #2158

Merged
merged 22 commits into from
Apr 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
DG's suggestions
  • Loading branch information
TideSofDarK committed Apr 8, 2018
commit 6ea18082edef8f7a7dc680e4bde6139eff7dfe8c
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ if IsServer() then
ApplyDamage(damageTable)

local impact = ParticleManager:CreateParticle("particles/econ/items/bloodseeker/bloodseeker_eztzhok_weapon/bloodseeker_bloodbath_eztzhok_burst.vpcf", PATTACH_POINT_FOLLOW, v)
ParticleManager:ReleaseParticleIndex(impact)

v:EmitSound("hero_ursa.attack")
end

ParticleManager:CreateParticle("particles/econ/items/lich/frozen_chains_ti6/lich_frozenchains_frostnova_swipe.vpcf", PATTACH_POINT, caster)
local swipe = ParticleManager:CreateParticle("particles/econ/items/lich/frozen_chains_ti6/lich_frozenchains_frostnova_swipe.vpcf", PATTACH_POINT, caster)
ParticleManager:ReleaseParticleIndex(swipe)

caster:Stop()
end
Expand Down Expand Up @@ -223,6 +225,7 @@ function modifier_boss_swiper_reapers_rush_active:OnIntervalThink()
v:EmitSound("hero_ursa.attack")

local impact = ParticleManager:CreateParticle("particles/econ/items/bloodseeker/bloodseeker_eztzhok_weapon/bloodseeker_bloodbath_eztzhok_burst.vpcf", PATTACH_POINT_FOLLOW, v)
ParticleManager:ReleaseParticleIndex(impact)
end
end
end
5 changes: 4 additions & 1 deletion game/scripts/vscripts/abilities/swiper/boss_swiper_swipe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ function boss_swiper_backswipe_base:FindUnitsInCone(position, coneDirection, con
coneDirection = coneDirection:Normalized()

local output = {}
local cone = math.cos(coneWidth/2)

for _, unit in pairs(units) do
local direction = (unit:GetAbsOrigin() - position):Normalized()
if direction:Dot(coneDirection) >= math.cos(coneWidth/2) then
if direction:Dot(coneDirection) >= cone then
table.insert(output, unit)
end
end
Expand Down Expand Up @@ -48,6 +49,7 @@ function boss_swiper_backswipe_base:OnSpellStart()
local swipe = ParticleManager:CreateParticle("particles/econ/items/invoker/invoker_ti6/invoker_deafening_blast_swipe_right_ti6.vpcf", PATTACH_ABSORIGIN, caster)
ParticleManager:SetParticleControl(swipe, 3, caster:GetAbsOrigin() + (caster:GetForwardVector() * 100))
ParticleManager:SetParticleControlForward(swipe, 3, caster:GetForwardVector())
ParticleManager:ReleaseParticleIndex(swipe)

local units = self:FindUnitsInCone(
caster:GetAbsOrigin(),
Expand All @@ -67,6 +69,7 @@ function boss_swiper_backswipe_base:OnSpellStart()
v:EmitSound("hero_ursa.attack")

local impact = ParticleManager:CreateParticle("particles/econ/items/pudge/pudge_ti6_immortal/pudge_meathook_witness_impact_ti6.vpcf", PATTACH_POINT_FOLLOW, v)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something? None of the particles in your code have ReleaseParticleIndex

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

ParticleManager:ReleaseParticleIndex(impact)
local damageTable = {
victim = v,
attacker = caster,
Expand Down
14 changes: 8 additions & 6 deletions game/scripts/vscripts/abilities/swiper/boss_swiper_thrust.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function boss_swiper_thrust:OnAbilityPhaseStart()
if IsServer() then
local caster = self:GetCaster()
local width = self:GetSpecialValueFor("width")
local target = self:GetCursorPosition()
local distance = (target - caster:GetAbsOrigin()):Length2D()
local target = GetGroundPosition(self:GetCursorPosition(), caster)
local distance = (target - caster:GetAbsOrigin()):Length()
local castTime = self:GetCastPoint()
local direction = (target - caster:GetAbsOrigin()):Normalized()

Expand All @@ -30,17 +30,18 @@ function boss_swiper_thrust:OnSpellStart()
if IsServer() then
local caster = self:GetCaster()
local width = self:GetSpecialValueFor("width")
local target = self:GetCursorPosition()
local distance = (target - caster:GetAbsOrigin()):Length2D()
local direction = (target - caster:GetAbsOrigin()):Normalized()
local target = GetGroundPosition(self:GetCursorPosition(), caster)
local distance = (target - caster:GetAbsOrigin()):Length()
local direction = ((target - caster:GetAbsOrigin()) * Vector(1, 1, 0)):Normalized()
local velocity = direction * 2000

local info = {
EffectName = "particles/units/heroes/hero_nyx_assassin/nyx_assassin_impale.vpcf",
Ability = self,
vSpawnOrigin = caster:GetAbsOrigin(),
fStartRadius = width,
fEndRadius = width,
vVelocity = direction * 2000,
vVelocity = velocity,
fDistance = distance,
Source = self:GetCaster(),
iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY,
Expand All @@ -59,6 +60,7 @@ function boss_swiper_thrust:OnProjectileHit( target, location )
target:EmitSound("hero_ursa.attack")

local impact = ParticleManager:CreateParticle("particles/econ/items/bloodseeker/bloodseeker_eztzhok_weapon/bloodseeker_bloodbath_eztzhok_burst.vpcf", PATTACH_POINT_FOLLOW, target)
ParticleManager:ReleaseParticleIndex(impact)

local damageTable = {
victim = target,
Expand Down
9 changes: 6 additions & 3 deletions game/scripts/vscripts/units/swiper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ function Spawn( entityKeyValues )
thisEntity.hBackswipeAbility = thisEntity:FindAbilityByName( "boss_swiper_backswipe" )
thisEntity.hReapersRushAbility = thisEntity:FindAbilityByName( "boss_swiper_reapers_rush" )

thisEntity.retreatDelay = 6.0

thisEntity:SetContextThink( "SwiperBossThink", SwiperBossThink, 1 )
end

Expand Down Expand Up @@ -166,7 +168,7 @@ function RetreatHome()
Position = thisEntity.vInitialSpawnPos
})

return 6
return thisEntity.retreatDelay
end

function CastFrontswipe( )
Expand All @@ -178,10 +180,11 @@ function CastFrontswipe( )

local delay = thisEntity.hFrontswipeAbility:GetCastPoint() + 1.0

if math.random(1,4) == 1 then
if RandomInt(1,4) == 1 then
-- thisEntity.hFrontswipeAbility:StartCooldown(8.0)
Timers:CreateTimer(delay - 0.9, function ( )
thisEntity.hFrontswipeAbility:StartCooldown(8.0)
if not IsValidEntity(thisEntity) or not thisEntity:IsAlive() then return end
thisEntity.hFrontswipeAbility:StartCooldown(thisEntity.hFrontswipeAbility:GetCooldownTime() * 2)
thisEntity:Stop()
ExecuteOrderFromTable({
UnitIndex = thisEntity:entindex(),
Expand Down