Damage formula based on equipped armor

Hi. I would like to make an ability where the damage is increased if the user has no armor equipped. The damage formula is as follows: if has no armor equipped, the damage would be 110 + a.atk * 2 - b.def * 2.
If the user is using an armor, that damage formula would be 55 + a.atk * 2 - b. def * 2


How could I make it?
By "armor" do you mean specifically chest armor or are helms/accessories also included?
By "armor" do you mean specifically chest armor or are helms/accessories also included?
Yeah. All kind of armor included. I'm making a game where the armor is a special kind of item that The actor (or enemy) can have. Like special gems. And this ability I am making is stronger when the user has no equipment.
If that is the case, you can use this formula:
Code:
wa = a.equips.any? { |e| e.is_a?(RPG::Armor) }; a.atk * 2 - b.def * 2 + (wa ? 55 : 110)

I am not sure whether or not it fits because VX Ace formula box is very small, but it is not so long so I am quite positive.
That worked perfectly well. Thanks. I could have never had imagine to put something like that.
@Heirukichi You could also do the following to save space:
Code:
wa = a.armors.any?; a.atk * 2 - b.def * 2 + (wa ? 55 : 110)
or:
Code:
a.atk * 2 - b.def * 2 + (a.armors.any? ? 55 : 110)
@Heirukichi You could also do the following to save space:
Code:
wa = a.armors.any?; a.atk * 2 - b.def * 2 + (wa ? 55 : 110)
or:
Code:
a.atk * 2 - b.def * 2 + (a.armors.any? ? 55 : 110)
Thank you both!
@Wisshy
If your query is fully resolved, please Report your post and ask for the thread to be closed. Mods might not see a post, but they will see a Report.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/damage-formula-based-on-equipped-armor.116286/