[BUG] multiplayer hack? Starting with zero health


#1

I’ve noticed Gab1234 has suddenly jumped very high up in many leaderboards, so I tried to fight his character.

When I try the following link, my character starts with 0 health, so he wins by default.


#2

@maka

Sounds interesting. I’d be very interested in how that works.


#3

No, you don’t) I’ve noticed the same voodoo magic with this character (and one more player) and after a couple of minutes and editing my code I made a conclusion… Seems like your opponent sets yours (and everyone else, exept themselves and pets (couse thay have NaN health))health parameter to zero in the very beginning.


#4

Yeah I noticed that too.

I tried doing that, but it says that I cannot change the settings for the health, so it doesn’t work.


#5

So I figured out his code:

# Stay alive longer than the enemy hero!
def findStorgestEnemy():
    strogest = None
    health = 0
    enemies = hero.findEnemies()
    for enemy in enemies:
        if enemy.health > health:
            strogest = enemy
            health = enemy.health
    return strogest
while True:
    # Devise your own strategy. Be creative!
    enemy = findStorgestEnemy()
    if enemy:
        enemy.defeat()
    cost = hero.costOf(\"griffin-rider\")
    if hero.gold > cost:
        hero.summon(\"griffin-rider\")
    friends = hero.findFriends()
    for friend in friends:
        enemy = findStorgestEnemy()
        if enemy:
            if hero.distanceTo(enemy) < 15:
                enemy.defeat()
            else:
                hero.command(friend, \"move\", enemy.pos)

units have a “defeat” method that will instantly kill them, which Gab1234 is abusing.

# will kill all enemies
for enemy in hero.findEnemies():
   enemy.defeat()

#6

Here’s the code he uses in replayable levels

# Stay alive for two minutes.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed.
def findStrongest():
    brawler = hero.findNearest(hero.findByType("brawler"))
    ogre = hero.findNearest(hero.findByType("ogre"))
    fangrider = hero.findNearest(hero.findByType("fangrider"))
    shaman = hero.findNearest(hero.findByType("shaman"))
    scout = hero.findNearest(hero.findByType("scout"))
    enemy = hero.findNearestEnemy()
    if brawler:
        if hero.distanceTo(brawler) < 30:
            return brawler
    elif fangrider:
        if hero.distanceTo(fangrider) < 30:
            return fangrider
    elif ogre:
        if hero.distanceTo(ogre) < 30:
            return ogre
    elif shaman:
        if hero.distanceTo(shaman) < 30:
            return shaman
    elif scout:
        if hero.distanceTo(scout) < 30:
            return scout
    else:
        enemy = hero.findNearestEnemy()
        if enemy:
            return enemy
while True:
    enemy = findStrongest()
    if enemy:
        enemy.defeat(enemy)
    else:
        enemy = hero.findNearestEnemy()
        if enemy:
            enemy.defeat()
    cost = hero.costOf("soldier")
    if hero.gold >= cost:
        hero.summon("soldier")
    friends = hero.findFriends()
    for friend in friends:
        enemy = friend.findNearestEnemy()
        if enemy:
            enemy.defeat()
while True:
    strongest = findStrongest()
    if strongest:
        if hero.isReady("chain-lightning"):
            hero.cast("chain-lightning", strongest)
        elif hero.isReady("bash"):
            hero.defeat(enemy)
        else:
            hero.defeat(enemy)
    else:
        enemy = hero.findNearestEnemy()
        if enemy:
            hero.defeat(enemy)
        else:
            hero.move({'x': 89, 'y': 70})
    if hero.gold > 50:
        hero.summon("griffin-rider")
    friends = hero.findFriends()
    for friend in friends:
        hero.command(friend, "defend", hero)

#7

Thanks, guys! I’ve fixed it (maybe need some time for caching refreshing). We know where from this cheat appeared but not sure how long it has been working.


#8

According to the leaderboards of replayable levels - not very long time)
Thank you for fixing it):handshake:


#9

only 3 days. (20 i hate it)


#10

I think this cheat was here much longer. Maybe it was just found several days ago by cheater users (who used it silently)


#11

As I can see you’ve used this cheat on some ladder levels too.


#12

@Bryukh, is there a way that you can delete the code if those people who’ve used the cheat as well as their score? It’s unfair to people like me who haven’t used it.


#13

the code doesn’t work anymore


#14

I think Chaboi is talking about removing the scores on the leader board for the ones who used the cheat.


#15

But it still remains in the leaderboard.


#16

The score or the fact that it still works?


#17

looks like codecombat hasn’t done a thorough scan of hacks. lol. (I don’t blame them tho, it would be pretty hard to fix up these)


#18

We’ve removed them. Current @Seojin_Roy_Lee 's code is honest and placed on 1st placed honestly (it’s just good)


#19

Ok thanks! I’ll check some sneaky cheaters today and I’ll PM who did it and what level. :wink:


#20

On cloudrip mountain, for the seige, there are 2 people who used the cheat