QUOTE
This definetely doesn't work as is written in requirement, because it checks step 4 before cleric starts to cast Protection from Fire not after.
It isn't a big issue, but strictly speaking, in this case it means some unnoticeable difference in the game (even if it doesn't have any practical consequences for the tester/player).
Actually, this part of the specification didn't perfectly reflect the practical goal I tried to express, I have spoken about this with someone else as well. Strictly speaking, you're right with that. This is why I've written things (in the discussion in the announcement thread) such as this:
QUOTE
Although the requirement also includes "instead of restarting from Step 1", solutions which use a correctly handled global variable will also be accepted
and
QUOTE
[..]This also guarantees that the next character who the Cleric helps if needed will be the Fighter in all circumstances.
Consequently, the practical goal was supposed to be that the order of
actually executed actions is fixed. That is, assume the Fighter has been attacked by fire at least 5 times so far (and Resist Fire/Cold hasn’t been cast yet), he is feedbleminded too, and the Cleric gets an attack while casting Protection from Fire. In this case, the practical goal was to ensure that the Cleric casts Cure Disease instead of trying to cast Draw Upon Holy Might. I tested it more times and it worked with the reference implementation as well as with your submission.
So in this case, I believe that the difference in the order of condition checks has only theoretical significance; the actions are added to the action list in the correct order even if the condition checks precede the execution of actions. So the sentence "when Protection from Fire has been (successfully or unsuccessfully) cast, the Cleric must immediately move to the next, fourth check" should actually end with "move to the next, fourth step", i.e. the next actions that are executed should be those in Step 4. But strictly speaking, your solution is more robust, precise for the current wording of the requirements in question.
It would be problem if the conditions included triggers with so-called
side-effects (like an expression of array[++i] in programming) and the result of the side effects wouldn't be invariant. For example, instant triggers which immediately set certain variables, and thus might influence the behaviour of actions. Fortunately, this can't happen in this case, as far as I've noticed.
QUOTE
This is almost correct, but cleric will cast Spiritual Hammer, even when he succesfully casts DUHM. He just needs to wait 10 rounds, and when the spell's effect wears off he will cast Spiritual Hammer.
Good spot! Reference implementation deserves penalty points
A new block is needed and some lines, so it means one more block, +4 effective lines for the script altogeher. Of course, I noticed it has some other minor flaws as well (I made it in a short time), e.g. it checks all types of Spiritual Hammers in the inventory, despite the fact that the creature file for the contest is fixed (i.e. has constant level, unless the Cleric had a level-up before the battle
Just kidding).
Nice work with the scripts, they seem to be robust and completely correct (apart from the negligible accident with the Mage).
By the way, I might have not mentioned it yet that you can send me a PM with your portrait choice / subtitle choice; I'll be online so I can quickly set them for you.