Boss Fights – vs Memory Shield

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

“Harold” returns with our scheduled rematch. This time, he has a new trick up his sleeve! But will it be enough for him to make this an interesting boss fight?

For those who’d like to get the code for the Memory Shield, go here: 


Memory Shield Plugin Requirements



Memory Shield Stage 1 – Perfect Memory


When the Memory Shield’s user is struck by an offensive skill, the Memory Shield will memorize it the skill’s ID. Any hit that follows afterward will be automatically evaded.

Insert the following Lunatic Mode code into the Memory Shield stage 1’s notebox:

<Custom Apply Effect>
user._memoryShield = user._memoryShield || [];
user.setStateCounter(stateId, user._memoryShield.length);
</Custom Apply Effect>

<Custom Select Effect>
if (this.isSkill() && !this.isAttack() && this.isForOpponent()) {
  var skillId = this.item().id;
  if (target._memoryShield.contains(skillId)) {
    this._formerItemSuccessRateMS = this.item().successRate;
    this.item().successRate = 0;
  } else {
    target._memoryShield.push(skillId);
    target.setStateCounter(stateId, target._memoryShield.length);
    var skill = $dataSkills[skillId];
    var text = '<CENTER>\\c[4]\\i[' + skill.iconIndex + ']' + skill.name + '\\c[0] added to \\c[4]Memory Shield\\c[0]!';
    var wait = 60;
    BattleManager.addText(text, wait);
  }
}
</Custom Select Effect>

<Custom Deselect Effect>
if (this._formerItemSuccessRate !== undefined) {
  this.item().successRate = this._formerItemSuccessRateMS;
}
</Custom Deselect Effect>

Memory Shield Stage 2 – Limited Memory


Memory Shield under stage 2 is a bit weaker. Just like the Perfect Memory Shield, it will cause the user to evade any memorized offensive skills directed towards the user. However, the Limited Memory functionality will cause the Memory Shield to be only able to store 8 skills at a time. When a new skill is memorized that would push it past 8, the oldest stored memory will be pushed out and removed storing only the last 8 skills used against the Memory Shield’s user.

Insert the following Lunatic Mode code into the Memory Shield stage 2’s notebox. Change the values in red to reflect the settings of your game.:

 <Custom Apply Effect>
user._memoryShield = user._memoryShield || [];
user.setStateCounter(stateId, user._memoryShield.length);
</Custom Apply Effect>

<Custom Select Effect>
if (this.isSkill() && !this.isAttack() && this.isForOpponent()) {
  var skillId = this.item().id;
  if (target._memoryShield.contains(skillId)) {
    this._formerItemSuccessRateMS = this.item().successRate;
    this.item().successRate = 0;
  } else {
    target._memoryShield.push(skillId);
    var skill = $dataSkills[skillId];
    var text = '<CENTER>\\c[4]\\i[' + skill.iconIndex + ']' + skill.name + '\\c[0] added to \\c[4]Memory Shield\\c[0]!';
    var wait = 60;
    BattleManager.addText(text, wait);
    for (;;) {
      if (target._memoryShield.length > 8) {
        var skill = $dataSkills[target._memoryShield.shift()];
        target.startAnimation(5);
        text = '<CENTER>\\c[4]\\i[' + skill.iconIndex + ']' + skill.name + '\\c[0] is removed from \\c[4]Memory Shield\\c[0]!';
        BattleManager.addText(text);
      } else {
        break;
      }
    }
  target.setStateCounter(stateId, target._memoryShield.length);
  }
}
</Custom Select Effect>

<Custom Deselect Effect>
if (this._formerItemSuccessRate !== undefined) {
  this.item().successRate = this._formerItemSuccessRateMS;
}
</Custom Deselect Effect>

Memory Shield Stage 3 – Memory Leak


Memory Shield under stage 3 operates the same way as stage 2, where it can only store the last 8 skills used against the Memory Shield’s user. However, in this stage, if the user is struck by a basic attack, the Memory Shield will leak out its oldest stored skill even without 8 skills being stored. If the Memory Shield has 0 skills, then no skills will be leaked out.

Insert the following Lunatic Mode code into the Memory Shield stage 3’s notebox. Change the values in red to reflect the settings of your game.:

<Custom Apply Effect>
user._memoryShield = user._memoryShield || [];
user.setStateCounter(stateId, user._memoryShield.length);
</Custom Apply Effect>

<Custom Select Effect>
if (this.isSkill() && !this.isAttack() && this.isForOpponent()) {
  var skillId = this.item().id;
  if (target._memoryShield.contains(skillId)) {
    this._formerItemSuccessRateMS = this.item().successRate;
    this.item().successRate = 0;
  } else {
    target._memoryShield.push(skillId);
    var skill = $dataSkills[skillId];
    var text = '<CENTER>\\c[4]\\i[' + skill.iconIndex + ']' + skill.name + '\\c[0] added to \\c[4]Memory Shield\\c[0]!';
    var wait = 60;
    BattleManager.addText(text, wait);
    for (;;) {
      if (target._memoryShield.length > 8) {
        var skill = $dataSkills[target._memoryShield.shift()];
        target.startAnimation(5);
        text = '<CENTER>\\c[4]\\i[' + skill.iconIndex + ']' + skill.name + '\\c[0] is removed from \\c[4]Memory Shield\\c[0]!';
        BattleManager.addText(text);
      } else {
        break;
      }
    }
  target.setStateCounter(stateId, target._memoryShield.length);
  }
} else if (this.isAttack() && target._memoryShield.length > 0) {
  var skill = $dataSkills[target._memoryShield.shift()];
  text = '<CENTER>\\c[4]\\i[' + skill.iconIndex + ']' + skill.name + '\\c[0] is removed from \\c[4]Memory Shield\\c[0]!';
  target.startAnimation(5);
  target.setStateCounter(stateId, target._memoryShield.length);
  var wait = 60;
  BattleManager.addText(text, wait);
}
</Custom Select Effect>

<Custom Deselect Effect>
if (this._formerItemSuccessRate !== undefined) {
  this.item().successRate = this._formerItemSuccessRateMS;
}
</Custom Deselect Effect>

 

Once all three stages are made, make a Battle Event under the Troops events and add the Memory Shield via a Change Enemy State event. When switching between the stages, remember to remove the previous stage and then add the next stage.

Enjoy!


The contents shown on this site are made possible thanks to our creative patrons on Patreon! The majority of our Tips & Tricks ideas are placed within the Patreon-exclusive Sample Project for quick and easy access! If you’d like to make a Tips & Tricks suggestion, Yanfly’s Patreon-based Suggestion Box a visit here:

Happy RPG Making!