Joint Penalty (MV Plugin Tips & Tricks)

From Yanfly.moe Wiki
Jump to navigation Jump to search

Welcome to the wiki! This is where you can find resources from Yanfly.moe, Ækashics.moe,
VisuStella, Caz Wolf, Fallen Angel Olivia, Atelier Irina, and other affiliated content creators.


From Tree of Savior, the Linker class has a rather unique ability to link allies and enemies. For this video, we’ll be exploring the Joint Penalty skill, which links together enemies. Linked enemies with the Joint Penalty link will split and share any damage they take to other enemies affected by Joint Penalty. This tips & tricks video will show you just how to do that!

Required Plugins

The following plugin(s) is required to create this Tips & Tricks effect:

For help on how to install plugins, click here.

For help on how to update plugins, click here.

About

This is a Tips & Tricks effect created for RPG Maker MV. Tips & Tricks are not to be confused with plugins. Instead, they are usually customized code created for the sake of producing unique features/effects that do not require an entire plugin to do.

Yanfly Engine Plugins

This Tips & Tricks effect is made possible due to the Yanfly Engine Plugins library.

Click here if you want to help support Team Yanfly on Patreon.

Warning for RPG Maker MZ Users

Warning.jpg

If you are using RPG Maker MZ and VisuStella MZ, the following code may or MAY NOT work as this Tips & Tricks is made for RPG Maker MV. VisuStella MZ is NOT responsible if this Tips & Trick does not work because the code base for RPG Maker MV and RPG Maker MZ are different and the code base between Yanfly Engine Plugins and VisuStella MZ is even more drastically different.

Instructions

Follow video instructions.

Physical Only Damage
<Custom React Effect>
// Check if the damage is positive and if it's a physical action.
if (value > 0 && this.isPhysical()) {
  // Get the living members of the same party.
  var members = target.friendsUnit().aliveMembers();
  // Make an empty group to list affected members.
  var affected = [];
  // We'll go through each member to check them.
  for (var i = 0; i < members.length; ++i) {
    // Getting the individual member.
    var member = members[i];
    // Does the member exist and is the member affected by state 91 (the Joint Penalty state)?
    if (member && member.isStateAffected(91)) {
      // If the member is affected, add it to the affected group.
      affected.push(member);
    }
  }
  // Divide up the damage by how many members are affected.
  value = Math.ceil(value / affected.length);
  // We'll go through each of the affected members now.
  for (var i = 0; i < affected.length; ++i) {
    // Getting the individual affected member.
    var member = affected[i];
    // Ignore the effect if the member is the target of attack.
    if (member !== target) {
      // Let's play animation 12 on the affected member.
      member.startAnimation(12);
      // The affected member takes damage.
      member.gainHp(-value);
      // We'll have the affected member reveal a damage popup.
      member.startDamagePopup();
      // Clear the results of the effect.
      member.clearResult();
      // Next, check to see if the member is dead.
      if (member.isDead()) {
        // If the member is dead, we'll make it collapse.
        member.performCollapse();
      }
    }
  }
}
</Custom React Effect>
Magical Only Damage
<Custom React Effect>
// Check if the damage is positive and if it's a magical action.
if (value > 0 && this.isMagical()) {
  // Get the living members of the same party.
  var members = target.friendsUnit().aliveMembers();
  // Make an empty group to list affected members.
  var affected = [];
  // We'll go through each member to check them.
  for (var i = 0; i < members.length; ++i) {
    // Getting the individual member.
    var member = members[i];
    // Does the member exist and is the member affected by state 91 (the Joint Penalty state)?
    if (member && member.isStateAffected(91)) {
      // If the member is affected, add it to the affected group.
      affected.push(member);
    }
  }
  // Divide up the damage by how many members are affected.
  value = Math.ceil(value / affected.length);
  // We'll go through each of the affected members now.
  for (var i = 0; i < affected.length; ++i) {
    // Getting the individual affected member.
    var member = affected[i];
    // Ignore the effect if the member is the target of attack.
    if (member !== target) {
      // Let's play animation 12 on the affected member.
      member.startAnimation(12);
      // The affected member takes damage.
      member.gainHp(-value);
      // We'll have the affected member reveal a damage popup.
      member.startDamagePopup();
      // Clear the results of the effect.
      member.clearResult();
      // Next, check to see if the member is dead.
      if (member.isDead()) {
        // If the member is dead, we'll make it collapse.
        member.performCollapse();
      }
    }
  }
}
</Custom React Effect>
Certain-Hit Only Damage
<Custom React Effect>
// Check if the damage is positive and if it's a certain hit action.
if (value > 0 && this.isCertainHit()) {
  // Get the living members of the same party.
  var members = target.friendsUnit().aliveMembers();
  // Make an empty group to list affected members.
  var affected = [];
  // We'll go through each member to check them.
  for (var i = 0; i < members.length; ++i) {
    // Getting the individual member.
    var member = members[i];
    // Does the member exist and is the member affected by state 91 (the Joint Penalty state)?
    if (member && member.isStateAffected(91)) {
      // If the member is affected, add it to the affected group.
      affected.push(member);
    }
  }
  // Divide up the damage by how many members are affected.
  value = Math.ceil(value / affected.length);
  // We'll go through each of the affected members now.
  for (var i = 0; i < affected.length; ++i) {
    // Getting the individual affected member.
    var member = affected[i];
    // Ignore the effect if the member is the target of attack.
    if (member !== target) {
      // Let's play animation 12 on the affected member.
      member.startAnimation(12);
      // The affected member takes damage.
      member.gainHp(-value);
      // We'll have the affected member reveal a damage popup.
      member.startDamagePopup();
      // Clear the results of the effect.
      member.clearResult();
      // Next, check to see if the member is dead.
      if (member.isDead()) {
        // If the member is dead, we'll make it collapse.
        member.performCollapse();
      }
    }
  }
}
</Custom React Effect>
All Damage
<Custom React Effect>
// Check if the damage is positive.
if (value > 0) {
  // Get the living members of the same party.
  var members = target.friendsUnit().aliveMembers();
  // Make an empty group to list affected members.
  var affected = [];
  // We'll go through each member to check them.
  for (var i = 0; i < members.length; ++i) {
    // Getting the individual member.
    var member = members[i];
    // Does the member exist and is the member affected by state 91 (the Joint Penalty state)?
    if (member && member.isStateAffected(91)) {
      // If the member is affected, add it to the affected group.
      affected.push(member);
    }
  }
  // Divide up the damage by how many members are affected.
  value = Math.ceil(value / affected.length);
  // We'll go through each of the affected members now.
  for (var i = 0; i < affected.length; ++i) {
    // Getting the individual affected member.
    var member = affected[i];
    // Ignore the effect if the member is the target of attack.
    if (member !== target) {
      // Let's play animation 12 on the affected member.
      member.startAnimation(12);
      // The affected member takes damage.
      member.gainHp(-value);
      // We'll have the affected member reveal a damage popup.
      member.startDamagePopup();
      // Clear the results of the effect.
      member.clearResult();
      // Next, check to see if the member is dead.
      if (member.isDead()) {
        // If the member is dead, we'll make it collapse.
        member.performCollapse();
      }
    }
  }
}
</Custom React Effect>

Have fun!