Guest User

Untitled

a guest
Apr 16th, 2019
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Yanfly.RR.Game_CharacterBase_isMapPassable =
  2. Game_CharacterBase.prototype.isMapPassable;
  3. Game_CharacterBase.prototype.isMapPassable = function(x, y, d) {
  4. if (this.isEventRegionForbid(x, y, d)) return false;
  5. if (this.isPlayerRegionForbid(x, y, d)) return false;
  6. if (this.isEventRegionAllow(x, y, d)) return true;
  7. if (this.isPlayerRegionAllow(x, y, d)) return true;
  8. return Yanfly.RR.Game_CharacterBase_isMapPassable.call(this, x, y, d);
  9. };
  10.  
  11. Game_CharacterBase.prototype.isEvent = function() {
  12. return false;
  13. };
  14.  
  15. Game_CharacterBase.prototype.isPlayer = function() {
  16. return false;
  17. };
  18.  
  19. Game_CharacterBase.prototype.processRRNotetags = function() {
  20. DataManager.processRRNotetags();
  21. };
  22.  
  23. Game_CharacterBase.prototype.isEventRegionForbid = function(x, y, d) {
  24. if (this.isPlayer()) return false;
  25. if (this.isThrough()) return false;
  26. var regionId = this.getRegionId(x, y, d);
  27. if (regionId === 0) return false;
  28. if ($gameMap.restrictEventRegions().contains(regionId)) return true;
  29. return false;
  30. };
  31.  
  32. Game_CharacterBase.prototype.isPlayerRegionForbid = function(x, y, d) {
  33. if (this.isEvent()) return false;
  34. if (this.isThrough()) return false;
  35. var regionId = this.getRegionId(x, y, d);
  36. if (regionId === 0) return false;
  37. if ($gameMap.restrictPlayerRegions().contains(regionId)) return true;
  38. return false;
  39. };
  40.  
  41. Game_CharacterBase.prototype.isEventRegionAllow = function(x, y, d) {
  42. if (this.isPlayer()) return false;
  43. var regionId = this.getRegionId(x, y, d);
  44. if (regionId === 0) return false;
  45. if ($gameMap.allowEventRegions().contains(regionId)) return true;
  46. return false;
  47. };
  48.  
  49. Game_CharacterBase.prototype.isPlayerRegionAllow = function(x, y, d) {
  50. if (this.isEvent()) return false;
  51. var regionId = this.getRegionId(x, y, d);
  52. if (regionId === 0) return false;
  53. if ($gameMap.allowPlayerRegions().contains(regionId)) return true;
  54. return false
  55. };
  56.  
  57. Game_CharacterBase.prototype.getRegionId = function(x, y, d) {
  58. switch (d) {
  59. case 1:
  60. return $gameMap.regionId(x - 1, y + 1);
  61. break;
  62. case 2:
  63. return $gameMap.regionId(x + 0, y + 1);
  64. break;
  65. case 3:
  66. return $gameMap.regionId(x + 1, y + 1);
  67. break;
  68. case 4:
  69. return $gameMap.regionId(x - 1, y + 0);
  70. break;
  71. case 5:
  72. return $gameMap.regionId(x + 0, y + 0);
  73. break;
  74. case 6:
  75. return $gameMap.regionId(x + 1, y + 0);
  76. break;
  77. case 7:
  78. return $gameMap.regionId(x - 1, y - 1);
  79. break;
  80. case 8:
  81. return $gameMap.regionId(x + 0, y - 1);
  82. break;
  83. case 9:
  84. return $gameMap.regionId(x + 1, y - 1);
  85. break;
  86. default:
  87. return $gameMap.regionId(x, y);
  88. break;
  89. }
  90. };
  91.  
  92. //=============================================================================
  93. // Game_Event
  94. //=============================================================================
  95.  
  96. Game_Event.prototype.isEvent = function() {
  97. return true;
  98. };
  99.  
  100. //=============================================================================
  101. // Game_Player
  102. //=============================================================================
  103.  
  104. Game_Player.prototype.isPlayer = function() {
  105. return true;
  106. };
RAW Paste Data