Advertisement
WCouillard

Coolie_SuikodenGodspeedRune

Mar 4th, 2023 (edited)
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Imported = Imported || {};
  2. Imported.Coolie_SuikodenGodspeedRune = true;
  3. var Coolie = Coolie || {};
  4. Coolie.SGS = Coolie.SGS || {};
  5. Coolie.SGS.version = 1.00;
  6.  
  7. /*:
  8.  * @plugindesc v1.01 Replicates the effect of the Godspeed Rune from Suikoden
  9.  * @author William Couillard (Coolie)
  10.  *
  11.  * @help
  12.  * -----------------------------------------------------------------------------
  13.  * ABOUT THIS PLUGIN
  14.  * -----------------------------------------------------------------------------
  15.  * The Godspeed Rune in Suikoden is a special rune that has two effects.
  16.  *  1. When the bearer of the rune is in your battle party, you can dash faster!
  17.  *  2. When the bearer of the rune is in your battle party, escape never fails!
  18.  *
  19.  * This plugin will recreate those effects for your chosen actor.
  20.  *
  21.  * 1. When the chosen actor is in the battle party and all conditions set in the
  22.  *    parameters returns a true result, escape is guaranteed. Otherwise, the
  23.  *    normal escape process chance will occur.
  24.  *
  25.  * 2. When the chosen actor is in the battle party, your dash speed is doubled!
  26.  *    Walking speed is NOT affected!
  27.  *
  28.  * This plugin overwrites the default escape chance processing and the default
  29.  * setting for movement speed outside of battle. Any other plugins that may
  30.  * also alter these default functions may make this plugin incompatible with
  31.  * your project, so please test accordingly.
  32.  *
  33.  * Overwritten: BattleManager.processEscape [rpg_managers.js]
  34.  * Overwritten: Game_CharacterBase.prototype.distancePerFrame [rpg_objects.js]
  35.  *
  36.  * -----------------------------------------------------------------------------
  37.  * TERMS OF USE
  38.  * -----------------------------------------------------------------------------
  39.  * It is OK to use this plugin in both commercial and non-commercial
  40.  * projects.
  41.  *
  42.  * Credit is appreciated, but not required.
  43.  *
  44.  * -----------------------------------------------------------------------------
  45.  * VERSION & UPDATE HISTORY
  46.  * -----------------------------------------------------------------------------
  47.  * - v1.00 : Initial release.
  48.  *           March 4th, 2023
  49.  * -----------------------------------------------------------------------------
  50.  * @param Escape Settings
  51.  *
  52.  * @param Actor ID
  53.  * @parent Escape Settings
  54.  * @type number
  55.  * @min 1
  56.  * @desc The actor ID that will guarantee escaping from battle.
  57.  * Default: 1
  58.  * @default 1
  59.  *
  60.  * @param Must Be Alive?
  61.  * @parent Escape Settings
  62.  * @type boolean
  63.  * @on Yes
  64.  * @off No
  65.  * @desc Does the actor have to be alive to guarantee escape?
  66.  * Yes/True: Must be alive   No/False: Can be dead
  67.  * @default true
  68.  *
  69.  * @param Can Move?
  70.  * @parent Escape Settings
  71.  * @type boolean
  72.  * @on Yes
  73.  * @off No
  74.  * @desc Does the actor have to be able to move to guarantee escape?
  75.  * Yes/True: Must be able to move   No/False: Can be restricted
  76.  * @default true
  77.  */
  78.  
  79. Coolie.Parameters = PluginManager.parameters('Coolie_SuikodenGodspeedRune');
  80. Coolie.Param = Coolie.Param || {};
  81. Coolie.Param.SGSactorId = Number(Coolie.Parameters['Actor ID']);
  82. Coolie.Param.SGSmustBeAlive = eval(String(Coolie.Parameters['Must Be Alive?']));
  83. Coolie.Param.SGScanMove = eval(String(Coolie.Parameters['Can Move?']));
  84.  
  85. var coolieMBA = Coolie.Param.SGSmustBeAlive;
  86. var coolieCM = Coolie.Param.SGScanMove;
  87.  
  88. // -----------------------------------------------------------------------------
  89. // Overwrite: BattleManager.processEscape
  90. // -----------------------------------------------------------------------------
  91. BattleManager.processEscape = function() {
  92.     $gameParty.performEscape();
  93.     SoundManager.playEscape();
  94.     if ($gameActors.actor(Coolie.Param.SGSactorId).isBattleMember() && coolieMBA === false && coolieCM === false) {
  95.         var success = true;
  96.     } else if ($gameActors.actor(Coolie.Param.SGSactorId).isBattleMember() && coolieMBA && coolieCM === false) {
  97.         if ($gameActors.actor(Coolie.Param.SGSactorId).hp >= 1) {
  98.             var success = true;
  99.         } else {
  100.             var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  101.         }
  102.     } else if ($gameActors.actor(Coolie.Param.SGSactorId).isBattleMember() && coolieMBA === false && coolieCM) {
  103.         if ($gameActors.actor(Coolie.Param.SGSactorId).canMove()) {
  104.             var success = true;
  105.         } else {
  106.             var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  107.         }
  108.     } else if ($gameActors.actor(Coolie.Param.SGSactorId).isBattleMember() && coolieMBA && coolieCM) {
  109.         if ($gameActors.actor(Coolie.Param.SGSactorId).hp >= 1) {
  110.             if ($gameActors.actor(Coolie.Param.SGSactorId).canMove()) {
  111.                 var success = true;
  112.             } else {
  113.             var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  114.             }
  115.         } else {
  116.             var success = this._preemptive ? true : (Math.random() < this._escapeRatio);
  117.         }
  118.     } else {
  119.     }
  120.     if (success) {
  121.         this.displayEscapeSuccessMessage();
  122.         this._escaped = true;
  123.         this.processAbort();
  124.     } else {
  125.         this.displayEscapeFailureMessage();
  126.         this._escapeRatio += 0.1;
  127.         $gameParty.clearActions();
  128.         this.startTurn();
  129.     }
  130.     return success;
  131. };
  132.  
  133. // -----------------------------------------------------------------------------
  134. // Overwrite: Game_CharacterBase.prototype.distancePerFrame
  135. // -----------------------------------------------------------------------------
  136. Game_CharacterBase.prototype.distancePerFrame = function() {
  137.     if ($gameActors.actor(Coolie.Param.SGSactorId).isBattleMember() && this.isDashing()) {
  138.         return Math.pow(2, this.realMoveSpeed()) / 192;
  139.     } else {
  140.         return Math.pow(2, this.realMoveSpeed()) / 256;
  141.     }
  142. };
Tags: Plugin RMMV
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement