Is it possible to be "Idle" in Mages Might? I have heard that there is a "Cool Down" period

Does anyone know how to be Idle at certain moments or some code that will take up some time other than the spawn collecter code?I need code that will take up some time while I am collecting more Mana fruit to summon more spells or because of the cool down preventing me to summon spells.I can’t making more collecters every time I have a cool down period or is low on mana fruit to cast any spells.To spawn collecters,it takes some time and doing that makes me vulurable to attack.I spectated other rounds,hopeful to find some clues and finally,I did.It was the action “Idle”.But…There was a problem.

Right now the only way I know how to be "Idle is when it is the end of your code and your hero does nothing.How would this help me?Well If I could get some code that could be able to control the time of the Idleness, collect more Mana fruit for more spells,pass the cool down period and control my enemy’s amount of blows on me.This could be the key to solving my problem.Do any of you out there know the solution to my problem?Or do you have a totally different way to solve my problem?Please let me know if you have any suggestions.Thank you.

P.S This has to be in Java.

Ideally, your code will be based around a while-true loop rather than simply a list of commands. If that is the case, then to idling is as simple as executing no code in the body of your while loop.

A simple example in Python:

# Untested Code

while True:
  if hero.time < 50: # For the first 50 seconds, only spawn collectors
    hero.spawnCollector()

  if hero.time > 90: # After 1:30, attempt to cast fire balls
    if hero.canCast("fire-ball"):
      hero.cast("fire-ball")

  # Note:
  #   If the time is between 50 seconds and 90 seconds, we do nothing (idle)
  #   If >90 seconds and we cannot afford a fire ball, we will also idle

CodeCombat ensures that a while-true loop will not cause an infinite loop by adding a one tick delay between each iteration (see here).

2 Likes

Also…Welcome to the discourse!!!

1 Like

Thanks so much! But,do you know how to change this code into Java?

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.