Jump to content

Any way to calculate how much damage an enemy will deal to you?


u lil nerd

Recommended Posts

Hi there, I've been stumped on this for a while but I don't think there seems to be a function that allows you to return the number of damage an enemy will deal to you after your turn ends and was just wondering if anyone had any luck doing so?  Also I'm stuck on adding hit_count for the amount of condition stacks an enemy has? 

Link to comment
Share on other sites

Ah I've figured out how to calculate how much damage an enemy or enemies will deal to you, just haven't figured out how to increment your hit count on an enemy you are targetting.  It seems that you can only increment it in the Prereq function, so far I've found out how to get a random enemy in Prereq and get all of their conditions and the stacks of the conditions, then apply it to hit_count but haven't had much luck on a specific enemy or the enemy you want to target as it seems like that you cannot increment a hit_count unless you target an enemy which counts as an attack (Which hasn't happened yet if you are in Prereq)

Link to comment
Share on other sites

  • Developer

This is something pretty hard to do in the current release build, so I made a change in experimental (you'll see it next push) to support this a little easier.  Here's an example stab attack that does one extra hit per stack of Power on the selected target.

Pay particular attention to 'hit_anim = true', which basically tells the presentation to replay the same anim for each attack, and of course, the CALC_HIT_COUNT event handler.

Hopefully this sets you on the right path.

Spoiler


    stab =
    {
        name = "Stab",
        anim = "stab",
        flavour = "'Why do I have two daggers? Well, I have two hands, don't I?'",

        flags = CARD_FLAGS.MELEE,
        rarity = CARD_RARITY.BASIC,
        cost = 1,
        max_xp = 6,
        wild = true,
        hit_anim = true,

        min_damage = 2,
        max_damage = 5,


        event_handlers =
        {
            [ BATTLE_EVENT.CALC_HIT_COUNT ] = function( self, acc, card, target )
                if card == self then
                    acc:AddValue( target:GetConditionStacks( "POWER" ))
                end
            end,
        }
    },

 

Link to comment
Share on other sites

Amazing, thank you so much!  The mod I'm creating has some features that the cards currently don't have in included functions, including hit count depending on whatever, so this takes off some of the stress I've been dealing trying to be innovative haha.  With this new event handler, would it be possible to change attack anim for each hit like if hit_count = 2, could I have hit 1 to use anim = attack1 and hit 2 to use anim = attack2 for example?

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