Advertisement
nio_kasgami

Fear System

Apr 26th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  * Alone Panic
  3.  * @plugindesc this plugin hold all the data who control the panic Meter and panics states
  4.  * @author Nio Kasgami
  5.  * @version 1.00 {Alpha}
  6.  * @require  NA
  7.  * @overwrite {
  8.     * Game_Player
  9.     * Game_Actor
  10.     * Game_Map
  11.  * }
  12.  * @TODOLIST {
  13.     * make the fear system.
  14.  * }
  15. */
  16.  
  17. //-----------------------------------------------------------------------------
  18. // Game_Player
  19. //
  20. // The game object class for the player. It contains event starting
  21. // determinants and map scrolling functions.
  22.  
  23.  
  24.   Object.defineProperty(Game_Player.prototype, 'fear', {
  25.     get: function() {
  26.         return this._fearPoint;
  27.     },
  28.     configurable: true
  29.   });
  30.  
  31.   Object.defineProperty(Game_Player.prototype, 'maxFear', {
  32.     get: function() {
  33.         return this._maxFearPoint;
  34.     },
  35.     configurable: true
  36.   });
  37.  
  38.   Game_Player.prototype.initMembers = function(){
  39.     Game_Character.prototype.initMembers.call(this);
  40.     this._vehicleType = 'walk';
  41.     this._vehicleGettingOn = false;
  42.     this._vehicleGettingOff = false;
  43.     this._dashing = false;
  44.     this._needsMapReload = false;
  45.     this._transferring = false;
  46.     this._newMapId = 0;
  47.     this._newX = 0;
  48.     this._newY = 0;
  49.     this._newDirection = 0;
  50.     this._fadeType = 0;
  51.     this._followers = new Game_Followers();
  52.     this._encounterCount = 0;
  53.     this._fearPoint = 0;
  54.     this._maxFearPoint = 1000;
  55.     this._fearStates = [];
  56.   };
  57.  
  58.   Game_Player.prototype.resetFear = function(){
  59.     this._fearPoint = 0;
  60.   };
  61.  
  62.   Game_Player.prototype.maxFear = function(){
  63.     this._fearPoint = this._maxFearPoint;
  64.   };
  65.  
  66.   Game_Player.prototype.setFear = function(value){
  67.     this._fearPoint = value;
  68.   };
  69.  
  70.   Game_Player.prototype.addFear = function(value){
  71.     var oldFearPoint = this._fearPoint;
  72.     this._fearPoint  = oldFearPoint  + value;
  73.   };
  74.  
  75.   Game_Player.prototype.removeFear = function(value){
  76.     var oldFearPoint = this._fearPoint;
  77.     this._fearPoint = oldFearPoint - value;
  78.   };
  79.  
  80.   Game_Player.prototype.progressiveFearIncreasing = function(){
  81.     this._fearPoint++;
  82.   };
  83.  
  84.   Game_Player.prototype.progressiveFearDecreasing = function(){
  85.     this._fearPoint--;
  86.   };
  87.  
  88.   Scene_Map.prototype.createDisplayObjects = function() {
  89.     this.createSpriteset();
  90.     this.createMapNameWindow();
  91.     this.createWindowLayer();
  92.     this.createAllWindows();
  93.     this.drawFear();
  94.   };
  95.  
  96.   Scene_Map.prototype.drawFear = function(){
  97.     this._gameTitleSprite = new Sprite(new Bitmap(Graphics.width, Graphics.height));
  98.     this.addChild(this._gameTitleSprite);
  99.     var x = 20;
  100.     var y = Graphics.height / 4;
  101.     var maxWidth = Graphics.width - x * 2;
  102.     var text = $gamePlayer.fear;
  103.     this._gameTitleSprite.bitmap.outlineColor = 'black';
  104.     this._gameTitleSprite.bitmap.outlineWidth = 8;
  105.     this._gameTitleSprite.bitmap.fontSize = 72;
  106.     this._gameTitleSprite.bitmap.drawText(text, x, y, maxWidth, 48, 'center');
  107.   };
  108.  
  109.   Scene_Map.prototype.update = function() {
  110.     var oldFear = $gamePlayer.fear;
  111.     this.updateDestination();
  112.     this.updateMainMultiply();
  113.     if (this.isSceneChangeOk()) {
  114.         this.updateScene();
  115.     } else if (SceneManager.isNextScene(Scene_Battle)) {
  116.         this.updateEncounterEffect();
  117.     } else if($gamePlayer.fear !== oldFear){
  118.           var x = 20;
  119.     var y = Graphics.height / 4;
  120.     var maxWidth = Graphics.width - x * 2;
  121.     var text = $gamePlayer.fear;
  122.       this._gameTitleSprite.bitmap.clear();
  123.       this._gameTitleSprite.bitmap.drawText(text, x, y, maxWidth, 48, 'center');
  124.     }
  125.     this.updateWaitCount();
  126.     Scene_Base.prototype.update.call(this);
  127. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement