//============================================================================= // Maliki's Damage Type Changer // MalDamageTypeChange.js // version 1.0 //============================================================================= /*: * @plugindesc Version 1.0 Allows States to temporarily alter damage types in battle * @author Maliki79 * @help * To change a battler's damage type, place the following tag onto state notes: * * * * * with changing ALL attacks to Magical. * changing them to physical * and changing them to certain hit type. * * Note that this alone will NOT alter damage formulas. * In other words, if you want a magical skill to ignore magic defence, you'll * need to do more than just apply this tag. * * Note also that there is a preferential order if you have multiple tags active. * Certain Hit - Physical - Magical */ //begin database setup var MalTChDatabaseLoad = DataManager.isDatabaseLoaded; DataManager.isDatabaseLoaded = function() { if (!MalTChDatabaseLoad.call(this)) return false; if (!DataManager._malTCh_DatabaseLoaded) { this.processTChNotetags($dataWeapons); this.processTChNotetags($dataArmors); this.processTChNotetags($dataStates); DataManager._malTCh_DatabaseLoaded = true; } return true; }; DataManager.processTChNotetags = function(group) { for (var n = 1; n < group.length; n++) { var obj = group[n]; obj.c_change = false; obj.p_change = false; obj.m_change = false; this.createTChValues(obj); } }; DataManager.createTChValues = function(object) { var noteread = object.note; if(noteread.indexOf("typeChange_c") > -1) object.c_change = true; if(noteread.indexOf("typeChange_p") > -1) object.p_change = true; if(noteread.indexOf("typeChange_m") > -1) object.m_change = true; }; //End Database setup var mal_TCh_isCertainHit = Game_Action.prototype.isCertainHit; Game_Action.prototype.isCertainHit = function() { if(this.typeCheck("a")) return this.typeCheck("c"); return mal_TCh_isCertainHit.call(this); }; var mal_TCh_isPhysical = Game_Action.prototype.isPhysical; Game_Action.prototype.isPhysical = function() { if(this.typeCheck("a")) return this.typeCheck("p"); return mal_TCh_isPhysical.call(this); }; var mal_TCh_isMagical = Game_Action.prototype.isMagical; Game_Action.prototype.isMagical = function() { if(this.typeCheck("a")) return this.typeCheck("m"); return mal_TCh_isMagical.call(this); }; Game_Action.prototype.typeCheck = function(key) { var key = key; var states = this.subject().states(); for(var i = 0; i < states.length; ++i) { if(states[i].c_change == true && (key === "c" || key === 'a')) return true; if(states[i].p_change == true && (key === "p" || key === 'a')) return true; if(states[i].m_change == true && (key === "m" || key === 'a')) return true; } return false; };