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,378 @@
require( "encounters/encounter_boss_base" )
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Aghanim == nil then
CMapEncounter_Aghanim = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:Precache( context )
CMapEncounter_BossBase.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_boss_aghanim", context, -1 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
-- Agh Victory phase
self.AGH_VICTORY_NOT_STARTED = 0
self.AGH_VICTORY_BESTED = 1
self.AGH_VICTORY_VICTORY_SPEECH = 2
self.AGH_VICTORY_BOWING = 3
self.AGH_VICTORY_FINISHED = 4
self.nVictoryState = self.AGH_VICTORY_NOT_STARTED
self.szBossSpawner = "spawner_boss"
self:AddSpawner( CDotaSpawner( self.szBossSpawner, self.szBossSpawner,
{
{
EntityName = "npc_dota_boss_aghanim",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:Start()
CMapEncounter_BossBase.Start( self )
self.nHeroOnTrigger1 = 0
self.nHeroOnTrigger2 = 0
self.nHeroOnTrigger3 = 0
self.nHeroOnTrigger4 = 0
self.nPlayersReady = 0
ListenToGameEvent( "trigger_start_touch", Dynamic_Wrap( getclass( self ), "OnTriggerStartTouch" ), self )
ListenToGameEvent( "trigger_end_touch", Dynamic_Wrap( getclass( self ), "OnTriggerEndTouch" ), self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:OnTriggerStartTouch( event )
if self.bAllButtonsReady == true then
return
end
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
-- Assign an integer to the trigger
if szTriggerName == "trigger_player_1" then
self.nHeroOnTrigger1 = 1
elseif szTriggerName == "trigger_player_2" then
self.nHeroOnTrigger2 = 1
elseif szTriggerName == "trigger_player_3" then
self.nHeroOnTrigger3 = 1
elseif szTriggerName == "trigger_player_4" then
self.nHeroOnTrigger4 = 1
end
local hHeroes = HeroList:GetAllHeroes()
local nTotalHeroes = #hHeroes
self.nPlayersReady = self.nHeroOnTrigger1 + self.nHeroOnTrigger2 + self.nHeroOnTrigger3 + self.nHeroOnTrigger4
if self.nPlayersReady == nTotalHeroes then
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "aghanim_gate_open_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
self.bAllButtonsReady = true
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:OnTriggerEndTouch( event )
if self.bAllButtonsReady == true then
return
end
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if szTriggerName == "trigger_player_1" then
self.nHeroOnTrigger1 = 0
elseif szTriggerName == "trigger_player_2" then
self.nHeroOnTrigger2 = 0
elseif szTriggerName == "trigger_player_3" then
self.nHeroOnTrigger3 = 0
elseif szTriggerName == "trigger_player_4" then
self.nHeroOnTrigger4 = 0
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:OnBossSpawned( hBoss )
CMapEncounter_BossBase.OnBossSpawned( self, hBoss )
hBoss.AI:SetEncounter( self )
self.hAghanim = hBoss
self.hAghanim.bOutroComplete = false
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:OnThink()
CMapEncounter_BossBase.OnThink( self )
if self.nVictoryState > self.AGH_VICTORY_NOT_STARTED then
self:OnThinkVictorySequence()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:IntroduceBoss( hEncounteredBoss )
CMapEncounter_BossBase.IntroduceBoss( self, hEncounteredBoss )
-- local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "aghanim_gate_close_relay", false )
-- for _, hRelay in pairs( hRelays ) do
-- hRelay:Trigger( nil, nil )
-- end
local hTriggers = self:GetRoom():FindAllEntitiesInRoomByName( "aghanim_boss_room_bounds", false )
local hTeleportPositions = self:GetRoom():FindAllEntitiesInRoomByName( "teleport_players", false )
if #hTriggers > 0 and #hTeleportPositions > 0 then
local hTrigger = hTriggers[1]
local hTeleportPosition = hTeleportPositions[1]
if hTrigger ~= nil and hTeleportPosition ~= nil then
local vMins = hTrigger:GetBoundingMins()
local vMaxs = hTrigger:GetBoundingMaxs()
vMins = hTrigger:TransformPointEntityToWorld( vMins )
vMaxs = hTrigger:TransformPointEntityToWorld( vMaxs )
local flSize = vMaxs.x - vMins.x
local flSizeY = vMaxs.y - vMins.y
if flSizeY > flSize then
flSize = flSizeY
end
local netTable = {}
netTable[ "room_name" ] = self:GetRoom():GetName()
netTable[ "map_name" ] = "aghanim_arena_boss_room"
netTable[ "x" ] = hTrigger:GetAbsOrigin().x
netTable[ "y" ] = hTrigger:GetAbsOrigin().y
netTable[ "size" ] = flSize
netTable[ "scale" ] = 8
for nPlayerID = 0, AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
if not hTrigger:IsTouching( hPlayerHero ) then
FindClearSpaceForUnit( hPlayerHero, hTeleportPosition:GetAbsOrigin() + RandomVector( 250 ), true )
end
local kv =
{
min_x = vMins.x,
min_y = vMins.y,
max_x = vMaxs.x,
max_y = vMaxs.y,
}
hPlayerHero:AddNewModifier( hPlayerHero, nil, "modifier_morty_leash", kv )
CustomNetTables:SetTableValue( "game_global", "minimap_info" .. nPlayerID, netTable )
end
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:OnComplete()
CMapEncounter.OnComplete( self )
GameRules.Aghanim:MarkGameWon()
end
---------------------------------------------------------------------------
function CMapEncounter_Aghanim:BossSpeak( szSoundEvent, bLaugh )
-- Use response rules to talk
return
end
---------------------------------------------------------------------------
function CMapEncounter_Aghanim:AghanimSpeak( flDelay, bForce, hCriteriaTable )
-- Don't speak after we started our victory sequence
if self.nVictoryState > self.AGH_VICTORY_VICTORY_SPEECH then
return false
end
-- We're juking the announcer to speak through our own unit
-- So we can share in the "is speaking" logic as well as the global criteria
-- And also other game code that triggers announcer lines
return GameRules.Aghanim:GetAnnouncer():Speak( flDelay, bForce, hCriteriaTable )
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:CheckForCompletion()
return self.nVictoryState == self.AGH_VICTORY_FINISHED
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:BeginVictorySequence()
-- A brutal hack. We need to know how long the victory speech is to know when to stop
-- but the only way to achieve that is to make this line server-authoritative
GameRules.Aghanim:GetAnnouncer():SetServerAuthoritative( true )
self:AghanimSpeak( 0.0, true,
{
announce_event = "bested",
})
self.nVictoryState = self.AGH_VICTORY_BESTED
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:OnThinkVictorySequence()
-- Wait until he finishes his line
if GameRules.Aghanim:GetAnnouncer():IsCurrentlySpeaking() == false then
if self.nVictoryState == self.AGH_VICTORY_BESTED then
self:AghanimSpeak( 0.0, true,
{
announce_event = "victory_speech",
})
GameRules.Aghanim:GetAnnouncer():OverrideSpeakingUnit( nil )
self.nVictoryState = self.AGH_VICTORY_VICTORY_SPEECH
elseif self.nVictoryState == self.AGH_VICTORY_VICTORY_SPEECH then
self.nVictoryState = self.AGH_VICTORY_BOWING
elseif self.nVictoryState == self.AGH_VICTORY_BOWING and self.hAghanim.bOutroComplete == true then
self.nVictoryState = self.AGH_VICTORY_FINISHED
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetPreviewUnit()
return "npc_dota_boss_aghanim"
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetBossIntroVoiceLine()
-- Sort of a hack. Starting with the intro voice, we are going to
-- juke the announcer to play lines through us. BossSpeak() is commented
-- out so it does nothing
-- While the boss is spawned, don't do any announcer lines
GameRules.Aghanim:GetAnnouncer():OverrideSpeakingUnit( self.hAghanim )
self:AghanimSpeak( 0.0, true,
{
announce_event = "boss_intro",
})
return nil
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetBossIntroGesture()
return ACT_DOTA_SPAWN
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetBossIntroDuration()
return 5.0
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetBossIntroCameraPitch()
return 40
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetBossIntroCameraDistance()
return 800
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetBossIntroCameraHeight()
return 225
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetLaughLine()
-- No laughing after we started our end sequence
if self.nVictoryState > self.AGH_VICTORY_NOT_STARTED then
return ""
end
local bDidSpeak = self:AghanimSpeak( 0.0, false,
{
announce_event = "laugh",
})
-- Just the laugh system into not trying to laugh again for a while
if bDidSpeak == true then
return ""
end
return nil
end
--------------------------------------------------------------------------------
function CMapEncounter_Aghanim:GetAbilityUseLine( szAbilityName )
local bForce = false
if ( szAbilityName == "aghanim_staff_beams" ) or ( szAbilityName == "aghanim_blink" ) or ( szAbilityName == "aghanim_shard_attack" )
or ( szAbilityName == "aghanim_summon_portals" ) or ( szAbilityName == "aghanim_spell_swap" ) then
bForce = true
end
self:AghanimSpeak( 0.0, bForce,
{
announce_event = "ability_use",
ability_name = szAbilityName,
})
return nil
end
--------------------------------------------------------------------------------
return CMapEncounter_Aghanim

View File

@@ -0,0 +1,92 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Alchemist == nil then
CMapEncounter_Alchemist = class( {}, {}, CMapEncounter )
end
function CMapEncounter_Alchemist:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
-- Dynamic Spawns
self.vWaveSchedule =
{
{
Time = 5,
Count = 1,
},
{
Time = 35,
Count = 1,
},
}
--DeepPrintTable( self.vWaveSchedule )
self.szDynamicPortal = "dynamic_portal"
local bInvulnerable = true
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szDynamicPortal, self.szDynamicPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_alchemist",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szDynamicPortal, self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Alchemist:GetPreviewUnit()
return "npc_dota_creature_alchemist"
end
--------------------------------------------------------------------------------
function CMapEncounter_Alchemist:InitializeObjectives()
self:AddEncounterObjective( "defeat_the_alchemists", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Alchemist:Start()
CMapEncounter.Start( self )
self:StartSpawnerSchedule( self.szDynamicPortal, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Alchemist:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if hVictim and hVictim:GetUnitName() == "npc_dota_creature_alchemist" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_the_alchemists" )
self:UpdateEncounterObjective( "defeat_the_alchemists", nCurrentValue + 1, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Alchemist:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
self:SetInitialGoalEntityToNearestHero( hSpawnedUnit )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Alchemist

View File

@@ -0,0 +1,182 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_BabyOgres == nil then
CMapEncounter_BabyOgres = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_BabyOgres:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_baby_ogre_magi",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 150.0,
},
}
))
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_baby_ogre_tank",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
))
self.vWaveSchedule =
{
{
Time = 5,
Count = 2,
},
{
Time = 30,
Count = 3,
},
{
Time = 55,
Count = 3,
},
{
Time = 80,
Count = 4,
},
}
local bInvulnerable = true
self.szDynamicPortal = "dynamic_portal"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szDynamicPortal, self.szDynamicPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_baby_ogre_magi",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_baby_ogre_tank",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szDynamicPortal, self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_BabyOgres:GetPreviewUnit()
return "npc_dota_creature_baby_ogre_tank"
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_BabyOgres:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWaveSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() ) -- doesn't capture pre-placed spawns?
end
--------------------------------------------------------------------------------
function CMapEncounter_BabyOgres:GetMaxSpawnedUnitCount()
local nCount = 0
local hPeonSpawners = self:GetSpawner( self.szPeonSpawner )
if hPeonSpawners then
nCount = nCount + hPeonSpawners:GetSpawnPositionCount()
end
local hCaptainSpawners = self:GetSpawner( self.szCaptainSpawner )
if hCaptainSpawners then
nCount = nCount + hCaptainSpawners:GetSpawnPositionCount()
end
return nCount
end
]]
--------------------------------------------------------------------------------
function CMapEncounter_BabyOgres:Start()
CMapEncounter.Start( self )
for _, hSpawner in pairs( self:GetSpawners() ) do
hSpawner:SpawnUnits()
end
self:StartSpawnerSchedule( self.szDynamicPortal, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_BabyOgres:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--[[
if hSpawner.szSpawnerName == self.szDynamicPortal then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
]]
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
print( "CMapEncounter_BabyOgres:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "CMapEncounter_BabyOgres:OnSpawnerFinished: WARNING: Can't find a living hero" )
end
end
end
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_BabyOgres:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
]]
--------------------------------------------------------------------------------
return CMapEncounter_BabyOgres

View File

@@ -0,0 +1,303 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Bandits == nil then
CMapEncounter_Bandits = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_phantom_assassin/phantom_assassin_stifling_dagger_debuff.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_riki/riki_blink_strike.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Pre-placed creatures (done this way to use a specific subset of existing map spawners)
self.vPreplacedSchedule =
{
{
Time = 0,
Count = 2,
},
}
self.szPreplacedSpawner = "spawner_preplaced"
self:AddSpawner( CDotaSpawner( self.szPreplacedSpawner, self.szPreplacedSpawner,
{
{
EntityName = "npc_dota_creature_bandit",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_bandit_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
-- Players have to kill the pre-placed creatures to trigger the dynamic portals
self:SetPortalTriggerSpawner( self.szPreplacedSpawner, 0.8 )
self:SetSpawnerSchedule( self.szPreplacedSpawner, self.vPreplacedSchedule )
-- Additional creatures
self.szGroupSpawner = "spawner_group"
self.vExtraCreaturesSchedule =
{
{
Time = 0,
Count = 1,
},
}
self:AddSpawner( CDotaSpawner( self.szGroupSpawner, self.szGroupSpawner,
{
{
EntityName = "npc_dota_creature_bandit_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
self:SetSpawnerSchedule( self.szGroupSpawner, self.vExtraCreaturesSchedule )
-- Wave 1
local nNumPortals = 3
local flInitialPortalSpawnDelay = 0.0
local flInitialSummonTime = 6.0
local flPortalIntervalInput = 60.0
local flScaleInput = 1.0
local nNameCounter = 1
local szLocatorName = "dynamic_portal"
self.nTotalPortals = nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, 80 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_bandit",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 250.0,
},
{
EntityName = "npc_dota_creature_bandit_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
))
end
-- Wave 2A
nNumPortals = 3
flInitialPortalSpawnDelay = 24.0
flInitialSummonTime = 6.0
flScaleInput = 1.0
self.nTotalPortals = self.nTotalPortals + nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, 80 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_bandit",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 250.0,
},
{
EntityName = "npc_dota_creature_bandit_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
))
end
-- Wave 2B
nNumPortals = 1
flInitialPortalSpawnDelay = 24.0
flInitialSummonTime = 6.0
flScaleInput = 1.3
self.nTotalPortals = self.nTotalPortals + nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, 120 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_bandit_captain",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
))
end
-- Wave 3A
nNumPortals = 2
flInitialPortalSpawnDelay = 48.0
flInitialSummonTime = 6.0
flScaleInput = 1.0
self.nTotalPortals = self.nTotalPortals + nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, 80 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_bandit",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 250.0,
},
{
EntityName = "npc_dota_creature_bandit_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
))
end
-- Wave 3B
nNumPortals = 2
flInitialPortalSpawnDelay = 48.0
flInitialSummonTime = 6.0
flScaleInput = 1.3
self.nTotalPortals = self.nTotalPortals + nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, 120 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_bandit_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_bandit_captain",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
))
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:GetPreviewUnit()
return "npc_dota_creature_bandit_captain"
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, self.nTotalPortals )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:GetMaxSpawnedUnitCount()
local nCount = 0
local hPeonSpawners = self:GetSpawner( self.szPreplacedSpawner )
if hPeonSpawners then
nCount = nCount + hPeonSpawners:GetSpawnPositionCount() * 3
end
for _,hPortalSpawner in pairs ( self.PortalSpawners ) do
for _,rgUnitInfo in pairs ( hPortalSpawner.rgUnitsInfo ) do
nCount = nCount + rgUnitInfo.Count
end
end
print( 'CMapEncounter_Bandits:GetMaxSpawnedUnitCount() calculated ' .. nCount .. ' units' )
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:Start()
CMapEncounter.Start( self )
self:StartSpawnerSchedule( self.szPreplacedSpawner, 0 )
self:StartSpawnerSchedule( self.szGroupSpawner, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bandits:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Bandits:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "CMapEncounter_Bandits:OnSpawnerFinished: WARNING: Can't find a living hero" )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Bandits

View File

@@ -0,0 +1,119 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_BigOgres == nil then
CMapEncounter_BigOgres = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_BigOgres:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_ogre_seer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 150.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_ogre_tank_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self.vMagiSchedule =
{
{
Time = 10,
Count = 1,
},
{
Time = 25,
Count = 2,
},
{
Time = 40,
Count = 3,
},
}
local bInvulnerable = true
self.szDynamicPortal = "dynamic_portal"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szDynamicPortal, self.szDynamicPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_ogre_seer",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szDynamicPortal, self.vMagiSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_BigOgres:GetPreviewUnit()
return "npc_dota_creature_ogre_tank"
end
--------------------------------------------------------------------------------
function CMapEncounter_BigOgres:Start()
CMapEncounter.Start( self )
for _, hSpawner in pairs( self:GetSpawners() ) do
hSpawner:SpawnUnits()
end
self:StartSpawnerSchedule( self.szDynamicPortal, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_BigOgres:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_BigOgres:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_BigOgres

View File

@@ -0,0 +1,137 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Bomb_Squad == nil then
CMapEncounter_Bomb_Squad = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bomb_Squad:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.vPudgeSchedule =
{
{
Time = 0,
Count = 2,
},
{
Time = 40,
Count = 3,
},
{
Time = 80,
Count = 4,
},
}
self.vBombSquadSchedule =
{
{
Time = 0,
Count = 1,
},
{
Time = 40,
Count = 2,
},
{
Time = 80,
Count = 2,
},
}
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
local bInvulnerable = true
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPeonSpawner, self.szPeonSpawner, 60 * hRoom:GetDepth(), 5, 1.0,
{
{
EntityName = "npc_aghsfort_creature_walrus_pudge",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szCaptainSpawner, self.szCaptainSpawner, 60 * hRoom:GetDepth(), 5, 1.0,
{
{
EntityName = "npc_aghsfort_creature_bomb_squad",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szPeonSpawner, self.vPudgeSchedule )
self:SetSpawnerSchedule( self.szCaptainSpawner, self.vBombSquadSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bomb_Squad:GetPreviewUnit()
return "npc_aghsfort_creature_bomb_squad"
end
--------------------------------------------------------------------------------
function CMapEncounter_Bomb_Squad:Start()
CMapEncounter.Start( self )
for _, hSpawner in pairs( self:GetSpawners() ) do
hSpawner:SpawnUnits()
end
self:StartSpawnerSchedule( self.szPeonSpawner, 0 )
self:StartSpawnerSchedule( self.szCaptainSpawner, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bomb_Squad:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vPudgeSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bomb_Squad:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner.szSpawnerName == "spawner_peon" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Bomb_Squad:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_aghsfort_creature_bomb_squad_landmine" then
return false
end
if hEnemyCreature:GetUnitName() == "npc_aghsfort_creature_bomb_squad_stasis_trap" then
return false
end
return true
end
--------------------------------------------------------------------------------
return CMapEncounter_Bomb_Squad

View File

@@ -0,0 +1,228 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Bombers == nil then
CMapEncounter_Bombers = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
local bInvulnerable = true
local nWaves = 8
local flFirstWaveSpawnDelay = 0.0
local flTimeBetweenWaves = 9.0
self.vWave1Schedule =
{
{
Time = 0,
Count = 1,
},
{
Time = 30,
Count = 1,
},
{
Time = 60,
Count = 1,
},
}
self.vWave2Schedule =
{
{
Time = 20,
Count = 1,
},
{
Time = 40,
Count = 1,
},
{
Time = 60,
Count = 1,
},
}
self.vWave3Schedule =
{
{
Time = 10,
Count = 2,
},
{
Time = 50,
Count = 2,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "wave_1", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_bomber",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 300.0,
},
{
EntityName = "npc_dota_creature_gyrocopter",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "wave_2", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_bomber",
Team = DOTA_TEAM_BADGUYS,
Count = 5,
PositionNoise = 300.0,
},
{
EntityName = "npc_dota_creature_gyrocopter",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "wave_3", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_bomber",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 300.0,
},
{
EntityName = "npc_dota_creature_gyrocopter",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:SetSpawnerSchedule( "wave_1", self.vWave1Schedule )
self:SetSpawnerSchedule( "wave_2", self.vWave2Schedule )
self:SetSpawnerSchedule( "wave_3", self.vWave3Schedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_gyrocopter", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_rattletrap", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_gyrocopter.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_rattletrap.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:GetPreviewUnit()
return "npc_dota_creature_bomber"
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self.szObjectiveEnts = "objective"
self.hObjectiveEnts = self:GetRoom():FindAllEntitiesInRoomByName( self.szObjectiveEnts, true )
if #self.hObjectiveEnts == 0 then
printf( "WARNING - self.hObjectiveEnt is nil (looked for classname \"%s\")", self.szObjectiveEnts )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:Start()
CMapEncounter.Start( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWave1Schedule + #self.vWave2Schedule + #self.vWave3Schedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner.szLocatorName == "spawner_peon" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
--print( heroes )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
elseif #self.hObjectiveEnts > 0 then
print( "Can't find a hero to attack - setting a goal position to Objective Entity" )
hSpawnedUnit:SetInitialGoalPosition( self.hObjectiveEnts[1]:GetOrigin() )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Bombers:OnTriggerStartTouch( event )
CMapEncounter.OnTriggerStartTouch( self, event )
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
printf( "szTriggerName: %s, hUnit:GetUnitName(): %s, hTriggerEntity:GetName(): %s", szTriggerName, hUnit:GetUnitName(), hTriggerEntity:GetName() )
if self.bCreatureSpawnsActivated == nil and szTriggerName == "trigger_spawn_creatures" then
self.bCreatureSpawnsActivated = true
self:StartAllSpawnerSchedules( 0 )
printf( "Unit \"%s\" triggered creature spawning!", hUnit:GetUnitName() )
EmitGlobalSound( "RoundStart" )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Bombers

View File

@@ -0,0 +1,133 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_BonusBase == nil then
CMapEncounter_BonusBase = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.bGameStarted = false
self.PlayerGoldCollected = {}
self.flEndTime = 9999999999999
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:Precache( context )
CMapEncounter.Precache( self, context )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:GetMaxSpawnedUnitCount()
return 0
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:Start()
CMapEncounter.Start( self )
self.nItemPickedUpListener = ListenToGameEvent( "dota_item_picked_up", Dynamic_Wrap( getclass( self ), "OnItemPickedUp" ), self )
self.nGoldReward = 0
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:StartBonusRound( flTimeLimit )
EmitGlobalSound( "RoundStart" )
self.bGameStarted = true
self.flEndTime = GameRules:GetGameTime() + flTimeLimit
for nPlayerID=0,AGHANIM_PLAYERS-1 do
self.PlayerGoldCollected[ nPlayerID ] = {}
self.PlayerGoldCollected[ nPlayerID ][ "bags" ] = 0
self.PlayerGoldCollected[ nPlayerID ][ "gold" ] = 0
end
local BonusStartData = {}
BonusStartData[ "end_time" ] = self.flEndTime
CustomNetTables:SetTableValue( "encounter_state", "bonus", self.PlayerGoldCollected )
CustomGameEventManager:Send_ServerToAllClients( "bonus_start", BonusStartData )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:OnComplete()
CMapEncounter.OnComplete( self )
StopListeningToGameEvent( self.nItemPickedUpListener )
for nPlayerID=0,AGHANIM_PLAYERS-1 do
CenterCameraOnUnit( nPlayerID, PlayerResource:GetSelectedHeroEntity( nPlayerID ) )
end
CustomGameEventManager:Send_ServerToAllClients( "bonus_complete", self.PlayerGoldCollected )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusBase:CheckForCompletion()
return GameRules:GetGameTime() > self.flEndTime
end
---------------------------------------------------------
-- dota_item_picked_up
-- * PlayerID
-- * HeroEntityIndex
-- * UnitEntityIndex (only if parent is not a hero)
-- * itemname
-- * ItemEntityIndex
---------------------------------------------------------
function CMapEncounter_BonusBase:OnItemPickedUp( event )
local item = EntIndexToHScript( event.ItemEntityIndex )
local hCollector = nil
if event.HeroEntityIndex then
hCollector = EntIndexToHScript( event.HeroEntityIndex )
elseif event.UnitEntityIndex then
hCollector = EntIndexToHScript( event.UnitEntityIndex )
end
if hCollector and item and item:GetAbilityName() == "item_bag_of_gold" then
--printf( "hCollector name: %s", hCollector:GetUnitName() )
--printf( "hCollector player id: %d", hCollector:GetPlayerID() )
--printf( "self.PlayerGoldCollected table: " )
--PrintTable( self.PlayerGoldCollected, " -- " )
if not self.PlayerGoldCollected or #self.PlayerGoldCollected <= 0 then
printf( "WARNING - self.PlayerGoldCollected is nil or empty" )
return
end
--printf( "encounter name: %s", self:GetEncounter():GetName() )
self.PlayerGoldCollected[ hCollector:GetPlayerID() ][ "bags" ] = self.PlayerGoldCollected[ hCollector:GetPlayerID() ][ "bags" ] + 1
self.PlayerGoldCollected[ hCollector:GetPlayerID() ][ "gold" ] = self.PlayerGoldCollected[ hCollector:GetPlayerID() ][ "gold" ] + item:GetCurrentCharges()
CustomNetTables:SetTableValue( "encounter_state", "bonus", self.PlayerGoldCollected )
end
end
-----------------------------------------
return CMapEncounter_BonusBase

View File

@@ -0,0 +1,74 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_bonus_base" )
--------------------------------------------------------------------------------
if CMapEncounter_BonusChicken == nil then
CMapEncounter_BonusChicken = class( {}, {}, CMapEncounter_BonusBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusChicken:constructor( hRoom, szEncounterName )
CMapEncounter_BonusBase.constructor( self, hRoom, szEncounterName )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_bonus_chicken",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 200.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusChicken:GetPreviewUnit()
return "npc_dota_creature_bonus_chicken"
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusChicken:OnEncounterLoaded()
CMapEncounter_BonusBase.OnEncounterLoaded( self )
self:SetupBristlebackShop( false )
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusChicken:OnTriggerStartTouch( event )
CMapEncounter_BonusBase.OnTriggerStartTouch( self, event )
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
if self.bGameStarted == false and szTriggerName == "trigger_spawn_creatures" then
self:GetSpawner( "spawner_peon" ):SpawnUnits()
self:StartBonusRound( 45.0 )
EmitGlobalSound( "BonusRoom.ChaseMusicLoop" )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusChicken:CheckForCompletion()
return self.bGameStarted == true and not self:HasRemainingEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounter_BonusChicken:OnComplete()
CMapEncounter_BonusBase.OnComplete( self )
StopGlobalSound( "BonusRoom.ChaseMusicLoop" )
end
--------------------------------------------------------------------------------
return CMapEncounter_BonusChicken

View File

@@ -0,0 +1,456 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
_G.BOSS_SPEECH_COOLDOWN = 7.0
_G.BOSS_LAUGH_COOLDOWN = 20.0
--------------------------------------------------------------------------------
if CMapEncounter_BossBase == nil then
CMapEncounter_BossBase = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.bBossIntroduced = false
self.bBossFightStarted = false
self.bBossKilled = false
self.flBossSpeechCooldown = -1
self.flBossNextLaughTime = -1
self.flBossIntroEndTime = 9999999999999999999999
self.Bosses = {}
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:OnThink()
CMapEncounter.OnThink( self )
if self.bBossIntroduced == false then
for nPlayerID = 0,AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
for _,hBoss in pairs( self.Bosses ) do
if hPlayerHero:CanEntityBeSeenByMyTeam( hBoss ) then
self:IntroduceBoss( hBoss )
return
end
end
end
end
return
end
local flNow = GameRules:GetGameTime()
if self.bBossIntroduced and self.flBossIntroEndTime > flNow then
return
end
if not self.bBossFightStarted and flNow > self.flBossIntroEndTime then
self:StartBossFight()
return
end
if self.bBossFightStarted and flNow > self.flBossNextLaughTime then
local szLaughLine = self:GetLaughLine()
if szLaughLine ~= nil then
self:BossSpeak( szLaughLine )
self.flBossNextLaughTime = flNow + BOSS_LAUGH_COOLDOWN
end
end
for nPlayerID = 0,AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
local hVisionBuff = hPlayerHero:FindModifierByName( "modifier_provide_vision" )
if hVisionBuff == nil then
for _,hBoss in pairs( self.Bosses ) do
if hBoss and hBoss:IsNull() == false and hBoss:IsAlive() then
hPlayerHero:AddNewModifier( hBoss, nil, "modifier_provide_vision", { duration = -1 } )
break
end
end
end
end
end
self:UpdateBossHP()
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:UpdateBossHP()
local flHPResolution = 500.0;
local netTable = {}
local nEntIndex = -1;
local szUnitName = self:GetBossUnitName();
local flMaxHP = 0
local flCurHP = 0
local flBossHP = 0
local bAnyActive = false
for _,hBoss in pairs ( self.Bosses ) do
if hBoss and not hBoss:IsNull() then
if hBoss:IsAlive() then
bAnyActive = true
flCurHP = flCurHP + hBoss:GetHealth()
end
flMaxHP = flMaxHP + hBoss:GetMaxHealth()
nEntIndex = hBoss:entindex()
end
end
flBossHP = math.floor( flHPResolution * ( flCurHP / flMaxHP ) ) / flHPResolution;
CustomNetTables:SetTableValue( "boss_net_table", "current_boss", { active=bAnyActive, hp = flBossHP, ent_index=nEntIndex, unit_name=szUnitName } )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossUnitName()
return self:GetPreviewUnit()
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossUnits()
return self.Bosses
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:OnBossSpawned( hBoss )
hBoss.bIsBoss = true
hBoss:SetAbsAngles( 0, 270, 0 )
hBoss:AddNewModifier( hPlayerHero, nil, "modifier_boss_intro", {} )
hBoss:RemoveAbility( "ability_ascension" )
hBoss:RemoveModifierByName( "modifier_ascension" )
table.insert( self.Bosses, hBoss )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroGesture()
return ACT_DOTA_VICTORY
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroCameraPitch()
return 30
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroCameraDistance()
return 800
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroCameraHeight()
return 50
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroCameraYawRotateSpeed()
return 0.1
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroCameraInitialYaw()
return 120
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroDuration()
return 4.0
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetBossIntroVoiceLine()
return nil
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:IntroduceBoss( hEncounteredBoss )
self.bBossIntroduced = true
for _,hBoss in pairs ( self.Bosses ) do
hBoss:SetAbsAngles( 0, 270, 0 )
hBoss:AddNewModifier( hBoss, nil, "modifier_provide_vision", { duration = -1 } )
hBoss:StartGesture( self:GetBossIntroGesture() )
end
for nPlayerID = 0,AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
hPlayerHero:AddNewModifier( hPlayerHero, nil, "modifier_boss_intro", { } )
end
end
self:AddEncounterObjective( tostring( "defeat_boss_" .. self:GetBossUnitName() ), 0, 0 )
local netTable = {}
netTable[ "boss_ent_index" ] = hEncounteredBoss:entindex()
netTable[ "camera_pitch" ] = self:GetBossIntroCameraPitch()
netTable[ "camera_distance" ] = self:GetBossIntroCameraDistance()
netTable[ "camera_height" ] = self:GetBossIntroCameraHeight()
netTable[ "camera_yaw_rotate_speed" ] = self:GetBossIntroCameraYawRotateSpeed()
netTable[ "camera_inital_yaw" ] = self:GetBossIntroCameraInitialYaw()
self.flBossIntroEndTime = GameRules:GetGameTime() + self:GetBossIntroDuration()
CustomGameEventManager:Send_ServerToAllClients( "boss_intro_begin", netTable )
if self:GetBossIntroVoiceLine() ~= nil then
self:BossSpeak( self:GetBossIntroVoiceLine() )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:StartBossFight()
self.nAbilityListener = ListenToGameEvent( "dota_non_player_begin_cast", Dynamic_Wrap( getclass( self ), "OnNonPlayerBeginCast" ), self )
self.bBossFightStarted = true
self:UpdateBossHP()
for _,hBoss in pairs ( self.Bosses ) do
--hBoss:RemoveModifierByName( "modifier_boss_intro"
local hBuff = hBoss:FindModifierByName( "modifier_boss_intro" )
if hBuff then
hBuff:SetDuration( 1.0, false )
end
hBoss.Encounter = self
hBoss:RemoveGesture( self:GetBossIntroGesture() )
end
for nPlayerID = 0,AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
hPlayerHero:RemoveModifierByName( "modifier_boss_intro" )
end
local hPlayer = PlayerResource:GetPlayer( nPlayerID )
if hPlayer then
hPlayer:SetMusicStatus( 2, 1.0 ) -- turn on battle music
end
end
CustomGameEventManager:Send_ServerToAllClients( "boss_intro_end", netTable )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetMaxSpawnedUnitCount()
return #self.Bosses
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:Start()
CMapEncounter.Start( self )
self.nGoldReward = 0
self.Bosses = {}
self:GetSpawner( "spawner_boss" ):SpawnUnits()
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerName() == "spawner_boss" then
for _,hUnit in pairs ( hSpawnedUnits ) do
if hUnit then
self:OnBossSpawned( hUnit )
end
end
end
end
---------------------------------------------------------------------------
function CMapEncounter_BossBase:OnEnemyCreatureSpawned( hEnemyCreature )
CMapEncounter.OnEnemyCreatureSpawned( self, hEnemyCreature )
end
---------------------------------------------------------------------------
function CMapEncounter_BossBase:OnEntityKilled( event )
CMapEncounter.OnEntityKilled( self, event )
local hVictim = nil
local hAttacker = nil
local hInflictor = nil
if event.entindex_killed ~= nil then
hVictim = EntIndexToHScript( event.entindex_killed )
end
if event.entindex_attacker ~= nil then
hAttacker = EntIndexToHScript( event.entindex_attacker )
end
if event.entindex_inflictor ~= nil then
hInflictor = EntIndexToHScript( event.entindex_inflictor )
end
if hVictim ~= nil then
if hVictim.bIsBoss == true then
self:OnBossKilled( hVictim, hAttacker )
end
if hVictim:IsRealHero() and hAttacker.bIsBoss == true then
self:BossSpeak( self:GetKillTauntLine() )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:OnBossKilled( hBoss, hAttacker )
for k,Boss in pairs ( self.Bosses ) do
if hBoss == Boss then
table.remove( self.Bosses, k )
end
end
if #self.Bosses == 0 then
self.bBossKilled = true
CustomGameEventManager:Send_ServerToAllClients( "boss_fight_finished", netTable )
for i=1,NUM_LIVES_FROM_BOSSES do
self:DropLifeRuneFromUnit( hBoss, hAttacker, false )
end
self:DropNeutralItemFromUnit( hBoss, hAttacker, true )
for nPlayerID = 0,AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
hPlayerHero:RemoveModifierByName( "modifier_provide_vision" )
end
local hPlayer = PlayerResource:GetPlayer( nPlayerID )
if hPlayer then
hPlayer:SetMusicStatus( 0, 1.0 ) -- go back to laning music
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:OnComplete()
CMapEncounter.OnComplete( self )
if self.nAbilityListener ~= nil then
StopListeningToGameEvent( self.nAbilityListener )
end
if self.bBossFightStarted == false then
-- Fix for test encounter
for nPlayerID = 0,AGHANIM_PLAYERS-1 do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
hPlayerHero:RemoveModifierByName( "modifier_boss_intro" )
end
end
self:UpdateBossHP()
CustomGameEventManager:Send_ServerToAllClients( "boss_intro_end", netTable )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:CheckForCompletion()
if self.bBossKilled then
return true
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:DestroyRemainingSpawnedUnits()
-- Necessary to make bosses drop loot in the case of win_encounter
for i = #self.Bosses,1,-1 do
self.Bosses[i]:ForceKill( false )
end
CMapEncounter.DestroyRemainingSpawnedUnits( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossBase:GetLaughLine()
return nil
end
---------------------------------------------------------------------------
function CMapEncounter_BossBase:GetKillTauntLine()
return nil
end
---------------------------------------------------------------------------
function CMapEncounter_BossBase:GetAbilityUseLine( szAbilityName )
return nil
end
---------------------------------------------------------------------------
function CMapEncounter_BossBase:BossSpeak( szSoundEvent, bLaugh )
if szSoundEvent == nil then
print( "CMapEncounter_BossBase:BossSpeak - szSoundEvent is nil! This might be ok if the boss doesn't have a response for this." )
return
end
local flNow = GameRules:GetGameTime()
if flNow > self.flBossSpeechCooldown then
self.flBossSpeechCooldown = GameRules:GetGameTime() + BOSS_SPEECH_COOLDOWN
EmitGlobalSound( szSoundEvent )
end
end
---------------------------------------------------------
-- dota_non_player_begin_cast
-- * abilityname
-- * caster_entindex
---------------------------------------------------------
function CMapEncounter_BossBase:OnNonPlayerBeginCast( event )
local hCaster = nil
if event.caster_entindex ~= nil and event.abilityname ~= nil then
hCaster = EntIndexToHScript( event.caster_entindex )
if hCaster ~= nil and hCaster.bIsBoss then
self:BossSpeak( self:GetAbilityUseLine( event.abilityname ) )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_BossBase

View File

@@ -0,0 +1,223 @@
require( "encounters/encounter_boss_base" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_BossTimbersaw == nil then
CMapEncounter_BossTimbersaw = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
GameRules:SetTreeRegrowTime( 30.0 )
self:AddSpawner( CDotaSpawner( "spawner_boss", "spawner_boss",
{
{
EntityName = self:GetPreviewUnit(),
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:GetPreviewUnit()
return "npc_dota_boss_timbersaw"
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:Precache( context )
CMapEncounter_BossBase.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_creature_timbersaw_treant", context, -1 )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_shredder", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_shredder.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/voscripts/game_sounds_vo_shredder.vsndevts", context )
PrecacheResource( "particle", "particles/units/heroes/hero_shredder/shredder_chakram_aghs.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_shredder/shredder_chakram_stay.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_shredder/shredder_chakram_return.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:GetBossIntroVoiceLine()
local nLine = RandomInt( 0, 3 )
if nLine == 0 then
return "shredder_timb_levelup_04"
end
if nLine == 1 then
return "shredder_timb_levelup_05"
end
if nLine == 2 then
return "shredder_timb_levelup_06"
end
if nLine == 3 then
return "shredder_timb_levelup_07"
end
return "shredder_timb_levelup_07"
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:OnEncounterLoaded()
CMapEncounter_BossBase.OnEncounterLoaded( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:OnThink()
CMapEncounter_BossBase.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_dota_creature_timbersaw_treant" then
return false
end
return true
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:OnBossSpawned( hBoss )
CMapEncounter_BossBase.OnBossSpawned( self, hBoss )
hBoss.AI:SetEncounter( self )
end
---------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:OnBossKilled( hBoss, hAttacker )
CMapEncounter_BossBase.OnBossKilled( self, hBoss, hAttacker )
local vecTreants = self:GetRoom():FindAllEntitiesInRoomByName( "npc_dota_furion_treant_4", false )
if #vecTreants > 0 then
for _,hTreant in pairs ( vecTreants ) do
hTreant:ForceKill( false )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:GetLaughLine()
local szLines =
{
"shredder_timb_laugh_01",
"shredder_timb_laugh_02",
"shredder_timb_laugh_03",
"shredder_timb_laugh_04",
"shredder_timb_laugh_05",
"shredder_timb_laugh_06",
"shredder_timb_kill_15",
"shredder_timb_kill_16",
"shredder_timb_deny_14",
"shredder_timb_levelup_09",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:GetKillTauntLine()
local szLines =
{
"shredder_timb_kill_02",
"shredder_timb_kill_03",
"shredder_timb_kill_04",
"shredder_timb_kill_06",
"shredder_timb_kill_07",
"shredder_timb_kill_10",
"shredder_timb_kill_11",
"shredder_timb_kill_12",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_BossTimbersaw:GetAbilityUseLine( szAbilityName )
local szLineToUse = self:GetLaughLine()
if szAbilityName == "boss_timbersaw_whirling_death" then
local szLines =
{
"shredder_timb_whirlingdeath_01",
"shredder_timb_whirlingdeath_02",
"shredder_timb_whirlingdeath_03",
"shredder_timb_whirlingdeath_04",
"shredder_timb_whirlingdeath_05",
"shredder_timb_whirlingdeath_06",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "boss_timbersaw_timber_chain" then
local szLines =
{
"shredder_timb_timberchain_01",
"shredder_timb_timberchain_02",
"shredder_timb_timberchain_05",
"shredder_timb_timberchain_04",
"shredder_timb_timberchain_07",
"shredder_timb_timberchain_08",
"shredder_timb_timberchain_09",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "boss_timbersaw_chakram_dance" then
local szLines =
{
"shredder_timb_attack_08",
"shredder_timb_attack_07",
"shredder_timb_attack_05",
"shredder_timb_attack_03",
"shredder_timb_attack_02",
"shredder_timb_cast_01",
"shredder_timb_levelup_10",
"shredder_timb_levelup_11",
"shredder_timb_levelup_12",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "shredder_chakram" then
local szLines =
{
"shredder_timb_chakram_01",
"shredder_timb_chakram_02",
"shredder_timb_chakram_03",
"shredder_timb_chakram_04",
"shredder_timb_chakram_05",
"shredder_timb_chakram_06",
"shredder_timb_chakram_07",
"shredder_timb_chakram_08",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
return szLineToUse
end
--------------------------------------------------------------------------------
return CMapEncounter_BossTimbersaw

View File

@@ -0,0 +1,160 @@
require( "encounters/encounter_boss_base" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_BossVisage == nil then
CMapEncounter_BossVisage = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
self:AddSpawner( CDotaSpawner( "spawner_boss", "spawner_boss",
{
{
EntityName = self:GetPreviewUnit(),
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_familiar", "spawner_familiar",
{
{
EntityName = "npc_dota_boss_visage_familiar",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_familiar_statue_east", "spawner_familiar_statue_east",
{
{
EntityName = "npc_dota_boss_visage_familiar_statue",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_familiar_statue_west", "spawner_familiar_statue_west",
{
{
EntityName = "npc_dota_boss_visage_familiar_statue",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:GetPreviewUnit()
return "npc_dota_boss_visage"
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:Precache( context )
CMapEncounter_BossBase.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_boss_visage_familiar", context, -1 )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_visage", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_visage.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/voscripts/game_sounds_vo_visage.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:OnEncounterLoaded()
CMapEncounter_BossBase.OnEncounterLoaded( self )
self.vecFamiliars = self:GetSpawner( "spawner_familiar" ):SpawnUnits()
self.vecFamiliarStatuesWest = self:GetSpawner( "spawner_familiar_statue_west" ):SpawnUnits()
self.vecFamiliarStatuesEast = self:GetSpawner( "spawner_familiar_statue_east" ):SpawnUnits()
for _,Familiar in pairs ( self.vecFamiliars ) do
Familiar:FaceTowards( self:GetSpawner( "spawner_boss" ):GetSpawners()[1]:GetAbsOrigin() )
end
for _,StatueWest in pairs ( self.vecFamiliarStatuesWest ) do
StatueWest:SetAbsAngles( 0, 0, 0 )
end
for _,StatueEast in pairs ( self.vecFamiliarStatuesEast ) do
StatueEast:SetAbsAngles( 0, 180, 0 )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:OnThink()
CMapEncounter_BossBase.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_dota_boss_visage_familiar" then
return false
end
if hEnemyCreature:GetUnitName() == "npc_dota_boss_visage_familiar_statue" then
return false
end
return true
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVisage:OnBossSpawned( hBoss )
CMapEncounter_BossBase.OnBossSpawned( self, hBoss )
hBoss.AI:SetEncounter( self )
hBoss.WestStatues = self.vecFamiliarStatuesWest
hBoss.EastStatues = self.vecFamiliarStatuesEast
for _,Familiar in pairs ( self.vecFamiliars ) do
Familiar:FaceTowards( self:GetSpawner( "spawner_boss" ):GetSpawners()[1]:GetAbsOrigin() )
Familiar:FindAbilityByName( "boss_visage_familiar_stone_form" ):OnSpellStart()
end
for _,StatueWest in pairs ( self.vecFamiliarStatuesWest ) do
StatueWest:FindAbilityByName( "boss_visage_familiar_stone_form" ):OnSpellStart()
end
for _,StatueEast in pairs ( self.vecFamiliarStatuesEast ) do
StatueEast:FindAbilityByName( "boss_visage_familiar_stone_form" ):OnSpellStart()
end
end
---------------------------------------------------------------------------
function CMapEncounter_BossVisage:OnBossKilled( hBoss, hAttacker )
CMapEncounter_BossBase.OnBossKilled( self, hBoss, hAttacker )
for _,Familiar in pairs ( self.vecFamiliars ) do
Familiar:ForceKill( false )
end
for _,StatueWest in pairs ( self.vecFamiliarStatuesWest ) do
StatueWest:ForceKill( false )
end
for _,StatueEast in pairs ( self.vecFamiliarStatuesEast ) do
StatueEast:ForceKill( false )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_BossVisage

View File

@@ -0,0 +1,263 @@
require( "encounters/encounter_boss_base" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_BossVoidSpirit == nil then
CMapEncounter_BossVoidSpirit = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
self:AddSpawner( CDotaSpawner( "spawner_boss", "spawner_boss",
{
{
EntityName = self:GetPreviewUnit(),
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:GetPreviewUnit()
return "npc_dota_boss_void_spirit"
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:Precache( context )
CMapEncounter_BossBase.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_earth_spirit_statue", context, -1 )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:OnEncounterLoaded()
CMapEncounter_BossBase.OnEncounterLoaded( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:Start()
CMapEncounter_BossBase.Start( self )
local vEarthSpiritSpawnPos = nil
local hEarthSpiritSpawners = self:GetRoom():FindAllEntitiesInRoomByName( "spawner_earth_spirit", true )
local hBossSpawners = self:GetRoom():FindAllEntitiesInRoomByName( "spawner_boss", true )
self.hEarthSpirits = {} -- had some issue finding these units from Void's ability, so just track them as they get made
for _, hSpawner in pairs( hEarthSpiritSpawners ) do
local vSpawnPos = hSpawner:GetAbsOrigin()
local hEarthSpirit = CreateUnitByName( "npc_dota_earth_spirit_statue", vSpawnPos, true, nil, nil, DOTA_TEAM_BADGUYS )
if hEarthSpirit ~= nil then
if #hBossSpawners > 0 and hBossSpawners[ 1 ] ~= nil then
-- Initially face statues towards the boss
local vBossPos = hBossSpawners[ 1 ]:GetOrigin()
local vDir = vBossPos - hEarthSpirit:GetOrigin()
vDir.z = 0.0
vDir = vDir:Normalized()
hEarthSpirit:SetForwardVector( vDir )
end
--self:SuppressRewardsOnDeath( hEarthSpirit )
table.insert( self.hEarthSpirits, hEarthSpirit )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:OnThink()
CMapEncounter_BossBase.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:MustKillForEncounterCompletion( hEnemyCreature )
return true
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:OnBossSpawned( hBoss )
CMapEncounter_BossBase.OnBossSpawned( self, hBoss )
hBoss.AI:SetEncounter( self )
end
---------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:OnBossKilled( hBoss, hAttacker )
CMapEncounter_BossBase.OnBossKilled( self, hBoss, hAttacker )
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:GetBossIntroVoiceLine()
local szLines =
{
"void_spirit_voidspir_battle_01_02",
"void_spirit_voidspir_battle_03_02",
"void_spirit_voidspir_battle_04",
"void_spirit_voidspir_battlebegins_01",
"void_spirit_voidspir_battlebegins_02",
"void_spirit_voidspir_battlebegins_03",
"void_spirit_voidspir_battlebegins_04",
"void_spirit_voidspir_inthebag_01",
"void_spirit_voidspir_inthebag_02",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:GetLaughLine()
local szLines =
{
"void_spirit_voidspir_laugh_01",
"void_spirit_voidspir_laugh_01_02",
"void_spirit_voidspir_laugh_01_03",
"void_spirit_voidspir_laugh_02",
"void_spirit_voidspir_laugh_03",
"void_spirit_voidspir_laugh_04",
"void_spirit_voidspir_laugh_07",
"void_spirit_voidspir_laugh_08",
"void_spirit_voidspir_laugh_09",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:GetKillTauntLine()
local szLines =
{
"void_spirit_voidspir_kill_06",
"void_spirit_voidspir_kill_08",
"void_spirit_voidspir_kill_09",
"void_spirit_voidspir_kill_10",
"void_spirit_voidspir_kill_13",
"void_spirit_voidspir_kill_14",
"void_spirit_voidspir_kill_15",
"void_spirit_voidspir_kill_16",
"void_spirit_voidspir_kill_18",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:GetAbilityUseLine( szAbilityName )
local szLineToUse = self:GetLaughLine()
if szAbilityName == "aghsfort_void_spirit_boss_aether_remnant" then
local szLines =
{
"void_spirit_voidspir_ability1_13",
"void_spirit_voidspir_ability1_12",
"void_spirit_voidspir_ability1_11",
"void_spirit_voidspir_ability1_10",
"void_spirit_voidspir_ability1_09",
"void_spirit_voidspir_ability1_08",
"void_spirit_voidspir_ability1_06",
"void_spirit_voidspir_ability1_05",
"void_spirit_voidspir_ability1_03",
"void_spirit_voidspir_ability1_01",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "aghsfort_void_spirit_boss_dissimilate" then
local szLines =
{
"void_spirit_voidspir_ability2_20",
"void_spirit_voidspir_ability2_18",
"void_spirit_voidspir_ability2_17",
"void_spirit_voidspir_ability2_15",
"void_spirit_voidspir_ability2_14",
"void_spirit_voidspir_ability2_13",
"void_spirit_voidspir_ability2_09",
"void_spirit_voidspir_ability2_08",
"void_spirit_voidspir_ability2_07",
"void_spirit_voidspir_ability2_05",
"void_spirit_voidspir_ability2_02",
"void_spirit_voidspir_ability2_01",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "aghsfort_void_spirit_boss_resonant_pulse" then
local szLines =
{
"void_spirit_voidspir_ability3_15",
"void_spirit_voidspir_ability3_14",
"void_spirit_voidspir_ability3_10",
"void_spirit_voidspir_ability3_09",
"void_spirit_voidspir_ability3_08",
"void_spirit_voidspir_ability3_06",
"void_spirit_voidspir_ability3_04",
"void_spirit_voidspir_ability3_03",
"void_spirit_voidspir_ability3_01",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "void_spirit_boss_activate_earth_spirits" then
local szLines =
{
"void_spirit_voidspir_cast_03",
"void_spirit_voidspir_cast_02",
"void_spirit_voidspir_cast_01",
"void_spirit_voidspir_battlebegins_05",
"void_spirit_voidspir_levelup_11_02",
"void_spirit_voidspir_levelup_12",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "aghsfort_void_spirit_boss_astral_step" then
local szLines =
{
"void_spirit_voidspir_ability4_18",
"void_spirit_voidspir_ability4_13",
"void_spirit_voidspir_ability4_12",
"void_spirit_voidspir_ability4_08",
"void_spirit_voidspir_ability4_06",
"void_spirit_voidspir_ability4_04",
"void_spirit_voidspir_ability4_02",
"void_spirit_voidspir_ability4_01",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
return szLineToUse
end
--------------------------------------------------------------------------------
function CMapEncounter_BossVoidSpirit:GetBossIntroGesture()
return ACT_DOTA_TELEPORT
end
--------------------------------------------------------------------------------
return CMapEncounter_BossVoidSpirit

View File

@@ -0,0 +1,128 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Brewmaster == nil then
CMapEncounter_Brewmaster = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Brewmaster:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_brewmaster", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_brewmaster.vsndevts", context )
PrecacheResource( "particle", "particles/units/heroes/hero_stormspirit/stormspirit_static_remnant.vpcf", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_stormspirit.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Brewmaster:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
local bInvulnerable = true
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_dota_creature_brewmaster_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
}
} ) )
self:SetSpawnerSchedule( "spawner_captain_trigger", nil )
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.5 )
-- Captain:
self.vCaptainSchedule =
{
{
Time = 0,
Count = 3,
},
{
Time = 22,
Count = 3,
},
{
Time = 44,
Count = 3,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "dynamic_portal", "dynamic_portal", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_brewmaster_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "dynamic_portal", self.vCaptainSchedule )
end
function CMapEncounter_Brewmaster:GetPreviewUnit()
return "npc_dota_creature_brewmaster_boss"
end
--------------------------------------------------------------------------------
function CMapEncounter_Brewmaster:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Brewmaster:ShouldAutoStartGlobalAscensionAbilities()
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_Brewmaster:Start()
CMapEncounter.Start( self )
local spawnerFocusPath = self:GenerateSpawnFocusPath( "portal_v2_captain", 300, 1000 )
self:AssignSpawnFocusPath( "portal_v2_peon", spawnerFocusPath )
self:AssignSpawnFocusPath( "portal_v2_captain", spawnerFocusPath )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Brewmaster:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner.szSpawnerName == "dynamic_portal" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
--print( "CMapEncounter_Brewmaster:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), 1000 )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Brewmaster

View File

@@ -0,0 +1,224 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
require( "utility_functions" )
--------------------------------------------------------------------------------
if CMapEncounter_Broodmothers == nil then
CMapEncounter_Broodmothers = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Broodmothers:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_batrider/batrider_flaming_lasso.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Broodmothers:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Pre-placed eggs (done this way to use only a subset of the map spawners)
self.szEggSpawner = "spider_sac_position"
local nAscLevel = GameRules.Aghanim:GetAscensionLevel()
local nPreplacedSacs = 9 + ( 2 * nAscLevel )
self.vEggSchedule =
{
{
Time = 0,
Count = nPreplacedSacs,
},
}
self:AddSpawner( CDotaSpawner( self.szEggSpawner, self.szEggSpawner,
{
{
EntityName = "npc_dota_spider_sac",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
self:SetSpawnerSchedule( self.szEggSpawner, self.vEggSchedule )
-- Pre-placed broodmothers
self.szBroodmotherSpawner = "preplaced_broodmother"
self.vBroodmotherSchedule =
{
{
Time = 0,
Count = 5,
},
}
self:AddSpawner( CDotaSpawner( self.szBroodmotherSpawner, self.szBroodmotherSpawner,
{
{
EntityName = "npc_dota_creature_broodmother",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
self:SetSpawnerSchedule( self.szBroodmotherSpawner, self.vBroodmotherSchedule )
-- Portals
self.vHugeBroodSchedule =
{
{
Time = 34,
Count = 1,
},
{
Time = 64,
Count = 1,
},
}
self.vKidnapperSchedule =
{
{
Time = 10,
Count = 1,
},
{
Time = 45,
Count = 1,
},
{
Time = 80,
Count = 1,
},
{
Time = 115,
Count = 1,
},
}
self.szHugeBroodPortal = "portal_huge_brood"
self.szKidnapperPortal = "portal_kidnapper"
local bInvulnerable = true
local nHealth = 1
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szHugeBroodPortal, self.szHugeBroodPortal, nHealth, 5, 1.0,
{
{
EntityName = "npc_dota_creature_huge_broodmother",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szKidnapperPortal, self.szKidnapperPortal, nHealth, 5, 1.0,
{
{
EntityName = "npc_dota_creature_kidnap_spider",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szHugeBroodPortal, self.vHugeBroodSchedule )
self:SetSpawnerSchedule( self.szKidnapperPortal, self.vKidnapperSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Broodmothers:GetPreviewUnit()
return "npc_dota_creature_huge_broodmother"
end
--------------------------------------------------------------------------------
function CMapEncounter_Broodmothers:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Broodmothers:OnThink()
-- We'll pop the eggs when all the important spiders are dead
if self:AreScheduledSpawnsComplete() and not self:HasAnyPortals() then
--printf( "Scheduled spawns are complete and there are no portals" )
-- Search for enemies remaining
local fSearchRange = 6000
local vRoomOrigin = self:GetRoom():GetOrigin()
local hCreatures = FindUnitsInRadius( DOTA_TEAM_BADGUYS, vRoomOrigin, nil, fSearchRange,
DOTA_TEAM_BADGUYS, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_INVULNERABLE, FIND_CLOSEST, false
)
local nCaptainsRemaining = 0
for _, hCreature in pairs( hCreatures ) do
if hCreature and ( not hCreature:IsNull() ) and hCreature:IsAlive() then
if hCreature:GetUnitName() == "npc_dota_creature_kidnap_spider" or hCreature:GetUnitName() == "npc_dota_creature_broodmother" or hCreature:GetUnitName() == "npc_dota_creature_huge_broodmother" then
nCaptainsRemaining = nCaptainsRemaining + 1
end
end
end
if nCaptainsRemaining == 0 then
--printf( "All the captain spiders are dead" )
for _, hCreature in pairs( hCreatures ) do
if hCreature:GetUnitName() == "npc_dota_spider_sac" then
--printf( "Popping an egg" )
hCreature:Kill( nil, nil )
end
end
end
end
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Broodmothers:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
if hSpawner:GetSpawnerName() == self.szKidnapperPortal then -- kidnap spiders do their own thing, their ai was getting broken by SetInitialGoalEntity
return
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Broodmothers

View File

@@ -0,0 +1,46 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_trap_base" )
--------------------------------------------------------------------------------
if CMapEncounter_CastleTraps == nil then
CMapEncounter_CastleTraps = class( {}, {}, CMapEncounter_TrapBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_CastleTraps:GetPreviewUnit()
return "npc_dota_spike_trap_ward"
end
--------------------------------------------------------------------------------
function CMapEncounter_CastleTraps:CheckForCompletion()
if not IsServer() then
return
end
local bIsComplete = CMapEncounter_TrapBase.CheckForCompletion( self )
if bIsComplete then
self:DisableTraps()
end
return bIsComplete
end
--------------------------------------------------------------------------------
function CMapEncounter_CastleTraps:DisableTraps()
--print("Disabling Traps!")
-- Disable any traps in the map
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
--local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_CastleTraps

View File

@@ -0,0 +1,46 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_trap_base" )
--------------------------------------------------------------------------------
if CMapEncounter_CliffPass == nil then
CMapEncounter_CliffPass = class( {}, {}, CMapEncounter_TrapBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_CliffPass:GetPreviewUnit()
return "npc_dota_breathe_fire_trap"
end
--------------------------------------------------------------------------------
function CMapEncounter_CliffPass:CheckForCompletion()
if not IsServer() then
return
end
local bIsComplete = CMapEncounter_TrapBase.CheckForCompletion( self )
if bIsComplete then
self:DisableTraps()
end
return bIsComplete
end
--------------------------------------------------------------------------------
function CMapEncounter_CliffPass:DisableTraps()
--print("Disabling Traps!")
-- Disable any traps in the map
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
--local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_CliffPass

View File

@@ -0,0 +1,72 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_trap_base" )
--------------------------------------------------------------------------------
if CMapEncounter_CryptTraps == nil then
CMapEncounter_CryptTraps = class( {}, {}, CMapEncounter_TrapBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_CryptTraps:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_observer_ward_crypt", context, -1 )
end
--------------------------------------------------------------------------------
function CMapEncounter_CryptTraps:GetPreviewUnit()
return "npc_dota_spike_trap_ward"
end
--------------------------------------------------------------------------------
function CMapEncounter_CryptTraps:Start()
CMapEncounter_TrapBase.Start( self )
if not IsServer() then
return
end
local wardUnits = Entities:FindAllByName( "spawner_ward" )
local wardUnit = "npc_dota_observer_ward_crypt"
for _, spawnerUnit in pairs(wardUnits) do
local hUnit = CreateUnitByName( wardUnit, spawnerUnit:GetAbsOrigin(), true, nil, nil, DOTA_TEAM_GOODGUYS )
if hUnit ~= nil then
--print("Placing a ward")
hUnit:SetForwardVector( RandomVector( 1 ) )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_CryptTraps:CheckForCompletion()
if not IsServer() then
return
end
local bIsComplete = CMapEncounter_TrapBase.CheckForCompletion( self )
if bIsComplete then
self:DisableTraps()
end
return bIsComplete
end
--------------------------------------------------------------------------------
function CMapEncounter_CryptTraps:DisableTraps()
--print("Disabling Traps!")
-- Disable any traps in the map
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
--local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_CryptTraps

View File

@@ -0,0 +1,122 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_DarkSeer == nil then
CMapEncounter_DarkSeer = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_dark_seer", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_dark_seer.vsndevts", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_lich", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_lich.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_dark_seer", "spawner_dark_seer",
{
{
EntityName = "npc_dota_creature_dark_seer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_lich", "spawner_lich",
{
{
EntityName = "npc_dota_creature_lich",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_frost_kobold",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:GetPreviewUnit()
return "npc_dota_creature_dark_seer"
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:Start()
CMapEncounter.Start( self )
self:CreateEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DarkSeer:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Wildwings:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_DarkSeer

View File

@@ -0,0 +1,228 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_DireSiege == nil then
CMapEncounter_DireSiege = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.hDireCaptain = nil
self.nDireCaptainHealthPercentTrigger = 20
self.nNumCatapultsToKillForReinforcements = 3
self.bTriggeredReinforcements = false
self.szMeleeSpawner = "spawner_melee"
self.szRangedSpawner = "spawner_ranged"
self.szCatapultSpawner = "spawner_catapult"
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szMeleeSpawner, self.szMeleeSpawner,
{
{
EntityName = "npc_dota_assault_bad_melee_creep",
Team = DOTA_TEAM_BADGUYS,
Count = 5,
PositionNoise = 250.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szRangedSpawner, self.szRangedSpawner,
{
{
EntityName = "npc_dota_assault_bad_ranged_creep",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 250.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCatapultSpawner, self.szCatapultSpawner,
{
{
EntityName = "npc_dota_creature_catapult",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_aghsfort_creature_dire_assault_captain",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
-- reinforcement wave through portals
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_ranged", "portal_ranged", 8, 5, 1.0,
{
{
EntityName = "npc_dota_assault_bad_ranged_creep",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 250.0,
},
}, true
) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_melee", "portal_melee", 8, 5, 1.0,
{
{
EntityName = "npc_dota_assault_bad_melee_creep",
Team = DOTA_TEAM_BADGUYS,
Count = 5,
PositionNoise = 250.0,
},
}, true
) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_captain", "portal_captain", 8, 5, 1.0,
{
{
EntityName = "npc_aghsfort_creature_dire_assault_captain",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, true
) )
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:GetPreviewUnit()
return "npc_dota_creature_catapult"
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:GetMaxSpawnedUnitCount()
local nCount = 0
local hMeleeSpawners = self:GetSpawner( self.szMeleeSpawner )
if hMeleeSpawners then
nCount = nCount + hMeleeSpawners:GetSpawnPositionCount()
end
local hRangedSpawners = self:GetSpawner( self.szRangedSpawner )
if hRangedSpawners then
nCount = nCount + hRangedSpawners:GetSpawnPositionCount()
end
local hCatapultSpawners = self:GetSpawner( self.szCatapultSpawner )
if hCatapultSpawners then
nCount = nCount + hCatapultSpawners:GetSpawnPositionCount()
end
local hCaptainSpawners = self:GetSpawner( self.szCaptainSpawner )
if hCaptainSpawners then
nCount = nCount + hCaptainSpawners:GetSpawnPositionCount()
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:Start()
CMapEncounter.Start( self )
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:SpawnReinforcements()
if self.bTriggeredReinforcements == true then
return
end
self.bTriggeredReinforcements = true
self.hDireCaptain = nil
for _, hPortalSpawner in pairs( self.PortalSpawnersV2 ) do
hPortalSpawner:SpawnUnitsFromRandomSpawners( 1 )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:OnThink()
CMapEncounter.OnThink( self )
if self.bTriggeredReinforcements == true then
return
end
-- original dire captain is dead or goes below the health percent trigger
if self.hDireCaptain ~= nil and self.hDireCaptain:IsNull() == false then
--print( 'CMapEncounter_DireSiege:OnThink() Dire Assault Captain health percent is ' .. self.hDireCaptain:GetHealthPercent() )
if self.hDireCaptain:IsAlive() == false or self.hDireCaptain:GetHealthPercent() < self.nDireCaptainHealthPercentTrigger then
self:SpawnReinforcements()
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if self.bTriggeredReinforcements == true then
return
end
-- trigger the reinforcements after killing a set number of catapults
if hVictim and hVictim:GetUnitName() == "npc_dota_creature_catapult" then
self.nNumCatapultsToKillForReinforcements = self.nNumCatapultsToKillForReinforcements - 1
if self.nNumCatapultsToKillForReinforcements <= 0 then
self:SpawnReinforcements()
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DireSiege:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_Pinecones:OnSpawnerFinished" )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
if hSpawnedUnit:GetUnitName() == "npc_aghsfort_creature_dire_assault_captain" then
print( 'CMapEncounter_DireSiege:OnSpawnerFinished() - found original Dire Assault Captain')
self.hDireCaptain = hSpawnedUnit
end
end
elseif hSpawner:GetSpawnerType() == "CPortalSpawnerV2" then
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_DireSiege

View File

@@ -0,0 +1,223 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_DragonKnight == nil then
CMapEncounter_DragonKnight = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
local bInvulnerable = true
self.vWaveSchedule =
{
{
Time = 0,
Count = 1,
},
{
Time = 20,
Count = 2,
},
{
Time = 45,
Count = 2,
},
{
Time = 70,
Count = 2,
},
}
--DeepPrintTable( self.vWaveSchedule )
self.szPortal = "spawner_peon"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPortal, self.szPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_underlord",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_dragon_knight",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_peon", self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:Precache( context )
CMapEncounter.Precache( self, context )
--[[
local towerTable =
{
MapUnitName = "npc_dota_holdout_tower_tier2",
teamnumber = DOTA_TEAM_GOODGUYS,
}
]]
local ogreTable =
{
MapUnitName = "npc_dota_creature_friendly_ogre_tank",
teamnumber = DOTA_TEAM_GOODGUYS,
}
PrecacheUnitFromTableSync( ogreTable, context )
PrecacheResource( "particle", "particles/units/heroes/heroes_underlord/underlord_firestorm_pre.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/heroes_underlord/abyssal_underlord_firestorm_wave.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/heroes_underlord/abyssal_underlord_firestorm_wave_burn.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:GetPreviewUnit()
return "npc_dota_creature_dragon_knight"
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWaveSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self.szObjectiveEnts = "objective"
self.hObjectiveEnts = self:GetRoom():FindAllEntitiesInRoomByName( self.szObjectiveEnts, true )
if #self.hObjectiveEnts == 0 then
printf( "WARNING - self.hObjectiveEnt is nil (looked for classname \"%s\")", self.szObjectiveEnts )
return
end
self.hOgre = CreateUnitByName( "npc_dota_creature_friendly_ogre_tank", self.hObjectiveEnts[1]:GetOrigin(), false, nil, nil, DOTA_TEAM_GOODGUYS )
if self.hOgre ~= nil then
self.hOgre:SetForwardVector( RandomVector( 1 ) )
local nAscLevel = GameRules.Aghanim:GetAscensionLevel()
self.hOgre:CreatureLevelUp( nAscLevel )
self.vGoalPos = self.hOgre:GetAbsOrigin()
else
printf( "WARNING - Failed to spawn the objective entity!" )
return
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:ShouldAutoStartGlobalAscensionAbilities()
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:Start()
CMapEncounter.Start( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner.szSpawnerName == "spawner_peon" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
if self.hOgre ~= nil and ( not self.hOgre:IsNull() ) and self.hOgre:IsAlive() then
hSpawnedUnit:SetInitialGoalEntity( self.hOgre )
else
if self.hObjectiveEnts[ 1 ] ~= nil and self.hObjectiveEnts[ 1 ]:IsNull() == false then
hSpawnedUnit:SetInitialGoalPosition( self.hObjectiveEnts[ 1 ]:GetOrigin() )
else
hSpawnedUnit:SetInitialGoalPosition( self.vGoalPos )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:OnTriggerStartTouch( event )
CMapEncounter.OnTriggerStartTouch( self, event )
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
--printf( "szTriggerName: %s, hUnit:GetUnitName(): %s, hTriggerEntity:GetName(): %s", szTriggerName, hUnit:GetUnitName(), hTriggerEntity:GetName() )
if self.bCreatureSpawnsActivated == nil and szTriggerName == "trigger_spawn_creatures" then
self.bCreatureSpawnsActivated = true
self:StartGlobalAscensionAbilities()
self:StartAllSpawnerSchedules( 0 )
--printf( "Unit \"%s\" triggered creature spawning!", hUnit:GetUnitName() )
EmitGlobalSound( "RoundStart" )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DragonKnight:OnComplete()
CMapEncounter.OnComplete( self )
-- If friendly ogre is still alive, grant some rewards and do other stuff
if self.hOgre ~= nil and ( not self.hOgre:IsNull() ) and self.hOgre:IsAlive() then
self.hOgre:Heal( self.hOgre:GetMaxHealth(), nil )
local nFXIndex = ParticleManager:CreateParticle( "particles/items3_fx/fish_bones_active.vpcf", PATTACH_ABSORIGIN_FOLLOW, self.hOgre )
ParticleManager:ReleaseParticleIndex( nFXIndex )
local nLives = 1
for i = 1, nLives do
self:DropLifeRuneFromUnit( self.hOgre, nil, true )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_DragonKnight

View File

@@ -0,0 +1,177 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_DrowRangerMiniboss == nil then
CMapEncounter_DrowRangerMiniboss = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.bBossSpawned = false
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_boss", "spawner_boss",
{
{
EntityName = self:GetPreviewUnit(),
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
--[[
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_drow_ranger_skeleton_archer",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 150.0,
},
} ) )
--]]
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_peon", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_drow_ranger_skeleton_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 300.0,
},
}, true
) )
self.nSkeletonSpawnersToUse = 4
self.nSkeletonSpawnerIncrement = 2
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:GetPreviewUnit()
return "npc_dota_creature_drow_ranger_miniboss"
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:Precache( context )
CMapEncounter.Precache( self, context )
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:Start()
CMapEncounter.Start( self )
self.bBossSpawned = true
self:GetSpawner( "spawner_boss" ):SpawnUnits()
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:GetMaxSpawnedUnitCount()
-- count the drow ranger
local nCount = 1
local nSkeletonSpawnersToUse = self.nSkeletonSpawnersToUse
local nSkeletonSpawnerIncrement = self.nSkeletonSpawnerIncrement
-- drow is set to go invis 3 times and spawn an increasing number of skeletons
for i = 1, 3 do
local nSkeletonsPerSpawn = self:GetPortalSpawnerV2( "spawner_peon" ):GetSpawnCountPerSpawnPosition()
nCount = nCount + ( nSkeletonSpawnersToUse * nSkeletonsPerSpawn )
nSkeletonsPerSpawn = nSkeletonsPerSpawn + nSkeletonSpawnerIncrement
end
print( 'CMapEncounter_DrowRangerMiniboss:GetMaxSpawnedUnitCount() - max unit count is ' .. nCount )
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerName() == "spawner_boss" then
for _,hUnit in pairs ( hSpawnedUnits ) do
if hUnit then
--hUnit:AddNewModifier( hUnit, nil, "modifier_provide_vision", { duration = -1 } )
hUnit.AI:SetEncounter( self )
end
end
else
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:KillSkeletons()
local vecSkeletons = self:GetSpawnedSecondaryUnits()
print( 'Trying to kill ' .. #vecSkeletons .. " Skeletons")
if #vecSkeletons > 0 then
for _,hSkeleton in pairs ( vecSkeletons ) do
print( 'Attempting to kill skeleton' )
hSkeleton:ForceKill( false )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:OnDrowShadowBladed()
print( 'CMapEncounter_DrowRangerMiniboss:OnDrowShadowBladed()' )
--self:KillSkeletons()
self:GetPortalSpawnerV2( "spawner_peon" ):SpawnUnitsFromRandomSpawners( self.nSkeletonSpawnersToUse )
self.nSkeletonSpawnersToUse = self.nSkeletonSpawnersToUse + self.nSkeletonSpawnerIncrement
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_DrowRangerMiniboss:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_dota_creature_drow_ranger_skeleton_archer" then
return false
end
return true
end
--]]
---------------------------------------------------------------------------
function CMapEncounter_DrowRangerMiniboss:CheckForCompletion()
--print( 'CMapEncounter_DrowRangerMiniboss:CheckForCompletion() )
if self.bBossSpawned and not self:HasRemainingEnemies() then
return true
end
return false
end
--------------------------------------------------------------------------------
return CMapEncounter_DrowRangerMiniboss

View File

@@ -0,0 +1,134 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Elemental_Tiny == nil then
CMapEncounter_Elemental_Tiny = class( {}, {}, CMapEncounter )
end
function CMapEncounter_Elemental_Tiny:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
local bInvulnerable = true
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_peon", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_elemental_tiny",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 100.0,
},
}, bInvulnerable ) )
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_dota_creature_elemental_tiny",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 100.0,
}
}, bInvulnerable ) )
self.nCaptains = 5
self.vPeonSchedule =
{
{
Time = 1,
Count = 2,
},
{
Time = 26,
Count = 2,
},
}
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.8 )
self:SetSpawnerSchedule( "spawner_captain_trigger", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_peon", self.vPeonSchedule )
self:SetCalculateRewardsFromUnitCount( true )
end
--------------------------------------------------------------------------------
function CMapEncounter_Elemental_Tiny:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "kill_tinies", 0, self.nCaptains )
end
--------------------------------------------------------------------------------
function CMapEncounter_Elemental_Tiny:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if hVictim and hVictim:GetUnitName() == "npc_dota_creature_elemental_tiny" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "kill_tinies" )
self:UpdateEncounterObjective( "kill_tinies", nCurrentValue + 1, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Elemental_Tiny:GetPreviewUnit()
return "npc_dota_creature_elemental_tiny"
end
--------------------------------------------------------------------------------
function CMapEncounter_Elemental_Tiny:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Elemental_Tiny:OnThink()
CMapEncounter.OnThink( self )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes <= 0 then
return
end
--print( "CMapEncounter_Elemental_Tiny:OnThink() - iterating through portal units" )
for _,hEnemy in pairs( self.SpawnedEnemies ) do
if hEnemy == nil or hEnemy:IsNull() or hEnemy:IsAlive() == false then
goto continue
end
::continue::
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Elemental_Tiny:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_Elemental_Tiny:OnSpawnerFinished" )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
--if #heroes > 0 then
-- for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
-- local hero = heroes[RandomInt(1, #heroes)]
-- if hero ~= nil then
-- --printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
-- hSpawnedUnit:SetInitialGoalEntity( hero )
-- end
-- end
--end
end
--------------------------------------------------------------------------------
return CMapEncounter_Elemental_Tiny

View File

@@ -0,0 +1,76 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_EmptyBeach == nil then
CMapEncounter_EmptyBeach = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyBeach:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_shop_keeper", context, -1 )
PrecacheModel("models/items/wards/crab_trap_ward_ward/crab_trap_ward_ward.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_back.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_bracer.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_head.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_necklace.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_weapon.vmdl", context)
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyBeach:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self:SetupBristlebackShop( true )
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyBeach:OnComplete()
CMapEncounter.OnComplete( self )
self:SpawnWards()
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyBeach:GetPreviewUnit()
return "npc_dota_shop_keeper"
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyBeach:CheckForCompletion()
local connectedPlayers = GameRules.Aghanim:GetConnectedPlayers()
for i=1,#connectedPlayers do
local nPlayerID = connectedPlayers[i]
if GameRules.Aghanim:GetPlayerCurrentRoom( nPlayerID ) ~= self:GetRoom() then
return false
end
end
return true
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyBeach:SpawnWards()
local wardUnits = Entities:FindAllByName( "spawner_ward" )
local wardUnit = "npc_dota_observer_ward_beach"
for _, spawnerUnit in pairs(wardUnits) do
local hUnit = CreateUnitByName( wardUnit, spawnerUnit:GetAbsOrigin(), true, nil, nil, DOTA_TEAM_GOODGUYS )
if hUnit ~= nil then
--print("Placing a ward")
hUnit:SetForwardVector( RandomVector( 1 ) )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_EmptyBeach

View File

@@ -0,0 +1,54 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_EmptyCavern == nil then
CMapEncounter_EmptyCavern = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyCavern:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_shop_keeper", context, -1 )
PrecacheModel("models/heroes/bristleback/bristleback_back.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_bracer.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_head.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_necklace.vmdl", context)
PrecacheModel("models/heroes/bristleback/bristleback_weapon.vmdl", context)
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyCavern:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self:SetupBristlebackShop( true )
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyCavern:GetPreviewUnit()
return "npc_dota_shop_keeper"
end
--------------------------------------------------------------------------------
function CMapEncounter_EmptyCavern:CheckForCompletion()
local connectedPlayers = GameRules.Aghanim:GetConnectedPlayers()
for i=1,#connectedPlayers do
local nPlayerID = connectedPlayers[i]
print( )
if GameRules.Aghanim:GetPlayerCurrentRoom( nPlayerID ) ~= self:GetRoom() then
return false
end
end
return true
end
--------------------------------------------------------------------------------
return CMapEncounter_EmptyCavern

View File

@@ -0,0 +1,125 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounterEnragedHellbears == nil then
CMapEncounterEnragedHellbears = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_small_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 7,
PositionNoise = 225.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 75.0,
},
} ) )
self.flEnrageTimer = 60
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:GetPreviewUnit()
return "npc_dota_creature_hellbear"
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:GetMaxSpawnedUnitCount()
local nCount = 0
local hWarriorSpawners = self:GetSpawner( self.szPeonSpawner )
if hWarriorSpawners then
nCount = nCount + hWarriorSpawners:GetSpawnPositionCount() * 6
end
local hChampionSpawners = self:GetSpawner( self.szCaptainSpawner )
if hChampionSpawners then
nCount = nCount + hChampionSpawners:GetSpawnPositionCount()
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:Start()
CMapEncounter.Start( self )
self:CreateEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:OnThink()
CMapEncounter.OnThink( self )
local flNow = GameRules:GetGameTime()
if ( flNow - self.flStartTime ) > self.flEnrageTimer then
--printf("ENRAGING!!")
for _,hMob in pairs ( self:GetSpawnedUnits() ) do
if hMob:GetLevel() < 2 then
--printf("UPGRADING CREATURE %s to level 2", hMob:GetUnitName())
hMob:CreatureLevelUp(1)
hMob:AddNewModifier( hMob, nil, "modifier_aghsfort_enrage" , {} )
hMob:SetAcquisitionRange(9000)
end
local hAbility = hMob:FindAbilityByName("hellbear_smash")
if hAbility then
--printf("UPGRADING ABILITY %s from %d to %d", hAbility:GetAbilityName(), hAbility:GetLevel(), 2 )
hAbility:SetLevel(2)
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:CheckForCompletion()
if not self:HasRemainingEnemies() then
return true
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounterEnragedHellbears:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
return CMapEncounterEnragedHellbears

View File

@@ -0,0 +1,153 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Enraged_Wildwings == nil then
CMapEncounter_Enraged_Wildwings = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self.nCaptains = 6
local bInvulnerable = true
self.vWaveSchedule =
{
{
Time = 0,
Count = 2,
},
{
Time = 36,
Count = 3,
},
}
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_aghsfort_creature_enraged_wildwing",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 50.0,
}
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szCaptainSpawner, self.szCaptainSpawner, 4, 5, 1.0,
{
{
EntityName = "npc_aghsfort_creature_enraged_wildwing",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 100.0,
},
{
EntityName = "npc_aghsfort_creature_tornado_harpy",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 100.0,
},
}, bInvulnerable ) )
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.8 )
self:SetSpawnerSchedule( "spawner_captain_trigger", nil ) -- means spawn once when triggered
--self:SetSpawnerSchedule( self.szPeonSpawner, self.vPeonSchedule )
self:SetSpawnerSchedule( self.szCaptainSpawner, self.vWaveSchedule )
self:SetCalculateRewardsFromUnitCount( true )
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:GetPreviewUnit()
return "npc_aghsfort_creature_enraged_wildwing"
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:GetMaxSpawnedUnitCount()
local nCount = 0
local hWarriorSpawners = self:GetSpawner( self.szPeonSpawner )
if hWarriorSpawners then
nCount = nCount + hWarriorSpawners:GetSpawnPositionCount() * 2
end
local hChampionSpawners = self:GetSpawner( self.szCaptainSpawner )
if hChampionSpawners then
nCount = nCount + hChampionSpawners:GetSpawnPositionCount()
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "kill_wildwings", 0, self.nCaptains )
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if hVictim and hVictim:GetUnitName() == "npc_aghsfort_creature_enraged_wildwing" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "kill_wildwings" )
self:UpdateEncounterObjective( "kill_wildwings", nCurrentValue + 1, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
--for _,Spawner in pairs ( self:GetSpawners() ) do
-- if Spawner:GetSpawnerName() == "spawner_peon" then
-- Spawner:SpawnUnitsFromRandomSpawners( Spawner:GetSpawnPositionCount() )
-- else
-- Spawner:SpawnUnitsFromRandomSpawners( self.nCaptains )
-- end
--end
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Enraged_Wildwings:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_aghsfort_creature_enraged_wildwing_tornado" then
return false
end
return true
end
--------------------------------------------------------------------------------
return CMapEncounter_Enraged_Wildwings

View File

@@ -0,0 +1,152 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_FireRoshan == nil then
CMapEncounter_FireRoshan = class( {}, {}, CMapEncounter )
end
function CMapEncounter_FireRoshan:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_creature_baby_roshan", context, -1 )
PrecacheResource( "particle", "particles/units/heroes/hero_jakiro/jakiro_icepath_debuff.vpcf", context )
PrecacheResource( "particle", "particles/neutral_fx/mini_rosh_fire.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_lich/lich_frost_nova.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_lich/lich_slowed_cold.vpcf", context )
PrecacheResource( "particle", "particles/status_fx/status_effect_frost_lich.vpcf", context )
PrecacheResource( "particle", "particles/status_fx/status_effect_burn.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_FireRoshan:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.nNumBabyRoshans = 3
self:AddSpawner( CDotaSpawner( "spawner_fire_roshan", "spawner_fire_roshan",
{
{
EntityName = "npc_dota_creature_fire_roshan",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_ice_roshan", "spawner_ice_roshan",
{
{
EntityName = "npc_dota_creature_ice_roshan",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
local bInvulnerable = true
self.vReinforcementSchedule =
{
{
Time = 5,
Count = 2,
},
{
Time = 20,
Count = 2,
},
{
Time = 35,
Count = 2,
},
{
Time = 50,
Count = 2,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_reinforcements", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_baby_roshan",
Team = DOTA_TEAM_BADGUYS,
Count = 4,
PositionNoise = 225.0,
},
}, bInvulnerable ) )
self:SetSpawnerSchedule( "spawner_reinforcements", self.vReinforcementSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_FireRoshan:InitializeObjectives()
self:AddEncounterObjective( "defeat_blazhan", 0, 0 )
self:AddEncounterObjective( "defeat_frozhan", 0, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_FireRoshan:GetPreviewUnit()
return "npc_dota_creature_fire_roshan"
end
--------------------------------------------------------------------------------
function CMapEncounter_FireRoshan:Start()
CMapEncounter.Start( self )
self:CreateUnits()
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_FireRoshan:CreateUnits()
for _,Spawner in pairs ( self:GetSpawners() ) do
local vecUnits = Spawner:SpawnUnits()
for _,hUnit in pairs ( vecUnits ) do
if hUnit:GetUnitName() == "npc_dota_creature_ice_roshan" then
hUnit:SetMaterialGroup( "3" )
end
if hUnit:GetUnitName() == "npc_dota_creature_fire_roshan" then
hUnit:SetMaterialGroup( "2" )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_FireRoshan:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
print( "CMapEncounter_FireRoshan:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "CMapEncounter_FireRoshan:OnSpawnerFinished: WARNING: Can't find a living hero" )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_FireRoshan

View File

@@ -0,0 +1,144 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Gauntlet == nil then
CMapEncounter_Gauntlet = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_grimstroke/grimstroke_ink_swell_buff.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_grimstroke/grimstroke_cast_ink_swell.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_grimstroke/grimstroke_ink_swell_aoe.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_grimstroke/grimstroke_ink_swell_tick_damage.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_lifestealer", "spawner_lifestealer",
{
{
EntityName = "npc_dota_creature_life_stealer",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
self:AddSpawner( CDotaSpawner( "spawner_grimstroke", "spawner_grimstroke",
{
{
EntityName = "npc_dota_creature_grimstroke",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
--[[
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_gauntlet_skeleton",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 0.0,
},
}
) )
]]
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:GetPreviewUnit()
return "npc_dota_creature_life_stealer"
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:Start()
CMapEncounter.Start( self )
self:CreateEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:CheckForCompletion()
if not self:HasRemainingEnemies() and not self:HasAnyPortals() then
-- Disable any traps in the map
local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
return true
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Gauntlet:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Wildwings:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Gauntlet

View File

@@ -0,0 +1,107 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Hellbears == nil then
CMapEncounter_Hellbears = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
local flInitialPortalSpawnDelay = 0.0
local flInitialSummonTime = 5.0
local flPortalIntervalInput = DEFAULT_PORTAL_SPAWN_INTERVAL
local flScaleInput = 1.0
local nNumPortals = 4
for i=1,nNumPortals do
local name = string.format( "portal_%i", i )
self:AddPortalSpawner( CPortalSpawner( name, "dynamic_portal", 60 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_small_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 4,
PositionNoise = 0.0,
},
{
EntityName = "npc_dota_creature_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
} ) )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:GetPreviewUnit()
return "npc_dota_creature_hellbear"
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:GetMaxSpawnedUnitCount()
local nCount = 0
local hWarriorSpawners = self:GetSpawner( self.szPeonSpawner )
if hWarriorSpawners then
nCount = nCount + hWarriorSpawners:GetSpawnPositionCount() * 4
end
local hChampionSpawners = self:GetSpawner( self.szCaptainSpawner )
if hChampionSpawners then
nCount = nCount + hChampionSpawners:GetSpawnPositionCount() * 2
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_Hellbears:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "CMapEncounter_Hellbears:OnSpawnerFinished: WARNING: Can't find a living hero" )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Hellbears

View File

@@ -0,0 +1,217 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Hellbears == nil then
CMapEncounter_Hellbears = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.vPeonSchedule =
{
{
Time = 5,
Count = 4,
},
{
Time = 25,
Count = 4,
},
{
Time = 45,
Count = 6,
},
{
Time = 65,
Count = 6,
},
{
Time = 85,
Count = 6,
},
{
Time = 105,
Count = 8,
},
{
Time = 125,
Count = 8,
},
{
Time = 145,
Count = 8,
},
}
self.vCaptainSchedule =
{
{
Time = 5,
Count = 2,
},
{
Time = 25,
Count = 2,
},
{
Time = 45,
Count = 3,
},
{
Time = 65,
Count = 3,
},
{
Time = 85,
Count = 3,
},
{
Time = 105,
Count = 4,
},
{
Time = 125,
Count = 4,
},
{
Time = 145,
Count = 4,
},
}
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_small_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_dota_creature_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_v2_peon", "portal_v2_peon", 8, 7.5, 0.7,
{
{
EntityName = "npc_dota_creature_small_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_v2_captain", "portal_v2_captain", 35, 7.5, 1.3,
{
{
EntityName = "npc_dota_creature_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.5 )
self:SetSpawnerSchedule( "spawner_peon", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_captain_trigger", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "portal_v2_peon", self.vPeonSchedule )
self:SetSpawnerSchedule( "portal_v2_captain", self.vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:GetPreviewUnit()
return "npc_dota_creature_hellbear"
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:Start()
CMapEncounter.Start( self )
local spawnerFocusPath = self:GenerateSpawnFocusPath( "portal_v2_captain", 300, 1000 )
self:AssignSpawnFocusPath( "portal_v2_peon", spawnerFocusPath )
self:AssignSpawnFocusPath( "portal_v2_captain", spawnerFocusPath )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:InitializeObjectives()
--CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, 0 )
self:AddEncounterObjective( "survive_waves", 0, #self.vCaptainSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnPortalV2Killed( hVictim, hAttacker, nUnitCountSuppressed )
CMapEncounter.OnPortalV2Killed( self, hVictim, hAttacker, nUnitCountSuppressed )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + nUnitCountSuppressed, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
if hSpawner.szSpawnerName == "portal_v2_captain" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
--print( "CMapEncounter_Hellbears:OnSpawnerFinished " )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Hellbears

View File

@@ -0,0 +1,217 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Hellbears == nil then
CMapEncounter_Hellbears = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.vPeonSchedule =
{
{
Time = 5,
Count = 3,
},
{
Time = 15,
Count = 3,
},
{
Time = 35,
Count = 3,
},
{
Time = 50,
Count = 3,
},
{
Time = 65,
Count = 3,
},
{
Time = 80,
Count = 4,
},
{
Time = 95,
Count = 4,
},
{
Time = 110,
Count = 4,
},
}
self.vCaptainSchedule =
{
{
Time = 5,
Count = 1,
},
{
Time = 20,
Count = 2,
},
{
Time = 35,
Count = 2,
},
{
Time = 50,
Count = 2,
},
{
Time = 65,
Count = 2,
},
{
Time = 80,
Count = 3,
},
{
Time = 95,
Count = 3,
},
{
Time = 110,
Count = 3,
},
}
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_small_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_dota_creature_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_v2_peon", "portal_v2_peon", 16, 8, 0.8,
{
{
EntityName = "npc_dota_creature_small_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 4,
PositionNoise = 0.0,
},
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_v2_captain", "portal_v2_captain", 70, 8, 1.5,
{
{
EntityName = "npc_dota_creature_hellbear",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.5 )
self:SetSpawnerSchedule( "spawner_peon", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_captain_trigger", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "portal_v2_peon", self.vPeonSchedule )
self:SetSpawnerSchedule( "portal_v2_captain", self.vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:GetPreviewUnit()
return "npc_dota_creature_hellbear"
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:Start()
CMapEncounter.Start( self )
local spawnerFocusPath = self:GenerateSpawnFocusPath( "portal_v2_captain", 300, 1000 )
self:AssignSpawnFocusPath( "portal_v2_peon", spawnerFocusPath )
self:AssignSpawnFocusPath( "portal_v2_captain", spawnerFocusPath )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:InitializeObjectives()
--CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, 0 )
self:AddEncounterObjective( "survive_waves", 0, #self.vCaptainSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnPortalV2Killed( hVictim, hAttacker, nUnitCountSuppressed )
CMapEncounter.OnPortalV2Killed( self, hVictim, hAttacker, nUnitCountSuppressed )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + nUnitCountSuppressed, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Hellbears:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
if hSpawner.szSpawnerName == "portal_v2_captain" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
--print( "CMapEncounter_Hellbears:OnSpawnerFinished " )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Hellbears

View File

@@ -0,0 +1,47 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_trap_base" )
--------------------------------------------------------------------------------
if CMapEncounter_HellfireCanyon == nil then
CMapEncounter_HellfireCanyon = class( {}, {}, CMapEncounter_TrapBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_HellfireCanyon:GetPreviewUnit()
return "npc_dota_breathe_fire_trap"
end
--------------------------------------------------------------------------------
function CMapEncounter_HellfireCanyon:CheckForCompletion()
if not IsServer() then
return
end
local bIsComplete = CMapEncounter_TrapBase.CheckForCompletion( self )
if bIsComplete then
self:DisableTraps()
end
return bIsComplete
end
--------------------------------------------------------------------------------
function CMapEncounter_HellfireCanyon:DisableTraps()
--print("Disabling Traps!")
-- Disable any traps in the map
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
--local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_HellfireCanyon

View File

@@ -0,0 +1,46 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_trap_base" )
--------------------------------------------------------------------------------
if CMapEncounter_JungleFireMaze == nil then
CMapEncounter_JungleFireMaze = class( {}, {}, CMapEncounter_TrapBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleFireMaze:GetPreviewUnit()
return "npc_dota_breathe_fire_trap"
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleFireMaze:CheckForCompletion()
if not IsServer() then
return
end
local bIsComplete = CMapEncounter_TrapBase.CheckForCompletion( self )
if bIsComplete then
self:DisableTraps()
end
return bIsComplete
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleFireMaze:DisableTraps()
--print("Disabling Traps!")
-- Disable any traps in the map
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
--local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_JungleFireMaze

View File

@@ -0,0 +1,109 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_JungleHijinx == nil then
CMapEncounter_JungleHijinx = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleHijinx:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_huskar", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_dazzle", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_dazzle.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_huskar.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleHijinx:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_wildwing_laborer",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 150.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_dazzle", "spawner_dazzle",
{
{
EntityName = "npc_dota_creature_dazzle",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_huskar", "spawner_huskar",
{
{
EntityName = "npc_dota_creature_huskar",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:SetSpawnerSchedule( "spawner_peon", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_dazzle", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_huskar", nil ) -- means spawn once when triggered
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleHijinx:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleHijinx:GetPreviewUnit()
return "npc_dota_creature_huskar"
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleHijinx:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_JungleHijinx:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerName() == "spawner_huskar" then
for _,hUnit in pairs ( hSpawnedUnits ) do
if hUnit then
local hBurningSpears = hUnit:FindAbilityByName( "huskar_burning_spear" )
if hBurningSpears then
hBurningSpears:ToggleAutoCast()
end
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_JungleHijinx

View File

@@ -0,0 +1,183 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_KunkkaTide == nil then
CMapEncounter_KunkkaTide = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_tidehunter", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_kunkka", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_tidehunter.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_kunkka.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
local bInvulnerable = true
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self.szBossSpawner = "spawner_boss"
-- Peon:
self.vPeonSchedule =
{
{
Time = 0,
Count = 2,
},
{
Time = 20,
Count = 2,
},
{
Time = 40,
Count = 2,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_peon", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_tidehunter_mini",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
{
EntityName = "npc_dota_creature_tidehunter_medium",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_peon", self.vPeonSchedule )
-- Captain:
self.vCaptainSchedule =
{
{
Time = 20,
Count = 1,
},
{
Time = 40,
Count = 1,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_captain", "spawner_captain", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_kunkka_medium",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_captain", self.vCaptainSchedule )
-- Boss:
self.vBossSchedule =
{
{
Time = 0,
Count = 1,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_boss", "spawner_boss", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_tidehunter_large",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_boss", self.vBossSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:GetPreviewUnit()
return "npc_dota_creature_tidehunter_medium"
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
--self:AddEncounterObjective( "survive_waves", 0, #self.vPeonSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:Start()
CMapEncounter.Start( self )
--self:StartSpawnerSchedule( self.szPeonSpawner, 6 )
--self:StartSpawnerSchedule( self.szCaptainSpawner, 6 )
--self:StartSpawnerSchedule( self.szBossSpawner, 6 )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_KunkkaTide:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Hellbears:OnSpawnerFinished " )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "WARNING: Can't find a living hero and the objective entitiy is missing!" )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_KunkkaTide

View File

@@ -0,0 +1,289 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_LegionCommander == nil then
CMapEncounter_LegionCommander = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.bInitialSpawn = true
self.bTrapsEnabled = false
self.nTrapTimer = 0
self:SetCalculateRewardsFromUnitCount( true )
local bInvulnerable = true
-- bespoke version:
self.vPeonSchedule =
{
{
Time = 0,
Count = 2,
},
{
Time = 20,
Count = 2,
},
{
Time = 40,
Count = 3,
},
{
Time = 60,
Count = 3,
},
}
--DeepPrintTable( self.vPeonSchedule )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_peon", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_gladiator_creep",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 100.0,
},
{
EntityName = "npc_dota_creature_skywrath_mage",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 100.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_peon", self.vPeonSchedule )
-- Captain:
self.vCaptainSchedule =
{
{
Time = 0,
Count = 1,
},
{
Time = 20,
Count = 1,
},
{
Time = 40,
Count = 2,
},
{
Time = 60,
Count = 2,
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_captain", "spawner_captain", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_legion_commander",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_captain", self.vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_creature_gladiator_creep", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_skywrath_mage", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_legion_commander", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_skywrath_mage.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_legion_commander.vsndevts", context )
PrecacheResource( "particle", "particles/econ/events/ti10/emblem/ti10_emblem_effect_gem_ring.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:GetPreviewUnit()
return "npc_dota_creature_legion_commander"
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vPeonSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:ShouldAutoStartGlobalAscensionAbilities()
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:Start()
CMapEncounter.Start( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if self.bInitialSpawn == true then
--self:SpawnTowers()
self.bInitialSpawn = false
end
if hSpawner.szSpawnerName == "spawner_peon" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
--print( "CMapEncounter_Brewmaster:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:OnTriggerStartTouch( event )
CMapEncounter.OnTriggerStartTouch( self, event )
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
printf( "szTriggerName: %s, hUnit:GetUnitName(): %s, hTriggerEntity:GetName(): %s", szTriggerName, hUnit:GetUnitName(), hTriggerEntity:GetName() )
if self.bCreatureSpawnsActivated == nil and szTriggerName == "trigger_spawn_creatures" then
self.bCreatureSpawnsActivated = true
self:StartGlobalAscensionAbilities()
self:StartAllSpawnerSchedules( 0 )
self.bTrapsEnabled = true
printf( "Unit \"%s\" triggered creature spawning!", hUnit:GetUnitName() )
EmitGlobalSound( "RoundStart" )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:OnThink()
CMapEncounter.OnThink( self )
if self.bTrapsEnabled == true then
self.nTrapTimer = self.nTrapTimer + 1
end
if self.nTrapTimer == 1 then
self:FireArrowTrap1()
elseif self.nTrapTimer == 2 then
self:FireArrowTrap2()
elseif self.nTrapTimer == 3 then
self:FireArrowTrap3()
elseif self.nTrapTimer == 4 then
self:FireArrowTrap4()
self.nTrapTimer = 0
end
end
function CMapEncounter_LegionCommander:FireArrowTrap1()
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "arrow_trap_01_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
function CMapEncounter_LegionCommander:FireArrowTrap2()
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "arrow_trap_02_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
function CMapEncounter_LegionCommander:FireArrowTrap3()
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "arrow_trap_03_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
function CMapEncounter_LegionCommander:FireArrowTrap4()
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "arrow_trap_04_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:CheckForCompletion()
if self.bInitialSpawn == false then
if not self:HasRemainingEnemies() and self:AreScheduledSpawnsComplete() and not self:HasAnyPortals() then
self.bTrapsEnabled = false
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
return true
end
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_LegionCommander:OnComplete()
CMapEncounter.OnComplete( self )
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and not hHero:IsNull() and hHero:IsRealHero() then
hHero:RemoveModifierByName( "modifier_legion_commander_duel_damage_boost" )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_LegionCommander
--------------------------------------------------------------------------------

View File

@@ -0,0 +1,157 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Mirana == nil then
CMapEncounter_Mirana = class( {}, {}, CMapEncounter )
end
function CMapEncounter_Mirana:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Initial Spawns
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_luna_mini",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
-- Wave Spawns
local vPeonSchedule =
{
{
Time = 0,
Count = 4,
},
{
Time = 16,
Count = 5,
},
{
Time = 32,
Count = 5,
},
{
Time = 48,
Count = 5,
},
{
Time = 64,
Count = 6,
},
{
Time = 80,
Count = 6,
},
}
local vCaptainSchedule =
{
{
Time = 0,
Count = 2,
},
{
Time = 16,
Count = 2,
},
{
Time = 32,
Count = 2,
},
{
Time = 48,
Count = 2,
},
{
Time = 64,
Count = 2,
},
{
Time = 80,
Count = 3,
},
}
local nPeonPortalHealth = 10 * hRoom:GetDepth()
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_v2_peon", "portal_v2_peon", nPeonPortalHealth, 8, 0.7,
{
{
EntityName = "npc_dota_creature_luna_mini",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
} ), vPeonSchedule )
local nCaptainPortalHealth = 30 * hRoom:GetDepth()
self:AddPortalSpawnerV2( CPortalSpawnerV2( "portal_v2_captain", "portal_v2_captain", nCaptainPortalHealth, 8, 1.3,
{
{
EntityName = "npc_dota_creature_mirana",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ), vCaptainSchedule )
self:SetSpawnerSchedule( "spawner_peon", { { Time = 0, Count = 12 } } )
self:SetSpawnerSchedule( "portal_v2_peon", vPeonSchedule )
self:SetSpawnerSchedule( "portal_v2_captain", vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Mirana:GetPreviewUnit()
return "npc_dota_creature_mirana"
end
--------------------------------------------------------------------------------
function CMapEncounter_Mirana:Start()
CMapEncounter.Start( self )
self:StartSpawnerSchedule( "spawner_peon", 0 )
self:StartSpawnerSchedule( "portal_v2_peon", 4 )
self:StartSpawnerSchedule( "portal_v2_captain", 4 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Mirana:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Hellbears:OnSpawnerFinished " )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "WARNING: Can't find a living hero and the objective entitiy is missing!" )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Mirana

View File

@@ -0,0 +1,207 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Morphlings_B == nil then
CMapEncounter_Morphlings_B = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szPeonSpawner = "spawner_peon"
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_tiny_crab",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 225.0,
},
} ) )
self.szPeonPortalV2 = "portal_v2_peon"
self.szCaptainPortalV2 = "portal_v2_captain"
local vPeonSchedule =
{
{
Time = 5,
Count = 4,
},
{
Time = 40,
Count = 5,
},
{
Time = 75,
Count = 6,
},
{
Time = 110,
Count = 7,
},
}
self.vCaptainSchedule =
{
{
Time = 5,
Count = 2,
},
{
Time = 40,
Count = 3,
},
{
Time = 75,
Count = 3,
},
{
Time = 110,
Count = 4,
},
}
-- szSpawnerNameInput, nPortalHealthInput, flSummonTimeInput, flScaleInput, rgUnitsInfoInput
local nSmallPortalHealth = 12 * hRoom:GetDepth()
local nBigPortalHealth = 40 * hRoom:GetDepth()
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPeonPortalV2, self.szPeonPortalV2, nSmallPortalHealth, 6, 0.7,
{
{
EntityName = "npc_dota_creature_tiny_crab",
Team = DOTA_TEAM_BADGUYS,
Count = 4,
PositionNoise = 0.0,
},
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szCaptainPortalV2, self.szCaptainPortalV2, nBigPortalHealth, 6, 1.3,
{
{
EntityName = "npc_dota_creature_morphling_big",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
} ) )
self:SetSpawnerSchedule( self.szPeonPortalV2, vPeonSchedule )
self:SetSpawnerSchedule( self.szCaptainPortalV2, self.vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:InitializeObjectives()
--CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, 0 )
self:AddEncounterObjective( "survive_waves", 0, #self.vCaptainSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:GetMaxSpawnedUnitCount()
local nCount = 0
-- Standing trash
local hPeonSpawners = self:GetSpawner( "spawner_peon")
if hPeonSpawners then
nCount = nCount + hPeonSpawners:GetSpawnPositionCount() * 2
end
-- Peons = 88
nCount = nCount + 88
-- Captains = 24
nCount = nCount + 24
-- Total should be 124
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:OnPortalV2Killed( hVictim, hAttacker, nUnitCountSuppressed )
CMapEncounter.OnPortalV2Killed( self, hVictim, hAttacker, nUnitCountSuppressed )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + nUnitCountSuppressed, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
------------
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:GetPreviewUnit()
return "npc_dota_creature_morphling_big"
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:Start()
CMapEncounter.Start( self )
self:CreateUnits()
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:CreateUnits()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Morphlings_B:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
if hSpawner.szSpawnerName == "portal_v2_captain" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
--print( "CMapEncounter_Morphlings_B:OnSpawnerFinished " )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[ RandomInt( 1, #heroes ) ]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Morphlings_B

View File

@@ -0,0 +1,271 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_bonus_base" )
--------------------------------------------------------------------------------
if CMapEncounter_MortyTransition == nil then
CMapEncounter_MortyTransition = class( {}, {}, CMapEncounter_BonusBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:constructor( hRoom, szEncounterName )
CMapEncounter_BonusBase.constructor( self, hRoom, szEncounterName )
LinkLuaModifier( "modifier_morty_start_passive", "modifiers/creatures/modifier_morty_start_passive", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_ride_morty", "modifiers/modifier_ride_morty", LUA_MODIFIER_MOTION_BOTH )
self.nGoldPerBag = 25
self.flMortyTimeLimit = 45.0
self:AddSpawner( CDotaSpawner( "morty_spawner", "morty_spawner",
{
{
EntityName = "npc_aghsfort_morty",
Team = DOTA_TEAM_GOODGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:Precache( context )
CMapEncounter_BonusBase.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_snapfire/hero_snapfire_cookie_receive.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_snapfire/hero_snapfire_cookie_landing.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_life_stealer/life_stealer_infested_unit.vpcf", context )
PrecacheResource( "particle", "particles/dev/library/base_follow_absorigin_continuous.vpcf", context )
PrecacheResource( "particle", "particles/gameplay/location_hint_goal.vpcf", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_snapfire.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:GetPreviewUnit()
return "npc_aghsfort_morty"
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:OnEncounterLoaded()
CMapEncounter_BonusBase.OnEncounterLoaded( self )
self:SetupBristlebackShop( true )
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:InitializeObjectives()
self:AddEncounterObjective( "objective_saddle_up_on_morty", 0, 4 )
self:AddEncounterObjective( "objective_jump_to_collect_gold", 0, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:Start()
CMapEncounter_BonusBase.Start( self )
self.nAbilityListener = ListenToGameEvent( "dota_non_player_used_ability", Dynamic_Wrap( getclass( self ), "OnNonPlayerUsedAbility" ), self )
self.flEndTime = 99999999999999999
self.Morties = {}
local hUnits = self:GetSpawner( "morty_spawner" ):SpawnUnits()
local nPlayerID = 0
for _,hMorty in pairs ( hUnits ) do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
hPlayerHero:AddNewModifier( hPlayerHero, nil, "modifier_bonus_room_start", {} )
end
hMorty:SetControllableByPlayer( nPlayerID, true )
hMorty:SetOwner( hPlayerHero )
local hBuff = hMorty:AddNewModifier( hMorty, nil, "modifier_morty_start_passive", {} )
if hBuff then
hBuff.Encounter = self
end
local kv =
{
min_x = self:GetRoom():GetMins().x + 1000,
min_y = self:GetRoom():GetMins().y + 2500,
max_x = self:GetRoom():GetMaxs().x - 3500,
max_y = self:GetRoom():GetMaxs().y - 550,
}
hMorty:AddNewModifier( hMorty, nil, "modifier_morty_leash", kv )
table.insert( self.Morties, hMorty )
hMorty.nFXIndex = ParticleManager:CreateParticleForPlayer( "particles/gameplay/location_hint_goal.vpcf", PATTACH_WORLDORIGIN, nil, PlayerResource:GetPlayer( nPlayerID ) )
ParticleManager:SetParticleControl( hMorty.nFXIndex, 0, hMorty:GetAbsOrigin() )
ParticleManager:SetParticleControl( hMorty.nFXIndex, 1, Vector( 1.0, 0.8, 0.2 ) )
local vLocation = hMorty:GetAbsOrigin()
local WorldTextHint = {}
WorldTextHint["hint_text"] = "hint_ride_morty"
WorldTextHint["command"] = 18 -- DOTA_KEYBIND_HERO_MOVE
WorldTextHint["ent_index"] = -1
WorldTextHint["location_x"] = vLocation.x
WorldTextHint["location_y"] = vLocation.y
WorldTextHint["location_z"] = vLocation.z
CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer( nPlayerID ), "start_world_text_hint", WorldTextHint )
nPlayerID = nPlayerID + 1
end
self.nGoldForBags = self.nGoldReward * AGHANIM_PLAYERS
self.nGoldReward = 0
local hTrigger = self:GetRoom():FindAllEntitiesInRoomByName( "gold_bag_trigger", false )
if hTrigger[ 1 ] then
local vMins = hTrigger[ 1 ]:GetBoundingMins()
local vMaxs = hTrigger[ 1 ]:GetBoundingMaxs()
vMins = hTrigger[ 1 ]:TransformPointEntityToWorld( vMins )
vMaxs = hTrigger[ 1 ]:TransformPointEntityToWorld( vMaxs )
local flMinHeight = 0
local flMaxHeight = 128
self.GoldBags = {}
for i=1,300 do
local flHeight = flMinHeight
local nHigh = math.random( 0, 1 )
if nHigh == 1 then
flHeight = flMaxHeight
end
local vGoldBagPos = Vector( RandomFloat( vMins.x, vMaxs.x ), RandomFloat( vMins.y, vMaxs.y ), vMins.z )
self.nGoldForBags = self.nGoldForBags - self.nGoldPerBag
local newItem = CreateItem( "item_bag_of_gold", nil, nil )
newItem:SetPurchaseTime( 0 )
newItem:SetCurrentCharges( self.nGoldPerBag )
-- Bump the height up by a constant amount over the ground minimally
-- NOTE: We don't have to take flGroundHeight into account here
-- because CreateItemOnPositionSync will automatically drop to ground
flHeight = flHeight + 128
-- NOTE: CreateItemOnPositionSync will drop the item to the ground,
-- so the z height is going to be ignored
-- However, LaunchLootRequiredHeight will fix it back up for us.
local drop = CreateItemOnPositionSync( vGoldBagPos, newItem )
drop:SetModelScale( 1.5 )
newItem:LaunchLootRequiredHeight( true, flHeight, flHeight, 0.75, vGoldBagPos )
table.insert( self.GoldBags, newItem )
end
else
print( "trigger not found" )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:OnThink()
CMapEncounter_BonusBase.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:OnPlayerRideMorty( nPlayerID, hMorty )
ParticleManager:DestroyParticle( hMorty.nFXIndex, true )
CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer( nPlayerID ), "stop_world_text_hint", {} )
PlayerResource:SetCameraTarget( nPlayerID, hMorty )
PlayerResource:SetOverrideSelectionEntity( nPlayerID, hMorty )
local nCurrentValue = self:GetEncounterObjectiveProgress( "objective_saddle_up_on_morty" )
local nSaddledPlayers = nCurrentValue + 1
self:UpdateEncounterObjective( "objective_saddle_up_on_morty", nSaddledPlayers, nil )
local nPlayerCount = 0
for nPlayerID = 0, AGHANIM_PLAYERS - 1 do
if PlayerResource:GetTeam( nPlayerID ) == DOTA_TEAM_GOODGUYS and PlayerResource:IsValidPlayerID( nPlayerID ) then
nPlayerCount = nPlayerCount + 1
end
end
if nSaddledPlayers >= nPlayerCount then
self:StartBonusRound( self.flMortyTimeLimit )
for _,hMorty in pairs ( self.Morties ) do
hMorty:RemoveModifierByName( "modifier_morty_start_passive" )
local vLocation = hMorty:GetAbsOrigin()
local WorldTextHint = {}
WorldTextHint["hint_text"] = "hint_hop_with_morty"
WorldTextHint["command"] = 53 -- DOTA_KEYBIND_ABILITY_PRIMARY1
WorldTextHint["ent_index"] = -1
WorldTextHint["location_x"] = vLocation.x
WorldTextHint["location_y"] = vLocation.y
WorldTextHint["location_z"] = vLocation.z
CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer( hMorty:GetPlayerOwnerID() ), "start_world_text_hint", WorldTextHint )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_MortyTransition:OnComplete()
CMapEncounter_BonusBase.OnComplete( self )
StopListeningToGameEvent( self.nAbilityListener )
StopListeningToGameEvent( self.nItemPickedUpListener )
for _,hMorty in pairs ( self.Morties ) do
hMorty:SetControllableByPlayer( -1, true )
hMorty:SetOwner( nil )
end
for nPlayerID=0,AGHANIM_PLAYERS-1 do
local hHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hHero then
hHero:RemoveModifierByName( "modifier_bonus_room_start" )
hHero:RemoveModifierByName( "modifier_ride_morty" )
PlayerResource:SetCameraTarget( nPlayerID, nil )
PlayerResource:SetOverrideSelectionEntity( nPlayerID, nil )
local hEndPosition = self:GetRoom():FindAllEntitiesInRoomByName( "bonus_room_end_position", true )
FindClearSpaceForUnit( hHero, hEndPosition[1]:GetAbsOrigin(), true )
CenterCameraOnUnit( nPlayerID, hHero )
end
end
for _,GoldBag in pairs ( self.GoldBags ) do
if GoldBag and not GoldBag:IsNull() then
UTIL_Remove( GoldBag:GetContainer() )
UTIL_Remove( GoldBag )
end
end
end
---------------------------------------------------------
-- dota_non_player_used_ability
-- * abilityname
-- * caster_entindex
---------------------------------------------------------
function CMapEncounter_MortyTransition:OnNonPlayerUsedAbility( event )
local szAbilityName = event.abilityname
local hCaster = EntIndexToHScript( event.caster_entindex )
if hCaster and szAbilityName == "morty_hop" then
for _,hMorty in pairs ( self.Morties ) do
if hMorty == hCaster then
CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer( hMorty:GetPlayerOwnerID() ), "stop_world_text_hint", {} )
break
end
end
end
end
-----------------------------------------
return CMapEncounter_MortyTransition

View File

@@ -0,0 +1,203 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_MushroomMines == nil then
CMapEncounter_MushroomMines = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.nNumShroomGiantSpawners = 3
self.fShamanSpawnTimer = -1.0
self.fShamanRespawnTimeMin = 3.0
self.fShamanRespawnTimeMax = 7.0
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_shroomling",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 500.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain", "spawner_captain",
{
{
EntityName = "npc_dota_creature_shroom_giant",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
}
} ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "shaman_portal", "shaman_portal", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_shadow_shaman",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, true
) )
-- DON'T SET SCHEDULES FOR THESE
--self:SetSpawnerSchedule( "spawner_captain", nil )
--self:SetSpawnerSchedule( "spawner_peon", nil )
--self:SetSpawnerSchedule( "shaman_portal", nil )
self.bShroomGiantsKilled = false
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:InitializeObjectives()
self.nTotalGiants = self.nNumShroomGiantSpawners
self:AddEncounterObjective( "kill_shroom_giants", 0, self.nTotalGiants )
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:OnThink()
CMapEncounter.OnThink( self )
if self.fShamanSpawnTimer > 0 and self.fShamanSpawnTimer < GameRules:GetGameTime() then
print( 'Shaman ready to spawn!' )
local hShamanPortal = self:GetPortalSpawnerV2( "shaman_portal" )
hShamanPortal:SpawnUnitsFromRandomSpawners( 1 )
self.fShamanSpawnTimer = -1.0 -- this will be reset when the shaman is killed
end
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_MushroomMines:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_dota_creature_shadow_shaman" then
return false
end
return true
end
--]]
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if hVictim and hVictim:GetUnitName() == "npc_dota_creature_shroom_giant" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "kill_shroom_giants" )
nCurrentValue = nCurrentValue + 1
self:UpdateEncounterObjective( "kill_shroom_giants", nCurrentValue, nil )
--print( 'Updating kills objective to ' .. nCurrentValue )
if nCurrentValue >= self.nTotalGiants then
self.bShroomGiantsKilled = true
self:AddEncounterObjective( "defeat_all_enemies", 0, 0 )
self:WakeUpShroomlings()
end
elseif hVictim and hVictim:GetUnitName() == "npc_dota_creature_shadow_shaman" then
print( 'Shadow Shaman killed!' )
self:SetShamanRespawnTimer()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:SetShamanRespawnTimer()
local fTimer = RandomFloat( self.fShamanRespawnTimeMin, self.fShamanRespawnTimeMax )
self.fShamanSpawnTimer = GameRules:GetGameTime() + fTimer
print( 'Shadow Shaman spawn set for GetGameTime() + ' .. fTimer )
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:WakeUpShroomlings()
local vecShroomlings = self:GetSpawnedUnitsOfType( "npc_dota_creature_shroomling" )
print( 'Waking up ' .. #vecShroomlings .. " Shroomlings")
if #vecShroomlings > 0 then
for _,hUnit in pairs ( vecShroomlings ) do
local flWakeTime = RandomFloat( 2.0, 15.0 )
print( 'Wake up time set to ' .. flWakeTime )
local hSleepBuff = hUnit:FindModifierByName( "modifier_shroomling_sleep" )
if hSleepBuff ~= nil then
hSleepBuff:SetDuration( flWakeTime, true )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:GetPreviewUnit()
return "npc_dota_creature_shroom_giant"
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:GetMaxSpawnedUnitCount()
local nCount = 0
for _,Spawner in pairs ( self.Spawners ) do
nCount = nCount + self:ComputeUnitsSpawnedBySchedule( Spawner )
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:Start()
CMapEncounter.Start( self )
-- spawn a set number of captains from the available spawners
local GiantSpawner = self:GetSpawner( "spawner_captain" )
GiantSpawner:SpawnUnitsFromRandomSpawners( self.nNumShroomGiantSpawners )
-- spawn standing trash at half of the peon spawn locations
local ShroomSpawner = self:GetSpawner( "spawner_peon" )
local nSpawnPositionCount = ShroomSpawner:GetSpawnPositionCount()
ShroomSpawner:SpawnUnitsFromRandomSpawners( nSpawnPositionCount / 2 )
self:SetShamanRespawnTimer()
end
--------------------------------------------------------------------------------
function CMapEncounter_MushroomMines:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_Pinecones:OnSpawnerFinished" )
if hSpawner:GetSpawnerType() == "CPortalSpawnerV2" then -- only aggro the shamans that pop out of the spawners
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
end
return CMapEncounter_MushroomMines

View File

@@ -0,0 +1,309 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_NagaSiren == nil then
CMapEncounter_NagaSiren = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.bMinesSpawned = false
self.nMinesToDestroy = 4
self.nMinesDestroyed = 0
self.bInitialSpawn = false
self.bSongUsed = false
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_slark_peon",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 100.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain", "spawner_captain",
{
{
EntityName = "npc_dota_creature_naga_siren_illusion",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
-- Reinforcements:
local bInvulnerable = true
local vBossSchedule = { { Time = 0, Count = 1 } }
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_boss", "spawner_boss", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_naga_siren_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
{
EntityName = "npc_dota_creature_naga_siren_illusion",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 300.0,
},
}, bInvulnerable
) )
local vReinforcementsSchedule = { { Time = 0, Count = 4 } }
self:AddPortalSpawnerV2( CPortalSpawnerV2( "dynamic_portal", "dynamic_portal", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_slark_peon",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 100.0,
},
{
EntityName = "npc_dota_creature_naga_siren_illusion",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_peon", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_captain", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_boss", vBossSchedule )
self:SetSpawnerSchedule( "dynamic_portal", vReinforcementsSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:GetPreviewUnit()
return "npc_dota_creature_naga_siren_boss"
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_siren", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_siren.vsndevts", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_slark", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_slark.vsndevts", context )
PrecacheUnitByNameSync( "npc_dota_underwater_mine", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:GetMaxSpawnedUnitCount()
local nCount = 0
-- 5 Peon Spawners
local hPeonSpawners = self:GetSpawner( "spawner_peon" )
if hPeonSpawners then
nCount = nCount + hPeonSpawners:GetSpawnPositionCount() * 2
end
-- 4 Captain Spawners
local hCaptainSpawners = self:GetSpawner( "spawner_captain" )
if hCaptainSpawners then
nCount = nCount + hCaptainSpawners:GetSpawnPositionCount()
end
--[[
-- 1 Boss Spawner
local hBossSpawners = self:GetSpawner( "spawner_boss" )
if hBossSpawners then
nCount = nCount + hBossSpawners:GetSpawnPositionCount() * 4
end
-- 4 Dynamic Portals
local hReinforcementsSpawners = self:GetSpawner( "dynamic_portal" )
if hBossSpawners then
nCount = nCount + hReinforcementsSpawners:GetSpawnPositionCount() * 3
end
]]
print( "Number of enemies = " .. nCount )
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:Start()
CMapEncounter.Start( self )
self:CreateUnits()
ListenToGameEvent( "dota_non_player_used_ability", Dynamic_Wrap( getclass( self ), "OnAbilityUsed" ), self )
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self.nEnemies = self:GetMaxSpawnedUnitCount()
self:AddEncounterObjective( "defeat_all_enemies", 0, self.nEnemies )
self:AddEncounterObjective( "destroy_all_mines", self.nMinesDestroyed, self.nMinesToDestroy )
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:CheckForCompletion()
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
if not self.bInitialSpawn then
return false
end
if nCurrentValue >= self.nEnemies and self.nMinesDestroyed == self.nMinesToDestroy then
return true
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:CreateUnits()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
if not self.bMinesSpawned then
self:SpawnMines()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
self.bInitialSpawn = true
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
else
print( "WARNING: Can't find a living hero and the objective entity is missing!" )
hSpawnedUnit:MoveToPosition( self.hRoom:GetOrigin() )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:SpawnMines()
--print("Spawning mines")
local goalUnits = Entities:FindAllByName( "spawner_mine" )
local mineUnit = "npc_dota_underwater_mine"
for _, goalUnit in pairs(goalUnits) do
local hUnit = CreateUnitByName( mineUnit, goalUnit:GetAbsOrigin(), true, nil, nil, DOTA_TEAM_BADGUYS )
if hUnit ~= nil then
--print("Placing a mine")
hUnit:SetForwardVector( RandomVector( 1 ) )
end
end
self.bMinesSpawned = true
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:OnEntityKilled( event )
if not IsServer() then
return
end
if self.bMinesSpawned == false then
return
end
local killedUnit = EntIndexToHScript( event.entindex_killed )
if killedUnit == nil then
return
end
local killedUnit = EntIndexToHScript( event.entindex_killed )
if killedUnit == nil or killedUnit:GetTeam() == DOTA_TEAM_GOODGUYS then
return
end
if killedUnit:IsCreature() == true then
if killedUnit:GetUnitName() == "npc_dota_underwater_mine" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "destroy_all_mines" )
self:UpdateEncounterObjective( "destroy_all_mines", nCurrentValue + 1, nil )
self.nMinesDestroyed = self.nMinesDestroyed + 1
if self.nMinesDestroyed == self.nMinesToDestroy then
self:StartSpawnerSchedule( "spawner_boss", 0 )
self.nEnemies = self.nEnemies + 4
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies )
end
elseif killedUnit:GetUnitName() == "npc_dota_creature_slark_peon" or
killedUnit:GetUnitName() == "npc_dota_creature_naga_siren_illusion" or
killedUnit:GetUnitName() == "npc_dota_creature_naga_siren_boss" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, self.nEnemies )
if not self.bSongUsed then
if killedUnit:GetUnitName() == "npc_dota_creature_naga_siren_boss" then
-- Backup if Naga doesn't get to use Song
self.bSongUsed = true
self:StartSpawnerSchedule( "dynamic_portal", 0 )
self.nEnemies = self.nEnemies + 8
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies )
end
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_NagaSiren:OnAbilityUsed( event )
--print("Ability used")
-- Add to the enemy counter if Naga uses Mirror Image
if event.abilityname == "aghsfort_naga_siren_mirror_image" then
--print("Naga Illusion Spawned")
self.nEnemies = self.nEnemies + 1
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies )
end
-- Start the schedule for the Reinforcements if Naga uses Song
if not self.bSongUsed then
if event.abilityname == "naga_siren_song_of_the_siren" then
--print("Naga used Song!")
self.bSongUsed = true
self:StartSpawnerSchedule( "dynamic_portal", 0 )
self.nEnemies = self.nEnemies + 12
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_NagaSiren

View File

@@ -0,0 +1,172 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_OgreSeals == nil then
CMapEncounter_OgreSeals = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_OgreSeals:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
-- Pre-placed creatures (done this way to use a specific subset of existing map spawners)
self.vPeonSchedule =
{
{
Time = 0,
Count = 4,
},
}
self.vCaptainSchedule =
{
{
Time = 0,
Count = 2,
},
}
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_small_ogre_seal",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 225.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_large_ogre_seal",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
self:SetSpawnerSchedule( self.szPeonSpawner, self.vPeonSchedule )
self:SetSpawnerSchedule( self.szCaptainSpawner, self.vCaptainSchedule )
-- Portal-spawned creatures
local bInvulnerable = true
self.vWaveSchedule =
{
{
Time = 15,
Count = 2,
},
{
Time = 35,
Count = 2,
},
{
Time = 55,
Count = 2,
},
{
Time = 75,
Count = 3,
},
}
--DeepPrintTable( self.vWaveSchedule )
self.szPortal = "dynamic_portal"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPortal, self.szPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_small_ogre_seal",
Team = DOTA_TEAM_BADGUYS,
Count = 5,
PositionNoise = 225.0,
},
{
EntityName = "npc_dota_creature_large_ogre_seal",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:SetSpawnerSchedule( self.szPortal, self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_OgreSeals:GetPreviewUnit()
return "npc_dota_creature_large_ogre_seal"
end
--------------------------------------------------------------------------------
function CMapEncounter_OgreSeals:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_OgreSeals:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWaveSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() ) -- does this capture the pre-placed spawns?
end
--------------------------------------------------------------------------------
function CMapEncounter_OgreSeals:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_OgreSeals:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
if hSpawner.szSpawnerName == self.szPortal then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
--print( heroes )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_OgreSeals

View File

@@ -0,0 +1,239 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_bonus_base" )
--------------------------------------------------------------------------------
if CMapEncounter_Pangolier == nil then
CMapEncounter_Pangolier = class( {}, {}, CMapEncounter_BonusBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:Precache( context )
CMapEncounter_BonusBase.Precache( self, context )
PrecacheModel( "models/heroes/pangolier/pangolier_gyroshell2.vmdl", context )
PrecacheModel( "models/items/rattletrap/mechanised_pilgrim_cog/mechanised_pilgrim_cog.vmdl", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_pangolier", context )
PrecacheResource( "particle", "particles/units/heroes/hero_centaur/centaur_warstomp.vpcf", context )
PrecacheResource( "particle", "particles/creatures/greevil/greevil_prison_bottom_ring.vpcf", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_pangolier.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_obsidian_destroyer.vsndevts", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_obsidian_destroyer", context )
LinkLuaModifier( "modifier_pango_bonus", "modifiers/modifier_pango_bonus", LUA_MODIFIER_MOTION_NONE )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:constructor( hRoom, szEncounterName )
CMapEncounter_BonusBase.constructor( self, hRoom, szEncounterName )
self.bAllButtonsReady = false
self.nPlayersReady = 0
self.nHeroOnTrigger1 = 0
self.nHeroOnTrigger2 = 0
self.nHeroOnTrigger3 = 0
self.nHeroOnTrigger4 = 0
self.bCogsSpawned = false
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_bonus_greevil",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 300.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain", "spawner_captain",
{
{
EntityName = "npc_dota_creature_evil_greevil",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:OnEncounterLoaded()
CMapEncounter_BonusBase.OnEncounterLoaded( self )
self:SetupBristlebackShop( false )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:Transform()
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and not hHero:IsNull() and hHero:IsRealHero() then
--printf( "Start - Transforming into gyroshell" )
local hAbility = hHero:AddAbility( "aghsfort_pangolier_gyroshell" )
hAbility:UpgradeAbility( true )
if hAbility ~= nil then
PlayerResource:SetCameraTarget( hHero:GetPlayerOwnerID(), hHero )
PlayerResource:SetOverrideSelectionEntity( hHero:GetPlayerOwnerID(), hHero )
hHero:AddNewModifier( hHero, hAbility, "modifier_pango_bonus", { duration = -1 } )
hHero:CastAbilityNoTarget( hAbility, hHero:GetPlayerOwnerID() )
--hHero:AddNewModifier( hHero, hAbility, "modifier_pangolier_gyroshell", { duration = -1 } )
else
printf( "Start - Can't find ability" )
end
end
end
if not self.bCogsSpawned then
self:SpawnCogs()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:SpawnCogs()
--print("Spawning cogs")
local cogUnits = Entities:FindAllByName( "spawner_cog" )
for _, goalUnit in pairs(cogUnits) do
local cogPos = goalUnit:GetAbsOrigin()
local cogTable =
{
origin = "0 0 0",
angles = "0 0 0",
targetname = "bumper_cog",
model = "models/items/rattletrap/mechanised_pilgrim_cog/mechanised_pilgrim_cog.vmdl",
scales = "2 2 2",
defaultanim = "ACT_DOTA_IDLE"
}
local hUnit = SpawnEntityFromTableSynchronous( "prop_dynamic", cogTable )
hUnit:SetAbsOrigin( cogPos )
end
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "arena_obstruction_enable_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
self.bCogsSpawned = true
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:RemoveCogs()
--print("Removing cogs")
local cogUnits = Entities:FindAllByName( "bumper_cog" )
local vPos = nil
for _, cogUnit in pairs(cogUnits) do
vPos = cogUnit:GetAbsOrigin()
UTIL_Remove(cogUnit)
end
-- Remove Evil Greevils
local creatures = FindUnitsInRadius( DOTA_TEAM_BADGUYS, vPos, nil, FIND_UNITS_EVERYWHERE, DOTA_UNIT_TARGET_TEAM_FRIENDLY, DOTA_UNIT_TARGET_ALL, DOTA_UNIT_TARGET_FLAG_NONE, 0, false )
for _, hUnit in pairs(creatures) do
if hUnit:GetUnitName() == "npc_dota_creature_evil_greevil" then
--print("Removing an Evil Greevil")
UTIL_Remove(hUnit)
end
end
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "arena_obstruction_disable_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:GetPreviewUnit()
return "npc_dota_creature_bonus_greevil"
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:OnTriggerStartTouch( event )
CMapEncounter_BonusBase.OnTriggerStartTouch( self, event )
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
if self.bAllButtonsReady == true then
return
end
if self.bGameStarted == false then
if szTriggerName == "trigger_player_1" then
self.nHeroOnTrigger1 = 1
elseif szTriggerName == "trigger_player_2" then
self.nHeroOnTrigger2 = 1
elseif szTriggerName == "trigger_player_3" then
self.nHeroOnTrigger3 = 1
elseif szTriggerName == "trigger_player_4" then
self.nHeroOnTrigger4 = 1
end
self.nPlayersReady = self.nHeroOnTrigger1 + self.nHeroOnTrigger2 + self.nHeroOnTrigger3 + self.nHeroOnTrigger4
local vecPlayers = GameRules.Aghanim:GetConnectedPlayers()
if #vecPlayers > 0 then
if self.nPlayersReady == #vecPlayers then
--print("All players ready!")
self.bAllButtonsReady = true
self:GetSpawner( "spawner_peon" ):SpawnUnits()
self:GetSpawner( "spawner_captain" ):SpawnUnits()
self:StartBonusRound( 41.2 ) -- account for gyroshell cast time
self:Transform()
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:OnTriggerEndTouch( event )
CMapEncounter_BonusBase.OnTriggerEndTouch( self, event )
if self.bAllButtonsReady == true then
return
end
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if szTriggerName == "trigger_player_1" then
self.nHeroOnTrigger1 = 0
elseif szTriggerName == "trigger_player_2" then
self.nHeroOnTrigger2 = 0
elseif szTriggerName == "trigger_player_3" then
self.nHeroOnTrigger3 = 0
elseif szTriggerName == "trigger_player_4" then
self.nHeroOnTrigger4 = 0
end
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_Pangolier:CheckForCompletion()
return self.bGameStarted == true and not self:HasRemainingEnemies()
end
]]
--------------------------------------------------------------------------------
function CMapEncounter_Pangolier:OnComplete()
CMapEncounter_BonusBase.OnComplete( self )
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and not hHero:IsNull() and hHero:IsRealHero() then
hHero:RemoveAbility( "pangolier_gyroshell" )
hHero:RemoveModifierByName( "modifier_pangolier_gyroshell" )
hHero:RemoveModifierByName( "modifier_pango_bonus" )
PlayerResource:SetCameraTarget( hHero:GetPlayerOwnerID(), nil )
PlayerResource:SetOverrideSelectionEntity( hHero:GetPlayerOwnerID(), nil )
end
end
if self.bCogsSpawned then
self:RemoveCogs()
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Pangolier

View File

@@ -0,0 +1,341 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_bonus_base" )
--------------------------------------------------------------------------------
if CMapEncounter_PenguinsTransition == nil then
CMapEncounter_PenguinsTransition = class( {}, {}, CMapEncounter_BonusBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:constructor( hRoom, szEncounterName )
CMapEncounter_BonusBase.constructor( self, hRoom, szEncounterName )
self.flPenguinTimeLimit = 55.0
self:AddSpawner( CDotaSpawner( "penguin_spawner", "penguin_spawner",
{
{
EntityName = "npc_dota_sled_penguin",
Team = DOTA_TEAM_GOODGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:Precache( context )
CMapEncounter_BonusBase.Precache( self, context )
PrecacheResource( "particle", "particles/gameplay/location_hint_goal.vpcf", context )
PrecacheUnitByNameSync( "npc_dota_creature_wandering_ogre_seal", context, -1 )
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:GetPreviewUnit()
return "npc_dota_sled_penguin"
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:OnEncounterLoaded()
CMapEncounter_BonusBase.OnEncounterLoaded( self )
self:SetupBristlebackShop( true )
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:InitializeObjectives()
self:AddEncounterObjective( "objective_saddle_up_on_penguin", 0, 4 )
self:AddEncounterObjective( "objective_sled_to_collect_gold", 0, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:Start()
CMapEncounter_BonusBase.Start( self )
if not IsServer() then
return
end
self.flEndTime = 99999999999999999
local hUnits = self:GetSpawner( "penguin_spawner" ):SpawnUnits()
self.Penguins = {}
local hFacingTargets = self:GetRoom():FindAllEntitiesInRoomByName( "penguin_facing_target", true )
local hFacingTarget = hFacingTargets[ 1 ]
local nPlayerID = 0
for _, hPenguin in pairs ( hUnits ) do
local hPlayerHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hPlayerHero then
hPlayerHero:AddNewModifier( hPlayerHero, nil, "modifier_bonus_room_start", {} )
end
hPenguin.Encounter = self
hPenguin:SetOwner( hPlayerHero )
hPenguin:FaceTowards( hFacingTarget:GetAbsOrigin() )
hPenguin.nFXIndex = ParticleManager:CreateParticleForPlayer( "particles/gameplay/location_hint_goal.vpcf", PATTACH_WORLDORIGIN, nil, PlayerResource:GetPlayer( nPlayerID ) )
local vArrowFXPos = hPenguin:GetAbsOrigin()
ParticleManager:SetParticleControl( hPenguin.nFXIndex, 0, vArrowFXPos )
ParticleManager:SetParticleControl( hPenguin.nFXIndex, 1, Vector( 1.0, 0.8, 0.2 ) )
local vLocation = hPenguin:GetAbsOrigin()
local WorldTextHint = {}
WorldTextHint["hint_text"] = "hint_ride_penguin"
WorldTextHint["command"] = 18 -- DOTA_KEYBIND_HERO_MOVE
WorldTextHint["ent_index"] = -1
WorldTextHint["location_x"] = vLocation.x
WorldTextHint["location_y"] = vLocation.y
WorldTextHint["location_z"] = vLocation.z
CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer( nPlayerID ), "start_world_text_hint", WorldTextHint )
table.insert( self.Penguins, hPenguin )
nPlayerID = nPlayerID + 1
end
self.fCoinPileCreationInterval = 0.5
self.fNextCoinPileSpawn = GameRules:GetGameTime() + self.fCoinPileCreationInterval
local nTotalGold = 5000 -- this is probably not needed since we have the self.nGoldForBags value
self.nTotalGoldBagsToSpawn = 475
self.nGoldPerBag = nTotalGold / self.nTotalGoldBagsToSpawn
--printf( "Start - self.nGoldPerBag: %d", self.nGoldPerBag )
self.nGoldForBags = self.nGoldReward * AGHANIM_PLAYERS
--printf( "Start - self.nGoldForBags: %d", self.nGoldForBags )
self.nGoldReward = 0
self.nMinCoinsPerTarget = 8
self.nMaxCoinsPerTarget = 8
self.nPreplacedBagsToSpawn = self.nTotalGoldBagsToSpawn / 3
self.GoldBags = {}
self.hPreplacedBagTargets = self:GetRoom():FindAllEntitiesInRoomByName( "gold_bag_target_preplaced", true )
self.hDynamicBagTargets = self:GetRoom():FindAllEntitiesInRoomByName( "gold_bag_target", true )
--printf( "#self.hDynamicBagTargets: %d", #self.hDynamicBagTargets )
for _, hBagTarget in pairs( self.hPreplacedBagTargets ) do
local nCoinSpawnsPerTarget = RandomInt( self.nMinCoinsPerTarget, self.nMaxCoinsPerTarget )
for i = 1, nCoinSpawnsPerTarget do
if TableLength( self.GoldBags ) >= self.nPreplacedBagsToSpawn then
break
end
local vGoldBagPos = self:GetValidCoinSpawnPos( hBagTarget )
self.nGoldForBags = self.nGoldForBags - self.nGoldPerBag
local newItem = CreateItem( "item_bag_of_gold", nil, nil )
newItem:SetPurchaseTime( 0 )
newItem:SetCurrentCharges( self.nGoldPerBag )
-- NOTE: CreateItemOnPositionSync will drop the item to the ground, so the z height is going to be ignored
-- However, LaunchLootRequiredHeight will fix it back up for us.
local drop = CreateItemOnPositionSync( vGoldBagPos, newItem )
--drop:SetModelScale( 1.5 )
local fHeight = 0
newItem:LaunchLootRequiredHeight( true, fHeight, fHeight, 0.75, vGoldBagPos )
table.insert( self.GoldBags, newItem )
end
end
--printf( "[preplaced] total gold bags: %d", #self.GoldBags )
-- Create wandering ogre seals
self.hOgreSeals = {}
self.hOgreSealSpawners = self:GetRoom():FindAllEntitiesInRoomByName( "ogre_seal", true )
--printf( "#self.hOgreSealSpawners: %d", #self.hOgreSealSpawners )
local nAscLevel = GameRules.Aghanim:GetAscensionLevel()
local nTotalOgreSealsToSpawn = 7 + ( 2 * nAscLevel )
--printf( "nTotalOgreSealsToSpawn: %d", nTotalOgreSealsToSpawn )
for i = 1, nTotalOgreSealsToSpawn do
if #self.hOgreSealSpawners > 0 then
local nRandomIndex = RandomInt( 1, #self.hOgreSealSpawners )
local hRandomOgreSealSpawner = self.hOgreSealSpawners[ nRandomIndex ]
local vSpawnPos = hRandomOgreSealSpawner:GetAbsOrigin()
local hOgreSeal = CreateUnitByName( "npc_dota_creature_wandering_ogre_seal", vSpawnPos, true, nil, nil, DOTA_TEAM_BADGUYS )
if hOgreSeal ~= nil then
table.insert( self.hOgreSeals, hOgreSeal )
table.remove( self.hOgreSealSpawners, nRandomIndex )
end
else
printf( "WARNING - self.hOgreSealSpawners is empty, can't spawn more seals" )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:OnThink()
CMapEncounter_BonusBase.OnThink( self )
if not IsServer() or GameRules:IsGamePaused() then
return
end
if not self.bGameStarted then
return
end
if self.bGameStarted and not self.bStartedMusic then
EmitGlobalSound( "BonusRoom.ParadeMusicLoop" )
self.bStartedMusic = true
end
if self:HasStarted() and not self:IsComplete() then
if TableLength( self.GoldBags ) >= self.nTotalGoldBagsToSpawn then
return
end
if GameRules:GetGameTime() >= self.fNextCoinPileSpawn then
local hRandomBagTarget = self.hDynamicBagTargets[ RandomInt( 1, #self.hDynamicBagTargets ) ]
local nCoinSpawnsPerTarget = RandomInt( self.nMinCoinsPerTarget, self.nMaxCoinsPerTarget )
for i = 1, nCoinSpawnsPerTarget do
if TableLength( self.GoldBags ) >= self.nTotalGoldBagsToSpawn then
break
end
local vGoldBagPos = self:GetValidCoinSpawnPos( hRandomBagTarget )
self.nGoldForBags = self.nGoldForBags - self.nGoldPerBag
local newItem = CreateItem( "item_bag_of_gold", nil, nil )
newItem:SetPurchaseTime( 0 )
newItem:SetCurrentCharges( self.nGoldPerBag )
-- NOTE: CreateItemOnPositionSync will drop the item to the ground, so the z height is going to be ignored
-- However, LaunchLootRequiredHeight will fix it back up for us.
local drop = CreateItemOnPositionSync( vGoldBagPos, newItem )
--drop:SetModelScale( 1.5 )
local fHeight = 0
newItem:LaunchLootRequiredHeight( true, fHeight, fHeight, 0.75, vGoldBagPos )
table.insert( self.GoldBags, newItem )
end
--printf( "[dynamic] total gold bags: %d", #self.GoldBags )
self.fNextCoinPileSpawn = GameRules:GetGameTime() + self.fCoinPileCreationInterval
end
--printf( "Total gold bags spawned: %d", TableLength( self.GoldBags ) )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:OnComplete()
CMapEncounter_BonusBase.OnComplete( self )
StopListeningToGameEvent( self.nItemPickedUpListener ) -- redundant? already done in BonusBase
for _, hPenguin in pairs ( self.Penguins ) do
hPenguin:SetOwner( nil )
hPenguin:RemoveModifierByName( "modifier_sled_penguin_passive" )
end
for nPlayerID = 0, AGHANIM_PLAYERS - 1 do
local hHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hHero then
hHero:RemoveModifierByName( "modifier_bonus_room_start" )
PlayerResource:SetCameraTarget( nPlayerID, nil )
PlayerResource:SetOverrideSelectionEntity( nPlayerID, nil )
local hEndPosition = self:GetRoom():FindAllEntitiesInRoomByName( "bonus_room_end_position", true )
FindClearSpaceForUnit( hHero, hEndPosition[1]:GetAbsOrigin(), true )
CenterCameraOnUnit( nPlayerID, hHero )
end
end
for _,GoldBag in pairs ( self.GoldBags ) do
if GoldBag and not GoldBag:IsNull() then
UTIL_Remove( GoldBag:GetContainer() )
UTIL_Remove( GoldBag )
end
end
for _, hOgreSeal in pairs ( self.hOgreSeals ) do
if hOgreSeal and not hOgreSeal:IsNull() then
UTIL_Remove( hOgreSeal )
end
end
StopGlobalSound( "BonusRoom.ParadeMusicLoop" )
end
---------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:GetValidCoinSpawnPos( hBagTarget )
local fMinOffset = 25
local fMaxOffset = 600
local vPos = hBagTarget:GetAbsOrigin() + RandomVector( RandomFloat( fMinOffset, fMaxOffset ) )
local nAttempts = 0
while ( ( not GridNav:CanFindPath( hBagTarget:GetOrigin(), vPos ) ) and ( nAttempts < 5 ) ) do
vPos = hBagTarget:GetOrigin() + RandomVector( fMaxOffset )
nAttempts = nAttempts + 1
if nAttempts >= 5 then
vPos = hBagTarget:GetOrigin()
end
end
return vPos
end
--------------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:OnPlayerRidePenguin( nPlayerID, hPenguin )
ParticleManager:DestroyParticle( hPenguin.nFXIndex, true )
CustomGameEventManager:Send_ServerToPlayer( PlayerResource:GetPlayer( nPlayerID ), "stop_world_text_hint", {} )
--PlayerResource:SetCameraTarget( nPlayerID, hPenguin )
--PlayerResource:SetOverrideSelectionEntity( nPlayerID, hPenguin )
local nCurrentValue = self:GetEncounterObjectiveProgress( "objective_saddle_up_on_penguin" )
local nSaddledPlayers = nCurrentValue + 1
self:UpdateEncounterObjective( "objective_saddle_up_on_penguin", nSaddledPlayers, nil )
local nPlayerCount = 0
for nPlayerID = 0, AGHANIM_PLAYERS - 1 do
if PlayerResource:GetTeam( nPlayerID ) == DOTA_TEAM_GOODGUYS and PlayerResource:IsValidPlayerID( nPlayerID ) then
nPlayerCount = nPlayerCount + 1
end
end
if nSaddledPlayers >= nPlayerCount then
self:DisableBlocker()
self:StartBonusRound( self.flPenguinTimeLimit )
end
end
---------------------------------------------------------------------------
function CMapEncounter_PenguinsTransition:DisableBlocker()
--print("Disabling Starting Blockers!")
-- Disable any nav blockers in the start
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "starting_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
---------------------------------------------------------------------------
return CMapEncounter_PenguinsTransition

View File

@@ -0,0 +1,154 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Phoenix == nil then
CMapEncounter_Phoenix = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Phoenix:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Portal-spawned creatures
self.vEmberSchedule =
{
{
Time = 3,
Count = 2,
},
{
Time = 18,
Count = 2,
},
{
Time = 33,
Count = 2,
},
{
Time = 48,
Count = 2,
},
}
self.vPhoenixSchedule =
{
{
Time = 3,
Count = 1,
},
{
Time = 20,
Count = 1,
},
{
Time = 35,
Count = 1,
},
{
Time = 50,
Count = 2,
},
}
local bInvulnerable = true
self.szEmberPortal = "portal_v2_ember"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szEmberPortal, self.szEmberPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_ember_spirit",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 150.0,
},
}, bInvulnerable ) )
self.szPhoenixPortal = "portal_v2_phoenix"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPhoenixPortal, self.szPhoenixPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_phoenix",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:SetSpawnerSchedule( self.szEmberPortal, self.vEmberSchedule )
self:SetSpawnerSchedule( self.szPhoenixPortal, self.vPhoenixSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Phoenix:GetPreviewUnit()
return "npc_dota_creature_phoenix"
end
--------------------------------------------------------------------------------
function CMapEncounter_Phoenix:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Phoenix:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
local nWaves = #self.vEmberSchedule + #self.vPhoenixSchedule
self:AddEncounterObjective( "survive_waves", 0, nWaves )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Phoenix:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Phoenix:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
if hSpawner.szSpawnerName == self.szEmberPortal or hSpawner.szSpawnerName == self.szPhoenixPortal then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
--print( heroes )
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Phoenix

View File

@@ -0,0 +1,263 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Pinecones == nil then
CMapEncounter_Pinecones = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
------------------------
-- Pre-placed units
------------------------
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_pinecone_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
}
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_dota_pinecone_champion",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
}
} ) )
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.8 )
self:SetSpawnerSchedule( "spawner_peon", { { Time = 0, Count = 16 } } ) -- spawn N units when triggered
self:SetSpawnerSchedule( "spawner_captain_trigger", nil ) -- means spawn once when triggered
------------------------
-- WAVE: A
------------------------
local nNumPortals = 1
self.nTotalPortals = nNumPortals
self.vWaveSchedule_A =
{
{
Time = 0,
Count = nNumPortals,
},
}
local PortalUnits_A =
{
{
EntityName = "npc_dota_pinecone_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 4,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_pinecone_champion",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
local bInvulnerable = true
local nHealth = 1
local fSummonTime = 5
local fModelScale = 1.0
local szLocatorNameA = "dynamic_portal_a"
local szNameA = szLocatorNameA
self:AddPortalSpawnerV2( CPortalSpawnerV2( szNameA, szLocatorNameA, nHealth, fSummonTime, fModelScale,
PortalUnits_A, bInvulnerable
) )
self:SetSpawnerSchedule( szLocatorNameA, self.vWaveSchedule_A )
------------------------
-- WAVE: B
------------------------
nNumPortals = 2
self.nTotalPortals = self.nTotalPortals + nNumPortals
self.vWaveSchedule_B =
{
{
Time = 15,
Count = nNumPortals,
},
}
local PortalUnits_B =
{
{
EntityName = "npc_dota_pinecone_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 5,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_pinecone_champion",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
local szLocatorNameB = "dynamic_portal_b"
local szNameB = szLocatorNameB
self:AddPortalSpawnerV2( CPortalSpawnerV2( szNameB, szLocatorNameB, nHealth, fSummonTime, fModelScale,
PortalUnits_B, bInvulnerable
) )
self:SetSpawnerSchedule( szLocatorNameB, self.vWaveSchedule_B )
------------------------
-- WAVE: C
------------------------
nNumPortals = 3
self.nTotalPortals = self.nTotalPortals + nNumPortals
self.vWaveSchedule_C =
{
{
Time = 30,
Count = nNumPortals,
},
}
local PortalUnits_C =
{
{
EntityName = "npc_dota_pinecone_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 7,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_pinecone_champion",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
}
local szLocatorNameC = "dynamic_portal_c"
local szNameC = szLocatorNameC
self:AddPortalSpawnerV2( CPortalSpawnerV2( szNameC, szLocatorNameC, nHealth, fSummonTime, fModelScale,
PortalUnits_C, bInvulnerable
) )
self:SetSpawnerSchedule( szLocatorNameC, self.vWaveSchedule_C )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:GetPreviewUnit()
return "npc_dota_pinecone_champion"
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:OnThink()
CMapEncounter.OnThink( self )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes <= 0 then
return
end
--print( "CMapEncounter_Pinecones:OnThink() - iterating through portal units" )
for _,hEnemy in pairs( self.SpawnedEnemies ) do
if hEnemy == nil or hEnemy:IsNull() or hEnemy:IsAlive() == false then
goto continue
end
if hEnemy.bPortalUnit ~= nil and hEnemy.bPortalUnit == true then
--print( "CMapEncounter_Pinecones:OnThink() -found a portal unit" )
local hAggroTarget = hEnemy:GetAggroTarget()
local hInitialGoalEnt = hEnemy:GetInitialGoalEntity()
if hAggroTarget == nil and hInitialGoalEnt == nil then
--print( "CMapEncounter_Pinecones:OnThink() - Found a portal unit that doesn't have an aggro target or a goal ent! Searching for a goal ent for this unit" )
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "CMapEncounter_Pinecones:OnThink() - Set initial goal entity for unit \"%s\" to \"%s\"", hEnemy:GetUnitName(), hero:GetUnitName() )
hEnemy:SetInitialGoalEntity( hero )
end
end
end
::continue::
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Pinecones:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_Pinecones:OnSpawnerFinished" )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Pinecones

View File

@@ -0,0 +1,181 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Pucks == nil then
CMapEncounter_Pucks = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pucks:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_elder_titan/elder_titan_earth_splitter.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_elder_titan/elder_titan_earth_splitter_move.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_elder_titan/elder_titan_echo_stomp_cast_combined.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_elder_titan/elder_titan_echo_stomp_cast_combined_detail.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_elder_titan/elder_titan_echo_stomp_physical.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_elder_titan/elder_titan_echo_stomp_magical.vpcf", context )
PrecacheResource( "particle", "particles/creatures/puck/flying_bomb_destination.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Pucks:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Initial Spawns
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_puck",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 0.0,
},
} ) )
-- Dynamic Spawns
self.vPuckSchedule =
{
{
Time = 5,
Count = 2,
},
{
Time = 30,
Count = 2,
},
{
Time = 55,
Count = 2,
},
{
Time = 80,
Count = 2,
},
}
self.vTitanSchedule =
{
{
Time = 15,
Count = 1,
},
{
Time = 45,
Count = 1,
},
{
Time = 75,
Count = 1,
},
}
--DeepPrintTable( self.vWaveSchedule )
local bInvulnerable = true
self.szPuckPortal = "dynamic_portal_puck"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPuckPortal, self.szPuckPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_puck",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 150.0,
},
}, bInvulnerable
) )
self.szTitanPortal = "dynamic_portal_titan"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szTitanPortal, self.szTitanPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_large_elder_titan",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szPuckPortal, self.vPuckSchedule )
self:SetSpawnerSchedule( self.szTitanPortal, self.vTitanSchedule )
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_Pucks:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWaveSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
]]
--------------------------------------------------------------------------------
function CMapEncounter_Pucks:GetPreviewUnit()
return "npc_dota_creature_puck"
end
--------------------------------------------------------------------------------
function CMapEncounter_Pucks:Start()
CMapEncounter.Start( self )
for _, hSpawner in pairs( self:GetSpawners() ) do
hSpawner:SpawnUnits()
end
self:StartSpawnerSchedule( self.szPuckPortal, 0 )
self:StartSpawnerSchedule( self.szTitanPortal, 0 )
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_Pucks:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
]]
--------------------------------------------------------------------------------
function CMapEncounter_Pucks:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Pucks:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Pucks

View File

@@ -0,0 +1,226 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_PudgeMiniboss == nil then
CMapEncounter_PudgeMiniboss = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.flNextWaveSpawnTime = -1
self.flSpawnInterval = 5
self.flWaveDelay = 0
self.nWaves = 16
self.hHeroes = {}
self:SetCalculateRewardsFromUnitCount( false )
self.szPeonSpawner = "spawner_peon"
self.szBossSpawner = "spawner_pudge"
self.hPudge = nil
self.bBossSpawned = false
self.nMaxZombies = 100
self.hPeonSpawner = self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_pudge_miniboss_minion",
Team = DOTA_TEAM_BADGUYS,
Count = 5,
PositionNoise = 200.0,
},
} ) )
self.hBossSpawner = self:AddSpawner( CDotaSpawner( self.szBossSpawner, self.szBossSpawner,
{
{
EntityName = "npc_dota_creature_pudge_miniboss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
-------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_pudge", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_pudge.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/voscripts/game_sounds_vo_pudge.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:GetPreviewUnit()
return "npc_dota_creature_pudge_miniboss"
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:OnThink()
CMapEncounter.OnThink( self )
self:CreateMinions()
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:CreateMinions()
if self.bCreatureSpawnsActivated ~= true then
return
end
if self.nWaves > 0 and GameRules:GetGameTime() > self.flNextWaveSpawnTime then
for _,Spawner in pairs ( self:GetSpawners() ) do
if Spawner ~= self.hBossSpawner and self.hPudge ~= nil and self.hPudge:IsNull() == false and self.hPudge:IsAlive() then
local nSpawnedEnemies = #self.SpawnedEnemies + 1
if self.nMaxZombies > nSpawnedEnemies then
Spawner:SpawnUnits()
else
print( "Skipping zombie minion spawn; too many zombies!" )
end
end
end
self.nWaves = self.nWaves - 1
self.flNextWaveSpawnTime = GameRules:GetGameTime() + self.flSpawnInterval
end
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:AggroPudgeMinions( Mobs )
if Mobs == nil or #Mobs == 0 then
return
end
for _,Mob in pairs ( Mobs ) do
local hEnemies = self.hRoom:GetPlayerUnitsInRoom()
if #hEnemies > 0 then
AttackTargetOrder( Mob, hEnemies[ RandomInt( 1, #hEnemies)] )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner == self.hBossSpawner then
return
end
-- randomize zombie speed
for _,Mob in pairs ( hSpawnedUnits ) do
Mob:SetBaseMoveSpeed( Mob:GetBaseMoveSpeed() + RandomFloat( -100, 100 ) )
end
self:AggroPudgeMinions( hSpawnedUnits )
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:GetMaxSpawnedUnitCount()
local nCount = 0
local hPeonSpawners = self:GetSpawner( self.szPeonSpawner )
if hPeonSpawners then
nCount = nCount + hPeonSpawners:GetSpawnPositionCount() * 3 * self.nWaves
end
nCount = nCount + 1
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:CheckForCompletion()
if self.bBossSpawned and not self:HasRemainingEnemies() then
return true
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:OnComplete()
CMapEncounter.OnComplete( self )
if self.nAbilityListener ~= nil then
StopListeningToGameEvent( self.nAbilityListener )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_PudgeMiniboss:OnTriggerStartTouch( event )
CMapEncounter.OnTriggerStartTouch( self, event )
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if self.bCreatureSpawnsActivated == nil and szTriggerName == "trigger_spawn_creatures" then
self.bCreatureSpawnsActivated = true
if not self.bBossSpawned then
local hUnits = self.hBossSpawner:SpawnUnits()
for _,hBoss in pairs ( hUnits) do
EmitSoundOn( "pudge_pud_spawn_03", hBoss )
self.hPudge = hBoss
self.nAbilityListener = ListenToGameEvent( "dota_non_player_used_ability", Dynamic_Wrap( getclass( self ), 'OnNonPlayerUsedAbility' ), self )
end
self.bBossSpawned = true
end
self.flNextWaveSpawnTime = GameRules:GetGameTime() + self.flWaveDelay
EmitGlobalSound( "RoundStart" )
end
end
---------------------------------------------------------
-- dota_non_player_used_ability
-- * abilityname
-- * caster_entindex
---------------------------------------------------------
function CMapEncounter_PudgeMiniboss:OnNonPlayerUsedAbility( event )
local hCaster = nil
if event.caster_entindex ~= nil and event.abilityname ~= nil then
hCaster = EntIndexToHScript( event.caster_entindex )
if hCaster ~= nil and hCaster == self.hPudge and event.abilityname == "creature_pudge_dismember" then
local nRandomInt = RandomInt( 1, 3 )
if nRandomInt == 1 then
EmitSoundOn( "pudge_pud_ability_devour_02", self.hPudge )
end
if nRandomInt == 2 then
EmitSoundOn( "pudge_pud_ability_devour_03", self.hPudge )
end
if nRandomInt == 3 then
EmitSoundOn( "pudge_pud_ability_devour_04", self.hPudge )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_PudgeMiniboss

View File

@@ -0,0 +1,157 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_QuillBeasts == nil then
CMapEncounter_QuillBeasts = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_QuillBeasts:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_dire_hound",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain_trigger", "spawner_captain_trigger",
{
{
EntityName = "npc_dota_creature_dire_hound_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 225.0,
}
} ) )
self:SetPortalTriggerSpawner( "spawner_captain_trigger", 0.8 )
self:SetSpawnerSchedule( "spawner_peon", { { Time = 0, Count = 8 } } ) -- spawn 8 units when triggered
self:SetSpawnerSchedule( "spawner_captain_trigger", nil ) -- means spawn once when triggered
------------------------
-- Dynamic Portals
------------------------
local nNumPortals_1 = 2
local nNumPortals_2 = 3
local nNumPortals_3 = 3
local nNumPortals_4 = 3
self.nTotalPortals = nNumPortals_1 + nNumPortals_2 + nNumPortals_3 + nNumPortals_4
self.vWaveSchedule =
{
{
Time = 0,
Count = nNumPortals_1,
},
{
Time = 20,
Count = nNumPortals_2,
},
{
Time = 40,
Count = nNumPortals_3,
},
{
Time = 60,
Count = nNumPortals_4,
},
}
local PortalUnits =
{
{
EntityName = "npc_dota_creature_dire_hound",
Team = DOTA_TEAM_BADGUYS,
Count = 6,
PositionNoise = 0.0,
},
{
EntityName = "npc_dota_creature_dire_hound_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
local bInvulnerable = true
local nHealth = 1
local fSummonTime = 5
local fModelScale = 1.0
local szLocatorName = "dynamic_portal"
local szName = szLocatorName
self:AddPortalSpawnerV2( CPortalSpawnerV2( szName, szLocatorName, nHealth, fSummonTime, fModelScale,
PortalUnits, bInvulnerable
) )
self:SetSpawnerSchedule( szLocatorName, self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_QuillBeasts:GetPreviewUnit()
return "npc_dota_creature_dire_hound_boss"
end
--------------------------------------------------------------------------------
function CMapEncounter_QuillBeasts:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_QuillBeasts:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_QuillBeasts:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_QuillBeasts:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_QuillBeasts:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_QuillBeasts

View File

@@ -0,0 +1,67 @@
require( "map_encounter" )
require( "encounters/encounter_boss_base" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Rhyzik == nil then
CMapEncounter_Rhyzik = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_Rhyzik:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
self.szBossSpawner = "spawner_boss"
self:AddSpawner( CDotaSpawner( self.szBossSpawner, self.szBossSpawner,
{
{
EntityName = "npc_dota_creature_sand_king",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_Rhyzik:Precache( context )
CMapEncounter_BossBase.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_creature_timbersaw_treant", context, -1 )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_sandking", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_sandking.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_nyx_assassin.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/voscripts/game_sounds_vo_sandking.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Rhyzik:GetBossUnitName()
return "npc_dota_creature_sand_king"
end
--------------------------------------------------------------------------------
function CMapEncounter_Rhyzik:Start()
CMapEncounter_BossBase.Start( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Rhyzik:OnThink()
CMapEncounter_BossBase.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Rhyzik:OnComplete()
CMapEncounter.OnComplete( self )
GameRules.Aghanim:MarkGameWon()
end
return CMapEncounter_Rhyzik

View File

@@ -0,0 +1,135 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_RockGolems == nil then
CMapEncounter_RockGolems = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.vWaveSchedule =
{
{
Time = 3,
Count = 1,
},
{
Time = 33,
Count = 2,
},
{
Time = 63,
Count = 2,
},
}
local bInvulnerable = true
self.szPortal = "dynamic_portal"
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szPortal, self.szPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_rock_golem_a",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szPortal, self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_brewmaster/brewmaster_thunder_clap_debuff.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:GetPreviewUnit()
return "npc_dota_creature_rock_golem_a"
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWaveSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:GetMaxSpawnedUnitCount()
local nBigGolems = #self.PortalSpawnersV2
local nMediumGolems = nBigGolems * 3
local nSmallGolems = nMediumGolems * 4
local nTotal = nBigGolems + nMediumGolems + nSmallGolems -- isn't working, it's 0
printf( "GetMaxSpawnedUnitCount - nTotal: %d", nTotal )
return nTotal
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_RockGolems:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner.szSpawnerName == self.szPortal then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
self:SetInitialGoalEntityToNearestHero( hSpawnedUnit )
end
end
--------------------------------------------------------------------------------
--[[ necessary due to split-generated golems?
function CMapEncounter_RockGolems:CheckForCompletion()
if self.nWaves == 0 and not self:HasRemainingEnemies() then
return true
end
return false
end
]]
--------------------------------------------------------------------------------
return CMapEncounter_RockGolems

View File

@@ -0,0 +1,233 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_ShadowDemons == nil then
CMapEncounter_ShadowDemons = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- urns are standing trash
self.szUrnSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szUrnSpawner, self.szUrnSpawner,
{
{
EntityName = "npc_dota_creature_upheaval_urn",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
-- waves alternate between groups of necro melee warriors and a single shadow demon
-- one big Doom spawns in the middle of this nonsense
local bInvulnerable = true
self.vNecroWarriorSchedule =
{
{
Time = 3,
Count = 3,
},
{
Time = 24,
Count = 3,
},
{
Time = 55,
Count = 3,
},
{
Time = 76,
Count = 3,
},
}
self.vShadowDemonSchedule =
{
{
Time = 11,
Count = 1,
},
{
Time = 30,
Count = 1,
},
{
Time = 49,
Count = 1,
},
{
Time = 68,
Count = 1,
},
}
self.vDoomSchedule =
{
{
Time = 20.0,
Count = 1
},
}
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_shadow_demon", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_shadow_demon",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_necro_warrior", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_necro_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 250.0,
},
}, bInvulnerable ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_doom", "spawner_doom", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_doom",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:SetSpawnerSchedule( self.szUrnSpawner, nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_shadow_demon", self.vShadowDemonSchedule )
self:SetSpawnerSchedule( "spawner_necro_warrior", self.vNecroWarriorSchedule )
self:SetSpawnerSchedule( "spawner_doom", self.vDoomSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:GetPreviewUnit()
return "npc_dota_creature_doom"
end
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vShadowDemonSchedule + #self.vDoomSchedule + #self.vNecroWarriorSchedule )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
-- don't count urns as units that must be destroyed
function CMapEncounter_ShadowDemons:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_dota_creature_upheaval_urn" then
return false
end
return true
end
--------------------------------------------------------------------------------
-- only count the v2 portals for our max unit count - we don't want to count the urns since they're indestructible
function CMapEncounter_ShadowDemons:GetMaxSpawnedUnitCount()
local nCount = 0
for _,PortalSpawner in pairs ( self.PortalSpawnersV2 ) do
nCount = nCount + self:ComputeUnitsSpawnedBySchedule( PortalSpawner )
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
--[[function CMapEncounter_ShadowDemons:RemoveUrns()
print( 'CMapEncounter_ShadowDemons:RemoveUrns called')
local hUrns = FindUnitsInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), nil, FIND_UNITS_EVERYWHERE, DOTA_UNIT_TARGET_TEAM_BOTH, DOTA_UNIT_TARGET_ALL, DOTA_UNIT_TARGET_FLAG_INVULNERABLE, FIND_ANY_ORDER, false )
for i=1, #hUrns do
print( 'Found unit named ' .. hUrns[i]:GetUnitName() )
if hUrns[i]:GetUnitName() == "npc_dota_creature_upheaval_urn" then
print( 'Removing urn #' .. i )
hUrns[i]:ForceKill( false )
UTIL_Remove( hUrns[i] )
end
end
end
--]]
--------------------------------------------------------------------------------
function CMapEncounter_ShadowDemons:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
--print( "CMapEncounter_Pinecones:OnSpawnerFinished" )
if hSpawner:GetSpawnerType() == "CPortalSpawnerV2" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
if hSpawnedUnit:GetUnitName() == "npc_dota_creature_doom" then
EmitSoundOn( "encounter_shadow_demons.doom.intro", hSpawnedUnit )
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_ShadowDemons

View File

@@ -0,0 +1,146 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_Spectres == nil then
CMapEncounter_Spectres = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Spectres:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Initial Spawns
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_wolf",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 75.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_spectre",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
-- Dynamic Spawns
self.vWaveSchedule =
{
{
Time = 15,
Count = 1,
},
{
Time = 40,
Count = 2,
},
{
Time = 65,
Count = 2,
},
{
Time = 90,
Count = 2,
},
}
--DeepPrintTable( self.vWaveSchedule )
self.szDynamicPortal = "dynamic_portal"
local bInvulnerable = true
self:AddPortalSpawnerV2( CPortalSpawnerV2( self.szDynamicPortal, self.szDynamicPortal, 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_wolf",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_spectre",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( self.szDynamicPortal, self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Spectres:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "survive_waves", 0, #self.vWaveSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_Spectres:GetPreviewUnit()
return "npc_dota_creature_spectre"
end
--------------------------------------------------------------------------------
function CMapEncounter_Spectres:Start()
CMapEncounter.Start( self )
self:CreateUnits()
self:StartSpawnerSchedule( self.szDynamicPortal, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Spectres:CreateUnits()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Spectres:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Spectres:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Spectres

View File

@@ -0,0 +1,230 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_StartingRoom == nil then
CMapEncounter_StartingRoom = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:GetRoom().hSpawnGroupHandle = GetActiveSpawnGroupHandle()
self.bRewardsSelected = false
self.bSpokenGameStartLine = false
self.bAllButtonsReady = false
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:Start()
self.flStartTime = GameRules:GetGameTime()
if GameRules.Aghanim:HasSetAscensionLevel() == false then
-- Default the ascension level now in case we do any developer shit, and juke the system to think we haven't set it yet
GameRules.Aghanim:SetAscensionLevel( 0 )
GameRules.Aghanim.bHasSetAscensionLevel = false
local nMaxOption = GameRules.Aghanim:GetMaxAllowedAscensionLevel()
local nOption = 0
while nOption <= nMaxOption do
local hAscensionLocator = Entities:FindByName( nil, "ascension_picker_locator_" .. ( nOption + 1 ) )
if hAscensionLocator == nil then
break
end
local vOrigin = hAscensionLocator:GetAbsOrigin()
local vAngles = hAscensionLocator:GetAnglesAsVector()
local pickerTable =
{
MapUnitName = "npc_dota_aghsfort_watch_tower_option_1",
origin = tostring( vOrigin.x ) .. " " .. tostring( vOrigin.y ) .. " " .. tostring( vOrigin.z ),
angles = tostring( vAngles.x ) .. " " .. tostring( vAngles.y ) .. " " .. tostring( vAngles.z ),
OptionNumber = tostring( nOption + 1 ),
teamnumber = DOTA_TEAM_NEUTRALS,
AscensionLevelPicker = 1,
}
CreateUnitFromTable( pickerTable, vOrigin )
nOption = nOption + 1
end
if nOption == 0 then
print( "Unable to find ascension_picker_locator_ entities!\n" )
self:OnAscensionLevelSelected( { level = 1 } )
return
end
end
-- Use encounter name to display "select ascension level"
self:Introduce()
-- Players Ready
self.nPlayersReady = 0
local nTriggerStartTouchEvent = ListenToGameEvent( "trigger_start_touch", Dynamic_Wrap( getclass( self ), "OnTriggerStartTouch" ), self )
table.insert( self.EventListeners, nTriggerStartTouchEvent )
local nTriggerEndTouchEvent = ListenToGameEvent( "trigger_end_touch", Dynamic_Wrap( getclass( self ), "OnTriggerEndTouch" ), self )
table.insert( self.EventListeners, nTriggerEndTouchEvent )
local nAscensionSelectedEvent = ListenToGameEvent( "aghsfort_ascension_level_selected", Dynamic_Wrap( getclass( self ), "OnAscensionLevelSelected" ), self )
table.insert( self.EventListeners, nAscensionSelectedEvent )
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:OnAscensionLevelSelected( event )
print( "Ascension Level " .. event.level .. " selected" )
GameRules.Aghanim:SetAscensionLevel( event.level - 1 )
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:OnThink()
CMapEncounter.OnThink( self )
-- Don't speak until all players are connected
if self.bSpokenGameStartLine == false then
local nConnectedPlayerCount = 0
local nPlayerCount = 0
for nPlayerID = 0, AGHANIM_PLAYERS - 1 do
if PlayerResource:GetTeam( nPlayerID ) == DOTA_TEAM_GOODGUYS and PlayerResource:IsValidPlayerID( nPlayerID ) then
nPlayerCount = nPlayerCount + 1
if PlayerResource:GetConnectionState( nPlayerID ) == DOTA_CONNECTION_STATE_CONNECTED then
nConnectedPlayerCount = nConnectedPlayerCount + 1
end
end
end
if nConnectedPlayerCount == nPlayerCount then
GameRules.Aghanim:GetAnnouncer():OnGameStarted( )
self.bSpokenGameStartLine = true
end
end
-- Update UI indicating who has picked their reward
local vecRewardState = GameRules.Aghanim:DetermineRewardSelectionState()
if vecRewardState ~= nil then
local nNumSelected = 0
local vecPlayers = GameRules.Aghanim:GetConnectedPlayers()
for i=1,#vecPlayers do
if vecRewardState[ tostring( vecPlayers[i] ) ] == true then
nNumSelected = nNumSelected + 1
end
end
self:UpdateEncounterObjective( "objective_select_aghanims_fragmants", nNumSelected, nil )
if #vecPlayers > 0 and nNumSelected == #vecPlayers then
self:GetRoom().bSpawnGroupReady = true
self.bRewardsSelected = true
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:InitializeObjectives()
--CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "objective_stand_on_buttons", 0, 4 )
self:AddEncounterObjective( "objective_select_aghanims_fragmants", 0, 4 )
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:OnTriggerStartTouch( event )
if self.bAllButtonsReady == true then
return
end
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if szTriggerName == "trigger_player_1"
or szTriggerName == "trigger_player_2"
or szTriggerName == "trigger_player_3"
or szTriggerName == "trigger_player_4" then
--printf( "szTriggerName: %s, hUnit:GetUnitName(): %s, hTriggerEntity:GetName(): %s", szTriggerName, hUnit:GetUnitName(), hTriggerEntity:GetName() )
self.nPlayersReady = self.nPlayersReady + 1
self:UpdateEncounterObjective( "objective_stand_on_buttons", self.nPlayersReady, nil )
local vecPlayers = GameRules.Aghanim:GetConnectedPlayers()
if #vecPlayers > 0 then
if self.nPlayersReady == #vecPlayers then
self.bAllButtonsReady = true
self:GenerateRewards()
-- We want to announce rewards during the starting room
GameRules.Aghanim:GetAnnouncer():OnSelectRewards()
-- Open the main gate
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "main_gate_open_relay", false )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:OnTriggerEndTouch( event )
if self.bAllButtonsReady == true then
return
end
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if szTriggerName == "trigger_player_1"
or szTriggerName == "trigger_player_2"
or szTriggerName == "trigger_player_3"
or szTriggerName == "trigger_player_4" then
--printf( "szTriggerName: %s, hUnit:GetUnitName(): %s, hTriggerEntity:GetName(): %s", szTriggerName, hUnit:GetUnitName(), hTriggerEntity:GetName() )
self.nPlayersReady = self.nPlayersReady - 1
self:UpdateEncounterObjective( "objective_stand_on_buttons", self.nPlayersReady, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:CheckForCompletion()
return GameRules.Aghanim:HasSetAscensionLevel() == true and self.bRewardsSelected == true
end
--------------------------------------------------------------------------------
function CMapEncounter_StartingRoom:OnComplete()
CMapEncounter.OnComplete( self )
for nPlayerID=0,AGHANIM_PLAYERS-1 do
local hHero = PlayerResource:GetSelectedHeroEntity( nPlayerID )
if hHero then
hHero:SetAbilityPoints( 2 )
EmitSoundOnClient( "General.LevelUp", hHero:GetPlayerOwner() )
ParticleManager:ReleaseParticleIndex( ParticleManager:CreateParticle( "particles/generic_hero_status/hero_levelup.vpcf", PATTACH_ABSORIGIN_FOLLOW, nil ) )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_StartingRoom

View File

@@ -0,0 +1,269 @@
require( "encounters/encounter_boss_base" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Storegga == nil then
CMapEncounter_Storegga = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szRockSpawner_1 = "spawner_rock1"
self.szRockSpawner_2 = "spawner_rock2"
self.szRockSpawner_3 = "spawner_rock3"
self.szBossSpawner = "spawner_boss"
self.Rocks = {}
self:AddSpawner( CDotaSpawner( self.szRockSpawner_1, self.szRockSpawner_1,
{
{
EntityName = "npc_dota_storegga_rock",
Team = DOTA_TEAM_GOODGUYS,
Count = 1,
PositionNoise = 200.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szRockSpawner_2, self.szRockSpawner_2,
{
{
EntityName = "npc_dota_storegga_rock2",
Team = DOTA_TEAM_GOODGUYS,
Count = 1,
PositionNoise = 200.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szRockSpawner_3, self.szRockSpawner_3,
{
{
EntityName = "npc_dota_storegga_rock3",
Team = DOTA_TEAM_GOODGUYS,
Count = 1,
PositionNoise = 200.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szBossSpawner, self.szBossSpawner,
{
{
EntityName = "npc_dota_creature_storegga",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:Precache( context )
CMapEncounter_BossBase.Precache( self, context )
PrecacheUnitByNameSync( "npc_dota_creature_small_storegga", context, -1 )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_tiny", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_storegga.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/voscripts/game_sounds_vo_tiny.vsndevts", context )
PrecacheResource( "model", "models/heroes/tiny_01/tiny_01.vmdl", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetPreviewUnit()
return "npc_dota_creature_storegga"
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:Start()
CMapEncounter_BossBase.Start( self )
self:CreateOtherUnits()
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:OnThink()
CMapEncounter_BossBase.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:MustKillForEncounterCompletion( hEnemyCreature )
if hEnemyCreature:GetUnitName() == "npc_dota_creature_small_storegga" then
return false
end
if hEnemyCreature:GetUnitName() == "npc_dota_storegga_rock" then
return false
end
if hEnemyCreature:GetUnitName() == "npc_dota_storegga_rock2" then
return false
end
if hEnemyCreature:GetUnitName() == "npc_dota_storegga_rock3" then
return false
end
return true
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:CreateOtherUnits()
for _,Spawner in pairs ( self:GetSpawners() ) do
if Spawner.szSpawnerName ~= "spawner_boss" then
local hRocks = Spawner:SpawnUnits()
for _,hRock in pairs ( hRocks ) do
table.insert( self.Rocks, hRock )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:OnComplete()
CMapEncounter_BossBase.OnComplete( self )
for _,hRock in pairs ( self.Rocks ) do
UTIL_Remove( hRock )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetBossIntroVoiceLine()
return "tiny_tiny_pres_t3_spawn_03"
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetBossIntroGesture()
return ACT_TINY_GROWL
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetBossIntroCameraPitch()
return 40
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetBossIntroCameraDistance()
return 800
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetBossIntroCameraHeight()
return 350
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetLaughLine()
local szLines =
{
"tiny_tiny_pres_t3_laugh_01",
"tiny_tiny_pres_t3_laugh_02",
"tiny_tiny_pres_t3_laugh_03",
"tiny_tiny_pres_t3_laugh_04",
"tiny_tiny_pres_t3_laugh_05",
"tiny_tiny_pres_t3_laugh_06",
"tiny_tiny_pres_t3_laugh_07",
"tiny_tiny_pres_t3_laugh_08",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetKillTauntLine()
local szLines =
{
"tiny_tiny_pres_t3_kill_01",
"tiny_tiny_pres_t3_kill_03",
"tiny_tiny_pres_t3_kill_04",
"tiny_tiny_pres_t3_kill_05",
"tiny_tiny_pres_t3_kill_06",
"tiny_tiny_pres_t3_kill_09",
"tiny_tiny_pres_t3_ability_toss_11",
"tiny_tiny_pres_t3_ability_toss_08",
"tiny_tiny_pres_t3_ability_toss_07",
"tiny_tiny_pres_t3_ability_toss_06",
"tiny_tiny_pres_t3_attack_08",
"tiny_tiny_pres_t3_attack_06",
}
return szLines[ RandomInt( 1, #szLines ) ]
end
--------------------------------------------------------------------------------
function CMapEncounter_Storegga:GetAbilityUseLine( szAbilityName )
local szLineToUse = self:GetLaughLine()
if szAbilityName == "storegga_grab_throw" then
local szLines =
{
"tiny_tiny_pres_t3_ability_toss_13",
"tiny_tiny_pres_t3_ability_toss_12",
"tiny_tiny_pres_t3_ability_toss_05",
"tiny_tiny_pres_t3_ability_toss_04",
"tiny_tiny_pres_t3_ability_toss_03",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "storegga_arm_slam" then
local szLines =
{
"tiny_tiny_pres_t3_attack_12",
"tiny_tiny_pres_t3_attack_11",
"tiny_tiny_pres_t3_attack_07",
"tiny_tiny_pres_t3_ability_toss_01",
"tiny_tiny_pres_t3_ability_toss_02",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "storegga_ground_pound" then
local szLines =
{
"tiny_tiny_pres_t3_attack_04",
"tiny_tiny_pres_t3_attack_05",
"tiny_tiny_pres_t3_attack_03",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
if szAbilityName == "storegga_avalanche" then
local szLines =
{
"tiny_tiny_pres_t3_ability_toss_15",
"tiny_tiny_pres_t3_ability_toss_14",
"tiny_tiny_pres_t3_ability_grow_02",
}
szLineToUse = szLines[ RandomInt( 1, #szLines ) ]
end
return szLineToUse
end
--------------------------------------------------------------------------------
return CMapEncounter_Storegga

View File

@@ -0,0 +1,65 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_trap_base" )
--------------------------------------------------------------------------------
if CMapEncounter_TempleGarden == nil then
CMapEncounter_TempleGarden = class( {}, {}, CMapEncounter_TrapBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGarden:GetPreviewUnit()
return "npc_dota_breathe_fire_trap"
end
--------------------------------------------------------------------------------
--[[
function CMapEncounter_TempleGarden:Start()
CMapEncounter_TrapBase.Start( self )
if not IsServer() then
return
end
local wardUnits = Entities:FindAllByName( "spawner_ward" )
local wardUnit = "npc_dota_observer_ward_journey"
for _, spawnerUnit in pairs(wardUnits) do
local hUnit = CreateUnitByName( wardUnit, spawnerUnit:GetAbsOrigin(), true, nil, nil, DOTA_TEAM_GOODGUYS )
if hUnit ~= nil then
--print("Placing a ward")
hUnit:SetForwardVector( RandomVector( 1 ) )
end
end
end
]]
--------------------------------------------------------------------------------
function CMapEncounter_TempleGarden:CheckForCompletion()
if not IsServer() then
return
end
local bIsComplete = CMapEncounter_TrapBase.CheckForCompletion( self )
if bIsComplete then
self:DisableTraps()
end
return bIsComplete
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGarden:DisableTraps()
--print("Disabling Traps!")
-- Disable any traps in the map
local hRelays = self:GetRoom():FindAllEntitiesInRoomByName( "disable_traps_relay", false )
--local hRelays = Entities:FindAllByName( "disable_traps_relay" )
for _, hRelay in pairs( hRelays ) do
hRelay:Trigger( nil, nil )
end
end
--------------------------------------------------------------------------------
return CMapEncounter_TempleGarden

View File

@@ -0,0 +1,91 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "encounters/encounter_boss_base" )
--------------------------------------------------------------------------------
if CMapEncounter_TempleGuardians == nil then
CMapEncounter_TempleGuardians = class( {}, {}, CMapEncounter_BossBase )
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:constructor( hRoom, szEncounterName )
CMapEncounter_BossBase.constructor( self, hRoom, szEncounterName )
self.szBossSpawner = "spawner_boss"
self:AddSpawner( CDotaSpawner( self.szBossSpawner, self.szBossSpawner,
{
{
EntityName = "npc_dota_creature_temple_guardian",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetPreviewUnit()
return "npc_dota_creature_temple_guardian"
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroGesture()
return ACT_DOTA_CAPTURE
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroCameraPitch()
return 30
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroCameraDistance()
return 800
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroCameraHeight()
return 85
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroCameraYawRotateSpeed()
return 0.1
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroCameraInitialYaw()
return 120
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:GetBossIntroDuration()
return 5.0
end
--------------------------------------------------------------------------------
function CMapEncounter_TempleGuardians:IntroduceBoss( hEncounteredBoss )
CMapEncounter_BossBase.IntroduceBoss( self, hEncounteredBoss )
EmitGlobalSound( "Boss.Intro" )
end
--------------------------------------------------------------------------------
return CMapEncounter_TempleGuardians

View File

@@ -0,0 +1,25 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_TestImmediateVictory == nil then
CMapEncounter_TestImmediateVictory = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_TestImmediateVictory:GetPreviewUnit()
return "npc_dota_shop_keeper"
end
--------------------------------------------------------------------------------
function CMapEncounter_TestImmediateVictory:CheckForCompletion()
return true
end
--------------------------------------------------------------------------------
return CMapEncounter_TestImmediateVictory

View File

@@ -0,0 +1,19 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_TestRewardRoom == nil then
CMapEncounter_TestRewardRoom = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_TestRewardRoom:CheckForCompletion()
return true
end
--------------------------------------------------------------------------------
return CMapEncounter_TestRewardRoom

View File

@@ -0,0 +1,25 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Transition == nil then
CMapEncounter_Transition = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Transition:GetPreviewUnit()
return "npc_dota_creature_temple_guardian"
end
--------------------------------------------------------------------------------
function CMapEncounter_Transition:CheckForCompletion()
return true
end
--------------------------------------------------------------------------------
return CMapEncounter_Transition

View File

@@ -0,0 +1,153 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_TrapBase == nil then
CMapEncounter_TrapBase = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_monkey_king/monkey_king_disguise.vpcf", context )
PrecacheUnitByNameSync( "npc_dota_pendulum_trap", context, -1 )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self.HeroesOnGoal = {}
self.nHeroOnTrigger1 = 0
self.nHeroOnTrigger2 = 0
self.nHeroOnTrigger3 = 0
self.nHeroOnTrigger4 = 0
self.nHeroesOnGoal = 0
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:InitializeObjectives()
self:AddEncounterObjective( "navigate_the_traps", 0, 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:GetMaxSpawnedUnitCount()
return 0
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:Start()
CMapEncounter.Start( self )
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and not hHero:IsNull() and hHero:IsRealHero() then
hHero:AddNewModifier( hHero, nil, "modifier_aghsfort_player_transform", { duration = -1 } )
end
end
local PendulumSpawners = self:GetRoom():FindAllEntitiesInRoomByName( "pendulum_trap", false )
for _,Spawner in pairs ( PendulumSpawners ) do
local hPendulum = CreateUnitByName( "npc_dota_pendulum_trap", Spawner:GetAbsOrigin(), false, nil, nil, DOTA_TEAM_BADGUYS )
if hPendulum then
print( "Found pendulum")
hPendulum:SetForwardVector( Spawner:GetForwardVector() )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:CheckForCompletion()
local nHeroesAlive = 0
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and hHero:IsRealHero() and hHero:GetTeamNumber() == DOTA_TEAM_GOODGUYS then
if hHero:IsAlive() or hHero:GetRespawnsDisabled() == false then
nHeroesAlive = nHeroesAlive + 1
end
end
end
self.nHeroesOnGoal = self.nHeroOnTrigger1 + self.nHeroOnTrigger2 + self.nHeroOnTrigger3 + self.nHeroOnTrigger4
return nHeroesAlive > 0 and self.nHeroesOnGoal == nHeroesAlive
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:OnTriggerStartTouch( event )
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
local szTriggerName = event.trigger_name
if hUnit ~= nil and hUnit:IsRealHero() and hUnit:IsControllableByAnyPlayer() then
if szTriggerName == "trigger_player_1" then
self.nHeroOnTrigger1 = 1
elseif szTriggerName == "trigger_player_2" then
self.nHeroOnTrigger2 = 1
elseif szTriggerName == "trigger_player_3" then
self.nHeroOnTrigger3 = 1
elseif szTriggerName == "trigger_player_4" then
self.nHeroOnTrigger4 = 1
end
--table.insert( self.HeroesOnGoal, hUnit )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:OnTriggerEndTouch( event )
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
local szTriggerName = event.trigger_name
if hUnit ~= nil and hUnit:IsRealHero() and hUnit:IsControllableByAnyPlayer() then
if szTriggerName == "trigger_player_1" then
self.nHeroOnTrigger1 = 0
elseif szTriggerName == "trigger_player_2" then
self.nHeroOnTrigger2 = 0
elseif szTriggerName == "trigger_player_3" then
self.nHeroOnTrigger3 = 0
elseif szTriggerName == "trigger_player_4" then
self.nHeroOnTrigger4 = 0
end
--[[
for k,hHero in pairs( self.HeroesOnGoal ) do
if hHero == hUnit then
table.remove( self.HeroesOnGoal, k )
end
end
]]
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrapBase:OnComplete()
CMapEncounter.OnComplete( self )
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and not hHero:IsNull() and hHero:IsRealHero() then
hHero:RemoveModifierByName( "modifier_aghsfort_player_transform" )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_TrapBase

View File

@@ -0,0 +1,316 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_TrollWarlord == nil then
CMapEncounter_TrollWarlord = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_troll_warlord", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_troll_warlord.vsndevts", context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_beastmaster", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_beastmaster.vsndevts", context )
PrecacheUnitByNameSync( "npc_dota_creature_sheep_hostage", context )
PrecacheModel( "npc_dota_creature_sheep_hostage", context )
PrecacheResource( "particle", "particles/units/heroes/hero_lone_druid/lone_druid_bear_entangle.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_lone_druid/lone_druid_bear_entangle_body.vpcf", context )
PrecacheResource( "particle", "particles/econ/events/league_teleport_2014/teleport_start_league.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self.bInitialSpawn = true
self.bCagesSpawned = false
self.nSheepToRescue = 4
self.nSheepRescued = 0
--Hack to get objectives to work
self.nEnemies = 0
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_beastmaster_boar",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 0.0,
},
{
EntityName = "npc_dota_creature_beastmaster_boss",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
--Spawner schedule for Troll Warlord
local bInvulnerable = true
local vCaptainSchedule = { { Time = 0, Count = 1 } }
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_captain_1", "spawner_captain_1", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_troll_warlord_ranged",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_captain_2", "spawner_captain_2", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_troll_warlord_melee",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable ) )
self:SetSpawnerSchedule( "spawner_peon", nil ) -- means spawn once when triggered
self:SetSpawnerSchedule( "spawner_captain_1", vCaptainSchedule )
self:SetSpawnerSchedule( "spawner_captain_2", vCaptainSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:SpawnCages()
print("Spawning cages")
local captureUnits = Entities:FindAllByName( "spawner_cage" )
--Shuffling the table
local shuffledUnits = self:ShuffleCages(captureUnits)
local cageUnit = "npc_dota_cage"
local nCageID = 0
for _, captureUnit in pairs(shuffledUnits) do
local vSpawnLoc = captureUnit:GetAbsOrigin()
local vAngles = VectorAngles( RandomVector( 1 ) )
local cageTable =
{
MapUnitName = cageUnit,
origin = tostring( vSpawnLoc.x ) .. " " .. tostring( vSpawnLoc.y ) .. " " .. tostring( vSpawnLoc.z ),
angles = tostring( vAngles.x ) .. " " .. tostring( vAngles.y ) .. " " .. tostring( vAngles.z ),
teamnumber = DOTA_TEAM_BADGUYS,
NeverMoveToClearSpace = false,
}
local hUnit = CreateUnitFromTable( cageTable, vSpawnLoc )
if hUnit ~= nil then
--print("Placing a cage")
nCageID = nCageID + 1
hUnit:Attribute_SetIntValue( "cageID", nCageID )
--Don't double count the cages
self.nEnemies = self.nEnemies + 1
end
end
self.bCagesSpawned = true
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies)
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:StartExitPortal()
local szPortalFX = "particles/portals/portal_ground_spawn_endpoint.vpcf"
local PortalPoints = self:GetRoom():FindAllEntitiesInRoomByName( "dynamic_portal" )
if PortalPoints == nil then
--print("No Portal Points Found!")
return
end
for _, hPortal in pairs ( PortalPoints ) do
--print("Spawning Portal FX")
local effects = ParticleManager:CreateParticle( szPortalFX, PATTACH_WORLDORIGIN, hPortal )
ParticleManager:SetParticleControl( effects, 0, hPortal:GetAbsOrigin() )
EmitGlobalSound("Aghsfort_DarkPortal.Created")
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
--Hack to get objectives to work
self.nEnemies = self:GetMaxSpawnedUnitCount()
self:AddEncounterObjective( "defeat_all_enemies", 0, self.nEnemies )
self:AddEncounterObjective( "rescue_sheep", self.nSheepRescued, self.nSheepToRescue )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:GetMaxSpawnedUnitCount()
local nCount = 0
-- Map has 7 peon spawners
local hPeonSpawners = self:GetSpawner( "spawner_peon")
if hPeonSpawners then
nCount = nCount + hPeonSpawners:GetSpawnPositionCount() * 4
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:CheckForCompletion()
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
if nCurrentValue >= self.nEnemies and self.nSheepRescued == 4 then
return true
end
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:GetPreviewUnit()
return "npc_dota_creature_troll_warlord_ranged"
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:Start()
CMapEncounter.Start( self )
self:CreateEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if self.bInitialSpawn == true then
self:SpawnCages()
self.bInitialSpawn = false
end
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:OnEntityKilled( event )
if not IsServer() then
return
end
if self.bCagesSpawned == false then
return
end
local killedUnit = EntIndexToHScript( event.entindex_killed )
if killedUnit == nil then
return
end
if killedUnit:GetUnitName() =="npc_dota_creature_beastmaster_boss" or
killedUnit:GetUnitName() == "npc_dota_creature_beastmaster_boar" or
killedUnit:GetUnitName() == "npc_dota_creature_troll_warlord_melee" or
killedUnit:GetUnitName() == "npc_dota_creature_troll_warlord_ranged" or
killedUnit:GetUnitName() == "npc_dota_cage" then
--print(killedUnit:GetUnitName())
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, self.nEnemies )
end
--Check to see if it's a cage
if killedUnit:GetUnitName() == "npc_dota_cage" then
local cageAttribute = killedUnit:Attribute_GetIntValue( "cageID", -1 )
if cageAttribute ~= -1 then
local szHostageUnit = "npc_dota_creature_beastmaster_boar"
local vCagePos = killedUnit:GetOrigin()
--print("Cage has been destroyed")
if cageAttribute < 5 then
--print("Cage has been released")
--self:StartExitPortal()
self.nSheepRescued = self.nSheepRescued + 1
--Update the objectives
local nCurrentValue = self:GetEncounterObjectiveProgress( "rescue_sheep" )
self:UpdateEncounterObjective( "rescue_sheep", nCurrentValue + 1, nil )
--Spawn sheep
szHostageUnit = "npc_dota_creature_sheep_hostage"
local hHostage = CreateUnitByName( szHostageUnit, vCagePos, true, nil, nil, DOTA_TEAM_GOODGUYS )
if hHostage ~= nil then
--print("Spawning a sheep")
local hPortal = Entities:FindByName( nil, "portal_path_track" )
hHostage:SetInitialGoalEntity( hPortal )
EmitSoundOn("Creature.Sheep.Spawn", hHostage)
end
if self.nSheepRescued == 4 then
self:SpawnWarlord()
end
else
--Don't always spawn boars
local nRoll = RandomInt(1,2)
if nRoll == 1 then
local hBoar = CreateUnitByName( szHostageUnit, vCagePos, true, nil, nil, DOTA_TEAM_BADGUYS )
hBoar:SetForwardVector( RandomVector( 1 ) )
--Hack to get objectives to work
self.nEnemies = self.nEnemies + 1
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies )
end
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:SpawnWarlord()
print("Spawning Warlord")
self:StartSpawnerSchedule( "spawner_captain_1", 0 )
self:StartSpawnerSchedule( "spawner_captain_2", 0 )
self.nEnemies = self.nEnemies + 2
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue, self.nEnemies )
end
--------------------------------------------------------------------------------
function CMapEncounter_TrollWarlord:ShuffleCages(orig_list)
local list = shallowcopy( orig_list )
local result = {}
local count = #list
for i = 1, count do
local pick = RandomInt( 1, #list )
result[ #result + 1 ] = list[ pick ]
table.remove( list, pick )
end
return result
end
return CMapEncounter_TrollWarlord

View File

@@ -0,0 +1,208 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawnerv2" )
--------------------------------------------------------------------------------
if CMapEncounter_TuskSkeletons == nil then
CMapEncounter_TuskSkeletons = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.vPeonSchedule =
{
{
Time = 0,
Count = 2,
},
{
Time = 25,
Count = 3,
},
{
Time = 50,
Count = 3,
},
{
Time = 75,
Count = 4,
},
}
--DeepPrintTable( self.vPeonSchedule )
local bInvulnerable = true
self:AddPortalSpawnerV2( CPortalSpawnerV2( "spawner_peon", "spawner_peon", 8, 5, 1.0,
{
{
EntityName = "npc_dota_creature_tusk_skeleton",
Team = DOTA_TEAM_BADGUYS,
Count = 6,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_spectral_tusk_mage",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}, bInvulnerable
) )
self:SetSpawnerSchedule( "spawner_peon", self.vPeonSchedule )
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:Precache( context )
CMapEncounter.Precache( self, context )
local friendTable =
{
MapUnitName = "npc_dota_creature_friendly_ogre_seal",
teamnumber = DOTA_TEAM_GOODGUYS,
}
PrecacheUnitFromTableSync( friendTable, context )
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:GetPreviewUnit()
return "npc_dota_creature_spectral_tusk_mage"
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:InitializeObjectives()
self:AddEncounterObjective( "survive_waves", 0, #self.vPeonSchedule )
self:AddEncounterObjective( "save_gary", 0, 0 )
CMapEncounter.InitializeObjectives( self )
-- self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self.szObjectiveEnts = "objective"
self.hObjectiveEnts = self:GetRoom():FindAllEntitiesInRoomByName( self.szObjectiveEnts, true )
if #self.hObjectiveEnts == 0 then
printf( "WARNING - self.hObjectiveEnt is nil (looked for classname \"%s\")", self.szObjectiveEnts )
return
end
self.hFriend = CreateUnitByName( "npc_dota_creature_friendly_ogre_seal", self.hObjectiveEnts[1]:GetOrigin(), false, nil, nil, DOTA_TEAM_GOODGUYS )
if self.hFriend ~= nil then
self.hFriend:SetForwardVector( RandomVector( 1 ) )
local nAscLevel = GameRules.Aghanim:GetAscensionLevel()
self.hFriend:CreatureLevelUp( nAscLevel )
self.vGoalPos = self.hFriend:GetAbsOrigin()
else
printf( "WARNING - Failed to spawn the objective entity!" )
return
end
--[[
local objectiveAngles = self.hObjectiveEnts[ 1 ]:GetAngles()
self.hFriend:SetAbsAngles( objectiveAngles.x, objectiveAngles.y, objectiveAngles.z )
]]
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:ShouldAutoStartGlobalAscensionAbilities()
return false
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:Start()
CMapEncounter.Start( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner.szSpawnerName == "spawner_peon" then
if hSpawner.schedule then
local nCurrentValue = self:GetEncounterObjectiveProgress( "survive_waves" )
self:UpdateEncounterObjective( "survive_waves", nCurrentValue + 1, nil )
end
end
for _, hSpawnedUnit in pairs ( hSpawnedUnits ) do
if self.hFriend ~= nil and ( not self.hFriend:IsNull() ) and self.hFriend:IsAlive() then
hSpawnedUnit:SetInitialGoalEntity( self.hFriend )
else
if self.hObjectiveEnts[ 1 ] ~= nil and self.hObjectiveEnts[ 1 ]:IsNull() == false then
hSpawnedUnit:SetInitialGoalPosition( self.hObjectiveEnts[ 1 ]:GetOrigin() )
else
hSpawnedUnit:SetInitialGoalPosition( self.vGoalPos )
end
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:OnTriggerStartTouch( event )
CMapEncounter.OnTriggerStartTouch( self, event )
-- Get the trigger that activates the room
local szTriggerName = event.trigger_name
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
--printf( "szTriggerName: %s, hUnit:GetUnitName(): %s, hTriggerEntity:GetName(): %s", szTriggerName, hUnit:GetUnitName(), hTriggerEntity:GetName() )
if self.bCreatureSpawnsActivated == nil and szTriggerName == "trigger_spawn_creatures" then
self.bCreatureSpawnsActivated = true
self:StartGlobalAscensionAbilities()
self:StartAllSpawnerSchedules( 0 )
--printf( "Unit \"%s\" triggered creature spawning!", hUnit:GetUnitName() )
EmitGlobalSound( "RoundStart" )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_TuskSkeletons:OnComplete()
CMapEncounter.OnComplete( self )
-- If friendly unit is still alive, grant some rewards and do other stuff
if self.hFriend ~= nil and ( not self.hFriend:IsNull() ) and self.hFriend:IsAlive() then
self.hFriend:Heal( self.hFriend:GetMaxHealth(), nil )
local nFXIndex = ParticleManager:CreateParticle( "particles/items3_fx/fish_bones_active.vpcf", PATTACH_ABSORIGIN_FOLLOW, self.hFriend )
ParticleManager:ReleaseParticleIndex( nFXIndex )
local nLives = 1
for i = 1, nLives do
self:DropLifeRuneFromUnit( self.hFriend, nil, true )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_TuskSkeletons

View File

@@ -0,0 +1,135 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_UndeadWoods == nil then
CMapEncounter_UndeadWoods = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle_folder", "particles/units/heroes/hero_skeleton_king", context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_skeletonking.vsndevts", context )
PrecacheResource( "soundfile", "soundevents/voscripts/game_sounds_vo_skeleton_king.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_sk", "spawner_sk",
{
{
EntityName = "npc_dota_undead_woods_skeleton_king",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
local flInitialPortalSpawnDelay = 0.0
local flInitialSummonTime = 30.0
local flPortalIntervalInput = DEFAULT_PORTAL_SPAWN_INTERVAL
local flScaleInput = 1.0
self.nNumPortals = 4
for i=1,self.nNumPortals do
local name = string.format( "portal_%i", i )
self:AddPortalSpawner( CPortalSpawner( name, "dynamic_portal", 60 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_wraith_king_skeleton_warrior",
Team = DOTA_TEAM_BADGUYS,
Count = 10,
PositionNoise = 0.0,
},
} ) )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, self.nNumPortals )
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:GetPreviewUnit()
return "npc_dota_undead_woods_skeleton_king"
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:Start()
CMapEncounter.Start( self )
self:CreateEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_UndeadWoods:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
-- if hSpawner:GetSpawnerName() ~= "spawner_sk" then
-- local SkeletonKings = self:GetRoom():FindAllEntitiesInRoomByName( "npc_dota_undead_woods_skeleton_king" )
-- if #SkeletonKings > 0 then
-- local hAbility = SkeletonKings[1]:FindAbilityByName( "undead_woods_skeleton_king_mortal_strike" )
-- if hAbility then
-- for _,hUnit in pairs( hSpawnedUnits ) do
-- hUnit:AddNewModifier( SkeletonKings[1], hAbility, "modifier_skeleton_king_mortal_strike_summon", {} )
-- end
-- end
-- end
-- end
--print( "CMapEncounter_Wildwings:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_UndeadWoods

View File

@@ -0,0 +1,216 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Warlocks == nil then
CMapEncounter_Warlocks = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/units/heroes/hero_invoker/invoker_sun_strike_team.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_invoker/invoker_sun_strike.vpcf", context )
PrecacheResource( "particle", "particles/units/heroes/hero_warlock/warlock_shadow_word_buff.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
-- Pre-placed creatures (done this way to use a specific subset of existing map spawners)
self.vGatekeepersSchedule =
{
{
Time = 0,
Count = 2,
},
}
self:AddSpawner( CDotaSpawner( "spawner_gatekeepers", "spawner_gatekeepers",
{
{
EntityName = "npc_dota_creature_demon_golem",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 225.0,
},
{
EntityName = "npc_dota_creature_warlock",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
-- Players have to kill these creatures to trigger the dynamic portals
self:SetPortalTriggerSpawner( "spawner_gatekeepers", 0.8 )
self:SetSpawnerSchedule( "spawner_gatekeepers", self.vGatekeepersSchedule )
-- Additional creatures
self.vGroupCreaturesSchedule =
{
{
Time = 0,
Count = 1,
},
}
self:AddSpawner( CDotaSpawner( "spawner_group", "spawner_group",
{
{
EntityName = "npc_dota_creature_demon_golem",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 225.0,
},
{
EntityName = "npc_dota_creature_warlock",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
) )
self:SetSpawnerSchedule( "spawner_group", self.vGroupCreaturesSchedule )
-- Dynamic Portals
local nPortalHealth = 60 * hRoom:GetDepth()
local flInitialPortalSpawnDelay = 0.0
local flInitialSummonTime = 6.0
local flPortalIntervalInput = 45.0
local flScaleInput = 1.0
local nNumPortals = 3
local nNameCounter = 1
local szLocatorName = "dynamic_portal"
self.nTotalPortals = nNumPortals
local PortalUnits =
{
{
EntityName = "npc_dota_creature_demon_golem",
Team = DOTA_TEAM_BADGUYS,
Count = 2,
PositionNoise = 200.0,
},
{
EntityName = "npc_dota_creature_warlock",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
}
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, nPortalHealth, flInitialPortalSpawnDelay,
flInitialSummonTime, flPortalIntervalInput, flScaleInput, PortalUnits
) )
end
flInitialPortalSpawnDelay = 24.0
flInitialSummonTime = 5.0
nNumPortals = 3
self.nTotalPortals = self.nTotalPortals + nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, nPortalHealth, flInitialPortalSpawnDelay,
flInitialSummonTime, flPortalIntervalInput, flScaleInput, PortalUnits
) )
end
flInitialPortalSpawnDelay = 48.0
flInitialSummonTime = 5.0
nNumPortals = 3
self.nTotalPortals = self.nTotalPortals + nNumPortals
for i = 1, nNumPortals do
local name = string.format( "portal_%i", nNameCounter )
nNameCounter = nNameCounter + 1
self:AddPortalSpawner( CPortalSpawner( name, szLocatorName, nPortalHealth, flInitialPortalSpawnDelay,
flInitialSummonTime, flPortalIntervalInput, flScaleInput, PortalUnits
) )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, self.nTotalPortals )
self:AddEncounterObjective( "defeat_all_enemies", 0, self:GetMaxSpawnedUnitCount() ) -- doesn't capture pre-placed spawns?
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:OnPortalV2Killed( hVictim, hAttacker, nUnitCountSuppressed )
CMapEncounter.OnPortalV2Killed( self, hVictim, hAttacker, nUnitCountSuppressed )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + nUnitCountSuppressed, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
local nCurrentValue = self:GetEncounterObjectiveProgress( "defeat_all_enemies" )
self:UpdateEncounterObjective( "defeat_all_enemies", nCurrentValue + 1, nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:GetPreviewUnit()
return "npc_dota_creature_warlock"
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:Start()
CMapEncounter.Start( self )
self:StartSpawnerSchedule( "spawner_gatekeepers", 0 )
self:StartSpawnerSchedule( "spawner_group", 0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Warlocks:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Warlocks:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _, hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt( 1, #heroes ) ]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Warlocks

View File

@@ -0,0 +1,120 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
LinkLuaModifier( "modifier_room_monster_sleep", "modifiers/modifier_room_monster_sleep", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
if CMapEncounter_WaveBlasters == nil then
CMapEncounter_WaveBlasters = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "particle", "particles/generic_gameplay/generic_sleep.vpcf", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.nCaptains = 4
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_aghsfort_creature_wave_blaster_ghost",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 400.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain", "spawner_captain",
{
{
EntityName = "npc_dota_creature_wave_blaster",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 200.0,
},
} ) )
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "kill_waveblasters", 0, self.nCaptains )
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if hVictim and hVictim:GetUnitName() == "npc_dota_creature_wave_blaster" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "kill_waveblasters" )
self:UpdateEncounterObjective( "kill_waveblasters", nCurrentValue + 1, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:GetPreviewUnit()
return "npc_dota_creature_wave_blaster"
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:GetMaxSpawnedUnitCount()
local nCount = 0
for _,Spawner in pairs ( self.Spawners ) do
nCount = nCount + self:ComputeUnitsSpawnedBySchedule( Spawner )
end
-- Assume we get 4 ghosts per boss
local hCaptainSpawners = self:GetSpawner( "spawner_captain" )
if hCaptainSpawners then
nCount = nCount + hCaptainSpawners:GetSpawnCountPerSpawnPosition() * 3
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:Start()
CMapEncounter.Start( self )
for _,Spawner in pairs ( self:GetSpawners() ) do
if Spawner:GetSpawnerName() == "spawner_peon" then
Spawner:SpawnUnitsFromRandomSpawners( Spawner:GetSpawnPositionCount() )
else
Spawner:SpawnUnitsFromRandomSpawners( self.nCaptains )
end
end
end
--------------------------------------------------------------------------------
function CMapEncounter_WaveBlasters:OnSpawnerFinished( hSpawner, hSpawnedUnits)
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
for _,enemy in pairs( hSpawnedUnits ) do
if enemy ~= nil then
enemy:AddNewModifier( enemy, nil, "modifier_room_monster_sleep", { duration = 15 } )
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_WaveBlasters

View File

@@ -0,0 +1,149 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
require( "portalspawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Wildwings == nil then
CMapEncounter_Wildwings = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self.szPeonSpawner = "spawner_peon"
self.szCaptainSpawner = "spawner_captain"
self:AddSpawner( CDotaSpawner( self.szPeonSpawner, self.szPeonSpawner,
{
{
EntityName = "npc_dota_creature_wildwing_laborer",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 225.0,
},
} ) )
self:AddSpawner( CDotaSpawner( self.szCaptainSpawner, self.szCaptainSpawner,
{
{
EntityName = "npc_dota_creature_dazzle",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
local flInitialPortalSpawnDelay = 0.0
local flInitialSummonTime = 30.0
local flPortalIntervalInput = DEFAULT_PORTAL_SPAWN_INTERVAL
local flScaleInput = 1.0
self.nNumPortals = 4
for i=1,self.nNumPortals do
local name = string.format( "portal_%i", i )
self:AddPortalSpawner( CPortalSpawner( name, "dynamic_portal", 60 * hRoom:GetDepth(), flInitialPortalSpawnDelay, flInitialSummonTime, flPortalIntervalInput, flScaleInput,
{
{
EntityName = "npc_dota_creature_wildwing_laborer",
Team = DOTA_TEAM_BADGUYS,
Count = 3,
PositionNoise = 0.0,
},
{
EntityName = "npc_dota_creature_dazzle",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 0.0,
},
} ) )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "destroy_spawning_portals", 0, self.nNumPortals )
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:GetPreviewUnit()
return "npc_dota_creature_dazzle"
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:GetMaxSpawnedUnitCount()
local nCount = 0
local hWarriorSpawners = self:GetSpawner( self.szPeonSpawner )
if hWarriorSpawners then
nCount = nCount + hWarriorSpawners:GetSpawnPositionCount() * 4 --* self.nWaves
end
local hChampionSpawners = self:GetSpawner( self.szCaptainSpawner )
if hChampionSpawners then
nCount = nCount + hChampionSpawners:GetSpawnPositionCount() --* self.nWaves
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:Start()
CMapEncounter.Start( self )
self:CreateEnemies()
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:OnThink()
CMapEncounter.OnThink( self )
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:CreateEnemies()
for _,Spawner in pairs ( self:GetSpawners() ) do
Spawner:SpawnUnits()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Wildwings:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
if hSpawner:GetSpawnerType() == "CDotaSpawner" then -- standing enemies in the map should not aggro to players
return
end
--print( "CMapEncounter_Wildwings:OnSpawnerFinished" )
local heroes = FindRealLivingEnemyHeroesInRadius( DOTA_TEAM_BADGUYS, self.hRoom:GetOrigin(), FIND_UNITS_EVERYWHERE )
if #heroes > 0 then
for _,hSpawnedUnit in pairs( hSpawnedUnits ) do
local hero = heroes[RandomInt(1, #heroes)]
if hero ~= nil then
--printf( "Set initial goal entity for unit \"%s\" to \"%s\"", hSpawnedUnit:GetUnitName(), hero:GetUnitName() )
hSpawnedUnit:SetInitialGoalEntity( hero )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Wildwings

View File

@@ -0,0 +1,138 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_Wrath == nil then
CMapEncounter_Wrath = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:GetPreviewUnit()
return "npc_dota_hero_zuus"
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:OnEncounterLoaded()
CMapEncounter.OnEncounterLoaded( self )
self.bGreenLight = true
self.HeroesOnGoal = {}
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:GetMaxSpawnedUnitCount()
return 0
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:Start()
CMapEncounter.Start( self )
local hGreenLights = self:GetRoom():FindAllEntitiesInRoomByName( "green_light", true )
if #hGreenLights > 0 then
self.hGreenLight = hGreenLights[ 1 ]
end
if self.hGreenLight == nil then
print( "Unable to find \"green_light\"" )
end
local hRedLights = self:GetRoom():FindAllEntitiesInRoomByName( "red_light", true )
if #hRedLights > 0 then
self.hRedLight = hRedLights[ 1 ]
end
if self.hRedLight == nil then
print( "Unable to find \"red_light\"" )
end
self.fEncounterStartTime = GameRules:GetGameTime()
self.fNextLightChangeTime = self.fEncounterStartTime + self:GetNextLightChangeTime()
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:OnThink()
CMapEncounter.OnThink( self )
if GameRules:GetGameTime() >= self.fNextLightChangeTime then
printf( "self:ToggleLights()" )
self:ToggleLights()
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:GetNextLightChangeTime()
return RandomFloat( 1.0, 7.0 )
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:ToggleLights()
if self.bGreenLight then
self.hGreenLight:Disable()
self.hRedLight:Enable()
self.bGreenLight = false
else
self.hGreenLight:Enable()
self.hRedLight:Disable()
self.bGreenLight = true
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:CheckForCompletion()
local nHeroesAlive = 0
local hHeroes = HeroList:GetAllHeroes()
for _, hHero in pairs ( hHeroes ) do
if hHero ~= nil and hHero:IsRealHero() and hHero:GetTeamNumber() == DOTA_TEAM_GOODGUYS and ( hHero:IsAlive() or hHero:IsReincarnating() ) then
nHeroesAlive = nHeroesAlive + 1
end
end
return nHeroesAlive > 0 and #self.HeroesOnGoal == nHeroesAlive
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:OnSpawnerFinished( hSpawner, hSpawnedUnits )
CMapEncounter.OnSpawnerFinished( self, hSpawner, hSpawnedUnits )
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:OnTriggerStartTouch( event )
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if hUnit ~= nil and hUnit:IsRealHero() and hUnit:IsControllableByAnyPlayer() and event.trigger_name == "goal_trigger" then
table.insert( self.HeroesOnGoal, hUnit )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_Wrath:OnTriggerEndTouch( event )
local hUnit = EntIndexToHScript( event.activator_entindex )
local hTriggerEntity = EntIndexToHScript( event.caller_entindex )
if hUnit ~= nil and hUnit:IsRealHero() and hUnit:IsControllableByAnyPlayer() and event.trigger_name == "goal_trigger" then
for k,hHero in pairs( self.HeroesOnGoal ) do
if hHero == hUnit then
table.remove( self.HeroesOnGoal, k )
end
end
end
end
--------------------------------------------------------------------------------
return CMapEncounter_Wrath

View File

@@ -0,0 +1,108 @@
require( "map_encounter" )
require( "aghanim_utility_functions" )
require( "spawner" )
--------------------------------------------------------------------------------
if CMapEncounter_ZealotScarabs == nil then
CMapEncounter_ZealotScarabs = class( {}, {}, CMapEncounter )
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:constructor( hRoom, szEncounterName )
CMapEncounter.constructor( self, hRoom, szEncounterName )
self:SetCalculateRewardsFromUnitCount( true )
self:AddSpawner( CDotaSpawner( "spawner_peon", "spawner_peon",
{
{
EntityName = "npc_dota_creature_zealot_scarab",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 250.0,
},
} ) )
self:AddSpawner( CDotaSpawner( "spawner_captain", "spawner_captain",
{
{
EntityName = "npc_dota_creature_scarab_priest",
Team = DOTA_TEAM_BADGUYS,
Count = 1,
PositionNoise = 250.0,
},
} ) )
self:SetSpawnerSchedule( "spawner_peon", nil )
self:SetSpawnerSchedule( "spawner_captain", nil )
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:Precache( context )
CMapEncounter.Precache( self, context )
PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_nyx_assassin.vsndevts", context )
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:InitializeObjectives()
CMapEncounter.InitializeObjectives( self )
self:AddEncounterObjective( "kill_scarab_priests", 0, self:GetSpawner( "spawner_captain" ):GetSpawnPositionCount() )
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:OnRequiredEnemyKilled( hAttacker, hVictim )
CMapEncounter.OnRequiredEnemyKilled( self, hAttacker, hVictim )
if hVictim and hVictim:GetUnitName() == "npc_dota_creature_scarab_priest" then
local nCurrentValue = self:GetEncounterObjectiveProgress( "kill_scarab_priests" )
self:UpdateEncounterObjective( "kill_scarab_priests", nCurrentValue + 1, nil )
end
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:GetPreviewUnit()
return "npc_dota_creature_zealot_scarab"
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:GetMaxSpawnedUnitCount()
local nCount = 0
for _,Spawner in pairs ( self.Spawners ) do
nCount = nCount + self:ComputeUnitsSpawnedBySchedule( Spawner )
end
-- Assume we get 2 nyxes per boss
local hCaptainSpawners = self:GetSpawner( "spawner_captain" )
if hCaptainSpawners then
nCount = nCount + hCaptainSpawners:GetSpawnCountPerSpawnPosition() * 2
end
return nCount
end
--------------------------------------------------------------------------------
function CMapEncounter_ZealotScarabs:Start()
CMapEncounter.Start( self )
self:StartAllSpawnerSchedules( 0 )
end
--------------------------------------------------------------------------------
return CMapEncounter_ZealotScarabs