Conditions (JavaScript)

Conditions

> Tutorial

In the previous chapter, we saw how to boost ourselves, give ourselves a shield and heal ourselves. You've probably noticed that boosting and protecting yourself is always useful, but healing is pointless when your life is already at its maximum.

To avoid casting a heal and wasting TP , we'll use a condition, which is written like this:

This code casts Bandage only if we're hurt, that is, when our current life me.life is less than ` Which code(s) are valid?

if me.life < me.maxLife { me.useChip(Chip.bandage) } if (me.life < me.maxLife { me.useChip(Chip.bandage) }) if (me.life < me.maxLife) { me.useChip(Chip.bandage) } else { me.useChip(Chip.helmet) } if { me.life < me.maxLife } { me.useChip(Chip.bandage) }

Full AI