Stack troop commands with abilities in hero's chooseAction()?


#1

In the multiplayer:

Can the hero command troops AND call his/her ability in one if statement?

In other words what is meant by only last action happens? What falls under action umbrella?

if (this.health < 50)
{
  this.say("Attack!", {target: enemy});
  this.warcry();
}
this.say("Defend!", {targetPos: {x: 30, y: 30}}));
this.shield();

What will happen in the function, if hero’s health is 49? The help in commented code implies that only this.shield() will execute with rest of the code ignored.


#2

Sorry, it’s not clear what statements are actions! In fact, this.say() is not an action (in this level, but in some other levels it is), and so the last this.say() will be the one that takes, having overwritten the first. Likewise, this.shield() will overwrite the this.warcry() action. But this.shield() won’t overwrite this.say(). I am not sure a better way to indicate which methods will overwrite each other. Thoughts on how to make it easy to understand?