Increase Damage Based on Enemy Type

Hello,


Just a quick question. I'm looking to create weapons/skills that deal bonus damage to enemies of certain type. For example, a sword that does 10% bonus damage to Dragons.


I know that I can just make the sword attack with an element, and have the enemy weak to that element, but I'm wondering if there is a way that this would be possible with a plugin. The reason I ask is because I would like to incorporate a "scan" skill, and I don't want the scan to show the element under weaknesses.


Please let me know if you need any more details. Thank you.
If you're using Yanfly's stuff you can use his auto passive states plugin (in combination with his buffs and states core) to give certain enemies weakness to certain weapons. The downside is that you'd be making a state for each enemy type you want to interact with, but on the plus side that entire enemy type would be editable from a single state from there on. If you do decide to go that route I can write the base code for it
@Fugama I am definitely using Yanfly's stuff. I am wondering how this would be possible with the auto passive states. If you could write the base code for that, I would super appreciate it.
Alright, I used the example you listed above. This should work wonders! Just make a state, name it after the enemy type, and give it to enemies via <passive state: x> in their notebox Plenty of notes so you know what does what and examples to show you how to change the numbers and extra damage rate

Code:
//for Dragons
<custom battle effect>
//List Wep ID's that Dragons are weak to Example: user._weakToWeps = [1, 2, 3, 4];
user._weakToWeps = [];
</custom battle effect>

<custom react effect>
//make sure user is actor
if (user.isActor){
//fetches the attackers weapon
var equipList = user._equips[0];
//fethes the weapon id
var currentEquip = equipList._itemId;
//check if the attackers weapon is in the listed weaknesses
if (target._weakToWeps.contains(currentEquip)){
	//change this to change the pecent of damage added. 0.1 = 10%, 0.01= 1%
	var damageRate = 0.1;
	//Math is for nerds
	var addDamage = Math.floor(value * damageRate);
	//add the nerd stuff to the total damage
	value += addDamage;
}
}
<custom react effect>
Thanks so much for your help! Great explanation, really cleared everything up for me. Much obliged, again. 🙂
Actually I found a bit of a uh....issue with the code. Basically it would boon the damage of all your stuff instead of weapon based stuff. Here's a fix to that! Just make sure your Weapons skills are marked as "Physical" under Hit Type feel free to PM me if you find any other problems/have any other questions. 

Code:
//for Dragons
<custom battle effect>
//List Wep ID's that Dragons are weak to Example: user._weakToWeps = [1, 2, 3, 4];
user._weakToWeps = [1];
</custom battle effect>

<custom react effect>
//make sure user is actor
if (user.isActor){
//fetches the attackers weapon
var equipList = user._equips[0];
//fethes the weapon id
var currentEquip = equipList._itemId;
//fetch skillID
var skillId = this._item._itemId;
//find the skill
var skilltype = $dataSkills[skillId];
//find hitType
var hitType = skilltype.hitType;
//check if the attackers weapon is in the listed weaknesses, and checks if this is a physical attack
if (target._weakToWeps.contains(currentEquip) && hitType == 1){
	//change this to change the pecent of damage added. 0.1 = 10%, 0.01= 1%
	var damageRate = 2.0;
	//Math is for nerds
	var addDamage = Math.floor(value * damageRate);
	//add the nerd stuff to the total damage
	value += addDamage;
}
}
<custom react effect>

Original thread: https://forums.rpgmakerweb.com/threads/increase-damage-based-on-enemy-type.70790/