mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
updates to version 6.1
This commit is contained in:
@@ -165,12 +165,12 @@ class FusionTutorService
|
||||
compatibleMoves << :THOUSANDWAVES if is_fusion_of([:STUNFISK, :QUAGSIRE, :SWAMPERT])
|
||||
compatibleMoves << :FREEZESHOCK if is_fusion_of([:KYUREM, :ARTICUNO]) && hasType(:ELECTRIC)
|
||||
compatibleMoves << :ICEBURN if is_fusion_of([:KYUREM, :ARTICUNO]) && hasType(:FIRE)
|
||||
compatibleMoves << :RELICSONG if is_fusion_of([:JYNX, :LAPRAS, :JIGGLYPUFF, :WIGGLYTUFF, :MISDREAVUS, :MISMAGIUS])
|
||||
#compatibleMoves << :RELICSONG if is_fusion_of([:JYNX, :LAPRAS, :JIGGLYPUFF, :WIGGLYTUFF, :MISDREAVUS, :MISMAGIUS])
|
||||
compatibleMoves << :HAPPYHOUR if is_fusion_of([:MEOWTH, :JIRACHI, :DELIBIRD, :MUNCHLAX, :SNORLAX, :PIKACHU, :RAICHU])
|
||||
compatibleMoves << :HOLDHANDS if is_fusion_of([:CHARMANDER, :BULBASAUR, :SQUIRTLE, :PIKACHU, :TOGEPI])
|
||||
#compatibleMoves << :PRISMATICLASER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :DEOXYS, :MEWTWO, :MEW]) && hasType(:PSYCHIC)
|
||||
#compatibleMoves << :PHOTONGEYSER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :MEW, :MEWTWO, :DEOXYS]) && hasType(:PSYCHIC)
|
||||
compatibleMoves << :LUNARDANCE if is_fusion_of([:CLEFAIRY, :CLEFABLE, :STARYU, :STARMIE])
|
||||
# compatibleMoves << :LUNARDANCE if is_fusion_of([:CLEFAIRY, :CLEFABLE, :STARYU, :STARMIE])
|
||||
compatibleMoves << :DIAMONDSTORM if ((hasType(:FAIRY) && hasType(:ROCK)) || (hasType(:ROCK) && hasType(:STEEL))) || is_fusion_of([:DIALGA, :STEELIX])
|
||||
compatibleMoves << :SUNSTEELSTRIKE if is_fusion_of([:CHARIZARD, :VOLCARONA, :FLAREON, :NINETALES, :ENTEI, :HOOH, :RAPIDASH]) && hasType(:STEEL)
|
||||
compatibleMoves << :DOUBLEIRONBASH if canLearnMove(:DOUBLESLAP) && hasType(:STEEL)
|
||||
|
||||
@@ -71,8 +71,9 @@ module GameData
|
||||
end
|
||||
|
||||
def self.front_sprite_bitmap(dex_number, spriteform_body = nil, spriteform_head = nil, isShiny = false, bodyShiny = false, headShiny = false)
|
||||
spriteform_body = nil if spriteform_body == 0
|
||||
spriteform_head = nil if spriteform_head == 0
|
||||
spriteform_body = nil# if spriteform_body == 0
|
||||
spriteform_head = nil# if spriteform_head == 0
|
||||
#TODO Remove spriteform mechanic entirely
|
||||
|
||||
#la méthode est utilisé ailleurs avec d'autres arguments (gender, form, etc.) mais on les veut pas
|
||||
if dex_number.is_a?(Symbol)
|
||||
@@ -267,6 +268,16 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :autogen_sprites_cache
|
||||
end
|
||||
|
||||
#To force a specific sprites before a battle
|
||||
#
|
||||
# ex:
|
||||
# $PokemonTemp.forced_alt_sprites={"20.25" => "20.25a"}
|
||||
#
|
||||
class PokemonTemp
|
||||
attr_accessor :forced_alt_sprites
|
||||
end
|
||||
|
||||
#todo: refactor into smaller methods
|
||||
def get_fusion_sprite_path(head_id, body_id, spriteform_body = nil, spriteform_head = nil)
|
||||
$PokemonGlobal.autogen_sprites_cache = {} if $PokemonGlobal && !$PokemonGlobal.autogen_sprites_cache
|
||||
#Todo: ça va chier si on fusionne une forme d'un pokemon avec une autre forme, mais pas un problème pour tout de suite
|
||||
@@ -278,23 +289,33 @@ def get_fusion_sprite_path(head_id, body_id, spriteform_body = nil, spriteform_h
|
||||
dex_num = getSpeciesIdForFusion(head_id, body_id)
|
||||
substitution_id = dex_num.to_s + form_suffix
|
||||
|
||||
|
||||
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(substitution_id)
|
||||
substitutionPath= $PokemonGlobal.alt_sprite_substitutions[substitution_id]
|
||||
return substitutionPath if pbResolveBitmap(substitutionPath)
|
||||
end
|
||||
|
||||
random_alt = get_random_alt_letter_for_custom(head_id, body_id) #nil if no main
|
||||
random_alt = "" if !random_alt
|
||||
|
||||
#Try local custom sprite
|
||||
spriteform_body_letter = spriteform_body ? "_" + spriteform_body.to_s : ""
|
||||
spriteform_head_letter = spriteform_head ? "_" + spriteform_head.to_s : ""
|
||||
|
||||
filename = _INTL("{1}{2}.{3}{4}{5}.png", head_id, spriteform_head_letter, body_id, spriteform_body_letter, random_alt)
|
||||
pokemon_name = _INTL("{1}{2}.{3}{4}",head_id, spriteform_head_letter, body_id, spriteform_body_letter)
|
||||
|
||||
|
||||
#get altSprite letter
|
||||
random_alt = get_random_alt_letter_for_custom(head_id, body_id) #nil if no main
|
||||
random_alt = "" if !random_alt
|
||||
forcingSprite=false
|
||||
if $PokemonTemp.forced_alt_sprites && $PokemonTemp.forced_alt_sprites.key?(pokemon_name)
|
||||
random_alt = $PokemonTemp.forced_alt_sprites[pokemon_name]
|
||||
forcingSprite=true
|
||||
end
|
||||
|
||||
|
||||
filename = _INTL("{1}{2}.png", pokemon_name, random_alt)
|
||||
#Try local custom sprite
|
||||
local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + spriteform_head_letter + "/" + filename
|
||||
if pbResolveBitmap(local_custom_path)
|
||||
record_sprite_substitution(substitution_id, local_custom_path)
|
||||
record_sprite_substitution(substitution_id, local_custom_path) if !forcingSprite
|
||||
return local_custom_path
|
||||
end
|
||||
#if the game has loaded an autogen earlier, no point in trying to redownload, so load that instead
|
||||
@@ -303,7 +324,7 @@ def get_fusion_sprite_path(head_id, body_id, spriteform_body = nil, spriteform_h
|
||||
#Try to download custom sprite if none found locally
|
||||
downloaded_custom = download_custom_sprite(head_id, body_id, spriteform_body_letter, spriteform_head_letter, random_alt)
|
||||
if downloaded_custom
|
||||
record_sprite_substitution(substitution_id, downloaded_custom)
|
||||
record_sprite_substitution(substitution_id, downloaded_custom) if !forcingSprite
|
||||
return downloaded_custom
|
||||
end
|
||||
|
||||
@@ -370,16 +391,23 @@ def list_alt_sprite_letters(spriteName)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def map_alt_sprite_letters_for_pokemon(spriteName)
|
||||
alt_sprites = {}
|
||||
File.foreach(Settings::CREDITS_FILE_PATH) do |line|
|
||||
row = line.split(',')
|
||||
sprite_name = row[0]
|
||||
if sprite_name.start_with?(spriteName) && sprite_name.length > spriteName.length
|
||||
letter = sprite_name[spriteName.length]
|
||||
if letter.match?(/[a-zA-Z]/)
|
||||
main_or_alt = row[2] ? row[2] : nil
|
||||
alt_sprites[letter] = main_or_alt
|
||||
if sprite_name.start_with?(spriteName)
|
||||
if sprite_name.length > spriteName.length #alt letter
|
||||
letter = sprite_name[spriteName.length]
|
||||
if letter.match?(/[a-zA-Z]/)
|
||||
main_or_alt = row[2] ? row[2] : nil
|
||||
alt_sprites[letter] = main_or_alt
|
||||
end
|
||||
else #letterless
|
||||
main_or_alt = row[2] ? row[2] : nil
|
||||
alt_sprites[""] = main_or_alt
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -208,10 +208,10 @@ def playPokeFluteAnimation
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
|
||||
def restoreDefaultCharacterSprite(charset_number=0)
|
||||
def restoreDefaultCharacterSprite(charset_number = 0)
|
||||
meta = GameData::Metadata.get_player($Trainer.character_ID)
|
||||
$game_player.setDefaultCharName(nil, 0, false)
|
||||
$game_player.character_name =meta[1]
|
||||
$game_player.character_name = meta[1]
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
@@ -431,6 +431,7 @@ KANTO_OUTDOOR_MAPS = [
|
||||
167, #Crimson city
|
||||
303, #indigo plateau
|
||||
380, #Pewter city
|
||||
827, #Mt. Moon summit
|
||||
#
|
||||
# DUNGEONS
|
||||
#
|
||||
@@ -464,6 +465,7 @@ KANTO_OUTDOOR_MAPS = [
|
||||
467, #Pokemon Tower
|
||||
468, #Pokemon Tower
|
||||
469, #Pokemon Tower
|
||||
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_1 = [
|
||||
50, #Lavender town
|
||||
@@ -528,6 +530,7 @@ KANTO_DARKNESS_STAGE_3 = [
|
||||
228, #Route 20 underwater 2
|
||||
98, #Cinnabar island
|
||||
58, #Route 21
|
||||
827, #Mt. Moon summit
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_4 = KANTO_OUTDOOR_MAPS
|
||||
|
||||
@@ -599,8 +602,6 @@ def has_species_or_fusion?(species, form = -1)
|
||||
return $Trainer.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
|
||||
end
|
||||
|
||||
|
||||
|
||||
#Solution: position of boulders [[x,y],[x,y],etc.]
|
||||
def validate_regirock_ice_puzzle(solution)
|
||||
for boulder_position in solution
|
||||
@@ -609,32 +610,31 @@ def validate_regirock_ice_puzzle(solution)
|
||||
# echoln ""
|
||||
# echoln x.to_s + ", " + y.to_s
|
||||
# echoln $game_map.event_at_position(x,y)
|
||||
return false if !$game_map.event_at_position(x,y)
|
||||
return false if !$game_map.event_at_position(x, y)
|
||||
end
|
||||
echoln "all boulders in place"
|
||||
return true
|
||||
end
|
||||
|
||||
def unpress_all_regirock_steel_switches()
|
||||
switch_ids = [75,77,76,67, 74,68, 73,72,70,69]
|
||||
switch_ids = [75, 77, 76, 67, 74, 68, 73, 72, 70, 69]
|
||||
regi_map = 813
|
||||
switch_ids.each do |event_id|
|
||||
pbSetSelfSwitch(event_id,"A",false,regi_map)
|
||||
pbSetSelfSwitch(event_id, "A", false, regi_map)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def validate_regirock_steel_puzzle()
|
||||
expected_pressed_switches = [75,77,74,68,73,69]
|
||||
expected_unpressed_switches = [76,67,72,70]
|
||||
switch_ids = [75,77,76,67,
|
||||
74,68,
|
||||
73,72,70,69]
|
||||
expected_pressed_switches = [75, 77, 74, 68, 73, 69]
|
||||
expected_unpressed_switches = [76, 67, 72, 70]
|
||||
switch_ids = [75, 77, 76, 67,
|
||||
74, 68,
|
||||
73, 72, 70, 69]
|
||||
|
||||
pressed_switches =[]
|
||||
pressed_switches = []
|
||||
unpressed_switches = []
|
||||
switch_ids.each do |switch_id|
|
||||
is_pressed = pbGetSelfSwitch(switch_id,"A")
|
||||
is_pressed = pbGetSelfSwitch(switch_id, "A")
|
||||
if is_pressed
|
||||
pressed_switches << switch_id
|
||||
else
|
||||
@@ -642,25 +642,23 @@ def validate_regirock_steel_puzzle()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for event_id in switch_ids
|
||||
is_pressed = pbGetSelfSwitch(event_id,"A")
|
||||
is_pressed = pbGetSelfSwitch(event_id, "A")
|
||||
return false if !is_pressed && expected_pressed_switches.include?(event_id)
|
||||
return false if is_pressed && expected_unpressed_switches.include?(event_id)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
def registeel_ice_press_switch(letter)
|
||||
order = pbGet(1)
|
||||
solution = "ssBSBGG"#GGSBBss"
|
||||
solution = "ssBSBGG" #GGSBBss"
|
||||
registeel_ice_reset_switches() if !order.is_a?(String)
|
||||
order << letter
|
||||
pbSet(1,order)
|
||||
pbSet(1, order)
|
||||
if order == solution
|
||||
echoln "OK"
|
||||
pbSEPlay("Evolution start",nil,130)
|
||||
pbSEPlay("Evolution start", nil, 130)
|
||||
elsif order.length >= solution.length
|
||||
registeel_ice_reset_switches()
|
||||
end
|
||||
@@ -668,50 +666,354 @@ def registeel_ice_press_switch(letter)
|
||||
end
|
||||
|
||||
def registeel_ice_reset_switches()
|
||||
switches_events = [66,78,84,85,86,87,88]
|
||||
switches_events = [66, 78, 84, 85, 86, 87, 88]
|
||||
switches_events.each do |switch_id|
|
||||
pbSetSelfSwitch(switch_id, "A", false)
|
||||
echoln "reset" + switch_id.to_s
|
||||
end
|
||||
pbSet(1,"")
|
||||
pbSet(1, "")
|
||||
end
|
||||
|
||||
|
||||
def regirock_steel_move_boulder()
|
||||
|
||||
switches_position = [
|
||||
[16,21],[18,21],[20,21],[22,21],
|
||||
[16,23], [22,23],
|
||||
[16,25],[18,25],[20,25],[22,25]
|
||||
[16, 21], [18, 21], [20, 21], [22, 21],
|
||||
[16, 23], [22, 23],
|
||||
[16, 25], [18, 25], [20, 25], [22, 25]
|
||||
]
|
||||
boulder_event = get_self
|
||||
old_x = boulder_event.x
|
||||
old_y = boulder_event.y
|
||||
stepped_off_switch = switches_position.find { |position| position[0] == old_x && position[1] == old_y }
|
||||
|
||||
|
||||
pbPushThisBoulder()
|
||||
boulder_event = get_self
|
||||
|
||||
if stepped_off_switch
|
||||
switch_event = $game_map.get_event_at_position(old_x,old_y,[boulder_event.id])
|
||||
switch_event = $game_map.get_event_at_position(old_x, old_y, [boulder_event.id])
|
||||
echoln switch_event.id if switch_event
|
||||
pbSEPlay("Entering Door",nil,80)
|
||||
pbSEPlay("Entering Door", nil, 80)
|
||||
pbSetSelfSwitch(switch_event.id, "A", false) if switch_event
|
||||
end
|
||||
|
||||
stepped_on_switch = switches_position.find { |position| position[0] == boulder_event.x && position[1] == boulder_event.y }
|
||||
if stepped_on_switch
|
||||
switch_event = $game_map.get_event_at_position(boulder_event.x,boulder_event.y,[boulder_event.id])
|
||||
switch_event = $game_map.get_event_at_position(boulder_event.x, boulder_event.y, [boulder_event.id])
|
||||
echoln switch_event.id if switch_event
|
||||
pbSEPlay("Entering Door")
|
||||
pbSetSelfSwitch(switch_event.id, "A", true) if switch_event
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def displayRandomizerErrorMessage()
|
||||
Kernel.pbMessage(_INTL("The randomizer has encountered an error. You should try to re-randomize your game as soon as possible."))
|
||||
Kernel.pbMessage(_INTL("You can do this on the top floor of Pokémon Centers."))
|
||||
end
|
||||
|
||||
#ex:Game_Event.new
|
||||
# forced_sprites = {"1.133" => "a"}
|
||||
# setForcedAltSprites(forced_sprites)
|
||||
#
|
||||
def setForcedAltSprites(forcedSprites_map)
|
||||
$PokemonTemp.forced_alt_sprites = forcedSprites_map
|
||||
end
|
||||
|
||||
def playMeloettaBandMusic()
|
||||
unlocked_members = []
|
||||
unlocked_members << :DRUM if $game_switches[SWITCH_BAND_DRUMMER]
|
||||
unlocked_members << :AGUITAR if $game_switches[SWITCH_BAND_ACOUSTIC_GUITAR]
|
||||
unlocked_members << :EGUITAR if $game_switches[SWITCH_BAND_ELECTRIC_GUITAR]
|
||||
unlocked_members << :FLUTE if $game_switches[SWITCH_BAND_FLUTE]
|
||||
unlocked_members << :HARP if $game_switches[SWITCH_BAND_HARP]
|
||||
|
||||
echoln unlocked_members
|
||||
echoln (unlocked_members & [:DRUM, :AGUITAR, :EGUITAR, :FLUTE, :HARP])
|
||||
|
||||
track = "band/band_1"
|
||||
if unlocked_members == [:DRUM, :AGUITAR, :EGUITAR, :FLUTE, :HARP]
|
||||
track = "band/band_full"
|
||||
else
|
||||
if unlocked_members.include?(:FLUTE)
|
||||
track = "band/band_5a"
|
||||
elsif unlocked_members.include?(:HARP)
|
||||
track = "band/band_5b"
|
||||
else
|
||||
if unlocked_members.include?(:EGUITAR) && unlocked_members.include?(:AGUITAR)
|
||||
track = "band/band_4"
|
||||
elsif unlocked_members.include?(:AGUITAR)
|
||||
track = "band/band_3a"
|
||||
elsif unlocked_members.include?(:EGUITAR)
|
||||
track = "band/band_3b"
|
||||
elsif unlocked_members.include?(:DRUM)
|
||||
track = "band/band_2"
|
||||
end
|
||||
end
|
||||
end
|
||||
echoln track
|
||||
pbBGMPlay(track)
|
||||
end
|
||||
|
||||
def setPokemonMoves(pokemon, move_ids = [])
|
||||
moves = []
|
||||
move_ids.each { |move_id|
|
||||
moves << Pokemon::Move.new(move_id)
|
||||
}
|
||||
pokemon.moves = moves
|
||||
end
|
||||
|
||||
def isTuesdayNight()
|
||||
day = getDayOfTheWeek()
|
||||
hour = pbGetTimeNow().hour
|
||||
echoln hour
|
||||
return (day == :TUESDAY && hour >= 20) || (day == :WEDNESDAY && hour < 5)
|
||||
end
|
||||
|
||||
def apply_concert_lighting(light, duration = 1)
|
||||
tone = Tone.new(0, 0, 0)
|
||||
case light
|
||||
when :GUITAR_HIT
|
||||
tone = Tone.new(-50, -100, -50)
|
||||
when :VERSE_1
|
||||
tone = Tone.new(-90, -110, -50)
|
||||
when :VERSE_2_LIGHT
|
||||
tone = Tone.new(-40, -80, -30)
|
||||
when :VERSE_2_DIM
|
||||
tone = Tone.new(-60, -100, -50)
|
||||
when :CHORUS_1
|
||||
tone = Tone.new(0, -80, -50)
|
||||
when :CHORUS_2
|
||||
tone = Tone.new(0, -50, -80)
|
||||
when :CHORUS_3
|
||||
tone = Tone.new(0, -80, -80)
|
||||
when :CHORUS_END
|
||||
tone = Tone.new(-68, 0, -102)
|
||||
when :MELOETTA_1
|
||||
tone = Tone.new(-60, -50, 20)
|
||||
end
|
||||
$game_screen.start_tone_change(tone, duration)
|
||||
end
|
||||
|
||||
def replaceFusionSpecies(pokemon, speciesToChange, newSpecies)
|
||||
currentBody = pokemon.species_data.get_body_species()
|
||||
currentHead = pokemon.species_data.get_head_species()
|
||||
should_update_body = currentBody == speciesToChange
|
||||
should_update_head = currentHead == speciesToChange
|
||||
return if !should_update_body && !should_update_head
|
||||
|
||||
newSpeciesBody = should_update_body ? newSpecies : currentBody
|
||||
newSpeciesHead = should_update_head ? newSpecies : currentHead
|
||||
|
||||
newSpecies = getFusionSpecies(newSpeciesBody, newSpeciesHead)
|
||||
pokemon.species = newSpecies
|
||||
end
|
||||
|
||||
def changeSpeciesSpecific(pokemon, newSpecies)
|
||||
pokemon.species = newSpecies
|
||||
$Trainer.pokedex.set_seen(newSpecies)
|
||||
$Trainer.pokedex.set_owned(newSpecies)
|
||||
end
|
||||
|
||||
def getNextLunarFeatherHint()
|
||||
nb_feathers = pbGet(VAR_LUNAR_FEATHERS)
|
||||
case nb_feathers
|
||||
when 0
|
||||
return "Find the first feather in the northernmost dwelling in the city of sunsets..."
|
||||
when 1
|
||||
return "Amidst a playground for Pokémon youngsters, the second feather hides, surrounded by innocence."
|
||||
when 2
|
||||
return "Find the next one in the inn where water meets rest"
|
||||
when 3
|
||||
return "Find the next one inside the lone house in the city at the edge of civilization."
|
||||
when 4
|
||||
return "The final feather lies back in the refuge for orphaned Pokémon..."
|
||||
else
|
||||
return "Lie in the bed... Bring me the feathers..."
|
||||
end
|
||||
end
|
||||
|
||||
def clearAllSelfSwitches(mapID, switch = "A", newValue = false)
|
||||
map = $MapFactory.getMap(mapID, false)
|
||||
map.events.each { |event_array|
|
||||
event_id = event_array[0]
|
||||
pbSetSelfSwitch(event_id, switch, newValue, mapID)
|
||||
}
|
||||
end
|
||||
|
||||
#@formatter:off
|
||||
def get_constellation_variable(pokemon)
|
||||
case pokemon
|
||||
when :IVYSAUR; return VAR_CONSTELLATION_IVYSAUR
|
||||
when :WARTORTLE; return VAR_CONSTELLATION_WARTORTLE
|
||||
when :ARCANINE; return VAR_CONSTELLATION_ARCANINE
|
||||
when :MACHOKE; return VAR_CONSTELLATION_MACHOKE
|
||||
when :RAPIDASH; return VAR_CONSTELLATION_RAPIDASH
|
||||
when :GYARADOS; return VAR_CONSTELLATION_GYARADOS
|
||||
when :ARTICUNO; return VAR_CONSTELLATION_ARTICUNO
|
||||
when :MEW; return VAR_CONSTELLATION_MEW
|
||||
# when :POLITOED; return VAR_CONSTELLATION_POLITOED
|
||||
# when :URSARING; return VAR_CONSTELLATION_URSARING
|
||||
# when :LUGIA; return VAR_CONSTELLATION_LUGIA
|
||||
# when :HOOH; return VAR_CONSTELLATION_HOOH
|
||||
# when :CELEBI; return VAR_CONSTELLATION_CELEBI
|
||||
# when :SLAKING; return VAR_CONSTELLATION_SLAKING
|
||||
# when :JIRACHI; return VAR_CONSTELLATION_JIRACHI
|
||||
# when :TYRANTRUM; return VAR_CONSTELLATION_TYRANTRUM
|
||||
# when :SHARPEDO; return VAR_CONSTELLATION_SHARPEDO
|
||||
# when :ARCEUS; return VAR_CONSTELLATION_ARCEUS
|
||||
end
|
||||
end
|
||||
#@formatter:on
|
||||
|
||||
def promptCaughtPokemonAction(pokemon)
|
||||
pickedOption = false
|
||||
return pbStorePokemon(pokemon) if !$Trainer.party_full?
|
||||
|
||||
while !pickedOption
|
||||
command = pbMessage(_INTL("\\ts[]Your team is full!"),
|
||||
[_INTL("Add to your party"), _INTL("Store to PC"),], 2)
|
||||
echoln ("command " + command.to_s)
|
||||
case command
|
||||
when 0 #SWAP
|
||||
if swapCaughtPokemon(pokemon)
|
||||
echoln pickedOption
|
||||
pickedOption = true
|
||||
end
|
||||
else
|
||||
#STORE
|
||||
pbStorePokemon(pokemon)
|
||||
echoln pickedOption
|
||||
pickedOption = true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#def pbChoosePokemon(variableNumber, nameVarNumber, ableProc = nil, allowIneligible = false)
|
||||
def swapCaughtPokemon(caughtPokemon)
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg? &&
|
||||
!(poke.isShadow? rescue false)
|
||||
})
|
||||
index = pbGet(1)
|
||||
return false if index == -1
|
||||
$PokemonStorage.pbStoreCaught($Trainer.party[index])
|
||||
pbRemovePokemonAt(index)
|
||||
pbStorePokemon(caughtPokemon)
|
||||
return true
|
||||
end
|
||||
|
||||
def constellation_add_star(pokemon)
|
||||
star_variables = get_constellation_variable(pokemon)
|
||||
|
||||
pbSEPlay("GUI trainer card open", 80)
|
||||
nb_stars = pbGet(star_variables)
|
||||
pbSet(star_variables, nb_stars + 1)
|
||||
end
|
||||
|
||||
def clear_all_images()
|
||||
for i in 1..99
|
||||
echoln i.to_s + " : " + $game_screen.pictures[i].name
|
||||
$game_screen.pictures[i].erase
|
||||
end
|
||||
end
|
||||
|
||||
def exportTeamForShowdown()
|
||||
message=""
|
||||
for pokemon in $Trainer.party
|
||||
message << exportFusedPokemonForShowdown(pokemon)
|
||||
message << "\n"
|
||||
end
|
||||
Input.clipboard = message
|
||||
end
|
||||
|
||||
# Clefnair (Clefable) @ Life Orb
|
||||
# Ability: Magic Guard
|
||||
# Level: 33
|
||||
# Fusion: Dragonair
|
||||
# EVs: 252 HP / 252 SpD / 4 Spe
|
||||
# Modest Nature
|
||||
# - Dazzling Gleam
|
||||
# - Dragon Breath
|
||||
# - Wish
|
||||
# - Water Pulse
|
||||
def exportFusedPokemonForShowdown(pokemon)
|
||||
|
||||
|
||||
if pokemon.species_data.is_a?(GameData::FusedSpecies)
|
||||
head_pokemon_species = pokemon.species_data.head_pokemon
|
||||
species_name = head_pokemon_species.name
|
||||
else
|
||||
species_name = pokemon.species_data.real_name
|
||||
end
|
||||
|
||||
|
||||
if pokemon.item
|
||||
nameLine = _INTL("{1} ({2}) @ {3}", pokemon.name, species_name, pokemon.item.name)
|
||||
else
|
||||
nameLine = _INTL("{1} ({2})", pokemon.name, species_name)
|
||||
end
|
||||
|
||||
abilityLine = _INTL("Ability: {1}", pokemon.ability.name)
|
||||
levelLine = _INTL("Level: {1}", pokemon.level)
|
||||
|
||||
fusionLine=""
|
||||
if pokemon.species_data.is_a?(GameData::FusedSpecies)
|
||||
body_pokemon_species = pokemon.species_data.body_pokemon
|
||||
fusionLine = _INTL("Fusion: {1}\n", body_pokemon_species.name)
|
||||
end
|
||||
evsLine = calculateEvLineForShowdown(pokemon)
|
||||
ivsLine = calculateIvLineForShowdown(pokemon)
|
||||
|
||||
move1 = "", move2="", move3="", move4 = ""
|
||||
move1 = _INTL("- {1}", GameData::Move.get(pokemon.moves[0].id).real_name) if pokemon.moves[0]
|
||||
move2 = _INTL("- {1}", GameData::Move.get(pokemon.moves[1].id).real_name) if pokemon.moves[1]
|
||||
move3 = _INTL("- {1}", GameData::Move.get(pokemon.moves[2].id).real_name) if pokemon.moves[2]
|
||||
move4 = _INTL("- {1}", GameData::Move.get(pokemon.moves[3].id).real_name) if pokemon.moves[3]
|
||||
|
||||
ret = nameLine + "\n" +
|
||||
abilityLine + "\n" +
|
||||
levelLine + "\n" +
|
||||
fusionLine +
|
||||
evsLine + "\n" +
|
||||
ivsLine + "\n" +
|
||||
move1 + "\n" +
|
||||
move2 + "\n" +
|
||||
move3 + "\n" +
|
||||
move4 + "\n"
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
def calculateEvLineForShowdown(pokemon)
|
||||
evsLine = "EVs: "
|
||||
evsLine << _INTL("{1} HP /", pokemon.ev[:HP])
|
||||
evsLine << _INTL("{1} Atk / ", pokemon.ev[:ATTACK])
|
||||
evsLine << _INTL("{1} Def / ", pokemon.ev[:DEFENSE])
|
||||
evsLine << _INTL("{1} SpA / ", pokemon.ev[:SPECIAL_ATTACK])
|
||||
evsLine << _INTL("{1} SpD / ", pokemon.ev[:SPECIAL_DEFENSE])
|
||||
evsLine << _INTL("{1} Spe / ", pokemon.ev[:SPEED])
|
||||
return evsLine
|
||||
end
|
||||
|
||||
def calculateIvLineForShowdown(pokemon)
|
||||
ivLine = "IVs: "
|
||||
ivLine << _INTL("{1} HP / ", pokemon.iv[:HP])
|
||||
ivLine << _INTL("{1} Atk / ", pokemon.iv[:ATTACK])
|
||||
ivLine << _INTL("{1} Def / ", pokemon.iv[:DEFENSE])
|
||||
ivLine << _INTL("{1} SpA / ", pokemon.iv[:SPECIAL_ATTACK])
|
||||
ivLine << _INTL("{1} SpD / ", pokemon.iv[:SPECIAL_DEFENSE])
|
||||
ivLine << _INTL("{1} Spe", pokemon.iv[:SPEED])
|
||||
return ivLine
|
||||
end
|
||||
|
||||
def openUrlInBrowser(url="")
|
||||
begin
|
||||
# Open the URL in the default web browser
|
||||
system("xdg-open", url) || system("open", url) || system("start", url)
|
||||
rescue
|
||||
Input.clipboard = url
|
||||
pbMessage("The game could not open the link in the browser")
|
||||
pbMessage("The link has been copied to your clipboard instead")
|
||||
end
|
||||
end
|
||||
@@ -150,6 +150,12 @@ def getFusedPokemonIdFromDexNum(body_dex, head_dex)
|
||||
return ("B" + body_dex.to_s + "H" + head_dex.to_s).to_sym
|
||||
end
|
||||
|
||||
def getFusedPokemonIdFromSymbols(body_dex, head_dex)
|
||||
bodyDexNum = GameData::Species.get(body_dex).id_number
|
||||
headDexNum = GameData::Species.get(head_dex).id_number
|
||||
return getFusedPokemonIdFromDexNum(body_dex,head_dex)
|
||||
end
|
||||
|
||||
def getPokemon(dexNum)
|
||||
if dexNum.is_a?(Integer)
|
||||
if dexNum > NB_POKEMON
|
||||
|
||||
@@ -49,6 +49,7 @@ def download_pokemon_sprite_if_missing(body, head)
|
||||
get_fusion_sprite_path(head, body)
|
||||
end
|
||||
|
||||
|
||||
def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp", alt_letter = "", spriteformBody_suffix = "", spriteformHead_suffix = "")
|
||||
begin
|
||||
head_id = (head_id.to_s) + spriteformHead_suffix
|
||||
@@ -75,7 +76,7 @@ def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp",
|
||||
echoln _INTL("\nDownloaded file from {1} to {2}", base_path, saveLocation)
|
||||
return downloaded_file_name
|
||||
end
|
||||
echoln "tried to download " + base_path
|
||||
echoln "tried to download " + url
|
||||
return nil
|
||||
rescue MKXPError, Errno::ENOENT
|
||||
return nil
|
||||
@@ -110,6 +111,20 @@ def download_custom_sprite(head_id, body_id, spriteformBody_suffix = "", spritef
|
||||
return nil
|
||||
end
|
||||
|
||||
def download_custom_sprite_filename(filename)
|
||||
head_id = (head_id.to_s) + spriteformHead_suffix.to_s
|
||||
body_id = (body_id.to_s) + spriteformBody_suffix.to_s
|
||||
return nil if $PokemonSystem.download_sprites != 0
|
||||
url = Settings::CUSTOM_SPRITES_REPO_URL + "{1}.{2}{3}.png"
|
||||
destPath = _INTL("{1}{2}", Settings::CUSTOM_BATTLERS_FOLDER_INDEXED, head_id)
|
||||
if !Dir.exist?(destPath)
|
||||
Dir.mkdir(destPath)
|
||||
end
|
||||
sprite = download_sprite(_INTL(url, head_id, body_id,alt_letter), head_id, body_id, destPath, alt_letter)
|
||||
return sprite if sprite
|
||||
return nil
|
||||
end
|
||||
|
||||
#todo refactor & put custom base sprites in same folder as fusion sprites
|
||||
def download_unfused_main_sprite(dex_num, alt_letter="")
|
||||
base_url = alt_letter == "" ? Settings::BASE_POKEMON_SPRITES_REPO_URL : Settings::BASE_POKEMON_ALT_SPRITES_REPO_URL
|
||||
|
||||
@@ -333,28 +333,7 @@ class PokemonLoadScreen
|
||||
end
|
||||
end
|
||||
|
||||
def detectFakeDownload()
|
||||
blacklist = ["pokemoninfinitefusion.net"]
|
||||
current_user_directory=Dir.pwd
|
||||
for keyword in blacklist
|
||||
if current_user_directory.include?(keyword)
|
||||
pbMessage("The game has detected that it has been installed from an illegitimate source which likely contains viruses.")
|
||||
pbMessage("Please delete the game and reinstall it from the Discord or subreddit")
|
||||
pbMessage("discord.gg/infinitefusion\nreddit.com/r/pokemoninfinitefusion")
|
||||
|
||||
pbMessage("Please also make sure to report the website you originally downloaded the game from to Google.")
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
def fakeWebsiteDisclaimer()
|
||||
pbMessage("Reminder: This game does NOT have an official website. The ONLY official sources for the game are game's official discord or subreddit.")
|
||||
end
|
||||
|
||||
def pbStartLoadScreen
|
||||
return if detectFakeDownload
|
||||
fakeWebsiteDisclaimer()
|
||||
updateHttpSettingsFile
|
||||
updateCreditsFile
|
||||
newer_version = find_newer_available_version
|
||||
@@ -406,6 +385,8 @@ class PokemonLoadScreen
|
||||
end
|
||||
commands[cmd_options = commands.length] = _INTL('Options')
|
||||
commands[cmd_language = commands.length] = _INTL('Language') if Settings::LANGUAGES.length >= 2
|
||||
commands[cmd_discord = commands.length] = _INTL('Discord')
|
||||
commands[cmd_wiki = commands.length] = _INTL('Wiki')
|
||||
commands[cmd_debug = commands.length] = _INTL('Debug') if $DEBUG
|
||||
commands[cmd_quit = commands.length] = _INTL('Quit Game')
|
||||
cmd_left = -3
|
||||
@@ -445,6 +426,10 @@ class PokemonLoadScreen
|
||||
Game.start_new(@save_data[:bag], @save_data[:storage_system], @save_data[:player])
|
||||
@save_data[:player].new_game_plus_unlocked = true
|
||||
return
|
||||
when cmd_discord
|
||||
openUrlInBrowser(Settings::DISCORD_URL)
|
||||
when cmd_wiki
|
||||
openUrlInBrowser(Settings::WIKI_URL)
|
||||
when cmd_mystery_gift
|
||||
pbFadeOutIn { pbDownloadMysteryGift(@save_data[:player]) }
|
||||
when cmd_options
|
||||
|
||||
@@ -357,6 +357,58 @@ ItemHandlers::UseFromBag.add(:DEBUGGER, proc { |item|
|
||||
end
|
||||
})
|
||||
|
||||
def useSleepingBag()
|
||||
currentSecondsValue = pbGet(UnrealTime::EXTRA_SECONDS)
|
||||
choices = ["1 hour", "6 hours", "12 hours", "24 hours", "Cancel"]
|
||||
choice = Kernel.pbMessage("Sleep for how long?", choices, choices.length)
|
||||
echoln choice
|
||||
return 0 if choice == choices.length-1
|
||||
oldDay = getDayOfTheWeek()
|
||||
timeAdded =0
|
||||
case choice
|
||||
when 0
|
||||
timeAdded=3600
|
||||
when 1
|
||||
timeAdded=21600
|
||||
when 2
|
||||
timeAdded=43200
|
||||
when 3
|
||||
timeAdded=86400
|
||||
end
|
||||
pbSet(UnrealTime::EXTRA_SECONDS,currentSecondsValue+timeAdded)
|
||||
pbSEPlay("Sleep",100)
|
||||
pbFadeOutIn {
|
||||
Kernel.pbMessage(_INTL("{1} slept for a while...",$Trainer.name))
|
||||
}
|
||||
time = pbGetTimeNow.strftime("%I:%M %p")
|
||||
newDay = getDayOfTheWeek()
|
||||
if newDay != oldDay
|
||||
Kernel.pbMessage(_INTL("The current time is now {1} on {2}.",time,newDay.downcase.capitalize))
|
||||
else
|
||||
Kernel.pbMessage(_INTL("The current time is now {1}.",time))
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
ItemHandlers::UseFromBag.add(:SLEEPINGBAG, proc { |item|
|
||||
mapMetadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
if !mapMetadata || !mapMetadata.outdoor_map
|
||||
Kernel.pbMessage(_INTL("Can't use that here..."))
|
||||
next 0
|
||||
end
|
||||
next useSleepingBag()
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:SLEEPINGBAG, proc { |item|
|
||||
mapMetadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
if !mapMetadata || !mapMetadata.outdoor_map
|
||||
Kernel.pbMessage(_INTL("Can't use that here..."))
|
||||
next 0
|
||||
end
|
||||
next useSleepingBag()
|
||||
})
|
||||
|
||||
|
||||
ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item|
|
||||
TOTAL_SPIRITS_NEEDED = 108
|
||||
nbSpirits = pbGet(VAR_ODDKEYSTONE_NB)
|
||||
@@ -1601,9 +1653,11 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
|
||||
end
|
||||
end
|
||||
|
||||
#On ajoute l'autre dans le pokedex aussi
|
||||
#On ajoute les poke au pokedex
|
||||
$Trainer.pokedex.set_seen(poke1.species)
|
||||
$Trainer.pokedex.set_owned(poke1.species)
|
||||
$Trainer.pokedex.set_seen(poke2.species)
|
||||
$Trainer.pokedex.set_owned(poke2.species)
|
||||
|
||||
pokemon.species = poke1.species
|
||||
pokemon.level = poke1.level
|
||||
|
||||
@@ -164,6 +164,13 @@ QUESTS = [
|
||||
Quest.new(55, "The Cursed Forest", "A child wants you to find a floating tree stump in Ilex Forest. What could she be talking about?", questBranchHotels, "BW109", "Goldenrod City", defaultQuestColor),
|
||||
Quest.new(56, "Bitey Pokémon", "A fisherman wants to know what is the sharp-toothed Pokémon that bit him in the Safari Zone's lake.", questBranchHotels, "BW (71)", "Fuchsia City", defaultQuestColor),
|
||||
|
||||
Quest.new(57, "A legendary band (Part 1)", "The singer of a band in Saffron City wants you to help them recruit a drummer. They think they've heard some drumming around Crimson City...", questBranchField, "BW107", "Saffron City", specialQuestColor),
|
||||
Quest.new(58, "A legendary band (Part 2)", "The drummer from a legendary Pokéband wants you to find its former bandmates. The band manager talked about two former guitarists...", questBranchField, "band_drummer", "Saffron City", specialQuestColor),
|
||||
Quest.new(59, "A legendary band (Part 3)", "The drummer from a legendary Pokéband wants you to find its former bandmates. There are rumors about strange music that was heard around the region.", questBranchField, "band_drummer", "Saffron City", specialQuestColor),
|
||||
Quest.new(60, "A legendary band (Part 4)", "You assembled the full band! Come watch the show on Saturday night.", questBranchField, "BW117", "Saffron City", specialQuestColor),
|
||||
|
||||
Quest.new(61, "Mysterious Lunar feathers", "A mysterious entity asked you to collect Lunar Feather for them. It said that they will come at night to tell you where look. Whoever that may be...", questBranchField, "lunarFeather", "Lavender Town", specialQuestColor),
|
||||
|
||||
# attention: c'est un array et non un hash... l'id est en fait l'index, donc il est important de garder l'ordre
|
||||
#out of order quests
|
||||
#42 (cinnabar)
|
||||
|
||||
148
Data/Scripts/050_AddOns/Silhouette.rb
Normal file
148
Data/Scripts/050_AddOns/Silhouette.rb
Normal file
@@ -0,0 +1,148 @@
|
||||
class PokemonTemp
|
||||
def pbClearSilhouetteEvents()
|
||||
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 false
|
||||
#return true
|
||||
return $game_switches[SWITCH_NIGHTMARE_EFFECT] && pbGet(VAR_KARMA)<= 0 && 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.pbClearSilhouetteEvents
|
||||
$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
|
||||
$PokemonTemp.pbClearSilhouetteEvents
|
||||
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
|
||||
@@ -55,8 +55,15 @@ module Graphics
|
||||
$GameSpeed = 0 if $GameSpeed >= SPEEDUP_STAGES.size
|
||||
end
|
||||
$frame += 1
|
||||
speedStage = SPEEDUP_STAGES[$GameSpeed]
|
||||
speedStage=5 if $DEBUG && Input.press?(Input::SHIFT)
|
||||
if $PokemonSystem && $PokemonSystem.speedup == 1
|
||||
speedStage = SPEEDUP_STAGES[$GameSpeed]
|
||||
else
|
||||
speedStage = 1
|
||||
if Input.press?(Input::AUX1) && $CanToggle
|
||||
$PokemonSystem.speedup_speed = Settings::DEFAULT_SPEED_UP_SPEED if !$PokemonSystem.speedup_speed || $PokemonSystem.speedup_speed==0
|
||||
speedStage=$PokemonSystem.speedup_speed+1
|
||||
end
|
||||
end
|
||||
return unless $frame % speedStage == 0
|
||||
fast_forward_update
|
||||
$frame = 0
|
||||
|
||||
34
Data/Scripts/050_AddOns/TempEvents.rb
Normal file
34
Data/Scripts/050_AddOns/TempEvents.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :tempEvents
|
||||
attr_accessor :silhouetteDirection
|
||||
|
||||
def tempEvents
|
||||
@tempEvents = {} if !@tempEvents
|
||||
return @tempEvents
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbClearTempEvents()
|
||||
@tempEvents.keys.each {|map_id|
|
||||
map = $MapFactory.getMap(map_id)
|
||||
@tempEvents[map_id].each { |event|
|
||||
map.events[event.id].erase if map.events[event.id]
|
||||
}
|
||||
}
|
||||
@tempEvents={}
|
||||
@silhouetteDirection=nil
|
||||
end
|
||||
|
||||
|
||||
def addTempEvent(map,event)
|
||||
@tempEvents = {} if !@tempEvents
|
||||
mapEvents = @tempEvents.has_key?(map) ? @tempEvents[map] : []
|
||||
mapEvents.push(event)
|
||||
@tempEvents[map] = mapEvents
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -100,6 +100,11 @@ class PokemonPokedexInfo_Scene
|
||||
|
||||
end
|
||||
|
||||
def get_currently_selected_sprite()
|
||||
species_id = getDexNumberForSpecies(@species).to_s
|
||||
$PokemonGlobal.alt_sprite_substitutions = {} if !$PokemonGlobal.alt_sprite_substitutions
|
||||
return $PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
end
|
||||
|
||||
def set_displayed_to_current_alt(altsList)
|
||||
species_id = getDexNumberForSpecies(@species).to_s
|
||||
@@ -215,7 +220,6 @@ class PokemonPokedexInfo_Scene
|
||||
while !found_last_form
|
||||
form_index += 1
|
||||
form_path = Settings::BATTLERS_FOLDER + body_id.to_s + "_" + form_index.to_s
|
||||
echoln form_path
|
||||
if File.directory?(form_path)
|
||||
forms_list << form_index
|
||||
else
|
||||
|
||||
@@ -57,12 +57,12 @@
|
||||
#
|
||||
module UnrealTime
|
||||
# Set false to disable this system (returns Time.now)
|
||||
ENABLED=true
|
||||
ENABLED = true
|
||||
|
||||
# Time proportion here.
|
||||
# So if it is 100, one second in real time will be 100 seconds in game.
|
||||
# If it is 60, one second in real time will be one minute in game.
|
||||
PROPORTION=60
|
||||
PROPORTION = 60
|
||||
|
||||
# Starting on Essentials v17, the map tone only try to refresh tone each 30
|
||||
# real time seconds.
|
||||
@@ -73,68 +73,71 @@ module UnrealTime
|
||||
# Make this true to time only pass at field (Scene_Map)
|
||||
# A note to scripters: To make time pass on other scenes, put line
|
||||
# '$PokemonGlobal.addNewFrameCount' near to line 'Graphics.update'
|
||||
TIME_STOPS=true
|
||||
TIME_STOPS = true
|
||||
|
||||
# Make this true to time pass in battle, during turns and command selection.
|
||||
# This won't affect the Pokémon and Bag submenus.
|
||||
# Only works if TIME_STOPS=true.
|
||||
BATTLE_PASS=true
|
||||
BATTLE_PASS = true
|
||||
|
||||
# Make this true to time pass when the Dialog box or the main menu are open.
|
||||
# This won't affect the submenus like Pokémon and Bag.
|
||||
# Only works if TIME_STOPS=true.
|
||||
TALK_PASS=true
|
||||
TALK_PASS = true
|
||||
|
||||
# Choose switch number that when true the time won't pass (or -1 to cancel).
|
||||
# Only works if TIME_STOPS=true.
|
||||
SWITCH_STOPS=-1
|
||||
SWITCH_STOPS = -1
|
||||
|
||||
# Choose variable(s) number(s) that can hold time passage (or -1 to cancel).
|
||||
# Look at description for more details.
|
||||
EXTRA_SECONDS=79
|
||||
EXTRA_DAYS=-1
|
||||
EXTRA_SECONDS = 79
|
||||
EXTRA_DAYS = -1
|
||||
|
||||
WEEK_DAY_VARIABLE = 280
|
||||
WEEK_DAYS = [:MONDAY,:TUESDAY,:WEDNESDAY,:THURSDAY,:FRIDAY,:SATURDAY,:SUNDAY]
|
||||
|
||||
# Initial date. In sequence: Year, month, day, hour and minutes.
|
||||
# Method UnrealTime.reset resets time back to this time.
|
||||
def self.initial_date
|
||||
return Time.local(2000,1,1, 4,0)
|
||||
return Time.local(2000, 1, 1, 4, 0)
|
||||
end
|
||||
|
||||
# Advance to next time. If time already passed, advance
|
||||
# into the time on the next day.
|
||||
# Hour is 0..23
|
||||
def self.advance_to(hour,min=0,sec=0)
|
||||
def self.advance_to(hour, min = 0, sec = 0)
|
||||
if hour < 0 || hour > 23
|
||||
raise RangeError, "hour is #{hour}, should be 0..23"
|
||||
end
|
||||
day_seconds = 60*60*24
|
||||
seconds_now = pbGetTimeNow.hour*60*60+pbGetTimeNow.min*60+pbGetTimeNow.sec
|
||||
target_seconds = hour*60*60+min*60+sec
|
||||
seconds_added = target_seconds-seconds_now
|
||||
seconds_added += day_seconds if seconds_added<0
|
||||
$PokemonGlobal.newFrameCount+=seconds_added
|
||||
day_seconds = 60 * 60 * 24
|
||||
seconds_now = pbGetTimeNow.hour * 60 * 60 + pbGetTimeNow.min * 60 + pbGetTimeNow.sec
|
||||
target_seconds = hour * 60 * 60 + min * 60 + sec
|
||||
seconds_added = target_seconds - seconds_now
|
||||
seconds_added += day_seconds if seconds_added < 0
|
||||
$PokemonGlobal.newFrameCount += seconds_added
|
||||
PBDayNight.sheduleToneRefresh
|
||||
end
|
||||
|
||||
# Resets time to initial_date.
|
||||
def self.reset
|
||||
raise "Method doesn't work when TIME_STOPS is false!" if !TIME_STOPS
|
||||
$game_variables[EXTRA_SECONDS]=0 if EXTRA_DAYS>0
|
||||
$game_variables[EXTRA_DAYS]=0 if EXTRA_DAYS>0
|
||||
$PokemonGlobal.newFrameCount=0
|
||||
$PokemonGlobal.extraYears=0
|
||||
$game_variables[EXTRA_SECONDS] = 0 if EXTRA_DAYS > 0
|
||||
$game_variables[EXTRA_DAYS] = 0 if EXTRA_DAYS > 0
|
||||
$PokemonGlobal.newFrameCount = 0
|
||||
$PokemonGlobal.extraYears = 0
|
||||
PBDayNight.sheduleToneRefresh
|
||||
end
|
||||
|
||||
# Does the same thing as EXTRA_SECONDS variable.
|
||||
def self.add_seconds(seconds)
|
||||
raise "Method doesn't work when TIME_STOPS is false!" if !TIME_STOPS
|
||||
$PokemonGlobal.newFrameCount+=(seconds*Graphics.frame_rate)/PROPORTION.to_f
|
||||
$PokemonGlobal.newFrameCount += (seconds * Graphics.frame_rate) / PROPORTION.to_f
|
||||
PBDayNight.sheduleToneRefresh
|
||||
end
|
||||
|
||||
def self.add_days(days)
|
||||
add_seconds(60*60*24*days)
|
||||
add_seconds(60 * 60 * 24 * days)
|
||||
end
|
||||
|
||||
NEED_32_BIT_FIX = [''].pack('p').size <= 4
|
||||
@@ -149,11 +152,11 @@ module PBDayNight
|
||||
class << self
|
||||
if method_defined?(:getTone) && UnrealTime::TONE_CHECK_INTERVAL > 0
|
||||
def getTone
|
||||
@cachedTone = Tone.new(0,0,0) if !@cachedTone
|
||||
@cachedTone = Tone.new(0, 0, 0) if !@cachedTone
|
||||
return @cachedTone if !Settings::TIME_SHADING
|
||||
toneNeedUpdate = (!@dayNightToneLastUpdate ||
|
||||
Graphics.frame_count-@dayNightToneLastUpdate >=
|
||||
Graphics.frame_rate*UnrealTime::TONE_CHECK_INTERVAL
|
||||
Graphics.frame_count - @dayNightToneLastUpdate >=
|
||||
Graphics.frame_rate * UnrealTime::TONE_CHECK_INTERVAL
|
||||
)
|
||||
if toneNeedUpdate
|
||||
getToneInternal
|
||||
@@ -170,43 +173,48 @@ module PBDayNight
|
||||
end
|
||||
end
|
||||
|
||||
def getDayOfTheWeek()
|
||||
day_of_week = (pbGetTimeNow.day % UnrealTime::WEEK_DAYS.length).to_i
|
||||
return UnrealTime::WEEK_DAYS[day_of_week]
|
||||
end
|
||||
|
||||
def pbGetTimeNow
|
||||
return Time.now if !$PokemonGlobal || !UnrealTime::ENABLED
|
||||
day_seconds = 60*60*24
|
||||
day_seconds = 60 * 60 * 24
|
||||
if UnrealTime::TIME_STOPS
|
||||
# Sum the extra values to newFrameCount
|
||||
if UnrealTime::EXTRA_SECONDS>0
|
||||
if UnrealTime::EXTRA_SECONDS > 0
|
||||
UnrealTime.add_seconds(pbGet(UnrealTime::EXTRA_SECONDS))
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS]=0
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS] = 0
|
||||
end
|
||||
if UnrealTime::EXTRA_DAYS>0
|
||||
UnrealTime.add_seconds(day_seconds*pbGet(UnrealTime::EXTRA_DAYS))
|
||||
$game_variables[UnrealTime::EXTRA_DAYS]=0
|
||||
if UnrealTime::EXTRA_DAYS > 0
|
||||
UnrealTime.add_seconds(day_seconds * pbGet(UnrealTime::EXTRA_DAYS))
|
||||
$game_variables[UnrealTime::EXTRA_DAYS] = 0
|
||||
end
|
||||
elsif UnrealTime::EXTRA_SECONDS>0 && UnrealTime::EXTRA_DAYS>0
|
||||
elsif UnrealTime::EXTRA_SECONDS > 0 && UnrealTime::EXTRA_DAYS > 0
|
||||
# Checks to regulate the max/min values at UnrealTime::EXTRA_SECONDS
|
||||
while pbGet(UnrealTime::EXTRA_SECONDS)>=day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS]-=day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_DAYS]+=1
|
||||
while pbGet(UnrealTime::EXTRA_SECONDS) >= day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS] -= day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_DAYS] += 1
|
||||
end
|
||||
while pbGet(UnrealTime::EXTRA_SECONDS)<=-day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS]+=day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_DAYS]-=1
|
||||
while pbGet(UnrealTime::EXTRA_SECONDS) <= -day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS] += day_seconds
|
||||
$game_variables[UnrealTime::EXTRA_DAYS] -= 1
|
||||
end
|
||||
end
|
||||
start_time=UnrealTime.initial_date
|
||||
start_time = UnrealTime.initial_date
|
||||
if UnrealTime::TIME_STOPS
|
||||
time_played=$PokemonGlobal.newFrameCount
|
||||
time_played = $PokemonGlobal.newFrameCount
|
||||
else
|
||||
time_played=Graphics.frame_count
|
||||
time_played = Graphics.frame_count
|
||||
end
|
||||
time_played=(time_played*UnrealTime::PROPORTION)/Graphics.frame_rate
|
||||
time_jumped=0
|
||||
if UnrealTime::EXTRA_SECONDS>-1
|
||||
time_jumped+=pbGet(UnrealTime::EXTRA_SECONDS)
|
||||
time_played = (time_played * UnrealTime::PROPORTION) / Graphics.frame_rate
|
||||
time_jumped = 0
|
||||
if UnrealTime::EXTRA_SECONDS > -1
|
||||
time_jumped += pbGet(UnrealTime::EXTRA_SECONDS)
|
||||
end
|
||||
if UnrealTime::EXTRA_DAYS>-1
|
||||
time_jumped+=pbGet(UnrealTime::EXTRA_DAYS)*day_seconds
|
||||
if UnrealTime::EXTRA_DAYS > -1
|
||||
time_jumped += pbGet(UnrealTime::EXTRA_DAYS) * day_seconds
|
||||
end
|
||||
time_ret = 0
|
||||
# Before Essentials V19, there is a year limit. To prevent crashes due to this
|
||||
@@ -215,13 +223,13 @@ def pbGetTimeNow
|
||||
# $PokemonGlobal.extraYears. You can sum your actual year with this extraYears
|
||||
# when displaying years.
|
||||
loop do
|
||||
time_fix=0
|
||||
if $PokemonGlobal.extraYears!=0
|
||||
time_fix = $PokemonGlobal.extraYears*day_seconds*(365*6+1)/6
|
||||
time_fix = 0
|
||||
if $PokemonGlobal.extraYears != 0
|
||||
time_fix = $PokemonGlobal.extraYears * day_seconds * (365 * 6 + 1) / 6
|
||||
end
|
||||
time_ret=start_time+(time_played+time_jumped-time_fix)
|
||||
break if !UnrealTime::NEED_32_BIT_FIX || time_ret.year<2036
|
||||
$PokemonGlobal.extraYears+=6
|
||||
time_ret = start_time + (time_played + time_jumped - time_fix)
|
||||
break if !UnrealTime::NEED_32_BIT_FIX || time_ret.year < 2036
|
||||
$PokemonGlobal.extraYears += 6
|
||||
end
|
||||
return time_ret
|
||||
end
|
||||
@@ -232,18 +240,18 @@ if UnrealTime::ENABLED
|
||||
attr_accessor :extraYears
|
||||
|
||||
def addNewFrameCount
|
||||
return if (UnrealTime::SWITCH_STOPS>0 &&
|
||||
return if (UnrealTime::SWITCH_STOPS > 0 &&
|
||||
$game_switches[UnrealTime::SWITCH_STOPS])
|
||||
self.newFrameCount+=1
|
||||
self.newFrameCount += 1
|
||||
end
|
||||
|
||||
def newFrameCount
|
||||
@newFrameCount=0 if !@newFrameCount
|
||||
@newFrameCount = 0 if !@newFrameCount
|
||||
return @newFrameCount
|
||||
end
|
||||
|
||||
def extraYears
|
||||
@extraYears=0 if !@extraYears
|
||||
@extraYears = 0 if !@extraYears
|
||||
return @extraYears
|
||||
end
|
||||
end
|
||||
@@ -251,6 +259,7 @@ if UnrealTime::ENABLED
|
||||
if UnrealTime::TIME_STOPS
|
||||
class Scene_Map
|
||||
alias :updateold :update
|
||||
|
||||
def update
|
||||
$PokemonGlobal.addNewFrameCount
|
||||
updateold
|
||||
@@ -258,6 +267,7 @@ if UnrealTime::ENABLED
|
||||
|
||||
if UnrealTime::TALK_PASS
|
||||
alias :miniupdateold :miniupdate
|
||||
|
||||
def miniupdate
|
||||
$PokemonGlobal.addNewFrameCount
|
||||
miniupdateold
|
||||
@@ -268,6 +278,7 @@ if UnrealTime::ENABLED
|
||||
if UnrealTime::BATTLE_PASS
|
||||
class PokeBattle_Scene
|
||||
alias :pbGraphicsUpdateold :pbGraphicsUpdate
|
||||
|
||||
def pbGraphicsUpdate
|
||||
$PokemonGlobal.addNewFrameCount
|
||||
pbGraphicsUpdateold
|
||||
|
||||
Reference in New Issue
Block a user