-- evidently i am VERY rusty in programming as a whole and i know jack shit about lua. -- so if you're seeing what you think is bad coding here, know that i had made much, MUCH worse code than this. -- like, i am speaking about code with like O(n^5) time complexity (yes, it's that bad; no it's not in lua, but ruby; could have been worse tbh). -- hooray for technical debt /s -- at some point i might decide to like refactor and restructure everything here but i dont see the need to cross that river yet -- - signed, Project Rubicon's sole creator function mannOfSteel(_, activator) if activator.hiddenfirerate_sec == nil then activator.hiddenfirerate_sec = 0 activator.hiddenfirerate_melee = 0 activator.hiddendamage_melee = 0 activator.nohiddenfirerate_sec = false activator.nohiddenfirerate_melee = false end equippedSec = activator:GetPlayerItemBySlot(1) equippedMelee = activator:GetPlayerItemBySlot(2) activator:AcceptInput("$AddItemAttribute", "restore health on kill|25|1") activator:AcceptInput("$AddItemAttribute", "restore health on kill|25|2") -- Secondary activator:AcceptInput("$AddItemAttribute", "CARD: damage bonus|1.45|1") -- only the melee upgrade uses this so it's free real estate for secs local s_hidden_fire_rate = equippedSec:GetAttributeValue("fire rate bonus HIDDEN") if s_hidden_fire_rate == nil then activator:AcceptInput("$AddItemAttribute", "fire rate bonus HIDDEN|0.75|1") activator.nohiddenfirerate_sec = true elseif (s_hidden_fire_rate ~= nil and activator.hiddenfirerate_sec == 0 and activator.nohiddenfirerate_sec == false) then activator.hiddenfirerate_sec = s_hidden_fire_rate equippedSec:SetAttributeValue("fire rate bonus HIDDEN", math.max(s_hidden_fire_rate - 0.25, 0.01)) end -- Melee local m_hidden_fire_rate = equippedMelee:GetAttributeValue("fire rate bonus HIDDEN") if m_hidden_fire_rate == nil then activator:AcceptInput("$AddItemAttribute", "fire rate bonus HIDDEN|0.75|2") activator.nohiddenfirerate_melee = true elseif (m_hidden_fire_rate ~= nil and activator.hiddenfirerate_melee == 0 and activator.nohiddenfirerate_melee == false) then activator.hiddenfirerate_melee = m_hidden_fire_rate equippedMelee:SetAttributeValue("fire rate bonus HIDDEN", math.max(m_hidden_fire_rate - 0.25, 0.01)) end local m_hidden_damage = equippedMelee:GetAttributeValue("damage bonus HIDDEN") if m_hidden_damage == nil then -- which should be impossible imo activator.hiddendamage_melee = -1 activator:AcceptInput("$AddItemAttribute", "damage bonus hidden|3.058|2") elseif (m_hidden_damage ~= nil and activator.hiddendamage_melee == 0 and activator.hiddendamage_melee ~= -1) then activator.hiddendamage_melee = m_hidden_damage equippedMelee:SetAttributeValue("damage bonus HIDDEN", (m_hidden_damage + 0.75)) end -- GRU and Eviction Notice De-Nerfing local drain_rate = equippedMelee:GetAttributeValue("mod_maxhealth_drain_rate") if (drain_rate ~= nil and drain_rate > 0) then equippedMelee:SetAttributeValue("mod_maxhealth_drain_rate", 0) end if activator.callback_MOS_spawn == nil then activator.callback_MOS_spawn = activator:AddCallback(ON_SPAWN, function() activator:AcceptInput("$RemoveItemAttribute", "CARD: damage bonus|1") activator:AcceptInput("$RemoveItemAttribute", "restore health on kill|1") activator:AcceptInput("$RemoveItemAttribute", "restore health on kill|2") equippedSec = activator:GetPlayerItemBySlot(1) equippedMelee = activator:GetPlayerItemBySlot(2) if activator.nohiddenfirerate_sec == false then activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus HIDDEN|1") else equippedSec:SetAttributeValue("fire rate bonus HIDDEN", activator.hiddenfirerate_sec) end if activator.nohiddenfirerate_melee == false then activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus HIDDEN|2") else equippedMelee:SetAttributeValue("fire rate bonus HIDDEN", activator.hiddenfirerate_melee) end if activator.hiddendamage_melee == -1 then activator:AcceptInput("$RemoveItemAttribute", "damage bonus HIDDEN|2") else equippedMelee:SetAttributeValue("damage bonus HIDDEN", activator.hiddendamage_melee) end local is_eviction = false local grucheck = activator:GetPlayerItemByName("Gloves of Running Urgently") if grucheck == nil then grucheck = activator:GetPlayerItemByName("Festive Gloves of Running Urgently") end if grucheck == nil then grucheck = activator:GetPlayerItemByName("The Eviction Notice") is_eviction = true end if grucheck ~= nil then drain_rate = grucheck:GetAttributeValue("mod_maxhealth_drain_rate") if (drain_rate == 0) then if is_eviction then grucheck:SetAttributeValue("mod_maxhealth_drain_rate", 5) else grucheck:SetAttributeValue("mod_maxhealth_drain_rate", 10) end end end -- reset variables activator.hiddenfirerate_sec = 0 activator.hiddenfirerate_melee = 0 activator.hiddendamage_melee = 0 activator.nohiddenfirerate_sec = false activator.nohiddenfirerate_melee = false -- remove callback local cb = activator.callback_MOS_spawn activator.callback_MOS_spawn = nil activator:RemoveCallback(cb) local cb = activator.callback_MOS_death activator.callback_MOS_death = nil activator:RemoveCallback(cb) end ) end if activator.callback_MOS_death == nil then activator.callback_MOS_death = activator:AddCallback(ON_DEATH, function() activator:AcceptInput("$RemoveItemAttribute", "CARD: damage bonus|1") activator:AcceptInput("$RemoveItemAttribute", "restore health on kill|1") activator:AcceptInput("$RemoveItemAttribute", "restore health on kill|2") equippedSec = activator:GetPlayerItemBySlot(1) equippedMelee = activator:GetPlayerItemBySlot(2) if activator.nohiddenfirerate_sec == false then activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus HIDDEN|1") else equippedSec:SetAttributeValue("fire rate bonus HIDDEN", activator.hiddenfirerate_sec) end if activator.nohiddenfirerate_melee == false then activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus HIDDEN|2") else equippedMelee:SetAttributeValue("fire rate bonus HIDDEN", activator.hiddenfirerate_melee) end if activator.hiddendamage_melee == -1 then activator:AcceptInput("$RemoveItemAttribute", "damage bonus HIDDEN|2") else equippedMelee:SetAttributeValue("damage bonus HIDDEN", activator.hiddendamage_melee) end local is_eviction = false local grucheck = activator:GetPlayerItemByName("Gloves of Running Urgently") if grucheck == nil then grucheck = activator:GetPlayerItemByName("Festive Gloves of Running Urgently") end if grucheck == nil then grucheck = activator:GetPlayerItemByName("The Eviction Notice") is_eviction = true end if grucheck ~= nil then drain_rate = grucheck:GetAttributeValue("mod_maxhealth_drain_rate") if (drain_rate == 0) then if is_eviction then grucheck:SetAttributeValue("mod_maxhealth_drain_rate", 5) else grucheck:SetAttributeValue("mod_maxhealth_drain_rate", 10) end end end -- reset variables activator.hiddenfirerate_sec = 0 activator.hiddenfirerate_melee = 0 activator.hiddendamage_melee = 0 activator.nohiddenfirerate_sec = false activator.nohiddenfirerate_melee = false -- remove callback local cb = activator.callback_MOS_death activator.callback_MOS_death = nil activator:RemoveCallback(cb) end ) end end function defensiveDesperation(_, activator) activator:AcceptInput("$AddItemAttribute", "mult dmg with reduced health|3|0") activator:AcceptInput("$AddItemAttribute", "fire rate bonus with reduced health|0.2|0") activator:AcceptInput("$AddItemAttribute", "mult crit when health is below percent|0.3|0") activator:AcceptInput("$AddItemAttribute", "mult dmg with reduced health|3|2") activator:AcceptInput("$AddItemAttribute", "fire rate bonus with reduced health|0.2|2") activator:AcceptInput("$AddItemAttribute", "mult crit when health is below percent|0.3|2") if activator.callback_DefDes_spawn == nil then activator.callback_DefDes_spawn = activator:AddCallback(ON_SPAWN, function() activator:AcceptInput("$RemoveItemAttribute", "mult dmg with reduced health|0") activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus with reduced health|0") activator:AcceptInput("$RemoveItemAttribute", "mult crit when health is below percent|0") activator:AcceptInput("$RemoveItemAttribute", "mult dmg with reduced health|2") activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus with reduced health|2") activator:AcceptInput("$RemoveItemAttribute", "mult crit when health is below percent|2") -- remove callbacks local cb = activator.callback_DefDes_spawn activator.callback_DefDes_spawn = nil activator:RemoveCallback(cb) local cb = activator.callback_DefDes_death activator.callback_DefDes_death = nil activator:RemoveCallback(cb) end ) end if activator.callback_DefDes_death == nil then activator.callback_DefDes_death = activator:AddCallback(ON_DEATH, function() activator:AcceptInput("$RemoveItemAttribute", "mult dmg with reduced health|0") activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus with reduced health|0") activator:AcceptInput("$RemoveItemAttribute", "mult crit when health is below percent|0") activator:AcceptInput("$RemoveItemAttribute", "mult dmg with reduced health|2") activator:AcceptInput("$RemoveItemAttribute", "fire rate bonus with reduced health|2") activator:AcceptInput("$RemoveItemAttribute", "mult crit when health is below percent|2") -- remove callback local cb = activator.callback_DefDes_death activator.callback_DefDes_death = nil activator:RemoveCallback(cb) end ) end end function eyelandermoment(damage, activator, caller) weapon = activator.m_hActiveWeapon if weapon.eyekills == nil then weapon.eyekills = 0 end weapon.eyekills = weapon.eyekills + 1 if weapon and weapon:GetItemName() == "The Witcher's Hour" then -- this is not a happy reality local maxhealthmod = 15 local movespeedmod = 0.05 local damageresmod = 0.1 local hlthregenval = 15 local ammoregenval = 0.25 local maxkills = 10 local healthbonus = math.min(maxhealthmod * maxkills, math.max(0, maxhealthmod * weapon.eyekills)) local mspeedbonus = math.min(1 + (movespeedmod * maxkills), math.max(1, 1 + (movespeedmod * weapon.eyekills))) local dmgresbonus = math.max(0.4, math.min(1, 1 - (damageresmod * weapon.eyekills))) local bonushealth = activator:GetAttributeValue("max health additive penalty") local bonusspeed = weapon:GetAttributeValue("move speed bonus") local bonusres = activator:GetAttributeValue("dmg taken increased") local bonus10kills = weapon:GetAttributeValue("add attributes on kill") if bonushealth == nil then activator:AcceptInput("$AddPlayerAttribute", "max health additive penalty|" .. healthbonus) elseif weapon.eyekills <= maxkills then activator:SetAttributeValue("max health additive penalty", healthbonus) end if bonusspeed == nil then activator:AcceptInput("$AddItemAttribute", "move speed bonus|".. mspeedbonus .."|2") elseif weapon.eyekills <= maxkills then weapon:SetAttributeValue("move speed bonus", mspeedbonus) end if bonusres == nil then activator:AcceptInput("$AddPlayerAttribute", "dmg taken increased|" .. dmgresbonus) elseif weapon.eyekills <= maxkills then activator:SetAttributeValue("dmg taken increased", dmgresbonus) -- just in case end if weapon.eyekills >= maxkills and bonus10kills == nil then weapon:SetAttributeValue("add attributes on kill", "health regen|".. hlthregenval .."|10|ammo regen|".. ammoregenval .."|30") end end activator:AddCallback(ON_SPAWN, function() equippedMelee = activator:GetPlayerItemBySlot(2) if equippedMelee:GetItemName() ~= "The Witcher's Hour" then equippedMelee.eyekills = 0 local bonushealth = activator:GetAttributeValue("max health additive penalty") local bonusres = activator:GetAttributeValue("dmg taken increased") if bonushealth ~= nil then activator.AcceptInput("$RemovePlayerAttribute", "max health additive penalty") end if bonusres ~= nil then activator.AcceptInput("$RemovePlayerAttribute", "dmg taken increased") end end activator:RemoveAllCallbacks() end ) activator:AddCallback(ON_DEATH, function() weapon = activator:GetPlayerItemBySlot(2) weapon.eyekills = 0 local bonushealth = activator:GetAttributeValue("max health additive penalty") local bonusspeed = weapon:GetAttributeValue("move speed bonus") local bonusres = activator:GetAttributeValue("dmg taken increased") local bonus10kills = weapon:GetAttributeValue("add attributes on kill") if bonushealth ~= nil then activator.AcceptInput("$RemovePlayerAttribute", "max health additive penalty") end if bonusspeed ~= nil then activator.AcceptInput("$RemoveItemAttribute", "move speed bonus|2") end if bonusres ~= nil then activator.AcceptInput("$RemovePlayerAttribute", "dmg taken increased") end if bonus10kills ~= nil then activator.AcceptInput("$RemoveItemAttribute", "add attributes on kill|2") end activator:RemoveAllCallbacks() end ) end function phlog_mk2_delete(_, activator) weapon = activator:GetPlayerItemBySlot(0) weapon.eyekills = 0 local bonushealth = activator:GetAttributeValue("max health additive penalty") local bonusspeed = weapon:GetAttributeValue("move speed bonus") local bonuscrtdmg = weapon:GetAttributeValue("mult crit dmg") if bonushealth ~= nil then activator.AcceptInput("$RemovePlayerAttribute", "max health additive penalty") end if bonusspeed ~= nil then activator.AcceptInput("$RemoveItemAttribute", "move speed bonus|0") end if bonuscrtdmg ~= nil then activator.AcceptInput("$RemoveItemAttribute", "mult crit dmg|0") end activator:RemoveAllCallbacks() end function phlog_mk2(damage, activator, caller) weapon = activator.m_hActiveWeapon if weapon.eyekills == nil then weapon.eyekills = 0 end weapon.eyekills = weapon.eyekills + 1 if weapon and weapon:GetItemName() == "The Phlogistinator" and weapon:GetAttributeValue("loot rarity") == 7 then -- this is not a happy reality local maxhealthmod = 10 local movespeedmod = 0.025 local criticdmgmod = 0.05 local maxkills = 20 local healthbonus = math.min(maxhealthmod * maxkills, math.max(0, maxhealthmod * weapon.eyekills)) local mspeedbonus = math.min(1 + (movespeedmod * maxkills), math.max(1, 1 + (movespeedmod * weapon.eyekills))) local crtdmgbonus = math.min(1 + (criticdmgmod * maxkills), math.max(1, 1 + (criticdmgmod * weapon.eyekills))) local bonushealth = activator:GetAttributeValue("max health additive penalty") local bonusspeed = weapon:GetAttributeValue("move speed bonus") local bonuscrtdmg = weapon:GetAttributeValue("mult crit dmg") if bonushealth == nil then activator:AcceptInput("$AddPlayerAttribute", "max health additive penalty|" .. healthbonus) elseif weapon.eyekills <= maxkills then activator:SetAttributeValue("max health additive penalty", healthbonus) end if bonusspeed == nil then activator:AcceptInput("$AddItemAttribute", "move speed bonus|".. mspeedbonus .."|0") elseif weapon.eyekills <= maxkills then weapon:SetAttributeValue("move speed bonus", mspeedbonus) end if bonuscrtdmg == nil then activator:AcceptInput("$AddItemAttribute", "mult crit dmg|" .. crtdmgbonus .."|0") elseif weapon.eyekills <= maxkills then weapon:SetAttributeValue("mult crit dmg", crtdmgbonus) -- just in case end end activator:AddCallback(ON_SPAWN, function() weapon = activator:GetPlayerItemBySlot(0) if weapon:GetItemName() ~= "The Phlogistinator" or weapon:GetAttributeValue("loot rarity") ~= 7 then weapon.eyekills = 0 local bonushealth = activator:GetAttributeValue("max health additive penalty") local bonusspeed = weapon:GetAttributeValue("move speed bonus") local bonuscrtdmg = weapon:GetAttributeValue("mult crit dmg") if bonushealth ~= nil then activator.AcceptInput("$RemovePlayerAttribute", "max health additive penalty") end -- if bonusspeed ~= nil then -- activator.AcceptInput("$RemoveItemAttribute", "move speed bonus|") -- end end activator:RemoveAllCallbacks() end ) activator:AddCallback(ON_DEATH, phlog_mk2_delete) end -- discontinued -- function notverycashmoneyofyou(damage, activator, caller) -- if activator.cashmoneykills == nil then -- activator.cashmoneykills = 0 -- end -- activator.cashmoneykills = activator.cashmoneykills + 1 --math.min(25, activator.cashmoneykills + 1) -- activator:AddCallback(ON_SPAWN, function() -- local equippedMediGun = activator:GetPlayerItemBySlot(1) -- if equippedMediGun:GetItemName() ~= "Der Übermensch" then -- activator.cashmoneykills = 0 -- end -- activator:RemoveAllCallbacks() -- end -- ) -- activator:AddCallback(ON_DEATH, function() -- activator.cashmoneykills = 0 -- activator:RemoveAllCallbacks() -- end -- ) -- end