Backwood ambush a wizard sees both enemies but only casts against one


Function: hero cast spell works once and then does not cast spell again. The hero does ‘see’ the enemy but fails to cast.

I understand that I’m not using using python and that my ‘script’ is being interpreted.

Which makes me wonder if it’s me or the interpreter that is failing.

AFWIW, Cybersec is built on confusing the enemy. Unfortunately, this enemy is paying. Going forward…

  • Provide links to the source code in the level to make it easier to sort IF there is a bug?
  • Allow users to leave tips to devs/other users? Flag the level as possibly buggy?

see video

here’s the code:
# In this level you will use functions with two parameters.
# Look at the structure below, notice how there are two arguments.
# These are both accessible within the function.

def checkAndAttack(x, y):
    # First move to the coordinates provided by the parameters.
    hero.moveXY(x, y)
    # Then check for an enemy.
    # If there is one, attack it!
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.say("Enemy mine!") #I added this to ck if hero saw the enemy at all
       #hero.cast("chain-lightning", enemy) # no diff same no cast on second enemy
        hero.cast("chain-lightning", hero.findNearestEnemy())

checkAndAttack(24, 42)
checkAndAttack(27, 60)
# Navigate to the last 3 x-marks and defeat any remaining munchkins.
checkAndAttack(42, 50)
checkAndAttack(39, 24)
checkAndAttack(55, 29)
1 Like

It looks like you were using the Emperor’s Gloves to cast chain lightning, which has a 20 second specific cooldown between casts. That’s why nothing happened on the second cast.
Try using a different attack with lower cooldown.

1 Like

I reread the chain lightning spell and YES there is mention of the 20sec. rule. I’m sorry for wasting your time.

I just checked the details on the glove. See link. No mention of time to regenerate… Where do I find little details like that on the equipment?

thank you

1 Like

You can find such details in the Thang editor.

In the Emperor’s Gloves thang, open the “Components” tab, select the magic.CastsChainLightning component and look at the specificCooldown value.

As for the in-game description, I believe there are two problems:

  • The values are not being populated correctly in the description. This is a know issue (#2393, #2885). E.g. spells['chain-lightning'].damage should display the actual value instead of that text.

  • The Cast Lightning spell’s cooldown should be added to the Emperor’s Gloves description.

1 Like

Many thanks for the detailed and thoughtful review.

I see why my code did now work now. Thank you.

Having bumped into one bug early on in codecombat I think every problem I have now is a bug. :frowning: My mental weakness. I imagine I’m not alone.

suggestion going forward:
place links to in description of items so curious users can quickly ID component parts and functionality.

see screen grab for visual on suggestion:

thank you,

1 Like

Well, you can always post in the forums to have a second pair of eyes review the issue and help determining whether it is a bug or not. :smiley:

I’m not sure—in my opinion, all the relevant information should be displayed in the item description. The thang editor is not very user-friendly, it is designed with developers in mind.

1 Like