Multiplayer: cannot get attackDamage


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.attackDamage;
        total += amount;
    return total;


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];

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.

1 Like

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 ?

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.

isn’t the damage completely unit based?

Yes, its unit based, but rather than trying to determine DPS (and range, etc.) for each individual enemy.type, then ranking what you think is the most dangerous and telling your hero to go after that type first, wouldn’t it be cool to have your hero do a real-time damage assessment based on attributes of the enemy it figures out for itself?