Example #1
0
		timer = timers.setInterval(function() {
			if(ent && ent.wasBuilt && ent.isValid()) {
				var pos = ent.netprops.m_vecOrigin;
				
				// This command has to be different based on the team of the client
				if(team == dota.TEAM_RADIANT) {
					// Create Creeps
					for(var i=0;i<ent.CampSpawnGood.length;i++) {
						// Spawn creeps
						var creep = dota.createUnit(ent.CampSpawnGood[i], team);
						
						// Teleport
						dota.findClearSpaceForUnit(creep, pos);
						
						// March
						dota.setUnitWaypoint(creep, DIRE_ANCIENT);
						
						// Apply custom netprops
						if(ent.CustomNetprops) {
							for(var j in ent.CustomNetprops) {
								creep.netprops[j] = ent.CustomNetprops[j];
							}
						}
						
						// Do post process on creep
						if(ent.CampPass) {
							ent.CampPass(creep);
						}
					}
				} else {
					// Create Creeps
					for(var i=0;i<ent.CampSpawnBad.length;i++) {
						// Spawn creeps
						var creep = dota.createUnit(ent.CampSpawnBad[i], team);
						
						// Teleport
						dota.findClearSpaceForUnit(creep, pos);
						
						// March
						dota.setUnitWaypoint(creep, RADIANT_ANCIENT);
						
						// Apply custom netprops
						if(ent.CustomNetprops) {
							for(var j in ent.CustomNetprops) {
								creep.netprops[j] = ent.CustomNetprops[j];
							}
						}
						
						// Do post process on creep
						if(ent.CampPass) {
							ent.CampPass(creep);
						}
					}
				}
			} else {
				// Stop this timer
				timers.clearTimer(timer);
			}
		}, RAX_SPAWN_RATE);
Example #2
0
					timer = timers.setInterval(function() {
						// Ensure our ent still exists
						if(!ent) {
							timers.clearTimer(timer);
							return;
						}
						
						// Check if they moved out of range of the shop
						var dist = vecDist(ent.netprops.m_vecOrigin, shopEnt.netprops.m_vecOrigin);
						
						if(dist > SHOP_RANGE) {
							// Set their shop back
							ent.netprops.m_iCurShop = oldShop;
							
							// Remove this timer
							timers.clearTimer(timer);
						}
					}, 1000);
Example #3
0
function onEntityHurt(event) {
	// Grab the entity that was attacked
	var ent = game.getEntityByIndex(event.getInt('entindex_killed'));
	var attacker = game.getEntityByIndex(event.getInt('entindex_attacker'));
	
	// Ensure it was built
	if(ent.wasBuilt) {
		// Store when they were last attacked
		ent.lastAttacked = game.rules.props.m_fGameTime;
	}
	
	// Implement life steal
	if(attacker && attacker.lifestealBonus) {
		// Calculate amount to steal
		var damage = attacker.netprops.m_iDamageMin + attacker.netprops.m_iDamageBonus;
		var lifesteal = Math.ceil(damage * attacker.lifestealBonus / 100);
		
		// Workout max HP
		var maxHP = attacker.netprops.m_iMaxHealth;
		
		// Increase health
		attacker.netprops.m_iHealth += lifesteal;
		
		// Cap health
		if(attacker.netprops.m_iHealth > maxHP) {
			attacker.netprops.m_iHealth = maxHP;
		}
		
		/*var index = dota.createParticleEffect(ent, "kunkka_torrent_splash", 1);
		var pos = ent.netprops.m_vecOrigin;
		
		// Push effect to all clients
		var clients = getConnectedPlayingClients();
		for (i=0; i<clients.length; i++) {
			var client = clients[i];
			
			dota.setParticleControl(client, index, 0, pos);
		}*/
	}
	
	// Implement mana burn
	if(attacker && attacker.manaburnBonus) {
		// Check if the unit has any mana
		ent.netprops.m_flMana -= attacker.manaburnBonus;
		
		// Make sure it doesn't go below 0
		if(ent.netprops.m_flMana < 0) {
			ent.netprops.m_flMana = 0;
		}
	}
	
	// Abaddon's ult
	if(ent && ent.borrowedtimeModder) {
		if(ent.netprops.m_iHealth <= 400) {
			var gametime = game.rules.props.m_fGameTime;
			
			// Check when we last used it
			if(!ent.borrowedtimeModder.lastUsed || gametime > ent.borrowedtimeModder.lastUsed + ent.borrowedtimeModder.cooldown) {
				// Store when we last used it
				ent.borrowedtimeModder.lastUsed = gametime;
				
				// Activate it
				dota.addNewModifier(ent, ent.borrowedtimeModder, 'modifier_abaddon_borrowed_time', "abaddon_borrowed_time", {duration:ent.borrowedtimeModder.duration});
				
				// Store cooldown
				ent.borrowedtimeModder.netprops.m_flCooldownLength = ent.borrowedtimeModder.cooldown;
				ent.borrowedtimeModder.netprops.m_fCooldown = gametime + ent.borrowedtimeModder.cooldown;
			}
		}
	}
	
	// Stop spawning shit ffs
	if(ent.getClassname() == 'npc_dota_building') {
		// Check health
		if(ent.netprops.m_iHealth <= 0) {
			// Check for a timer
			if(ent.timer) {
				// Remove the timer
				timers.clearTimer(ent.timer);
				ent.timer = null;
			}
			
			// Check for a timer2
			if(ent.timer2) {
				// Remove the timer
				timers.clearTimer(ent.timer2);
				ent.timer2 = null;
			}
		}
	}
}