Guest User

Untitled

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