Added class GameData::TerrainTag

This commit is contained in:
Maruno17
2021-03-29 17:19:05 +01:00
parent e1ffd44e67
commit cd62ba840c
17 changed files with 336 additions and 260 deletions

View File

@@ -335,8 +335,8 @@ end
# Decide whether the player is able to ride/dismount their Bicycle
#===============================================================================
def pbBikeCheck
if $PokemonGlobal.surfing ||
(!$PokemonGlobal.bicycle && PBTerrain.onlyWalk?(pbGetTerrainTag))
if $PokemonGlobal.surfing || $PokemonGlobal.diving ||
(!$PokemonGlobal.bicycle && pbGetTerrainTag.must_walk)
pbMessage(_INTL("Can't use that here."))
return false
end

View File

@@ -41,12 +41,8 @@ ItemHandlers::UseFromBag.add(:BICYCLE,proc { |item|
ItemHandlers::UseFromBag.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
ItemHandlers::UseFromBag.add(:OLDROD,proc { |item|
terrain = pbFacingTerrainTag
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
if (PBTerrain.isWater?(terrain) && !$PokemonGlobal.surfing && notCliff) ||
(PBTerrain.isWater?(terrain) && $PokemonGlobal.surfing)
next 2
end
next 2 if pbFacingTerrainTag.can_fish && ($PokemonGlobal.surfing || notCliff)
pbMessage(_INTL("Can't use that here."))
next 0
})
@@ -113,27 +109,25 @@ ItemHandlers::UseInField.add(:MAXREPEL,proc { |item|
})
Events.onStepTaken += proc {
if $PokemonGlobal.repel>0
if !PBTerrain.isIce?($game_player.terrain_tag) # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1
if $PokemonGlobal.repel<=0
if $PokemonBag.pbHasItem?(:REPEL) ||
$PokemonBag.pbHasItem?(:SUPERREPEL) ||
$PokemonBag.pbHasItem?(:MAXREPEL)
if pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
ret = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
ret = screen.pbChooseItemScreen(Proc.new { |item|
[:REPEL, :SUPERREPEL, :MAXREPEL].include?(item)
})
}
pbUseItem($PokemonBag,ret) if ret
end
else
pbMessage(_INTL("The repellent's effect wore off!"))
if $PokemonGlobal.repel > 0 && !$game_player.terrain_tag.ice # Shouldn't count down if on ice
$PokemonGlobal.repel -= 1
if $PokemonGlobal.repel <= 0
if $PokemonBag.pbHasItem?(:REPEL) ||
$PokemonBag.pbHasItem?(:SUPERREPEL) ||
$PokemonBag.pbHasItem?(:MAXREPEL)
if pbConfirmMessage(_INTL("The repellent's effect wore off! Would you like to use another one?"))
ret = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
ret = screen.pbChooseItemScreen(Proc.new { |item|
[:REPEL, :SUPERREPEL, :MAXREPEL].include?(item)
})
}
pbUseItem($PokemonBag,ret) if ret
end
else
pbMessage(_INTL("The repellent's effect wore off!"))
end
end
end
@@ -236,9 +230,8 @@ ItemHandlers::UseInField.add(:BICYCLE,proc { |item|
ItemHandlers::UseInField.copy(:BICYCLE,:MACHBIKE,:ACROBIKE)
ItemHandlers::UseInField.add(:OLDROD,proc { |item|
terrain = pbFacingTerrainTag
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
if !PBTerrain.isWater?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
pbMessage(_INTL("Can't use that here."))
next 0
end
@@ -250,9 +243,8 @@ ItemHandlers::UseInField.add(:OLDROD,proc { |item|
})
ItemHandlers::UseInField.add(:GOODROD,proc { |item|
terrain = pbFacingTerrainTag
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
if !PBTerrain.isWater?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
pbMessage(_INTL("Can't use that here."))
next 0
end
@@ -264,9 +256,8 @@ ItemHandlers::UseInField.add(:GOODROD,proc { |item|
})
ItemHandlers::UseInField.add(:SUPERROD,proc { |item|
terrain = pbFacingTerrainTag
notCliff = $game_map.passable?($game_player.x,$game_player.y,$game_player.direction,$game_player)
if !PBTerrain.isWater?(terrain) || (!notCliff && !$PokemonGlobal.surfing)
if !pbFacingTerrainTag.can_fish || (!$PokemonGlobal.surfing && !notCliff)
pbMessage(_INTL("Can't use that here."))
next 0
end

View File

@@ -15,7 +15,8 @@ end
################################################################################
def pbCanUsePokeRadar?
# Can't use Radar if not in tall grass
if !PBTerrain.isJustGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
pbMessage(_INTL("Can't use that here."))
return false
end
@@ -73,7 +74,8 @@ def pbPokeRadarHighlightGrass(showmessage=true)
# Add tile to grasses array if it's a valid grass tile
if x>=0 && x<$game_map.width &&
y>=0 && y<$game_map.height
if PBTerrain.isJustGrass?($game_map.terrain_tag(x,y))
terrain = $game_map.terrain_tag(x, y)
if terrain.land_wild_encounters && terrain.shows_grass_rustle
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
s = (rand(100) < 25) ? 1 : 0
if $PokemonTemp.pokeradar && $PokemonTemp.pokeradar[2] > 0
@@ -216,7 +218,8 @@ Events.onStepTaken += proc { |_sender,_e|
!$PokemonTemp.pokeradar
$PokemonGlobal.pokeradarBattery -= 1
end
if !PBTerrain.isJustGrass?($game_map.terrain_tag($game_player.x, $game_player.y))
terrain = $game_map.terrain_tag($game_player.x,$game_player.y)
if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
pbPokeRadarCancel
end
}