Hey!
I would like to make a skill that deals more damage if the user has a certain class.
So, I figured out that this can be done either with
a.actor.class_id == x ? y : z
or
a.class_id == x ? y : z
But enemies that use the skill now deal no damage anymore. Can I make the skill work for enemies as well?
No, enemies don't have classes by default, so you can use class ID when the attacker's an enemy.
Of course there are ways to make the skill WORK (just like how you can make anything work if you change the requirements), but as far as class is concerned, you need to get yourself enemy classes in order to accomplish that.
Yes, that's right. I actually expected "z" to be the result in that case, but it isn't. Is there any way to change the formula so enemies use the "z" part of the formula as well (like actors with a different class than x)?
Or you can include logic to say what should happen if the user is an enemy:
a.enemy? ? dmg1 : (a.class_id == x ? dmg2 : dmg3)
Ah, that looks good. 🙂 Thank you very much!
Would something like this work, too? Just curious now.
a.enemy? || a.class_id != x ? y : z
It should. If it doesn't, try putting brackets around the condition just to clarify it a bit:
(a.enemy? || a.class_id != x) ? y : z
I would be surprised if you needed to, though.