Multiplayer: cannot get attackDamage


#1

Hey,

I was attempting to create an algorithm that involves getting enemy (and ally) attackDamage or DPS.
I see the variable is already defined but were aren’t allowed access to it.

Here is the relevance javascript code:

function get_strength(sequence) {
    var total = 0;
    for (var i = 0; i < sequence.length; i++) {
        var element = sequence[i];
        var amount = 0;
        if (!element.hasEffect("stomp")) {
            amount = element.health * element.attackDamage;
        }
        total += amount;
    }
    return total;
}

get_strength(this.enemies);

Here is a workaround encase anyone needs it

var DPS = {"soldier" : 5,
            "archer" : 16.67,
            "knight" : 20, 
            "librarian" : 13,
            "brawler" : 20,
            "munchkin" : 4,
            "thrower" : 18};
return DPS[element.type];

#2

We don’t want to add too many properties to Thangs’ APIs, or they’ll become unwieldy, and it’s pretty low-priority for most players to programmatically access DPS (although nice job, that sounds like a great strategy!). I could see adding an advanced item in the hero game that lets you access attackDamage, but that wouldn’t help you on Dungeon Arena, which doesn’t use the hero mechanics.


#3

Correct me if i’m wrong. but wouldn’t this be kind of useless considering you can’t tell what weapon they have equipped which is probably the biggest factor of DPS ?


#4

If you are fighting against an enemy hero, there’s a lot more variety. It might be useful for calculating how long a given ogre might take to kill you, for example, or finding the ones who do the most damage per health point they have so you can target them first.


#5

isn’t the damage completely unit based?