How too: Summoned pet deals 10% more damage if actor ID 11 is wearing summoner robe (armor)

Like the tittle says, I have 20 years of experience with Rpg Maker and there would be so many ways about doing this. One way would be to implement the damage multiplier in the formula box to check if actor ID x is wearing Armor ID x however this would have to be done to every skill that the summon has and there are quite a few summons. I don't want the summoner to have to buff his summons using some type of support skill. I simply want the summons to just already be 100% stronger when the actor is wearing this gear. Any ideas? If all else fails I would still appreciate if someone could build the damage formula for this.

(If actor ID x is wearing armor ID x then damage is a.atk * 3 - b.def * 1 else damage is a.atk * 2 - b.def * 1)
In your damage formula use this:

Code:
$gameActors.actor(11).equips()[x] && $gameActors.actor(11).equips().contains($dataArmors[y]) ? a.atk * 3 - b.def * 1 : a.atk * 2 - b.def * 1

x = equipment slot ID - 1. (i.e. if the Summoner Robe can only be equip in the Body slot which is number four in the Types tab in the database, then x will be 3.)

y = armor ID.
Though this problem seems solved, I like to use element rates for these types of problems as an alternative:

(original formula) * $gameActors.actor(11).elementRate(17)

This would increase the damage by the 11th actors element rate for element 17 (which would probably be a placeholder and only used in these formulas). This solution requires a bit more setup and is less flexible when it comes to how to increase the damage, but it would make it easier to add alternative pet damage increasing effects later.

If you want to buff your summons, that probably depends on how the summons work in the first place. For example, you could maybe give them a state through a common event in the skill that summons them if applicable, but that state would by default disappear on the first death and not reflect whether the summoner equips the armor after the fact.
I'm kinda confused about how much of a damage bonus you actually want. The subject line says "10% more", but then your actual post says that you want the summons to be "100% stronger", and then you proceeded to give an example damage formula that reflects neither of those values. So I dunno, but I'll just roll with the +10% damage thing, and you can adjust as necessary.

If you happen to have VisuStella Battle Core, this would actually be really easy. Supposing that the summoned pet is an actor, you can put this in the note box of that actor:
Code:
<JS Pre-Damage as User>
 if ($gameActors.actor(11).hasArmor($dataArmors[x])) {
   value = Math.round(value * 1.1);
 }
</JS Pre-Damage as User>
leave the damage formula alone and move the validation to the place where all validations are made, AKA, the item_apply routine.

that's quicker access to all states and values, since everything is handled there with it's own functions.
on attack use (or, on valid hit) grab the attacker.
if it's a summon, grab the master (which you should already have, from the process that calls the summon, if it's from a plugin!)
if not, continue as usual.


EDIT: scratch that.
on the damage formula, call for the validation to the summon actor itself.
*IT* should have it's own reference to it's master, if it's summoned from a plugin.
put the return value on that validation, and send that to the formula.
[ a.GetVal - b.def * N ]

where GetVal is a function that returns either X * 3 (IF ->), or X * 2 (IF NOT ->), and X is always self.atk.

since you're at attacking side, "B" is irrelevant, so calculate everything based on the attacker, which is "me" or "master".
once that is sorted out, you send the final value to the battle, and let it run on it's own.
don't put calculations you don't need on the damage formula!
Firstly, thank you everyone that provided and alternative solution! Each formula you provided is one that I and others will be able to come back and look at in the future as reference for building a custom skill.

I'm kinda confused about how much of a damage bonus you actually want. The subject line says "10% more", but then your actual post says that you want the summons to be "100% stronger", and then you proceeded to give an example damage formula that reflects neither of those values. So I dunno, but I'll just roll with the +10% damage thing, and you can adjust as necessary.

If you happen to have VisuStella Battle Core, this would actually be really easy. Supposing that the summoned pet is an actor, you can put this in the note box of that actor:
Code:
<JS Pre-Damage as User>
 if ($gameActors.actor(11).hasArmor($dataArmors[x])) {
   value = Math.round(value * 1.1);
 }
</JS Pre-Damage as User>
@Arthran , I am in fact using the battle core. This looks EXACTLY like the most simplest form of applying what I am hoping to implement. I just have one question. the $dataArmors[x] means the ID of the armor piece in the database. Do I need to include the armor type as well or am I golden with just the armor ID? I'm asking because @CrocPirate mentioned armor type in his formula.

Again, Thank you all for your time!
Firstly, thank you everyone that provided and alternative solution! Each formula you provided is one that I and others will be able to come back and look at in the future as reference for building a custom skill.


@Arthran , I am in fact using the battle core. This looks EXACTLY like the most simplest form of applying what I am hoping to implement. I just have one question. the $dataArmors[x] means the ID of the armor piece in the database. Do I need to include the armor type as well or am I golden with just the armor ID? I'm asking because @CrocPirate mentioned armor type in his formula.

Again, Thank you all for your time!
As long as it is an armor (and not a weapon), then all you gotta do is replace x with the ID of the armor piece in the database. There is no need to worry about the type of armor.

If you happen to want to check for a weapon instead, then you'd replace .hasArmor($dataArmors[x]) with .hasWeapon($dataWeapons[x])

Original thread: https://forums.rpgmakerweb.com/threads/how-too-summoned-pet-deals-10-more-damage-if-actor-id-11-is-wearing-summoner-robe-armor.149816/