#===============================================================================
# Whirlpool
#===============================================================================
# This Game $stats handle by this plugin [New from this Plugin]
if Item_Whirlpool[:active]
EventHandlers.add(:on_player_interact, :whirlpool,
proc {
if $game_player.pbFacingTerrainTag.whirlpool && $PokemonGlobal.surfing
pbWhirlpool
end
}
)
def pbWhirlpool
if !pbCanUseItem(Item_Whirlpool)
pbMessage(_INTL("It's a huge swirl of water use an item to cross it"))
return false
end
item_name = GameData::Item.get(Item_Whirlpool[:internal_name]).name
if pbConfirmMessage(_INTL("It's a huge swirl of water.\nWould you like to use the {1}?", item_name))
pbMessage(_INTL("{1} used the {2}!", $player.name, item_name))
terrain = $game_player.pbFacingTerrainTag
return if !terrain.whirlpool
oldthrough = $game_player.through
$game_player.through = true
$game_player.move_speed = 2
case $game_player.direction
when 2, 8
$game_player.always_on_top = true
end
pbWait(4/100)
loop do
case $game_player.direction
when 2 #[Player Looking Down]
if $game_player.pbFacingTerrainTag.whirlpool
$scene.spriteset.addUserAnimation(AdvancedItemsFieldMoves::WHIRLPOOL_CONFIG[:move_down_id],$game_player.x,$game_player.y,true,1)
end
$game_player.move_forward
when 4 #[Player Looking Left]
$scene.spriteset.addUserAnimation(AdvancedItemsFieldMoves::WHIRLPOOL_CONFIG[:move_left_id],$game_player.x,$game_player.y,true,1)
$game_player.move_forward
when 6 #[Player Looking Right]
$scene.spriteset.addUserAnimation(AdvancedItemsFieldMoves::WHIRLPOOL_CONFIG[:move_right_id],$game_player.x,$game_player.y,true,1)
$game_player.move_forward
when 8 #[Player Lookin Up]
$scene.spriteset.addUserAnimation(AdvancedItemsFieldMoves::WHIRLPOOL_CONFIG[:move_up_id],$game_player.x,$game_player.y,true,1)
$game_player.move_forward
end
terrain = $game_player.pbTerrainTag
break if !terrain.whirlpool
while $game_player.moving?
Graphics.update
Input.update
pbUpdateSceneMap
end
end
pbWait(36/100)
$game_player.through = oldthrough
$game_player.move_speed = 2
$game_player.always_on_top = false
$game_player.check_event_trigger_here([1, 2])
end
end
ItemHandlers::UseFromBag.add(Item_Whirlpool[:internal_name], proc do |item|
if !$game_player.pbFacingTerrainTag.whirlpool && !$PokemonGlobal.surfing
item_name = GameData::Item.get(Item_Whirlpool[:internal_name]).name
pbMessage(_INTL("There is no sensible reason why you would be trying to use the {1} now!", item_name))
next 0
end
next 2
end)
ItemHandlers::UseInField.add(Item_Whirlpool[:internal_name], proc do |item|
if !$game_player.pbFacingTerrainTag.whirlpool && !$PokemonGlobal.surfing
item_name = GameData::Item.get(Item_Whirlpool[:internal_name]).name
pbMessage(_INTL("There is no sensible reason why you would be trying to use the {1} now!", item_name))
next 0
end
pbWhirlpool
next 1
end)
end