mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 23:24:59 +00:00
update 6.7
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
def turnEventTowardsEvent(turning, turnedTowards)
|
||||
event_x = turnedTowards.x
|
||||
event_y = turnedTowards.y
|
||||
if turning.x < event_x
|
||||
turning.turn_right # Event is to the right of the player
|
||||
elsif turning.x > event_x
|
||||
turning.turn_left # Event is to the left of the player
|
||||
elsif turning.y < event_y
|
||||
turning.turn_down # Event is below the player
|
||||
elsif turning.y > event_y
|
||||
turning.turn_up # Event is above the player
|
||||
end
|
||||
end
|
||||
|
||||
def turnPlayerTowardsEvent(event)
|
||||
if event.is_a?(Integer)
|
||||
event = $game_map.events[event]
|
||||
end
|
||||
|
||||
event_x = event.x
|
||||
event_y = event.y
|
||||
if $game_player.x < event_x
|
||||
$game_player.turn_right # Event is to the right of the player
|
||||
elsif $game_player.x > event_x
|
||||
$game_player.turn_left # Event is to the left of the player
|
||||
elsif $game_player.y < event_y
|
||||
$game_player.turn_down # Event is below the player
|
||||
elsif $game_player.y > event_y
|
||||
$game_player.turn_up # Event is above the player
|
||||
end
|
||||
end
|
||||
|
||||
def giveJigglypuffScribbles(possible_versions = [1, 2, 3, 4])
|
||||
selected_scribbles_version = possible_versions.sample
|
||||
case selected_scribbles_version
|
||||
when 1
|
||||
scribbles_id = HAT_SCRIBBLES1
|
||||
when 2
|
||||
scribbles_id = HAT_SCRIBBLES2
|
||||
when 3
|
||||
scribbles_id = HAT_SCRIBBLES3
|
||||
when 4
|
||||
scribbles_id = HAT_SCRIBBLES4
|
||||
end
|
||||
return if !scribbles_id
|
||||
|
||||
if !hasHat?(scribbles_id)
|
||||
$Trainer.unlocked_hats << scribbles_id
|
||||
end
|
||||
putOnHat(scribbles_id, true, true)
|
||||
end
|
||||
|
||||
# type:
|
||||
# 0: default
|
||||
# 1: wood
|
||||
def sign(message, type = 0)
|
||||
signId = "sign_#{type}"
|
||||
formatted_message = "\\sign[#{signId}]#{message}"
|
||||
pbMessage(formatted_message)
|
||||
end
|
||||
|
||||
def setEventGraphicsToPokemon(species, eventId)
|
||||
event = $game_map.events[eventId]
|
||||
return if !event
|
||||
event.character_name = "Followers/#{species.to_s}"
|
||||
event.refresh
|
||||
end
|
||||
|
||||
# time in seconds
|
||||
def idleHatEvent(hatId, time, switchToActivate = nil)
|
||||
map = $game_map.map_id
|
||||
i = 0
|
||||
while i < (time / 5) do
|
||||
# /5 because we update 5 times per second
|
||||
return if $game_map.map_id != map
|
||||
i += 1
|
||||
pbWait(4)
|
||||
i = 0 if $game_player.moving?
|
||||
echoln i
|
||||
end
|
||||
$game_switches[switchToActivate] = true if switchToActivate
|
||||
obtainHat(hatId)
|
||||
end
|
||||
@@ -0,0 +1,161 @@
|
||||
class PokemonTemp
|
||||
# def pbClearAllTempEvents()
|
||||
# echoln @tempEvents
|
||||
# @tempEvents.keys.each {|map_id|
|
||||
# map = $MapFactory.getMap(map_id,false)
|
||||
# @tempEvents[map_id].each { |event|
|
||||
# map.events[event.id] = nil
|
||||
# }
|
||||
# }
|
||||
# @tempEvents={}
|
||||
# @silhouetteDirection=nil
|
||||
# end
|
||||
|
||||
def pbClearSilhouetteTempEvents()
|
||||
echoln @tempEvents
|
||||
@tempEvents.keys.each {|map_id|
|
||||
map = $MapFactory.getMap(map_id,false)
|
||||
@tempEvents[map_id].each { |event|
|
||||
#this deletes the event after a small fadeout
|
||||
$game_self_switches[[map_id, event.id, "B"]] = true if map.events[event.id]
|
||||
}
|
||||
}
|
||||
@tempEvents={}
|
||||
@silhouetteDirection=nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def isNightmareEffect()
|
||||
return $game_switches[SWITCH_NIGHTMARE_EFFECT] && PBDayNight.isNight?
|
||||
end
|
||||
|
||||
|
||||
# def playNightmareEffect()
|
||||
# frame=1
|
||||
# while true
|
||||
# frame +=1
|
||||
# frame = 1 if frame >4
|
||||
# filename = "nightmare"+frame.to_s
|
||||
# picture = Game_Picture.new(40)
|
||||
# picture.show(filename, 0, 0, 0, 200, 200, 255, 0)
|
||||
# pbWait(3)
|
||||
# picture.erase
|
||||
# end
|
||||
#
|
||||
# end
|
||||
|
||||
Events.onStepTaken += proc { |sender, e|
|
||||
next if !$PokemonTemp.silhouetteDirection
|
||||
if $PokemonTemp.silhouetteDirection && $PokemonTemp.silhouetteDirection == $game_player.direction
|
||||
$PokemonTemp.pbClearSilhouetteTempEvents
|
||||
$PokemonTemp.silhouetteDirection = nil
|
||||
end
|
||||
}
|
||||
|
||||
Events.onStepTaken += proc { |sender, e|
|
||||
next if !$scene.is_a?(Scene_Map)
|
||||
next if !isNightmareEffect()
|
||||
steps_constant_offset = 40
|
||||
steps_chance=100
|
||||
minimum_steps=10
|
||||
|
||||
steps_nb = rand(steps_chance)+pbGet(VAR_KARMA)+steps_constant_offset
|
||||
steps_nb = minimum_steps if steps_nb<minimum_steps
|
||||
next if $PokemonGlobal.stepcount % steps_nb != 0
|
||||
next if !isOutdoor()
|
||||
$PokemonTemp.pbClearSilhouetteTempEvents
|
||||
spawnSilhouette()
|
||||
}
|
||||
Events.onMapChange += proc { |sender, e|
|
||||
next if $PokemonTemp.tempEvents.empty?
|
||||
$PokemonTemp.pbClearTempEvents()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
def getRandomPositionOnPerimeter(width, height, center_x, center_y, variance=0,edge=nil)
|
||||
half_width = width / 2.0
|
||||
half_height = height / 2.0
|
||||
|
||||
# Randomly select one of the four edges of the rectangle
|
||||
edge = rand(4) if !edge
|
||||
|
||||
case edge
|
||||
when 0 # Top edge
|
||||
random_x = center_x + rand(-half_width..half_width)
|
||||
random_y = center_y - half_height
|
||||
when 1 # Bottom edge
|
||||
random_x = center_x + rand(-half_width..half_width)
|
||||
random_y = center_y + half_height
|
||||
when 2 # Left edge
|
||||
random_x = center_x - half_width
|
||||
random_y = center_y + rand(-half_height..half_height)
|
||||
when 3 # Right edge
|
||||
random_x = center_x + half_width
|
||||
random_y = center_y + rand(-half_height..half_height)
|
||||
end
|
||||
|
||||
return random_x.round, random_y.round
|
||||
end
|
||||
|
||||
# def launchSilhouetteCommonEvent(event)
|
||||
# $scene.spriteset.addUserAnimation(VIRUS_ANIMATION_ID, event.x, event.y, true)
|
||||
# $PokemonTemp.pbClearTempEvents
|
||||
# $PokemonTemp.silhouetteDirection = nil
|
||||
# pbCommonEvent(COMMON_EVENT_SILHOUETTE)
|
||||
# end
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Faces the same way as player
|
||||
# Disappears as soon as player takes a step in same direction as event
|
||||
# -> when talk to it:
|
||||
# ghost animation
|
||||
# Message:
|
||||
# A voice echoed from somewhere...
|
||||
# [NEXT HINT] (ex: The house in Vermillion City...)
|
||||
#
|
||||
|
||||
def generate_silhouette_event(id)
|
||||
$game_self_switches[[MAP_TEMPLATE_EVENTS, TEMPLATE_EVENT_SILHOUETTE, "A"]] = false
|
||||
$game_self_switches[[MAP_TEMPLATE_EVENTS, TEMPLATE_EVENT_SILHOUETTE, "B"]] = false
|
||||
template_event = $MapFactory.getMap(MAP_TEMPLATE_EVENTS,false).events[TEMPLATE_EVENT_SILHOUETTE]
|
||||
new_event= template_event.event.dup
|
||||
new_event.name = "temp_silhouette"
|
||||
new_event.id = id
|
||||
return new_event
|
||||
end
|
||||
|
||||
def spawnSilhouette()
|
||||
found_available_position = false
|
||||
max_tries = 10
|
||||
current_try = 0
|
||||
while !found_available_position
|
||||
x, y = getRandomPositionOnPerimeter(15, 11, $game_player.x, $game_player.y, 2)
|
||||
found_available_position = true if $game_map.passable?(x, y, $game_player.direction)
|
||||
current_try += 1
|
||||
return if current_try > max_tries
|
||||
end
|
||||
key_id = ($game_map.events.keys.max || -1) + 1
|
||||
rpgEvent = generate_silhouette_event(key_id)
|
||||
#rpgEvent = RPG::Event.new(x,y)
|
||||
|
||||
gameEvent = Game_Event.new($game_map.map_id, rpgEvent, $game_map)
|
||||
direction = $game_player.direction #[2,4,6,8].sample
|
||||
gameEvent.direction = direction
|
||||
$PokemonTemp.silhouetteDirection = direction
|
||||
$game_map.events[key_id] = gameEvent
|
||||
|
||||
|
||||
gameEvent.moveto(x, y)
|
||||
#-------------------------------------------------------------------------
|
||||
#updating the sprites
|
||||
|
||||
sprite = Sprite_Character.new(Spriteset_Map.viewport, $game_map.events[key_id])
|
||||
$scene.spritesets[$game_map.map_id] = Spriteset_Map.new($game_map) if $scene.spritesets[$game_map.map_id] == nil
|
||||
$scene.spritesets[$game_map.map_id].character_sprites.push(sprite)
|
||||
#$PokemonTemp.addTempEvent($game_map.map_id, gameEvent)
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
def displayPicture(image, x, y, z = 0)
|
||||
pictureWindow = PictureWindow.new(image)
|
||||
pictureWindow.z = z
|
||||
pictureWindow.x = x
|
||||
pictureWindow.y = y
|
||||
pictureWindow.opacity = 0
|
||||
return pictureWindow
|
||||
end
|
||||
|
||||
def showPokemonInPokeballWithMessage(pif_sprite, message, x_position = nil, y_position = nil)
|
||||
x_position = Graphics.width / 4 if !x_position
|
||||
y_position = 10 if !y_position
|
||||
|
||||
background_sprite = displayPicture("Graphics/Pictures/Trades/trade_pokeball_open_back", x_position, y_position, 1)
|
||||
foreground_sprite = displayPicture("Graphics/Pictures/Trades/trade_pokeball_open_front", x_position, y_position, 9999)
|
||||
displaySpriteWindowWithMessage(pif_sprite, message, 90, -10, 201)
|
||||
background_sprite.dispose
|
||||
foreground_sprite.dispose
|
||||
end
|
||||
@@ -0,0 +1,225 @@
|
||||
class Game_Temp
|
||||
attr_accessor :temp_waterfall
|
||||
attr_accessor :waterfall_sprites
|
||||
attr_accessor :splash_sprites
|
||||
attr_accessor :splash_coords
|
||||
|
||||
|
||||
end
|
||||
|
||||
def generate_dynamic_waterfall(starting_x_position, waterfall_top_y, thickness=1)
|
||||
map_height = $game_map.height - 8
|
||||
echoln map_height
|
||||
|
||||
boulder_positions = []
|
||||
CIANWOOD_BOULDER_IDS.each do |event_id|
|
||||
event = $game_map.events[event_id]
|
||||
boulder_positions << [event.x, event.y]
|
||||
end
|
||||
|
||||
# Add columns from starting_x_position to the right
|
||||
active_columns = []
|
||||
(starting_x_position...(starting_x_position + thickness)).each do |x|
|
||||
break if x >= $game_map.width # Don't go past map edge
|
||||
active_columns << { x: x, y: waterfall_top_y }
|
||||
end
|
||||
|
||||
visited = []
|
||||
final_coords = []
|
||||
splash_coords = []
|
||||
|
||||
while !active_columns.empty?
|
||||
new_columns = []
|
||||
|
||||
active_columns.each do |segment|
|
||||
x = segment[:x]
|
||||
y = segment[:y]
|
||||
next if visited.include?([x, y])
|
||||
|
||||
visited << [x, y]
|
||||
|
||||
while y < map_height
|
||||
pos = [x, y]
|
||||
final_coords << pos
|
||||
|
||||
if boulder_positions.include?(pos)
|
||||
splash_coords << [x - 1, y] if x > 0
|
||||
splash_coords << [x + 1, y] if x < $game_map.width - 1
|
||||
splash_coords << [x, y]
|
||||
|
||||
new_y = y
|
||||
new_columns << { x: x - 1, y: new_y } if x > 0 && !visited.include?([x - 1, new_y])
|
||||
new_columns << { x: x + 1, y: new_y } if x < $game_map.width - 1 && !visited.include?([x + 1, new_y])
|
||||
break
|
||||
end
|
||||
|
||||
#currents section
|
||||
if y > CIANWOOD_WATERFALL_EDGE+10
|
||||
if !$game_map.passable?(x, y + 1, DIRECTION_DOWN)
|
||||
splash_coords << [x, y + 1] if y + 1 < $game_map.height
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if y == CIANWOOD_WATERFALL_EDGE
|
||||
splash_coords << [x, y]
|
||||
end
|
||||
|
||||
if y == map_height
|
||||
splash_coords << [x, y]
|
||||
end
|
||||
|
||||
y += 1
|
||||
end
|
||||
end
|
||||
|
||||
active_columns = new_columns
|
||||
end
|
||||
|
||||
$game_temp.temp_waterfall = final_coords.uniq
|
||||
$game_temp.splash_coords = splash_coords.uniq
|
||||
echoln $game_temp.temp_waterfall
|
||||
draw_waterfall_layer
|
||||
end
|
||||
|
||||
def draw_waterfall_layer
|
||||
return if !$game_temp.temp_waterfall || $game_temp.temp_waterfall.empty?
|
||||
|
||||
# Clear previous sprites
|
||||
if $game_temp.waterfall_sprites
|
||||
$game_temp.waterfall_sprites.each(&:dispose)
|
||||
end
|
||||
if $game_temp.splash_sprites
|
||||
$game_temp.splash_sprites.each(&:dispose)
|
||||
end
|
||||
|
||||
$game_temp.waterfall_sprites = []
|
||||
$game_temp.splash_sprites = []
|
||||
|
||||
tile_size = 32
|
||||
waterfall_tile_id = 0 # Waterfall
|
||||
|
||||
splash_tile_id = 4 # Splash impact tile, assuming we have this in the tileset
|
||||
tileset = RPG::Cache.tileset($game_map.tileset_name)
|
||||
|
||||
# Draw waterfall tiles
|
||||
$game_temp.temp_waterfall.each do |x, y|
|
||||
sprite = Sprite.new(Spriteset_Map.viewport)
|
||||
|
||||
sprite.z = 10
|
||||
sprite.x = x * tile_size
|
||||
sprite.y = y * tile_size
|
||||
|
||||
sprite.bitmap = Bitmap.new(tile_size, tile_size)
|
||||
source_rect = Rect.new(waterfall_tile_id * tile_size,0, tile_size, tile_size) # Frame 0
|
||||
sprite.bitmap.blt(0, 0, tileset, source_rect)
|
||||
|
||||
# Store metadata for animation
|
||||
sprite.instance_variable_set(:@frame_offset, rand(3)) # Optional: make them start at different frames
|
||||
sprite.instance_variable_set(:@tile_x, x)
|
||||
sprite.instance_variable_set(:@tile_y, y)
|
||||
|
||||
$game_temp.waterfall_sprites << sprite
|
||||
end
|
||||
|
||||
# Draw splash impact tiles
|
||||
$game_temp.splash_coords.each do |x, y|
|
||||
sprite = Sprite.new(Spriteset_Map.viewport)
|
||||
sprite.z = 300 # Draw splash above the waterfall
|
||||
sprite.x = x * tile_size
|
||||
sprite.y = y * tile_size
|
||||
|
||||
sprite.bitmap = Bitmap.new(tile_size, tile_size)
|
||||
source_rect = Rect.new(splash_tile_id * tile_size,1, tile_size, tile_size) # Splash frame 0
|
||||
sprite.bitmap.blt(0, 0, tileset, source_rect)
|
||||
|
||||
# Store metadata for splash animation
|
||||
sprite.instance_variable_set(:@frame_offset, rand(3)) # Optional: make them start at different frames
|
||||
sprite.instance_variable_set(:@tile_x, x)
|
||||
sprite.instance_variable_set(:@tile_y, y)
|
||||
|
||||
$game_temp.splash_sprites << sprite
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
CIANWOOD_BOULDER_IDS = [2,3,5,6,
|
||||
4 ]#chuck head
|
||||
CIANWOOD_WATERFALL_EDGE =19
|
||||
|
||||
|
||||
def player_on_temp_waterfall?
|
||||
return false if !$game_temp.temp_waterfall
|
||||
|
||||
boulder_positions = []
|
||||
CIANWOOD_BOULDER_IDS.each do |event_id|
|
||||
event = $game_map.events[event_id]
|
||||
boulder_positions << [event.x, event.y]
|
||||
end
|
||||
|
||||
# Return false if a boulder is directly below the player
|
||||
return false if boulder_positions.include?([$game_player.x, $game_player.y + 1])
|
||||
|
||||
return $game_temp.temp_waterfall.any? { |x, y, _| x == $game_player.x && y == $game_player.y }
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Spriteset_Map
|
||||
alias_method :cianwood_waterfall_update, :update
|
||||
def update
|
||||
cianwood_waterfall_update
|
||||
|
||||
waterfall_edge = CIANWOOD_WATERFALL_EDGE
|
||||
if $game_temp.waterfall_sprites
|
||||
frame_count = Graphics.frame_count
|
||||
tile_size = 32
|
||||
autotile_id = 0
|
||||
tileset = RPG::Cache.tileset($game_map.tileset_name)
|
||||
|
||||
# Animate waterfall sprites
|
||||
$game_temp.waterfall_sprites.each do |sprite|
|
||||
tile_y = sprite.instance_variable_get(:@tile_y)
|
||||
frame_offset = sprite.instance_variable_get(:@frame_offset)
|
||||
|
||||
# Animate every 15 frames (change for speed control)
|
||||
animation_frame = (frame_count / 15 + tile_y - frame_offset) % 4
|
||||
|
||||
tileset_x = (autotile_id * 4 + animation_frame) * tile_size
|
||||
tileset_y = tile_y >= waterfall_edge ? tile_size : 0
|
||||
source_rect = Rect.new(tileset_x,tileset_y, tile_size, tile_size)
|
||||
|
||||
sprite.bitmap.clear
|
||||
sprite.bitmap.blt(0, 0, tileset, source_rect)
|
||||
|
||||
# Scroll with map
|
||||
sprite.ox = $game_map.display_x / 4
|
||||
sprite.oy = $game_map.display_y / 4
|
||||
end
|
||||
|
||||
# Animate splash sprites
|
||||
$game_temp.splash_sprites.each do |sprite|
|
||||
tile_y = sprite.instance_variable_get(:@tile_y)
|
||||
frame_offset = sprite.instance_variable_get(:@frame_offset)
|
||||
|
||||
# Animate every 10 frames for splash (you can adjust this speed)
|
||||
offset = (autotile_id * 4 + 4) * tile_size
|
||||
animation_frame = (frame_count / 10 + tile_y + frame_offset) % 4
|
||||
source_rect = Rect.new((autotile_id * 4 + animation_frame) * tile_size + offset, 0, tile_size, tile_size)
|
||||
|
||||
sprite.bitmap.clear
|
||||
sprite.bitmap.blt(0, 0, tileset, source_rect)
|
||||
|
||||
# Scroll with map
|
||||
sprite.ox = $game_map.display_x / 4
|
||||
sprite.oy = $game_map.display_y / 4
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,139 @@
|
||||
# todo: make the flower disappear from the tileset somehow?
|
||||
def oricorioEventPickFlower(flower_color)
|
||||
quest_progression = pbGet(VAR_ORICORIO_FLOWERS)
|
||||
if flower_color == :PINK
|
||||
if !$game_switches[SWITCH_ORICORIO_QUEST_PINK]
|
||||
pbMessage(_INTL("Woah! A Pokémon jumped out of the flower!"))
|
||||
pbWildBattle(:FOMANTIS, 10)
|
||||
end
|
||||
$game_switches[SWITCH_ORICORIO_QUEST_PINK] = true
|
||||
pbMessage(_INTL("It's a flower with pink nectar."))
|
||||
pbSEPlay("MiningAllFound")
|
||||
pbMessage(_INTL("{1} picked some of the pink flowers.", $Trainer.name))
|
||||
elsif flower_color == :RED && quest_progression == 1
|
||||
$game_switches[SWITCH_ORICORIO_QUEST_RED] = true
|
||||
pbMessage(_INTL("It's a flower with red nectar."))
|
||||
pbSEPlay("MiningAllFound")
|
||||
pbMessage(_INTL("{1} picked some of the red flowers.", $Trainer.name))
|
||||
elsif flower_color == :BLUE && quest_progression == 2
|
||||
$game_switches[SWITCH_ORICORIO_QUEST_BLUE] = true
|
||||
pbMessage(_INTL("It's a flower with blue nectar."))
|
||||
pbSEPlay("MiningAllFound")
|
||||
pbMessage(_INTL("{1} picked some of the blue flowers.", $Trainer.name))
|
||||
end
|
||||
end
|
||||
|
||||
def hasOricorioInParty()
|
||||
return $Trainer.has_species_or_fusion?(:ORICORIO_1) || $Trainer.has_species_or_fusion?(:ORICORIO_2) || $Trainer.has_species_or_fusion?(:ORICORIO_3) || $Trainer.has_species_or_fusion?(:ORICORIO_4)
|
||||
end
|
||||
|
||||
def changeOricorioFlower(form = 1)
|
||||
if $PokemonGlobal.stepcount % 25 == 0
|
||||
if !hatUnlocked?(HAT_FLOWER) && rand(2) == 0
|
||||
obtainHat(HAT_FLOWER)
|
||||
$PokemonGlobal.stepcount += 1
|
||||
else
|
||||
pbMessage(_INTL("Woah! A Pokémon jumped out of the flower!"))
|
||||
pbWildBattle(:FOMANTIS, 10)
|
||||
$PokemonGlobal.stepcount += 1
|
||||
end
|
||||
end
|
||||
return unless hasOricorioInParty
|
||||
message = ""
|
||||
form_name = ""
|
||||
if form == 1
|
||||
message = _INTL("It's a flower with red nectar. ")
|
||||
form_name = "Baile"
|
||||
elsif form == 2
|
||||
message = _INTL("It's a flower with yellow nectar. ")
|
||||
form_name = "Pom-pom"
|
||||
elsif form == 3
|
||||
message = _INTL("It's a flower with pink nectar. ")
|
||||
form_name = "Pa'u"
|
||||
elsif form == 4
|
||||
message = _INTL("It's a flower with blue nectar. ")
|
||||
form_name = "Sensu"
|
||||
end
|
||||
|
||||
message = message + _INTL("Show it to a Pokémon?")
|
||||
if pbConfirmMessage(message)
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg? &&
|
||||
(Kernel.isPartPokemon(poke, :ORICORIO_1) ||
|
||||
Kernel.isPartPokemon(poke, :ORICORIO_2) ||
|
||||
Kernel.isPartPokemon(poke, :ORICORIO_3) ||
|
||||
Kernel.isPartPokemon(poke, :ORICORIO_4))
|
||||
})
|
||||
if (pbGet(1) != -1)
|
||||
poke = $Trainer.party[pbGet(1)]
|
||||
if changeOricorioForm(poke, form)
|
||||
pbMessage(_INTL("{1} switched to the {2} style", poke.name, form_name))
|
||||
pbSet(1, poke.name)
|
||||
else
|
||||
pbMessage(_INTL("{1} remained the same...", poke.name, form_name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def changeOricorioForm(pokemon, form = nil)
|
||||
oricorio_forms = [:ORICORIO_1, :ORICORIO_2, :ORICORIO_3, :ORICORIO_4]
|
||||
body_id = pokemon.isFusion? ? get_body_species_from_symbol(pokemon.species) : pokemon.species
|
||||
head_id = pokemon.isFusion? ? get_head_species_from_symbol(pokemon.species) : pokemon.species
|
||||
|
||||
oricorio_body = oricorio_forms.include?(body_id)
|
||||
oricorio_head = oricorio_forms.include?(head_id)
|
||||
|
||||
target_form = case form
|
||||
when 1 then :ORICORIO_1
|
||||
when 2 then :ORICORIO_2
|
||||
when 3 then :ORICORIO_3
|
||||
when 4 then :ORICORIO_4
|
||||
else return false
|
||||
end
|
||||
if oricorio_body && oricorio_head && body_id == target_form && head_id == target_form
|
||||
return false
|
||||
end
|
||||
|
||||
if form == 1
|
||||
body_id = :ORICORIO_1 if oricorio_body
|
||||
head_id = :ORICORIO_1 if oricorio_head
|
||||
elsif form == 2
|
||||
body_id = :ORICORIO_2 if oricorio_body
|
||||
head_id = :ORICORIO_2 if oricorio_head
|
||||
elsif form == 3
|
||||
body_id = :ORICORIO_3 if oricorio_body
|
||||
head_id = :ORICORIO_3 if oricorio_head
|
||||
elsif form == 4
|
||||
body_id = :ORICORIO_4 if oricorio_body
|
||||
head_id = :ORICORIO_4 if oricorio_head
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
head_number = getDexNumberForSpecies(head_id)
|
||||
body_number = getDexNumberForSpecies(body_id)
|
||||
|
||||
newForm = pokemon.isFusion? ? getSpeciesIdForFusion(head_number, body_number) : head_id
|
||||
$Trainer.pokedex.set_seen(newForm)
|
||||
$Trainer.pokedex.set_owned(newForm)
|
||||
|
||||
pokemon.species = newForm
|
||||
return true
|
||||
end
|
||||
|
||||
# chance: out of 100
|
||||
def lilypadEncounter(pokemon, minLevel, maxLevel, chance = 10)
|
||||
minLevel, maxLevel = [minLevel, maxLevel].minmax
|
||||
level = rand(minLevel..maxLevel)
|
||||
|
||||
event = $game_map.events[@event_id]
|
||||
return if !event
|
||||
if rand(0..100) <= chance
|
||||
pbWildBattle(pokemon, level)
|
||||
else
|
||||
playAnimation(Settings::GRASS_ANIMATION_ID, event.x, event.y)
|
||||
end
|
||||
event.erase
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
def isOutdoor()
|
||||
current_map = $game_map.map_id
|
||||
map_metadata = GameData::MapMetadata.try_get(current_map)
|
||||
return map_metadata && map_metadata.outdoor_map
|
||||
end
|
||||
173
Data/Scripts/052_InfiniteFusion/Gameplay/Overworld/PokeMart.rb
Normal file
173
Data/Scripts/052_InfiniteFusion/Gameplay/Overworld/PokeMart.rb
Normal file
@@ -0,0 +1,173 @@
|
||||
# Necessary dor setting the various events within the pokemart map, uses the numbers as wondertrade
|
||||
def get_city_numerical_id(city_sym)
|
||||
return get_city_numerical_id_hoenn(city_sym) if Settings::GAME_ID == :IF_HOENN
|
||||
current_city_numerical = {
|
||||
:PEWTER => 1,
|
||||
:CERULEAN => 2,
|
||||
:VERMILLION => 3,
|
||||
:LAVENDER => 4,
|
||||
:CELADON => 5,
|
||||
:FUCHSIA => 6,
|
||||
:SAFFRON => 7,
|
||||
:CINNABAR => 8,
|
||||
:LEAGUE => 9,
|
||||
:VIOLET => 10,
|
||||
:AZALEA => 11,
|
||||
:GOLDENROD => 12,
|
||||
:ECRUTEAK => 13,
|
||||
:MAHOGANY => 14,
|
||||
:BLACKTHORN => 15,
|
||||
:OLIVINE => 16,
|
||||
:CIANWOOD => 17,
|
||||
:KNOTISLAND => 18,
|
||||
:BOONISLAND => 19,
|
||||
:KINISLAND => 20,
|
||||
:CHRONOISLAND => 21,
|
||||
:CRIMSON => 22,
|
||||
}
|
||||
return current_city_numerical[city_sym]
|
||||
end
|
||||
|
||||
POKEMART_MAP_ID = 357
|
||||
POKEMART_DOOR_POS = [12, 12]
|
||||
# city -> Symbol
|
||||
def enter_pokemart(city)
|
||||
pbSet(VAR_CURRENT_MART, city)
|
||||
pbSet(VAR_CURRENT_CITY_NUMERICAL_ID, get_city_numerical_id(city))
|
||||
echoln get_city_numerical_id(city)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = POKEMART_MAP_ID
|
||||
$game_temp.player_new_x = POKEMART_DOOR_POS[0]
|
||||
$game_temp.player_new_y = POKEMART_DOOR_POS[1]
|
||||
$scene.transfer_player(true)
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
end
|
||||
|
||||
def exit_pokemart()
|
||||
return exit_pokemart_hoenn() if Settings::GAME_ID == :IF_HOENN
|
||||
pokemart_entrances = {
|
||||
:PEWTER => [380, 43, 24],
|
||||
:CERULEAN => [1, 24, 22],
|
||||
:VERMILLION => [19, 32, 13],
|
||||
:LAVENDER => [50, 20, 23],
|
||||
:CELADON => [95, 18, 15], # not a real pokemart
|
||||
:FUCHSIA => [472, 7, 17],
|
||||
:SAFFRON => [108, 53, 24],
|
||||
:CINNABAR => [98, 30, 30],
|
||||
:CRIMSON => [167, 21, 36],
|
||||
:GOLDENROD => [237, 36, 33], # not a real pokemart
|
||||
:AZALEA => [278, 34, 17],
|
||||
:AZALEA_FLOODED => [338, 34, 17],
|
||||
:VIOLET => [230, 20, 31],
|
||||
:BLACKTHORN => [329, 16, 36],
|
||||
:MAHOGANY => [631, 19, 19], # not a real pokemart
|
||||
:ECRUTEAK => [359, 46, 38],
|
||||
:OLIVINE => [138, 33, 23],
|
||||
:CIANWOOD => [709.8, 46],
|
||||
}
|
||||
current_city = pbGet(VAR_CURRENT_MART)
|
||||
current_city = :PEWTER if !current_city.is_a?(Symbol)
|
||||
|
||||
entrance_map = pokemart_entrances[current_city][0]
|
||||
entrance_x = pokemart_entrances[current_city][1]
|
||||
entrance_y = pokemart_entrances[current_city][2]
|
||||
|
||||
reset_pokemart_variables
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = entrance_map
|
||||
$game_temp.player_new_x = entrance_x
|
||||
$game_temp.player_new_y = entrance_y
|
||||
$scene.transfer_player(true)
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
def reset_pokemart_variables
|
||||
pbSet(VAR_CURRENT_CITY_NUMERICAL_ID, 0)
|
||||
pbSet(VAR_CURRENT_MART, 0)
|
||||
end
|
||||
def pokemart_clothes_shop(current_city = nil, include_defaults = true)
|
||||
current_city = pbGet(VAR_CURRENT_MART) if !current_city
|
||||
echoln current_city
|
||||
current_city = :PEWTER if !current_city.is_a?(Symbol)
|
||||
current_city_tag = current_city.to_s.downcase
|
||||
selector = OutfitSelector.new
|
||||
list = selector.generate_clothes_choice(
|
||||
baseOptions = include_defaults,
|
||||
additionalIds = [],
|
||||
additionalTags = [current_city_tag],
|
||||
filterOutTags = [])
|
||||
clothesShop(list)
|
||||
end
|
||||
|
||||
def pokemart_hat_shop(include_defaults = true)
|
||||
current_city = pbGet(VAR_CURRENT_MART)
|
||||
current_city = :PEWTER if !current_city.is_a?(Symbol)
|
||||
current_city_tag = current_city.to_s.downcase
|
||||
selector = OutfitSelector.new
|
||||
list = selector.generate_hats_choice(
|
||||
baseOptions = include_defaults,
|
||||
additionalIds = [],
|
||||
additionalTags = [current_city_tag],
|
||||
filterOutTags = [])
|
||||
|
||||
hatShop(list)
|
||||
end
|
||||
|
||||
def get_mart_exclusive_items(city)
|
||||
return get_mart_exclusive_items_hoenn if Settings::GAME_ID == :IF_HOENN
|
||||
items_list = []
|
||||
case city
|
||||
when :PEWTER;
|
||||
items_list = [:ROCKGEM, :NESTBALL]
|
||||
when :VIRIDIAN;
|
||||
items_list = []
|
||||
when :CERULEAN;
|
||||
items_list = [:WATERGEM, :NETBALL, :PRETTYWING]
|
||||
when :VERMILLION;
|
||||
items_list = [:LOVEBALL, :ELECTRICGEM]
|
||||
when :LAVENDER;
|
||||
items_list = [:GHOSTGEM, :DARKGEM, :DUSKBALL]
|
||||
when :CELADON;
|
||||
items_list = [:GRASSGEM, :FLYINGGEM, :QUICKBALL, :TIMERBALL,]
|
||||
when :FUCHSIA;
|
||||
items_list = [:POISONGEM, :REPEATBALL]
|
||||
when :SAFFRON;
|
||||
items_list = [:PSYCHICGEM, :FIGHTINGGEM, :FRIENDBALL]
|
||||
when :CINNABAR;
|
||||
items_list = [:FIREGEM, :ICEGEM, :HEAVYBALL]
|
||||
when :CRIMSON;
|
||||
items_list = [:DRAGONGEM, :LEVELBALL]
|
||||
when :GOLDENROD;
|
||||
items_list = [:EVERSTONE, :MOONSTONE, :SUNSTONE, :DUSKSTONE, :DAWNSTONE, :SHINYSTONE]
|
||||
when :AZALEA;
|
||||
items_list = [:BUGGEM]
|
||||
when :VIOLET;
|
||||
items_list = [:FLYINGGEM, :STATUSBALL]
|
||||
when :BLACKTHORN;
|
||||
items_list = [:DRAGONGEM, :CANDYBALL]
|
||||
when :CHERRYGROVE;
|
||||
items_list = [:BUGGEM, :PUREBALL]
|
||||
when :MAHOGANY;
|
||||
items_list = []
|
||||
when :ECRUTEAK;
|
||||
items_list = [:GHOSTGEM, :DARKGEM]
|
||||
when :OLIVINE;
|
||||
items_list = []
|
||||
when :CIANWOOD;
|
||||
items_list = []
|
||||
when :KNOTISLAND;
|
||||
items_list = []
|
||||
when :BOONISLAND;
|
||||
items_list = []
|
||||
when :KINISLAND;
|
||||
items_list = []
|
||||
when :CHRONOISLAND;
|
||||
items_list = []
|
||||
end
|
||||
return items_list
|
||||
end
|
||||
Reference in New Issue
Block a user