1224Deko

Hamedo Snippet

Nov 13th, 2015
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //=============================================================================
  2. // Hamedo.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Hamedo  v.1.00
  7.  * @author 1224Deko
  8.  * @param Multi States
  9.  * @desc WIP - true = Can be state combined, flase = only one state will be activated
  10.  * @default true
  11.  *
  12.  * @param Counter Attack
  13.  * @desc Counter attack after taking damage
  14.  * @default 101
  15.  *
  16.  * @param First Strike
  17.  * @desc First-Strike
  18.  * @default 102
  19.  *
  20.  * @param Forestall
  21.  * @desc Evade and Counter state id
  22.  * @default 103
  23.  *
  24.  * @param Double Strike
  25.  * @desc Evade and Counter state id
  26.  * @default 104
  27.  *
  28.  * @param Evade and Counter
  29.  * @desc Evade and Counter state id
  30.  * @default 105
  31.  *
  32.  * @param CounterSameSkill
  33.  * @desc [WIP] Counter that same skill
  34.  * @default 106
  35.  *
  36.  * @param CounterEvenDeath
  37.  * @desc Deal counter dmg even if battler takes lethal damage
  38.  * @default 107
  39.  *
  40.  * @help
  41.  * This script/snippet overrides BattleManager.invokeAction
  42.  * Free for comercial, and non comercial uses... Credits only needed for comercial uses...
  43.  *
  44.  *
  45.  * Multi-counter states : Work in Progress....
  46.  *
  47.  * Counter Mechanism:
  48.  * 
  49.  *   Counter-Attack     : default mechanism actor countering after taking damage, added for priority, example you can create state that nullifies all counter states and make default counter mechanism
  50.  *   First Strike       : Countering before taking damage
  51.  *   Forestall          : Countering before taking damage if countering is succesfull, cancel action from countering skill
  52.  *   Double-Strike      : counter twice times
  53.  *   EAC- Evade and Counter : battler evades attack then countering
  54.  *  [WIP] CounterSameSkill   : Countering same skill
  55.  *   CounterEvenDeath   : Battler will counter even if it take lethal damages
  56.  */
  57.  
  58.  
  59. (function () {
  60.  
  61.      var parameters = PluginManager.parameters('Hamedo');
  62.      var dekomulti = String(parameters['Multi States'] || 'true');
  63.     var dekoeac = Number(parameters['Evade and Counter'] || '105');
  64.     var dekodstrike = Number(parameters['Double Strike'] || '104');
  65.     var dekoforestall = Number(parameters['Forestall'] || '103');
  66.     var dekohamedo = Number(parameters['First Strike'] || '102');
  67.     var dekodcounter = Number(parameters['Counter Attack'] || '101');
  68.     var dekosameskill = Number(parameters['CounterSameSkill'] || '106');
  69.     var dekoevendeath = Number(parameters['CounterEvenDeath'] || '107');
  70.  
  71.  
  72.  
  73.  
  74. BattleManager.invokeAction = function(subject, target) {
  75.     this._logWindow.push('pushBaseLine');
  76.  
  77.  
  78.  
  79.     if (Math.random() < this._action.itemCnt(target)) {
  80.         //if multipel states is true
  81.         if (dekomulti === 'true'){
  82.  
  83.             // if target has counter attack
  84.              if (target._states.contains(dekodcounter)){
  85.                 this.invokeNormalAction(subject, target);
  86.                 if(target.hp > 0){
  87.                 this.invokeCounterAttack(subject, target);}
  88.             // if target has state Evade and Counter
  89.             } else if (target._states.contains(dekoeac)){
  90.                 this.invokeCounterAttack(subject, target);
  91.             // if target has state Double Strike
  92.             } else if (target._states.contains(dekodstrike)){
  93.                 this.invokeCounterAttack(subject, target);
  94.                 if(subject.hp > 0){
  95.             this.invokeNormalAction(subject, target); }                
  96.                 if(target.hp > 0){
  97.             this.invokeCounterAttack(subject, target);}
  98.             // if target has state Forestall
  99.             } else if (target._states.contains(dekoforestall)){
  100.                 dekocshpsub = subject.hp
  101.                 this.invokeCounterAttack(subject, target);
  102.                  if(subject.hp >= dekocshpsub){
  103.                 this.invokeNormalAction(subject, target);}
  104.             // if target has state First Strike
  105.             } else if (target._states.contains(dekohamedo)){
  106.                 this.invokeCounterAttack(subject, target);
  107.                 if(subject.hp > 0){
  108.                 this.invokeNormalAction(subject, target);}
  109.             // if target has state same skill counter
  110.             } else if (target._states.contains(dekosameskill)){
  111.                 this.invokeNormalAction(subject, target);
  112.                 if(target.hp > 0){
  113.                 this.invokeCounterAttack(subject, target);}
  114.             // if target has state even death
  115.             } else if (target._states.contains(dekoevendeath)){
  116.                 this.invokeNormalAction(subject, target);
  117.                 this.invokeCounterAttack(subject, target);
  118.             } else {
  119.                 this.invokeNormalAction(subject, target);
  120.                 if(target.hp > 0){
  121.                 this.invokeCounterAttack(subject, target);}
  122.  
  123.             }
  124.  
  125.  
  126.         // else if multiple states is off(false, or isn't "true")
  127.         } else {
  128.             // if target has counter attack
  129.              if (target._states.contains(dekodcounter)){
  130.                 this.invokeNormalAction(subject, target);
  131.                 if(target.hp > 0){
  132.                 this.invokeCounterAttack(subject, target);}
  133.             // if target has state Evade and Counter
  134.             } else if (target._states.contains(dekoeac)){
  135.                 this.invokeCounterAttack(subject, target);
  136.             // if target has state Double Strike
  137.             } else if (target._states.contains(dekodstrike)){
  138.                 this.invokeCounterAttack(subject, target);
  139.                 if(subject.hp > 0){
  140.             this.invokeNormalAction(subject, target); }                
  141.                 if(target.hp > 0){
  142.             this.invokeCounterAttack(subject, target);}
  143.             // if target has state Forestall
  144.             } else if (target._states.contains(dekoforestall)){
  145.                 dekocshpsub = subject.hp
  146.                 this.invokeCounterAttack(subject, target);
  147.                  if(subject.hp >= dekocshpsub){
  148.                 this.invokeNormalAction(subject, target);}
  149.             // if target has state First Strike
  150.             } else if (target._states.contains(dekohamedo)){
  151.                 this.invokeCounterAttack(subject, target);
  152.                 if(subject.hp > 0){
  153.                 this.invokeNormalAction(subject, target);}
  154.             // if target has state same skill counter
  155.             } else if (target._states.contains(dekosameskill)){
  156.                 this.invokeNormalAction(subject, target);
  157.                 if(target.hp > 0){
  158.                 this.invokeCounterAttack(subject, target);}
  159.             // if target has state even death
  160.             } else if (target._states.contains(dekoevendeath)){
  161.                 this.invokeNormalAction(subject, target);
  162.                 this.invokeCounterAttack(subject, target);
  163.             } else {
  164.                 this.invokeNormalAction(subject, target);
  165.                 if(target.hp > 0){
  166.                 this.invokeCounterAttack(subject, target);}
  167.  
  168.             }
  169.  
  170.         }
  171.  
  172.  
  173.     } else if (Math.random() < this._action.itemMrf(target)) {
  174.         this.invokeMagicReflection(subject, target);
  175.     } else {
  176.         this.invokeNormalAction(subject, target);
  177.     }
  178.     subject.setLastTarget(target);
  179.     this._logWindow.push('popBaseLine');
  180.     this.refreshStatus();
  181. };
  182. // End of BattleManager.invokeAction
  183.   })();  // dont touch this.
Advertisement
Add Comment
Please, Sign In to add comment