Jump to content

Way to make something activate at x stacks


Recommended Posts

I have a mechanic in mind, and it involves making an existing effect (Protect) activate at 3 stacks instead of 1. I.E. enemies will attack this character when they have 3 stacks of it only, not anything below (lose 3 on hit to compensate).

Problem was, I couldn't find a place to add it to protect that would make it work without breaking protect in half. 

The only other option I had was extensive work arounds, each making it even more complicated than before and ending in something that kind of works, but gameplay is about as consistent as a derailed train covered in butter wearing roller skates.

  • Developer

If I'm understanding your intent correctly, can you just override the CanBeTargetted function of Protect so that it only validates for stacks of >= 3?  Something like this:

local pdef = Content.GetBattleCondition( "PROTECT" )
pdef.CanBeTargetted = function( self, card, fighter )
    if card:IsAttackCard() and not self.owner:HasCondition("STUN") then
        if fighter:GetTeam() ~= card:GetOwner():GetTeam() and card.owner:GetTeam() ~= self.owner:GetTeam() then
            if self.owner:GetConditionStacks( "PROTECT" ) >= 3 and fighter ~= self.owner and not (fighter:GetConditionStacks() >= 3) then
                return false, self:GetLocalizedString( "PROTECTED" )
            end
        end
    end
    return true
end

You'd have to replace OnPostDamage and the STATUS_CHANGED handler as well if you wanted it to remove more than 1 stack at a time.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...