This is just a redefined object of the heavy shield with a UsableItem component, and when used it first checks that the champion isn't already blocking, then if they aren't it gives them the blocking condition. The blocking condition currently gives 25 protection for about one second. (You might want to change this, it might be unbalanced.) The champion can still attack or use other items while they are blocking.
This might be OP or otherwise unbalanced, so feel free to change it however you want if you use it.
Also this only has the heavy shield definition, so unfortunately you'll have to redefine every single shield, and make a different condition for every one. And make sure that the shields check for conditions from different shields. I will probably do all this stuff eventually and update this when I'm done, but if anyone wants to use it until then feel free to.
Also if anyone knows of a more efficient way of doing this that doesn't involve so much conditions, please tell me.
Code:
Code: Select all
defineCondition{
name = "blocking",
uiName = "Blocking",
description = "Using a shield.",
iconAtlas = "assets/textures/gui/spell_icons.tga",
icon = 4000,
beneficial = true,
harmful = false,
tickInterval = 1,
onStart = function(self, champion, new)
self:setDuration(1)
champion:modifyBaseStat("protection",25)
end,
onStop = function(self, champion)
champion:modifyBaseStat("protection",-25)
end
}
defineObject{
name = "heavy_shield_new",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/heavy_shield.fbx",
},
{
class = "Item",
uiName = "Heavy Shield",
gfxIndex = 15,
weight = 6.0,
traits = { "shield" },
},
{
class = "EquipmentItem",
slot = "Weapon",
-- evasion = 6,
},
{
class = "UsableItem",
sound = "none",
cooldown = 3.4,
emptyItem = "heavy_shield_new",
canBeUsedByDeadChampion = false,
onUseItem = function(self, champion)
if champion:hasCondition("blocking")
then
return false
else
champion:setCondition("blocking")
champion:showAttackResult("Blocking!", "HitSplashLarge")
end
end,
},
},
}