Guest User

SOL_Cheats

a guest
Aug 7th, 2020
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var SOL = SOL || {};
  2. /*:
  3.  * @plugindesc v1.00 Allows you to use cheats in game
  4.  * @author Soulrender
  5.  *
  6.  * @help You can use cheats in your game, cool huh?
  7.  * How to use this plugin? Simple just install it and in game press
  8.  * ~ key on keyboard (it's located under ESC key) and enter one of
  9.  * following cheats:
  10.  *
  11.  * GodMode - makes entire party invincible, however you need to
  12.  * setup your state in database that will make actors invincible
  13.  *
  14.  * ItsRainingCash - Gives X gold to the party, wich can be set in
  15.  * plugin parameters, by default this cheat gives 99999999 gold
  16.  *
  17.  * IFearNoEvil - Revives all dead party members
  18.  * SmokeWeed - Restore HP to full for all party members
  19.  * DrinkBooze - Restore MP to full for all party members
  20.  * KaneWasHere - Restore TP to full for all party members
  21.  * IWantItAll - Restore All params for all.
  22.  * AlphaOmega - Automaticly Win battle.
  23.  *
  24.  * @param --- God Mode ---
  25.  * @default
  26.  *
  27.  * @param God Mode Cheat
  28.  * @parent --- God Mode ---
  29.  * @default GodMode
  30.  * @param God Mode State
  31.  * @parent --- God Mode ---
  32.  * @type number
  33.  * @default 3
  34.  *
  35.  * @param --- Gold Mode ---
  36.  * @default
  37.  *
  38.  * @param Gold Cheat
  39.  * @parent --- Gold Mode ---
  40.  * @default ItsRainingCash
  41.  * @param Gold amount
  42.  * @parent --- Gold Mode ---
  43.  * @type number
  44.  * @default 99999999
  45.  *
  46.  * @param --- Revival Mode ---
  47.  * @default
  48.  *
  49.  * @param Revival Cheat
  50.  * @parent --- Revival Mode ---
  51.  * @default IFearNoEvil
  52.  *
  53.  * @param HP Restore Cheat
  54.  * @parent --- Revival Mode ---
  55.  * @default SmokeWeed
  56.  *
  57.  * @param MP Restore Cheat
  58.  * @parent --- Revival Mode ---
  59.  * @default DrinkBooze
  60.  *
  61.  * @param TP Restore Cheat
  62.  * @parent --- Revival Mode ---
  63.  * @default KaneWasHere
  64.  *
  65.  * @param Restore All Cheat
  66.  * @parent --- Revival Mode ---
  67.  * @default IWantItAll
  68.  *
  69.  * @param --- Victory ---
  70.  * @default
  71.  *
  72.  * @param Win Battle Cheat
  73.  * @parent --- Victory ---
  74.  * @default AlphaOmega
  75.  *
  76.  *
  77.  */
  78.  
  79. SOL.Parameters = PluginManager.parameters('SOL_Cheats');
  80. SOL.Cheat = SOL.Cheat || {};
  81. SOL.Cheat.godMode = SOL.Parameters["God Mode Cheat"];
  82. SOL.Cheat.godState = Number(SOL.Parameters["God Mode State"]);
  83. SOL.Cheat.goldCheat = SOL.Parameters["Gold Cheat"];
  84. SOL.Cheat.goldCheatCash = Number(SOL.Parameters["Gold amount"]);
  85. SOL.Cheat.reviveCheat = SOL.Parameters["Revival Cheat"];
  86. SOL.Cheat.HP_Cheat = SOL.Parameters["HP Restore Cheat"];
  87. SOL.Cheat.MP_Cheat = SOL.Parameters["MP Restore Cheat"];
  88. SOL.Cheat.TP_Cheat = SOL.Parameters["TP Restore Cheat"];
  89. SOL.Cheat.restoreAllCheat = SOL.Parameters["Restore All Cheat"];
  90. SOL.Cheat.winBattleCheat = SOL.Parameters["Win Battle Cheat"];
  91.  
  92. var $cheat = null;
  93.  
  94. Cheat.prototype = Object.create(Cheat.prototype);
  95. Cheat.prototype.constructor = Cheat;
  96.  
  97. function Cheat(){
  98.     this.initialize.apply(this, arguments);
  99. }
  100.  
  101. Cheat.prototype.initialize = function() {
  102.     return this;
  103. };
  104.  
  105. Cheat.prototype.applyGodMode = function(state){
  106.     $gameParty.members().forEach(function(member){
  107.         if (member.isDead){
  108.             member.removeState(1);
  109.             member.recoverAll();
  110.             member.addState(state);
  111.             console.log(member.name() + " is now immortal and cannot be killed!");
  112.         }
  113.     });
  114. }
  115.  
  116. Cheat.prototype.applyGoldCheat = function(cash){
  117.     if ($gameParty._gold > 0){
  118.     $gameParty.gainGold(-$gameParty._gold);}
  119.     $gameParty.gainGold(Number(cash));
  120.     console.log(cash + " was set to party account");
  121. }
  122.  
  123. Cheat.prototype.reviveParty = function(){
  124.     $gameParty.members().forEach(function(member){
  125.         if (member.isDead()){
  126.             member.removeState(1);
  127.             member.recoverAll();
  128.             console.log(member.name() + " was revived!");          
  129.         }
  130.     });
  131. }
  132.  
  133. Cheat.prototype.recoverHp = function(){
  134.     $gameParty.members().forEach(function(member){
  135.         if (member.isAlive()){
  136.             member.gainHp(member.mhp);
  137.             console.log(member.name() + " is now at full HP");
  138.         }
  139.  
  140.     });
  141. }
  142.  
  143. Cheat.prototype.recoverMp = function(){
  144.     $gameParty.members().forEach(function(member){
  145.         if (member.isAlive()){
  146.             member.gainHp(member.mmp);
  147.             console.log(member.name() + " is now at full MP");
  148.         }
  149.  
  150.     });
  151. }
  152.  
  153. Cheat.prototype.recoverTp = function(){
  154.     $gameParty.members().forEach(function(member){
  155.         if (member.isAlive()){
  156.             member.gainTp(99999);
  157.             console.log(member.name() + " is now at full TP");
  158.         }
  159.     });
  160. }
  161.  
  162. Cheat.prototype.recoverAll = function(){
  163.     $gameParty.members().forEach(function(member){
  164.         if (member.isAlive){
  165.             member.recoverAll();
  166.             member.clearStates();
  167.             console.log(member.name() + " is fully recovered");
  168.         }      
  169.     });
  170. }
  171.  
  172. Cheat.prototype.winBattle = function(){
  173.     if (SceneManager._scene instanceof Scene_Battle){
  174.         $gameTroop.members().forEach(function(enemy){
  175.             if (!enemy.isStateAffected(1)){
  176.                 enemy.addState(1);
  177.                 if (enemy.isDead()){
  178.                     enemy.performCollapse();
  179.                 }
  180.             }      
  181.         });
  182.         BattleManager.processVictory();
  183.         console.log("You won a battle!");
  184.     }
  185. }
  186.  
  187. Graphics._onKeyDown = function(event) {
  188.     if (event.keyCode === 192){
  189.         if (SceneManager._scene instanceof Scene_Battle || SceneManager._scene instanceof Scene_Map){
  190.             var cheat = prompt("Please Enter your cheat", "Cheat");
  191.             if (cheat === null){
  192.                 window.focus();
  193.                 return;
  194.             } else {
  195.                 switch (cheat){
  196.                     case SOL.Cheat.godMode :
  197.                     {
  198.                         $cheat.applyGodMode(SOL.Cheat.godState);
  199.                         break;
  200.                     }
  201.                     case SOL.Cheat.goldCheat :
  202.                     {
  203.                         $cheat.applyGoldCheat(SOL.Cheat.goldCheatCash);
  204.                         break;
  205.                     }
  206.                     case SOL.Cheat.reviveCheat :
  207.                     {
  208.                         $cheat.reviveParty();
  209.                         break;
  210.                     }
  211.                     case SOL.Cheat.HP_Cheat :
  212.                     {
  213.                         $cheat.recoverHp();
  214.                         break;
  215.                     }
  216.                     case SOL.Cheat.MP_Cheat :
  217.                     {
  218.                         $cheat.recoverMp();
  219.                         break;
  220.                     }                  
  221.                     case SOL.Cheat.TP_Cheat :
  222.                     {
  223.                         $cheat.recoverTp();
  224.                         break;
  225.                     }  
  226.                     case SOL.Cheat.restoreAllCheat :
  227.                     {
  228.                         $cheat.recoverAll();
  229.                         break;
  230.                     }                  
  231.                     case SOL.Cheat.winBattleCheat :
  232.                     {
  233.                         $cheat.winBattle();
  234.                         break;
  235.                     }
  236.                     default:
  237.                     {
  238.                         alert("Unrecognized Cheat, sorry.");
  239.                     }                  
  240.                 }
  241.                 window.focus();
  242.             }
  243.         }
  244.         else
  245.         {
  246.             alert("You cannot use cheats here!");
  247.         }
  248.     }
  249. }
  250. $cheat = new Cheat();
RAW Paste Data