124 lines
3.9 KiB
Lua
124 lines
3.9 KiB
Lua
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
local ____exports = {}
|
|
function ____exports.SetGoldUsually(self, unit)
|
|
local difficulty_multiplier = 1
|
|
local baseMinGold = unit:GetMinimumGoldBounty()
|
|
local baseMaxGold = unit:GetMaximumGoldBounty()
|
|
local expirience = unit:GetDeathXP()
|
|
local expirience_full = math.floor(expirience * difficulty_multiplier)
|
|
local minGold = math.floor(baseMinGold * difficulty_multiplier)
|
|
local maxGold = math.floor(baseMaxGold * difficulty_multiplier)
|
|
unit:SetDeathXP(expirience_full)
|
|
unit:SetMinimumGoldBounty(minGold)
|
|
unit:SetMaximumGoldBounty(maxGold)
|
|
end
|
|
function ____exports.GiveGoldPlayers(self, amount)
|
|
local players = PlayerResource:GetPlayerCountForTeam(DOTA_TEAM_GOODGUYS)
|
|
do
|
|
local i = 0
|
|
while i < players do
|
|
local player = PlayerResource:GetPlayer(i)
|
|
if player then
|
|
local hero = player:GetAssignedHero()
|
|
if hero ~= nil and hero ~= nil then
|
|
hero:ModifyGold(amount, true, DOTA_ModifyGold_Unspecified)
|
|
end
|
|
end
|
|
i = i + 1
|
|
end
|
|
end
|
|
end
|
|
_G.HasShard = function(____, unit)
|
|
if unit:HasModifier("modifier_item_aghanims_shard") then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
_G.HasScepter = function(____, unit)
|
|
if not unit or unit:IsNull() then
|
|
return false
|
|
end
|
|
if unit:HasModifier("modifier_item_aghanims_scepter") then
|
|
return true
|
|
end
|
|
if unit:HasModifier("modifier_item_ultimate_scepter") then
|
|
return true
|
|
end
|
|
if unit:HasModifier("modifier_item_ultimate_scepter_consumed") then
|
|
return true
|
|
end
|
|
return unit:HasScepter()
|
|
end
|
|
_G.HasTalent = function(____, unit, talentName)
|
|
local talent = unit:FindAbilityByName(talentName)
|
|
return talent ~= nil and talent:GetLevel() > 0
|
|
end
|
|
____exports.SpawnUnitsAndAttack = function(____, name, location, count, data, team)
|
|
local ____data_0 = data
|
|
local attackPoint = ____data_0.attackPoint
|
|
local target = ____data_0.target
|
|
local units = {}
|
|
do
|
|
local index = 0
|
|
while index < count do
|
|
local unit = CreateUnitByName(
|
|
name,
|
|
location,
|
|
true,
|
|
nil,
|
|
nil,
|
|
team
|
|
)
|
|
units[#units + 1] = unit
|
|
if attackPoint then
|
|
Timers:CreateTimer(
|
|
0.1,
|
|
function()
|
|
unit:Stop()
|
|
ExecuteOrderFromTable({
|
|
UnitIndex = unit:entindex(),
|
|
Queue = false,
|
|
OrderType = DOTA_UNIT_ORDER_ATTACK_MOVE,
|
|
Position = attackPoint
|
|
})
|
|
end
|
|
)
|
|
elseif target then
|
|
unit:SetContextThink(
|
|
unit:GetUnitName(),
|
|
function()
|
|
ExecuteOrderFromTable({
|
|
UnitIndex = unit:entindex(),
|
|
OrderType = DOTA_UNIT_ORDER_ATTACK_TARGET,
|
|
TargetIndex = target:entindex()
|
|
})
|
|
return 0.25
|
|
end,
|
|
0.2
|
|
)
|
|
end
|
|
index = index + 1
|
|
end
|
|
end
|
|
return units
|
|
end
|
|
____exports.GetAllHeroes = function()
|
|
local heroes = {}
|
|
do
|
|
local index = 0
|
|
while index < PlayerResource:GetPlayerCount() do
|
|
do
|
|
local hero = PlayerResource:GetSelectedHeroEntity(index)
|
|
if not hero then
|
|
goto __continue22
|
|
end
|
|
heroes[#heroes + 1] = hero
|
|
end
|
|
::__continue22::
|
|
index = index + 1
|
|
end
|
|
end
|
|
return heroes
|
|
end
|
|
return ____exports
|