Jump to content

Weird damage calculation


Playr10

Recommended Posts

This is the condition's code, while it works perfectly fine on cards, it seems to start higher than 10% per stack and exponentially decrease on NPCS. When stacks are at 20, the attack deals exactly 4x damage. I want each stack to only add 10% to damage (ex: 4 stacks = 140% damage, 2 = 120%)
 event_handlers =
        {
            [ BATTLE_EVENT.CALC_DAMAGE ] = function( self, card, target, dmgt )
                if card.owner == self.owner then
                    dmgt:ModifyDamage( math.round( dmgt.max_damage * (1+(0.1*self.stacks))),
                                       math.round( dmgt.max_damage * (1+(0.1*self.stacks))),
                                       self )
                end
            end,
        }

Link to comment
Share on other sites

So that would technically be 40% more damage right?  What I'm seeing in your code is 140% more damage on top of the damage you will already be doing, you can probably fix it if you do:

dmgt:AddDamage( math.round( dmgt.max_damage * (0.1*self.stacks)),
                                       math.round( dmgt.max_damage * (0.1*self.stacks)),
                                       self )

dmgt.max_damage is already 100% of the damage, (0.1*self.stacks) will add 40% more damage to that assuming self.stacks == 4

Basically just remove the 1+

Link to comment
Share on other sites

No, it's not a 140% increase in damage, it's 140% damage total. I'd know if it doubled damage if enemies started off doing 110% more damage than usual, plus as I said before, it was exponentially decreasing in % increase per stack. I was going to get a video to show you, but my code inexplicably started working, so I'll take it. It might have been creature/character/racial traits interfering, but I find that unlikely since I tested this on several different enemies.

edit: plus, if this were true, my cards would be dealing double damage with 1 stack

Link to comment
Share on other sites

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...