Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var _Game_CharacterBase_isMapPassable = Game_CharacterBase.prototype.isMapPassable
- Game_CharacterBase.prototype.isMapPassable = function(x, y, d) {
- if (this.isEventRegionBlock(x, y, d) || this.isPlayerRegionBlock(x, y, d)) {
- return false
- }
- if (this.isEventRegionAllow(x, y, d) || this.isPlayerRegionAllow(x, y, d)) {
- return true
- }
- return _Game_CharacterBase_isMapPassable.call(this, x, y, d)
- }
- Game_CharacterBase.prototype.isEvent = function() {
- return false
- }
- Game_CharacterBase.prototype.isPlayer = function() {
- return false
- }
- Game_CharacterBase.prototype.isEventRegionBlock = function(x, y, d) {
- var regionId = this.getRegionId(x, y, d)
- if (this.isPlayer() || this.isThrough() || (regionId === 0)) {
- return false
- }
- if (Foundation.Regions.EventRestrict.contains(regionId)) {
- return true
- }
- return false
- }
- Game_CharacterBase.prototype.isPlayerRegionBlock = function(x, y, d) {
- var regionId = this.getRegionId(x, y, d)
- if (this.isEvent() || this.isThrough() || (regionId === 0)) {
- return false
- }
- if (Foundation.Regions.PlayerRestrict.contains(regionId)) {
- return true
- }
- return false
- }
- Game_CharacterBase.prototype.isEventRegionAllow = function(x, y, d) {
- var regionId = this.getRegionId(x, y, d)
- if (this.isPlayer() || (regionId === 0)) {
- return false
- }
- if (Foundation.Regions.EventAllow.contains(regionId)) {
- return true
- }
- return false
- }
- Game_CharacterBase.prototype.isPlayerRegionAllow = function(x, y, d) {
- var regionId = this.getRegionId(x, y, d)
- if (this.isEvent() || (regionId === 0)) {
- return false
- }
- if (Foundation.Regions.PlayerAllow.contains(regionId)) {
- return true
- }
- return false
- }
- Game_CharacterBase.prototype.getRegionId = function(x, y, d) {
- switch (d) {
- case 1:
- return $gameMap.regionId(x - 1, y + 1)
- case 2:
- return $gameMap.regionId(x + 0, y + 1)
- case 3:
- return $gameMap.regionId(x + 1, y + 1)
- case 4:
- return $gameMap.regionId(x - 1, y + 0)
- case 5:
- return $gameMap.regionId(x + 0, y + 0)
- case 6:
- return $gameMap.regionId(x + 1, y + 0)
- case 7:
- return $gameMap.regionId(x - 1, y - 1)
- case 8:
- return $gameMap.regionId(x + 0, y - 1)
- case 9:
- return $gameMap.regionId(x + 1, y - 1)
- default:
- return $gameMap.regionId(x, y)
- }
- }
- /* Game_Event */
- Game_Event.prototype.isEvent = function() {
- return true
- }
- /* Game_Player */
- Game_Player.prototype.isPlayer = function() {
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement