Uhh I said spells can't be modified by anything in the game state. that's oversimplification. THe game defines some methods; for example, you can do a spell on a target, and check whether it's friendly or hostile, and do an appropriate spell. For example,
/cast [harm] lightning bolt [help] healing wave
but you can only use the built-in features. It's been made impossible to cast a different size of heal based on how much healing the target needs, for example. Altho, there are methods to bypass those preventions..