What's wrong with this damage formula?

I have a boss that you have to fight with a temporary party member in your party. The gimmick to this fight is that the temporary party member has the only skill that can actually take a large chunk out of the boss's health.

The damage formula I'm using for said skill is this:

if b.id==94;9999;else;(150+a.mat*2-b.mdf*2);end

What it's supposed to do is check if the target is the boss (Which has an ID of 94 in the database) and if the target is indeed the boss, deal 9999 damage, and if not, use the skill's default damage formula. However, when I tested the skill against the boss, it did no damage at all.

So why isn't this formula working?
Are you 100% sure that that is the correct way to identify the particular enemy?

It might be that you should be using

[SIZE=10.5pt]$game_troop.members[n].  where n = the index number of the particular enemy in the troop.[/SIZE]

[SIZE=10.5pt]Another possibility is that it should be[/SIZE]

[SIZE=10.5pt]def enemy?[/SIZE]
You could use Yanfly's Weapon Attack Replace or Vlue's Set Guard/Attack Skills to make the guest actor have access to a separate attack formula.
You could use Yanfly's Weapon Attack Replace or Vlue's Set Guard/Attack Skills to make the guest actor have access to a separate attack formula.
That's not quite the effect I'm looking for though, because I want the skill to do 9999 damage to the specific boss only, the skill will use its normal damage formula for every other enemy, and I want to refrain from creating two copies of the same skill unless there is no other choice. Furthermore, what you're suggesting is to replace the primary attack command of the guest actor with the skill, which I also don't want. (The skill is supposed to be separate from the main attack command.)
Guessing b.id is not a correct way of checking enemy's id so it returns 0 damage as else;.

Try if b.enemy_id=94; 9999; else; damage formula;end for instead (I don't test it myself coz' I'm at work lol).
Here's a silly idea. Try setting the skill to do damage equal to b.id (for the short term), and no variance. If it does exactly 94 damage to that boss, then you know it is finding the id correctly and that is not the issue. I'd suggest trying that and reporting the result, as that would either prove the theory right that b.id doesn't work, or prove to everyone that this is not the issue.
Here's a silly idea. Try setting the skill to do damage equal to b.id (for the short term), and no variance. If it does exactly 94 damage to that boss, then you know it is finding the id correctly and that is not the issue. I'd suggest trying that and reporting the result, as that would either prove the theory right that b.id doesn't work, or prove to everyone that this is not the issue.
I just tried this.The result was the same "<target> took no damage." message I got before.
Try this instead:

b.enemy? && b.enemy_id == 94 ? 9999 : 150 + (a.mat - b.mdf) * 2Yours doesn't work as in the default RMVXA, enemies doesn't use id. They use enemy_id instead.

When yours are run, it actually returns a no method error. There's no crashes however, as it's rescued by forcing the resulting damage to be 0.

Technically speaking:

Spoiler
attr_reader :enemy_id # enemy IDIs the Game_Enemy public instance variable returning the enemy's id.

def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) # Evaluates the item's damage formula value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) endIs the Game_Battler method using the damage formula.

def eval(a, b, v) [Kernel.eval(@formula), 0].max * sign rescue 0 # Returns 0 when the game would crash endIs the RPG::UsableItem:😀amage method evaluating the damage formula.

Original thread: https://forums.rpgmakerweb.com/threads/whats-wrong-with-this-damage-formula.38646/