Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Maliki's Enemy Death State Markers
- // MalMZ_EnemyDeathStateMarkers.js
- // version 1.0 MZ
- //=============================================================================
- /*:
- * @target MZ
- *
- * @plugindesc ver1.0 Allows devs to give enemies states when taking Hp or MP damage. Also makes battlers die if they have 0 mp while having MMP over 0.
- * @author Maliki79
- *
- * @param HPDamageState
- * @desc Place an interger of the state from the database that will be added whenever an enemy takes HP Damage. 0 will not add a state.
- * Default: 0
- * @default 0
- *
- * @param MPDamageState
- * @desc Place an interger of the state from the database that will be added whenever an enemy takes MP Damage. 0 will not add a state.
- * Default: 0
- * @default 0
- */
- var MalSpec = MalSpec || {};
- MalSpec.Parameters = PluginManager.parameters('MalMZ_EnemyDeathStateMarkers');
- MalSpec.Param = MalSpec.Param || {};
- MalSpec.hpState = parseInt(MalSpec.Parameters['HPDamageState']) || 0;
- MalSpec.mpState = parseInt(MalSpec.Parameters['MPDamageState']) || 0;
- Game_Battler.prototype.refresh = function() {
- Game_BattlerBase.prototype.refresh.call(this);
- if (this.hp === 0 || (this.mp === 0 && this.mmp != 0)) {
- this.addState(this.deathStateId());
- } else {
- this.removeState(this.deathStateId());
- }
- };
- Game_BattlerBase.prototype.die = function() {
- this._hp = 0;
- if (this.isActor()) {
- this.clearStates();
- this.clearBuffs();
- };
- };
- var malGainHp = Game_Battler.prototype.gainHp;
- Game_Battler.prototype.gainHp = function(value) {
- malGainHp.call(this, value);
- if( this.isEnemy() && MalSpec.hpState != 0){
- if(value < 0) {
- this.addState(MalSpec.hpState);
- } else {
- this.removeState(MalSpec.hpState);
- };
- };
- };
- var malGainMp = Game_Battler.prototype.gainMp;
- Game_Battler.prototype.gainMp = function(value) {
- malGainMp.call(this, value);
- if( this.isEnemy() && MalSpec.mpState != 0){
- if(value < 0) {
- this.addState(MalSpec.mpState);
- } else {
- this.removeState(MalSpec.mpState);
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement