Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

The weapon formulas can contain anything that would normally work in the damage formula. As such, you can use a ternary operator to return one of two numbers if a specific condition is met:

a.atk *4 - b.def *2

This would be a normal damage formula.

a.isStateAffected(4) ? (a.atk *4 - b.def) : (a.atk *4 - b.def *2)

This adjusted formula would be the normal one if the actor does not have state 4 (after the ":") or an altered one if he has the state, in this case halving the enemy's effective defense value. You can also nest these operators together, allowing a check for multiple states in a row and modifying the formula accordingly:

a.isStateAffected(4) ? a.isStateAffected(5) ? (a.atk *4) : (a.atk *4 - b.def) : (a.atk *4 - b.def *2)

If he has states 4 and 5, he ignores defense completely, just 4, he halves it, and if neither, full defense.