Skip to content

Commit

Permalink
Implement sharing creep gold and intrinsic modifier multiplexer (#938)
Browse files Browse the repository at this point in the history
* Implement sharing creep gold and intrinsic modifier multiplexer

* Hide hidden modifiers, add tooltips for greaves

* Add missing greave upgrades, add tooltips file

* Fix lualint problems

* Remove unreachable code
  • Loading branch information
chrisinajar authored May 28, 2017
1 parent 3944190 commit c543fd9
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 21 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ globals = { -- these globals can be set and accessed.
"GAME_TIME_ELAPSED",
"GAME_WINNER_TEAM",
"GameRules",
"SKIP_TEAM_SETUP"
}

read_globals = { -- these globals can only be accessed.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//=============================================================================
// Greater Travels Passive GPM Buff
//=============================================================================
"DOTA_Tooltip_modifier_item_greater_guardian_greaves_aura" "Guardian Aura"
"DOTA_Tooltip_modifier_item_greater_guardian_greaves_aura_Description" "Provides health regeneration and bonus armor."
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "3035" // unique ID number for this item. Do not change this once established or it will invalidate collected stats.
"BaseClass" "item_guardian_greaves"
"BaseClass" "item_lua"
"ScriptFile" "items/farming/greater_guardian_greaves.lua"

"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET"
"FightRecapLevel" "1"
"AbilityTextureName" "custom/greater_guardian_greaves"
Expand Down Expand Up @@ -131,12 +133,12 @@
"14"
{
"var_type" "FIELD_INTEGER"
"spell_damage" "100 150 225 340 450"
"assist_percent" "50 70 95 130 175"
}
"15"
{
"var_type" "FIELD_INTEGER"
"mana_restore_per_creep" "25 40 60 85 110"
"assist_radius" "1200 1300 1400 1500 1600"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "3036" // unique ID number for this item. Do not change this once established or it will invalidate collected stats.
"BaseClass" "item_guardian_greaves"
"BaseClass" "item_lua"
"ScriptFile" "items/farming/greater_guardian_greaves.lua"

"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET"
"FightRecapLevel" "1"
"AbilityTextureName" "custom/greater_guardian_greaves"
Expand Down Expand Up @@ -134,12 +136,12 @@
"14"
{
"var_type" "FIELD_INTEGER"
"spell_damage" "100 150 225 340 450"
"assist_percent" "50 70 95 130 175"
}
"15"
{
"var_type" "FIELD_INTEGER"
"mana_restore_per_creep" "25 40 60 85 110"
"assist_radius" "1200 1300 1400 1500 1600"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "3037" // unique ID number for this item. Do not change this once established or it will invalidate collected stats.
"BaseClass" "item_guardian_greaves"
"BaseClass" "item_lua"
"ScriptFile" "items/farming/greater_guardian_greaves.lua"

"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET"
"FightRecapLevel" "1"
"AbilityTextureName" "custom/greater_guardian_greaves"
Expand Down Expand Up @@ -133,12 +135,12 @@
"14"
{
"var_type" "FIELD_INTEGER"
"spell_damage" "100 150 225 340 450"
"assist_percent" "50 70 95 130 175"
}
"15"
{
"var_type" "FIELD_INTEGER"
"mana_restore_per_creep" "25 40 60 85 110"
"assist_radius" "1200 1300 1400 1500 1600"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "3038" // unique ID number for this item. Do not change this once established or it will invalidate collected stats.
"BaseClass" "item_guardian_greaves"
"BaseClass" "item_lua"
"ScriptFile" "items/farming/greater_guardian_greaves.lua"

"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET"
"FightRecapLevel" "1"
"AbilityTextureName" "custom/greater_guardian_greaves"
Expand Down Expand Up @@ -132,12 +134,12 @@
"14"
{
"var_type" "FIELD_INTEGER"
"spell_damage" "100 150 225 340 450"
"assist_percent" "50 70 95 130 175"
}
"15"
{
"var_type" "FIELD_INTEGER"
"mana_restore_per_creep" "25 40 60 85 110"
"assist_radius" "1200 1300 1400 1500 1600"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "3039" // unique ID number for this item. Do not change this once established or it will invalidate collected stats.
"BaseClass" "item_guardian_greaves"
"BaseClass" "item_lua"
"ScriptFile" "items/farming/greater_guardian_greaves.lua"

"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_IMMEDIATE | DOTA_ABILITY_BEHAVIOR_NO_TARGET"
"FightRecapLevel" "1"
"AbilityTextureName" "custom/greater_guardian_greaves"
Expand Down Expand Up @@ -129,12 +131,12 @@
"14"
{
"var_type" "FIELD_INTEGER"
"spell_damage" "100 150 225 340 450"
"assist_percent" "50 70 95 130 175"
}
"15"
{
"var_type" "FIELD_INTEGER"
"mana_restore_per_creep" "25 40 60 85 110"
"assist_radius" "1200 1300 1400 1500 1600"
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions game/scripts/npc/npc_items_custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@
#base "items/item_greater_crit_3.txt"
#base "items/item_greater_crit_4.txt"
#base "items/item_greater_crit_5.txt"
// #base "items/farming/item_greater_guardian_greaves.txt"
// #base "items/farming/item_greater_guardian_greaves_2.txt"
// #base "items/farming/item_greater_guardian_greaves_3.txt"
// #base "items/farming/item_greater_guardian_greaves_4.txt"
// #base "items/farming/item_greater_guardian_greaves_5.txt"
#base "items/farming/item_greater_guardian_greaves.txt"
#base "items/farming/item_greater_guardian_greaves_2.txt"
#base "items/farming/item_greater_guardian_greaves_3.txt"
#base "items/farming/item_greater_guardian_greaves_4.txt"
#base "items/farming/item_greater_guardian_greaves_5.txt"
#base "items/farming/item_greater_phase_boots.txt"
#base "items/farming/item_greater_phase_boots_2.txt"
#base "items/farming/item_greater_phase_boots_3.txt"
Expand Down
4 changes: 3 additions & 1 deletion game/scripts/vscripts/components/creeps/spawner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ end

function CreepCamps:CreepSpawnTimer ()
if (10 > GameRules:GetDOTATime(false, false)) then
return 30
if not SKIP_TEAM_SETUP then
return 30
end
end
-- scan for creep camps and spawn them
-- DebugPrint('[creeps/spawner] Spawning creeps')
Expand Down
164 changes: 164 additions & 0 deletions game/scripts/vscripts/items/farming/greater_guardian_greaves.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
LinkLuaModifier( "modifier_item_greater_guardian_greaves", "items/farming/greater_guardian_greaves.lua", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_item_greater_guardian_greaves_aura", "items/farming/greater_guardian_greaves.lua", LUA_MODIFIER_MOTION_NONE )

LinkLuaModifier( "modifier_creep_assist_gold", "items/farming/modifier_creep_assist_gold.lua", LUA_MODIFIER_MOTION_NONE )

LinkLuaModifier( "modifier_intrinsic_muliplexer", "modifiers/modifier_intrinsic_muliplexer.lua", LUA_MODIFIER_MOTION_NONE )

item_greater_guardian_greaves = class({})

--[[
"14"
{
"var_type" "FIELD_INTEGER"
"assist_percent" "30 50 75 100 150"
}
}
-item greater_guardian_greaves
]]

function item_greater_guardian_greaves:OnSpellStart()
local caster = self:GetCaster()

local heroes = FindUnitsInRadius(
caster:GetTeamNumber(),
caster:GetAbsOrigin(),
nil,
self:GetSpecialValueFor("replenish_radius"),
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false
)

heroes = iter(heroes)
heroes:each(function (hero)
hero:Heal(self:GetSpecialValueFor("replenish_health"), self)
hero:GiveMana(self:GetSpecialValueFor("replenish_mana"))
end)

end

function item_greater_guardian_greaves:GetIntrinsicModifierName()
return "modifier_intrinsic_muliplexer"
end
function item_greater_guardian_greaves:GetIntrinsicModifierNames()
return {
"modifier_item_greater_guardian_greaves",
"modifier_creep_assist_gold"
}
end

item_greater_guardian_greaves_2 = item_greater_guardian_greaves
item_greater_guardian_greaves_3 = item_greater_guardian_greaves
item_greater_guardian_greaves_4 = item_greater_guardian_greaves
item_greater_guardian_greaves_5 = item_greater_guardian_greaves

------------------------------------------------------------------------------

modifier_item_greater_guardian_greaves = class({})

function modifier_item_greater_guardian_greaves:IsHidden()
return true
end

function modifier_item_greater_guardian_greaves:DeclareFunctions()
return {
MODIFIER_PROPERTY_MOVESPEED_BONUS_UNIQUE,
MODIFIER_PROPERTY_STATS_STRENGTH_BONUS,
MODIFIER_PROPERTY_STATS_INTELLECT_BONUS,
MODIFIER_PROPERTY_STATS_AGILITY_BONUS,
MODIFIER_PROPERTY_MANA_BONUS,
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS
}
end

function modifier_item_greater_guardian_greaves:GetModifierBonusStats_Agility()
return self:GetAbility():GetSpecialValueFor("bonus_all_stats")
end
function modifier_item_greater_guardian_greaves:GetModifierBonusStats_Intellect()
return self:GetAbility():GetSpecialValueFor("bonus_all_stats")
end
function modifier_item_greater_guardian_greaves:GetModifierBonusStats_Strength()
return self:GetAbility():GetSpecialValueFor("bonus_all_stats")
end
function modifier_item_greater_guardian_greaves:GetModifierMoveSpeedBonus_Special_Boots()
return self:GetAbility():GetSpecialValueFor("bonus_movement")
end
function modifier_item_greater_guardian_greaves:GetModifierMoveSpeedBonus_Special_Boots()
return self:GetAbility():GetSpecialValueFor("bonus_movement")
end
function modifier_item_greater_guardian_greaves:GetModifierManaBonus()
return self:GetAbility():GetSpecialValueFor("bonus_mana")
end
function modifier_item_greater_guardian_greaves:GetModifierPhysicalArmorBonus()
return self:GetAbility():GetSpecialValueFor("bonus_armor")
end

--------------------------------------------------------------------------
-- aura stuff

function modifier_item_greater_guardian_greaves:IsAura()
return true
end

function modifier_item_greater_guardian_greaves:GetAuraSearchType()
return DOTA_UNIT_TARGET_HERO
end

function modifier_item_greater_guardian_greaves:GetAuraSearchTeam()
return DOTA_UNIT_TARGET_TEAM_FRIENDLY
end

function modifier_item_greater_guardian_greaves:GetAuraRadius()
return self:GetAbility():GetSpecialValueFor("aura_radius")
end

function modifier_item_greater_guardian_greaves:GetModifierAura()
return "modifier_item_greater_guardian_greaves_aura"
end

function modifier_item_greater_guardian_greaves:GetAuraEntityReject(entity)
if entity:IsRealHero() then
return false
end
return true
end

------------------------------------------------------------------------------

modifier_item_greater_guardian_greaves_aura = class({})

function modifier_item_greater_guardian_greaves_aura:DeclareFunctions()
return {
MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT,
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS
}
end

function modifier_item_greater_guardian_greaves_aura:GetModifierConstantHealthRegen()
local hero = self:GetParent()
if not hero or not hero.GetHealth then
return
end
local hpPercent = (hero:GetHealth() / hero:GetMaxHealth()) * 100
if hpPercent < self:GetAbility():GetSpecialValueFor("aura_bonus_threshold") then
return self:GetAbility():GetSpecialValueFor("aura_health_regen_bonus")
else
return self:GetAbility():GetSpecialValueFor("aura_health_regen")
end
end

function modifier_item_greater_guardian_greaves:GetModifierPhysicalArmorBonus()
local hero = self:GetParent()
if not hero or not hero.GetHealth then
return
end
local hpPercent = (hero:GetHealth() / hero:GetMaxHealth()) * 100
if hpPercent < self:GetAbility():GetSpecialValueFor("aura_bonus_threshold") then
return self:GetAbility():GetSpecialValueFor("aura_armor_bonus")
else
return self:GetAbility():GetSpecialValueFor("aura_armor")
end
end
Loading

0 comments on commit c543fd9

Please sign in to comment.