mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
update 6.7
This commit is contained in:
232
Data/Scripts/052_InfiniteFusion/Gameplay/Battles/BattleLounge.rb
Normal file
232
Data/Scripts/052_InfiniteFusion/Gameplay/Battles/BattleLounge.rb
Normal file
@@ -0,0 +1,232 @@
|
||||
def get_opponent_level
|
||||
return $Trainer.highest_level_pokemon_in_party
|
||||
end
|
||||
|
||||
def get_egg_group_from_id(id)
|
||||
case id
|
||||
when 0;
|
||||
return nil
|
||||
when 1;
|
||||
return :Monster
|
||||
when 2;
|
||||
return :Water1
|
||||
when 3;
|
||||
return :Bug
|
||||
when 4;
|
||||
return :Flying
|
||||
when 5;
|
||||
return :Field
|
||||
when 6;
|
||||
return :Fairy
|
||||
when 7;
|
||||
return :Grass
|
||||
when 8;
|
||||
return :Humanlike
|
||||
when 9;
|
||||
return :Water3
|
||||
when 10;
|
||||
return :Mineral
|
||||
when 11;
|
||||
return :Amorphous
|
||||
when 12;
|
||||
return :Water2
|
||||
when 13;
|
||||
return :Ditto
|
||||
when 14;
|
||||
return :Dragon
|
||||
when 15;
|
||||
return :Undiscovered
|
||||
end
|
||||
end
|
||||
|
||||
def get_egg_group_name(id)
|
||||
case id
|
||||
when 0;
|
||||
return nil
|
||||
when 1;
|
||||
return "Monster Pokémon"
|
||||
when 2;
|
||||
return :"Aquatic Pokémon"
|
||||
when 3;
|
||||
return :"Bug Pokémon"
|
||||
when 4;
|
||||
return :"Bird Pokémon"
|
||||
when 5;
|
||||
return :"Land Pokémon"
|
||||
when 6;
|
||||
return :"Cute Pokémon"
|
||||
when 7;
|
||||
return :"Plant Pokémon"
|
||||
when 8;
|
||||
return :"Human-like Pokémon"
|
||||
when 9;
|
||||
return :"Aquatic Pokémon"
|
||||
when 10;
|
||||
return :"Mineral Pokémon"
|
||||
when 11;
|
||||
return :"Blob Pokémon"
|
||||
when 12;
|
||||
return :"Fish Pokémon"
|
||||
when 13;
|
||||
return :"Ditto"
|
||||
when 14;
|
||||
return :"Dragon Pokémon"
|
||||
when 15;
|
||||
return :"Legendary Pokémon"
|
||||
end
|
||||
end
|
||||
|
||||
def get_random_trainer_name(trainer_class)
|
||||
#0: male, 1: female
|
||||
gender = GameData::TrainerType.get(trainer_class).gender
|
||||
if (gender == 0)
|
||||
return RandTrainerNames_male[rand(RandTrainerNames_male.length)]
|
||||
else
|
||||
return RandTrainerNames_female[rand(RandTrainerNames_female.length)]
|
||||
end
|
||||
end
|
||||
|
||||
def get_random_battle_lounge_egg_group
|
||||
_DISABLED_EGG_GROUPS = [0, 13, 15]
|
||||
group = 0
|
||||
while _DISABLED_EGG_GROUPS.include?(group)
|
||||
group = rand(0, 15)
|
||||
end
|
||||
return group
|
||||
end
|
||||
|
||||
GENERIC_PRIZES_MULTI = [:HEARTSCALE, :HEARTSCALE,:HEARTSCALE,:HEARTSCALE,:HEARTSCALE,
|
||||
:LEMONADE, :PERFECTBALL, :TRADEBALL,
|
||||
:GENDERBALL, :ABILITYBALL, :VIRUSBALL, :SHINYBALL]
|
||||
GENERIC_PRIZES_SINGLE = [:RARECANDY, :RARECANDY,:RARECANDY, :PPUP, :EJECTBUTTON, :FOCUSBAND, :FOCUSSASH,
|
||||
:RESETURGE, :ABILITYURGE, :ITEMURGE, :ITEMDROP, :HPUP, :INCUBATOR, :LUCKYEGG]
|
||||
MONSTER_PRIZES = [:RAREBONE, :LAGGINGTAIL, :RAZORFANG, :RAZORCLAW, :GRIPCLAW, :MANKEYPAW]
|
||||
WATER_PRIZES = [:MYSTICWATER, :BIGPEARL, :SHELLBELL]
|
||||
BUG_PRIZES = [:SILVERPOWDER, :SHEDSHELL, :EVIOLITE]
|
||||
FLYING_PRIZES = [:AIRBALLOON, :FLOATSTONE, :COMETSHARD]
|
||||
FIELD_PRIZES = [:MOOMOOMILK, :IRONBALL, :RAREBONE, :MANKEYPAW, :FLAMEORB]
|
||||
FAIRY_PRIZES = [:STARPIECE, :DESTINYKNOT, :MAXELIXIR, :LIFEORB]
|
||||
HUMAN_PRIZES = [:BLACKBELT, :RINGTARGET, :EXPERTBELT, :GOLDRING, :AMULETCOIN]
|
||||
GRASS_PRIZES = [:REVIVALHERB, :POWERHERB, :HEALPOWDER, :ABSORBBULB, :BIGMUSHROOM]
|
||||
MINERAL_PRIZES = [:CELLBATTERY, :SHINYSTONE, :BIGNUGGET, :RELICCOPPER, :RELICGOLD, :RELICSILVER, :DIAMOND, :ROCKYHELMET]
|
||||
AMORPHOUS_PRIZES = [:SPELLTAG, :WIDELENS, :ZOOMLENS, :SCOPELENS, :TOXICORB]
|
||||
DRAGON_PRIZES = [:DRAGONSCALE, :DRAGONFANG, :RARECANDY, :GOLDRING]
|
||||
UNDISCOVERED_PRIZES = [:MASTERBALL, :SACREDASH]
|
||||
#todo: prizes related to the group (ex: dragon fang for dragon types, TMs, etc. )
|
||||
# todo: if heartscale, give a random amount from 10-20
|
||||
def get_random_battle_lounge_prize(group_type)
|
||||
generic_prizes = [GENERIC_PRIZES_MULTI, GENERIC_PRIZES_SINGLE]
|
||||
is_generic_prize = rand(3) == 1
|
||||
if is_generic_prize
|
||||
type = generic_prizes.sample
|
||||
return type.sample
|
||||
else
|
||||
case get_egg_group_from_id(group_type)
|
||||
when :Monster;
|
||||
return MONSTER_PRIZES.sample
|
||||
when :Water1, :Water2, :Water3;
|
||||
return WATER_PRIZES.sample
|
||||
when :Bug;
|
||||
return BUG_PRIZES.sample
|
||||
when :Flying;
|
||||
return FLYING_PRIZES.sample
|
||||
when :Field;
|
||||
return FIELD_PRIZES.sample
|
||||
when :Fairy;
|
||||
return FAIRY_PRIZES.sample
|
||||
when :Grass;
|
||||
return GRASS_PRIZES.sample
|
||||
when :Mineral;
|
||||
return MINERAL_PRIZES.sample
|
||||
when :Humanlike;
|
||||
return HUMAN_PRIZES.sample
|
||||
when :Amorphous;
|
||||
return AMORPHOUS_PRIZES.sample
|
||||
when :Dragon;
|
||||
return DRAGON_PRIZES.sample
|
||||
when :Undiscovered;
|
||||
return UNDISCOVERED_PRIZES.sample
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def generateSameEggGroupFusionsTeam(eggGroup_id)
|
||||
eggGroup = get_egg_group_from_id(eggGroup_id)
|
||||
teamComplete = false
|
||||
generatedTeam = []
|
||||
while !teamComplete
|
||||
foundFusionPartner = false
|
||||
species1 = rand(Settings::NB_POKEMON) + 1
|
||||
if getPokemonEggGroups(species1).include?(eggGroup)
|
||||
foundFusionPartner = false
|
||||
while !foundFusionPartner
|
||||
species2 = rand(Settings::NB_POKEMON) + 1
|
||||
if getPokemonEggGroups(species2).include?(eggGroup)
|
||||
generatedTeam << getFusionSpeciesSymbol(species1, species2)
|
||||
foundFusionPartner = true
|
||||
end
|
||||
end
|
||||
end
|
||||
teamComplete = generatedTeam.length == 3
|
||||
end
|
||||
return generatedTeam
|
||||
end
|
||||
|
||||
def listLegendaryPokemonIds()
|
||||
return [144, 145, 146, 150, 151, 245, 243, 244, 245, 249, 250, 251, 315, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 378, 379, 380, 381]
|
||||
end
|
||||
|
||||
def pokemonIsPartLegendary(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
body = getBasePokemonID(species, true)
|
||||
return listLegendaryPokemonIds().include?(head) || listLegendaryPokemonIds().include?(body)
|
||||
end
|
||||
|
||||
|
||||
def generateRandomFusionFromPokemon(dexNum, onlyCustomSprites = false, allowLegendaries=true)
|
||||
excluded = allowLegendaries ? [] : listLegendaryPokemonIds()
|
||||
customsList = getCustomSpeciesList(downloadAllowed?())
|
||||
i=0
|
||||
while i < customsList.length
|
||||
comparedPoke = customsList.sample
|
||||
next if excluded.include?(comparedPoke)
|
||||
if Kernel.isPartPokemon(comparedPoke, dexNum)
|
||||
return comparedPoke
|
||||
end
|
||||
i+=1
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
def getRandomBasePokemon(includeLegendaries = false,maxNb=NB_POKEMON)
|
||||
legendaries =listLegendaryPokemonIds()
|
||||
poke = rand(maxNb + 1)
|
||||
return poke if includeLegendaries
|
||||
while legendaries.include?(poke)
|
||||
poke = rand(maxNb + 1)
|
||||
end
|
||||
return poke
|
||||
end
|
||||
|
||||
def getAllPokemonWithBase(dexNum)
|
||||
#todo Unimplemented
|
||||
return [25]
|
||||
end
|
||||
|
||||
def getCustomSpeciesListForPokemon(dexNum,allowLegendaries=true)
|
||||
excluded = allowLegendaries ? [] : listLegendaryPokemonIds()
|
||||
customsList = getCustomSpeciesList(downloadAllowed?())
|
||||
speciesList = []
|
||||
for comparedPoke in customsList
|
||||
next if excluded.include?(comparedPoke)
|
||||
if Kernel.isPartPokemon(comparedPoke, dexNum)
|
||||
speciesList << comparedPoke
|
||||
end
|
||||
|
||||
end
|
||||
if speciesList.length == 0
|
||||
speciesList << dexNum
|
||||
end
|
||||
return speciesList
|
||||
end
|
||||
@@ -0,0 +1,232 @@
|
||||
# # ------------------------------------------------------------------------------
|
||||
# # Written by Stochastic, except for customTrainerBattle method which is a
|
||||
# # modified version of pbTrainerBattle method.
|
||||
# # ------------------------------------------------------------------------------
|
||||
#
|
||||
# BR_DRAW = 5
|
||||
# BR_LOSS = 2
|
||||
# BR_WIN = 1
|
||||
#
|
||||
# # ------------------------------------------------------------------------------
|
||||
# # species - Name of the species, e.g. "PIKACHU"
|
||||
# # level - Level
|
||||
# # moveset - Optional. Array of moves, e.g. [:MUDSLAP, :THUNDERBOLT, :VINEWHIP]
|
||||
# # If not specified, pokemon will be created with moves learned by leveling.
|
||||
# # The pokemon doesn't need to be able to learn the given moves, they can be
|
||||
# # arbitary.
|
||||
# # ------------------------------------------------------------------------------
|
||||
# def createPokemon(species, level, helditem=nil, moveset=nil, ability=nil, form=nil, nature=nil, hpev=nil, atkev=nil, defev=nil, speev=nil, spaev=nil, spdev=nil)
|
||||
# begin
|
||||
# poke = Pokemon.new(species, level)
|
||||
# poke.item=(helditem) if helditem
|
||||
# poke.moves = convertMoves(moveset) if moveset
|
||||
# poke.ability=(ability) if ability
|
||||
# poke.form = form if form
|
||||
# poke.shiny = false
|
||||
# poke.nature =(nature) if nature
|
||||
# poke.happiness=0
|
||||
# poke.iv[0]=hpev
|
||||
# poke.iv[1]=atkev
|
||||
# poke.iv[2]=defev
|
||||
# poke.iv[3]=speev
|
||||
# poke.iv[4]=spaev
|
||||
# poke.iv[5]=spdev
|
||||
#
|
||||
# poke.calc_stats
|
||||
# return poke
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def convertMoves(moves)
|
||||
# moves.map! {|m| PBMove.new(getMoveID(m))}
|
||||
# return moves
|
||||
# end
|
||||
#
|
||||
# # provide move like this; :TACKLE
|
||||
# def getMoveID(move)
|
||||
# return getConst(PBMoves,move)
|
||||
# end
|
||||
#
|
||||
# # ------------------------------------------------------------------------------
|
||||
# # Creates a trainer with specified id, name, party, and optionally, items.
|
||||
# # Does not depend on defined trainers, only on trainer types
|
||||
# # ------------------------------------------------------------------------------
|
||||
# def createTrainer(trainerid,trainername,party,items=[])
|
||||
#
|
||||
# name = pbGetMessageFromHash(MessageTypes::TrainerNames, trainername)
|
||||
#
|
||||
# trainer_hash = {
|
||||
# :id_number => 999,
|
||||
# :trainer_type => trainerid,
|
||||
# :name => name,
|
||||
# :version => 0,
|
||||
# :pokemon => party,
|
||||
# :items => items
|
||||
# }
|
||||
# opponent = GameData::Trainer.new(trainer_hash)
|
||||
# #opponent.setForeignID($Trainer) if $Trainer
|
||||
# # opponent.party = party
|
||||
# return [opponent.to_trainer,items,party]
|
||||
# end
|
||||
#
|
||||
# def init_trainer(trainer_data)
|
||||
# return (trainer_data) ? trainer_data.to_trainer : nil
|
||||
# end
|
||||
#
|
||||
# # ------------------------------------------------------------------------------
|
||||
# # Initiates trainer battle. This is a modified pbTrainerBattle method.
|
||||
# #
|
||||
# # trainer - custom PokeBattle_Trainer provided by the user
|
||||
# # endspeech - what the trainer says in-battle when defeated
|
||||
# # doublebattle - Optional. Set it to true if you want a double battle
|
||||
# # canlose - Optional. Set it to true if you want your party to be healed after battle,and if you don't want to be sent to a pokemon center if you lose
|
||||
# # ------------------------------------------------------------------------------
|
||||
#
|
||||
# def customTrainerBattle(trainer,endSpeech,doubleBattle=false,canLose=false,outcomeVar=1)
|
||||
# # If there is another NPC trainer who spotted the player at the same time, and
|
||||
# # it is possible to have a double battle (the player has 2+ able Pokémon or
|
||||
# # has a partner trainer), then record this first NPC trainer into
|
||||
# # $PokemonTemp.waitingTrainer and end this method. That second NPC event will
|
||||
# # then trigger and cause the battle to happen against this first trainer and
|
||||
# # themselves.
|
||||
# if !$PokemonTemp.waitingTrainer && pbMapInterpreterRunning? &&
|
||||
# ($Trainer.able_pokemon_count > 1 ||
|
||||
# ($Trainer.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||
# thisEvent = pbMapInterpreter.get_character(0)
|
||||
# # Find all other triggered trainer events
|
||||
# triggeredEvents = $game_player.pbTriggeredTrainerEvents([2],false)
|
||||
# otherEvent = []
|
||||
# for i in triggeredEvents
|
||||
# next if i.id==thisEvent.id
|
||||
# next if $game_self_switches[[$game_map.map_id,i.id,"A"]]
|
||||
# otherEvent.push(i)
|
||||
# end
|
||||
# return false if !trainer
|
||||
# Events.onTrainerPartyLoad.trigger(nil,trainer)
|
||||
# # If there is exactly 1 other triggered trainer event, and this trainer has
|
||||
# # 6 or fewer Pokémon, record this trainer for a double battle caused by the
|
||||
# # other triggered trainer event
|
||||
# if otherEvent.length == 1 && trainer.party.length <= Settings::MAX_PARTY_SIZE
|
||||
# trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
|
||||
# $PokemonTemp.waitingTrainer = [trainer, thisEvent.id]
|
||||
# return false
|
||||
# end
|
||||
# end
|
||||
# # Set some battle rules
|
||||
# setBattleRule("outcomeVar",outcomeVar) if outcomeVar!=1
|
||||
# setBattleRule("canLose") if canLose
|
||||
# setBattleRule("double") if doubleBattle || $PokemonTemp.waitingTrainer
|
||||
# # Perform the battle
|
||||
# if $PokemonTemp.waitingTrainer
|
||||
# decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer[0],
|
||||
# [trainer[0].trainer_type,trainer[0].name,endSpeech]
|
||||
# )
|
||||
# else
|
||||
# decision = pbTrainerCustomBattleCore(trainer,[trainer[0].trainer_type,trainer[0].name,endSpeech]) #trainerPartyID
|
||||
# end
|
||||
# # Finish off the recorded waiting trainer, because they have now been battled
|
||||
# if decision==1 && $PokemonTemp.waitingTrainer # Win
|
||||
# pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1], "A", true)
|
||||
# end
|
||||
# $PokemonTemp.waitingTrainer = nil
|
||||
# # Return true if the player won the battle, and false if any other result
|
||||
# return (decision==1)
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def pbTrainerCustomBattleCore(trainer,*args)
|
||||
# outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
# canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
# # Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
# if $Trainer.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
# pbMessage("SKIPPING BATTLE...") if $DEBUG
|
||||
# pbMessage("AFTER WINNING...") if $DEBUG && $Trainer.able_pokemon_count > 0
|
||||
# pbSet(outcomeVar,($Trainer.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
|
||||
# $PokemonTemp.clearBattleRules
|
||||
# $PokemonGlobal.nextBattleBGM = nil
|
||||
# $PokemonGlobal.nextBattleME = nil
|
||||
# $PokemonGlobal.nextBattleCaptureME = nil
|
||||
# $PokemonGlobal.nextBattleBack = nil
|
||||
# pbMEStop
|
||||
# return ($Trainer.able_pokemon_count == 0) ? 0 : 1 # Treat it as undecided/a win
|
||||
# end
|
||||
# # Record information about party Pokémon to be used at the end of battle (e.g.
|
||||
# # comparing levels for an evolution check)
|
||||
# Events.onStartBattle.trigger(nil)
|
||||
# # Generate trainers and their parties based on the arguments given
|
||||
# foeTrainers = []
|
||||
# foeItems = []
|
||||
# foeEndSpeeches = []
|
||||
# foeParty = []
|
||||
# foePartyStarts = []
|
||||
# for arg in args
|
||||
# if arg.is_a?(NPCTrainer)
|
||||
# foeTrainers.push(arg)
|
||||
# foePartyStarts.push(foeParty.length)
|
||||
# arg.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
# foeEndSpeeches.push(arg.lose_text)
|
||||
# foeItems.push(arg.items)
|
||||
# elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
|
||||
# pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer
|
||||
# return 0 if !trainer
|
||||
# Events.onTrainerPartyLoad.trigger(nil,trainer)
|
||||
# foeTrainers.push(trainer)
|
||||
# foePartyStarts.push(foeParty.length)
|
||||
# trainer.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
# foeEndSpeeches.push(arg[3] || trainer.lose_text)
|
||||
# foeItems.push(trainer.items)
|
||||
# else
|
||||
# raise "Expected NPCTrainer or array of trainer data, got {1}.", arg
|
||||
# end
|
||||
# end
|
||||
# # Calculate who the player trainer(s) and their party are
|
||||
# playerTrainers = [$Trainer]
|
||||
# playerParty = $Trainer.party
|
||||
# playerPartyStarts = [0]
|
||||
# room_for_partner = (foeParty.length > 1)
|
||||
# if !room_for_partner && $PokemonTemp.battleRules["size"] &&
|
||||
# !["single", "1v1", "1v2", "1v3"].include?($PokemonTemp.battleRules["size"])
|
||||
# room_for_partner = true
|
||||
# end
|
||||
# if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
# ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
||||
# ally.id = $PokemonGlobal.partner[2]
|
||||
# ally.party = $PokemonGlobal.partner[3]
|
||||
# playerTrainers.push(ally)
|
||||
# playerParty = []
|
||||
# $Trainer.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
# playerPartyStarts.push(playerParty.length)
|
||||
# ally.party.each { |pkmn| playerParty.push(pkmn) }
|
||||
# setBattleRule("double") if !$PokemonTemp.battleRules["size"]
|
||||
# end
|
||||
# # Create the battle scene (the visual side of it)
|
||||
# scene = pbNewBattleScene
|
||||
# # Create the battle class (the mechanics side of it)
|
||||
# battle = PokeBattle_Battle.new(scene,playerParty,foeParty,playerTrainers,foeTrainers)
|
||||
# battle.party1starts = playerPartyStarts
|
||||
# battle.party2starts = foePartyStarts
|
||||
# battle.items = foeItems
|
||||
# battle.endSpeeches = foeEndSpeeches
|
||||
# # Set various other properties in the battle class
|
||||
# pbPrepareBattle(battle)
|
||||
# $PokemonTemp.clearBattleRules
|
||||
# # End the trainer intro music
|
||||
# Audio.me_stop
|
||||
# # Perform the battle itself
|
||||
# decision = 0
|
||||
# pbBattleAnimation(pbGetTrainerBattleBGM(foeTrainers),(battle.singleBattle?) ? 1 : 3,foeTrainers) {
|
||||
# pbSceneStandby {
|
||||
# decision = battle.pbStartBattle
|
||||
# }
|
||||
# pbAfterBattle(decision,canLose)
|
||||
# }
|
||||
# Input.update
|
||||
# # Save the result of the battle in a Game Variable (1 by default)
|
||||
# # 0 - Undecided or aborted
|
||||
# # 1 - Player won
|
||||
# # 2 - Player lost
|
||||
# # 3 - Player or wild Pokémon ran from battle, or player forfeited the match
|
||||
# # 5 - Draw
|
||||
# pbSet(outcomeVar,decision)
|
||||
# return decision
|
||||
# end
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
def pick_trainer_sprite(spriter_name)
|
||||
possible_types = "abcd"
|
||||
trainer_type_index = select_number_from_seed(spriter_name,0,3)
|
||||
path = _INTL("Graphics/Trainers/trainer116{1}",possible_types[trainer_type_index].to_s)
|
||||
return path
|
||||
end
|
||||
|
||||
def select_number_from_seed(seed, min_value, max_value)
|
||||
hash = 137
|
||||
seed.each_byte do |byte|
|
||||
hash = ((hash << 5) + hash) + byte
|
||||
end
|
||||
srand(hash)
|
||||
selected_number = rand(min_value..max_value)
|
||||
selected_number
|
||||
end
|
||||
|
||||
def pick_spriter_losing_dialog(spriter_name)
|
||||
possible_dialogs = [
|
||||
_INTL("Oh... I lost..."),
|
||||
_INTL("I did my best!"),
|
||||
_INTL("You're too strong!"),
|
||||
_INTL("You win!"),
|
||||
_INTL("What a fight!"),
|
||||
_INTL("That was fun!"),
|
||||
_INTL("Ohh, that's too bad"),
|
||||
_INTL("I should've sprited some stronger Pokémon!"),
|
||||
_INTL("So much for that!"),
|
||||
_INTL("Should've seen that coming!"),
|
||||
_INTL("I can't believe it!"),
|
||||
_INTL("What a surprise!")
|
||||
]
|
||||
index = select_number_from_seed(spriter_name,0,possible_dialogs.size-1)
|
||||
return possible_dialogs[index]
|
||||
end
|
||||
@@ -0,0 +1,300 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
class RematchTrainer
|
||||
attr_reader :id
|
||||
attr_reader :nbTimesRematched
|
||||
|
||||
def initialize(id)
|
||||
@id = id
|
||||
@nbTimesRematched = 0
|
||||
end
|
||||
|
||||
def incrementNbTimes()
|
||||
@nbTimesRematched += 1
|
||||
end
|
||||
|
||||
def removeNbTimes()
|
||||
@nbTimesRematched -= 1
|
||||
end
|
||||
end
|
||||
|
||||
#Methods called from elsewhere in the code
|
||||
#
|
||||
# called from pbEndOfBattle
|
||||
#
|
||||
def incrNbRematches(trainerId)
|
||||
$PokemonGlobal.rematchedTrainers.each do |key, trainer|
|
||||
if (trainer.id == trainerId)
|
||||
trainer.incrementNbTimes()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# called from Trainer.to_trainer
|
||||
def getNumberRematch(trainerId)
|
||||
if $PokemonGlobal.rematchedTrainers == nil
|
||||
$PokemonGlobal.rematchedTrainers = Hash.new
|
||||
addNewTrainerRematch(trainerId)
|
||||
end
|
||||
trainer = $PokemonGlobal.rematchedTrainers[trainerId.to_sym]
|
||||
if trainer == nil
|
||||
addNewTrainerRematch(trainerId)
|
||||
return 0
|
||||
end
|
||||
return (trainer.nbTimesRematched)
|
||||
end
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
# #garder un list de cette classe en mem. globale
|
||||
#
|
||||
# #quand lance un combat: check si le switch pour rematch est actif.
|
||||
# #si oui, check dans l'array globale si on trouve le trainer id.
|
||||
# #si oui on maj, si non on l'ajoute
|
||||
#
|
||||
# #overload la classe qui lance les combats et ajuste les niveaux
|
||||
# #selon le nb. de fois rematched
|
||||
#
|
||||
#
|
||||
# # levelCap = originalLevel + (nbBadges*2) +2
|
||||
#
|
||||
# # on incremente le level a chaque x (jusqu'au levelcap)
|
||||
# # nb = (level/10).ceil
|
||||
#
|
||||
#
|
||||
def addNewTrainerRematch(trainerId)
|
||||
#$PokemonGlobal.rematchedTrainers[:trainerId]
|
||||
newTrainer = RematchTrainer.new(trainerId)
|
||||
$PokemonGlobal.rematchedTrainers[trainerId.to_sym] = newTrainer
|
||||
|
||||
end
|
||||
|
||||
def getNumberRematchOld(trainerId)
|
||||
if $PokemonGlobal.rematchedTrainers == nil
|
||||
$PokemonGlobal.rematchedTrainers = Hash.new
|
||||
addNewTrainerRematch(trainerId)
|
||||
end
|
||||
|
||||
$PokemonGlobal.rematchedTrainers.each do |key, trainer|
|
||||
if (trainer.id == trainerId)
|
||||
return (trainer.nbTimesRematched)
|
||||
end
|
||||
end
|
||||
addNewTrainerRematch(trainerId)
|
||||
return 0
|
||||
end
|
||||
|
||||
def getRematchLevel(originalLevel, nbRematch)
|
||||
levelCap = getLevelCap(originalLevel, $Trainer.numbadges)
|
||||
expRate = getLevelRate(originalLevel)
|
||||
levelIncr = 0
|
||||
for i in 0..nbRematch
|
||||
if i % expRate == 0
|
||||
levelIncr += 1
|
||||
end
|
||||
end
|
||||
newLevel = originalLevel + levelIncr
|
||||
#printDebugRematchInfo(nbRematch,expRate,newLevel,levelCap,originalLevel)
|
||||
return (newLevel < levelCap) ? newLevel : levelCap
|
||||
end
|
||||
|
||||
def getLevelRate(originalLevel)
|
||||
return 2 + (originalLevel / 20).ceil
|
||||
end
|
||||
|
||||
def getLevelCap(originalLevel, nbBadges)
|
||||
return 100 if $game_switches[599] #no cap in battle arena
|
||||
cap = originalLevel + nbBadges + 2
|
||||
return cap < 100 ? cap : 100
|
||||
end
|
||||
|
||||
def decreaseRematchNumber(trainerId)
|
||||
$PokemonGlobal.rematchedTrainers.each do |key, trainer|
|
||||
if (trainer.id == trainerId)
|
||||
trainer.removeNbTimes()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# def evolveRematchPokemon(nbRematch, speciesSymbol)
|
||||
# species = getDexNumberForSpecies(speciesSymbol)
|
||||
# if (nbRematch >= 10 && $Trainer.numbadges >= 3)
|
||||
# evospecies = getEvolution(species)
|
||||
# return species if evospecies == -1
|
||||
# if (nbRematch >= 20 && $Trainer.numbadges >= 8)
|
||||
# secondEvoSpecies = getEvolution(evospecies)
|
||||
# return secondEvoSpecies == -1 ? evospecies : secondEvoSpecies
|
||||
# end
|
||||
# return evospecies
|
||||
# end
|
||||
# return species
|
||||
# end
|
||||
def evolveRematchPokemon(nbRematch, speciesSymbol)
|
||||
species = getDexNumberForSpecies(speciesSymbol)
|
||||
if (nbRematch >= 30 && $Trainer.numbadges >= 6)
|
||||
species = getEvolution(species,:HEAD)
|
||||
species = getEvolution(species,:BODY)
|
||||
species = getEvolution(species,:HEAD)
|
||||
species = getEvolution(species,:BODY)
|
||||
elsif (nbRematch >= 20 && $Trainer.numbadges >= 3)
|
||||
species = getEvolution(species,:HEAD)
|
||||
species = getEvolution(species,:BODY)
|
||||
species = getEvolution(species,:HEAD)
|
||||
elsif (nbRematch >= 10 && $Trainer.numbadges >= 3)
|
||||
species = getEvolution(species,:HEAD)
|
||||
species = getEvolution(species,:BODY)
|
||||
elsif (nbRematch >= 5)
|
||||
species = getEvolution(species,:HEAD)
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
|
||||
def getEvolution(speciesParam, halfToEvolve=nil)
|
||||
species = dexNum(speciesParam)
|
||||
begin
|
||||
prioritizeHead = halfToEvolve == :HEAD
|
||||
prioritizeBody = halfToEvolve == :BODY
|
||||
|
||||
if species >= Settings::NB_POKEMON
|
||||
body = getBasePokemonID(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
|
||||
bodyPossibleEvolutions = GameData::Species.get(body).get_evolutions(true)
|
||||
headPossibleEvolutions = GameData::Species.get(head).get_evolutions(true)
|
||||
|
||||
bodyCanEvolve = !bodyPossibleEvolutions.empty?
|
||||
headCanEvolve = !headPossibleEvolutions.empty?
|
||||
|
||||
evoBodySpecies = bodyCanEvolve ? bodyPossibleEvolutions[rand(bodyPossibleEvolutions.length - 1)][0] : nil
|
||||
evoHeadSpecies = headCanEvolve ? headPossibleEvolutions[rand(headPossibleEvolutions.length - 1)][0] : nil
|
||||
if evoBodySpecies != nil
|
||||
evoBody = getDexNumberForSpecies(evoBodySpecies)
|
||||
end
|
||||
if evoHeadSpecies != nil
|
||||
evoHead = getDexNumberForSpecies(evoHeadSpecies)
|
||||
end
|
||||
|
||||
return species if evoBody == nil && evoHead == nil
|
||||
if prioritizeBody
|
||||
if evoBody == nil
|
||||
return body * Settings::NB_POKEMON + evoHead #only head evolves
|
||||
else
|
||||
return evoBody * Settings::NB_POKEMON + head #only body evolves
|
||||
end
|
||||
end
|
||||
|
||||
if prioritizeHead
|
||||
if evoHead == nil
|
||||
return evoBody * Settings::NB_POKEMON + head #only body evolves
|
||||
else
|
||||
return body * Settings::NB_POKEMON + evoHead #only head evolves
|
||||
end
|
||||
end
|
||||
|
||||
return body * Settings::NB_POKEMON + evoHead if evoBody == nil #only head evolves
|
||||
return evoBody * Settings::NB_POKEMON + head if evoHead == nil #only body evolves
|
||||
return evoBody * Settings::NB_POKEMON + evoHead #both evolve
|
||||
else
|
||||
evo = pbGetEvolvedFormData(species)
|
||||
newSpecies = evo[rand(evo.length - 1)][0]
|
||||
return evo.any? ? getDexNumberForSpecies(newSpecies) : species
|
||||
end
|
||||
rescue
|
||||
return species
|
||||
end
|
||||
end
|
||||
|
||||
#just a shortcut
|
||||
def fusionOf(head,body)
|
||||
return getFusionSpeciesSymbol(body,head)
|
||||
end
|
||||
|
||||
def getFusionSpeciesSymbol(body, head)
|
||||
body_num = dexNum(body)
|
||||
head_num = dexNum(head)
|
||||
nb_pokemon = Settings::NB_POKEMON
|
||||
id = body_num * nb_pokemon + head_num
|
||||
if id > (nb_pokemon*nb_pokemon)+nb_pokemon
|
||||
displayRandomizerErrorMessage()
|
||||
return body
|
||||
end
|
||||
|
||||
return GameData::Species.get(id).species
|
||||
end
|
||||
|
||||
|
||||
|
||||
#
|
||||
def evolveHead(species)
|
||||
species_id = getDexNumberForSpecies(species)
|
||||
if species_id <= Settings::NB_POKEMON
|
||||
evo = getEvolution(species_id)
|
||||
return evo == -1 ? species_id : evo
|
||||
end
|
||||
head = getBasePokemonID(species_id, false)
|
||||
body = getBasePokemonID(species_id)
|
||||
headEvo = getEvolution(head)
|
||||
return headEvo == -1 ? species_id : getFusionSpeciesSymbol(body, headEvo)
|
||||
end
|
||||
|
||||
def evolveBody(species)
|
||||
species_id = getDexNumberForSpecies(species)
|
||||
if species_id <= Settings::NB_POKEMON
|
||||
evo = getEvolution(species_id)
|
||||
return evo == -1 ? species_id : evo
|
||||
end
|
||||
head = getBasePokemonID(species_id, false)
|
||||
body = getBasePokemonID(species_id)
|
||||
bodyEvo = getEvolution(body)
|
||||
return bodyEvo == -1 ? species_id : getFusionSpeciesSymbol(bodyEvo, head)
|
||||
end
|
||||
|
||||
def getCorrectEvolvedSpecies(pokemon)
|
||||
if pokemon.species >= Settings::NB_POKEMON
|
||||
body = getBasePokemonID(pokemon.species)
|
||||
head = getBasePokemonID(pokemon.species, false)
|
||||
ret1 = -1; ret2 = -1
|
||||
for form in pbGetEvolvedFormData(body)
|
||||
retB = yield pokemon, form[0], form[1], form[2]
|
||||
break if retB > 0
|
||||
end
|
||||
for form in pbGetEvolvedFormData(head)
|
||||
retH = yield pokemon, form[0], form[1], form[2]
|
||||
break if retH > 0
|
||||
end
|
||||
return ret if ret == retB && ret == retH
|
||||
return fixEvolutionOverflow(retB, retH, pokemon.species)
|
||||
else
|
||||
for form in pbGetEvolvedFormData(pokemon.species)
|
||||
newspecies = form[2]
|
||||
end
|
||||
return newspecies;
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def printDebugRematchInfo(nbRematch, expRate, newLevel, levelCap, originalLevel)
|
||||
info = ""
|
||||
info << _INTL("total rematched trainers: ") + $PokemonGlobal.rematchedTrainers.length.to_s + "\n"
|
||||
|
||||
info << _INTL("nb times: ") + nbRematch.to_s + "\n"
|
||||
info << _INTL("lvl up every {1} times",expRate.to_s) + "\n"
|
||||
info << _INTL("original level: ") << originalLevel.to_s + "\n"
|
||||
info << _INTL("new level: ") + newLevel.to_s + "\n"
|
||||
info << _INTL("level cap: ") + levelCap.to_s
|
||||
print info
|
||||
end
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
# class PokeBattle_Trainer
|
||||
# attr_accessor(:name)
|
||||
# def name()
|
||||
# return @name
|
||||
# end
|
||||
# end
|
||||
@@ -0,0 +1,308 @@
|
||||
#Purchasable from pokemart.
|
||||
CARD_BACKGROUND_DEFAULT_PURCHASABLE = [
|
||||
"BLUE",
|
||||
"PLAIN_BLUE",
|
||||
"GREEN",
|
||||
"PLAIN_GREEN",
|
||||
"RED",
|
||||
"PURPLE",
|
||||
"BLACK",
|
||||
"BRONZE",
|
||||
"SILVER",
|
||||
"GOLD",
|
||||
]
|
||||
|
||||
#Purchasable, but not from pokemart.
|
||||
# a special npc somewhere.
|
||||
CARD_BACKGROUND_CITY_EXCLUSIVES = {
|
||||
"GRAYPOLY" => :PEWTER,
|
||||
|
||||
"HEARTMAIL" => :CERULEAN,
|
||||
"MAGIKARP_JUMP" => :CERULEAN,
|
||||
|
||||
"PIKACHU" => :VERMILLION,
|
||||
"OMG" => :VERMILLION,
|
||||
|
||||
"SPOOKY_FOREST" => :LAVENDER,
|
||||
|
||||
"EEVEELUTION" => :CELADON,
|
||||
"RAINBOWMAIL" => :CELADON,
|
||||
"SEWERS" => :CELADON,
|
||||
|
||||
"CACTI" => :FUCHSIA,
|
||||
"EEVEE_SLEEP" => :FUCHSIA,
|
||||
|
||||
"GALAXYMAIL" => :SAFFRON,
|
||||
"FIGHTING_HANDSHAKE" => :SAFFRON,
|
||||
|
||||
"CINNABAR" => :CINNABAR,
|
||||
|
||||
"SPHEAL_MOON" => :CRIMSON,
|
||||
|
||||
"EEVEE_FLOWERS" => :KNOTISLAND,
|
||||
"DESERT_SUNSET" => :KNOTISLAND,
|
||||
"ROCKRUFF_EVO" => :KNOTISLAND,
|
||||
|
||||
"TOTODILE_BEACH" => :BOONISLAND,
|
||||
|
||||
"HAMMOCK" => :KINISLAND,
|
||||
|
||||
"SLEEPY_CAMERUPT" => :CHRONOISLAND,
|
||||
|
||||
"ILLUSION" => :GOLDENROD,
|
||||
"BABIES" => :GOLDENROD,
|
||||
|
||||
"MUSHROOM_FOREST" => :AZALEA,
|
||||
|
||||
"NATIONAL_PARK" => :VIOLET,
|
||||
"ROCKRUFF_FLOWERS" => :VIOLET,
|
||||
|
||||
"CRANIDOS_PARK" => :BLACKTHORN,
|
||||
|
||||
|
||||
"CAMPFIRE" => :MAHOGANY,
|
||||
"MOON_LAKE" => :MAHOGANY,
|
||||
"STILL_LIFE" => :MAHOGANY,
|
||||
"MOUNTAIN_NIGHT" => :MAHOGANY,
|
||||
|
||||
|
||||
"SPOOKY_ATTIC" => :ECRUTEAK,
|
||||
"UNDERDOG" => :ECRUTEAK,
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#purchasable from pokemart after unlocking a
|
||||
# certain switch
|
||||
#flag => switch to unlock
|
||||
CARD_BACKGROUND_UNLOCKABLES = {
|
||||
|
||||
#Unobtainable Pokemon team flags:
|
||||
# Move these to the /flags folder if the Pokemon become implemented into the game
|
||||
"SHIINOTIC_FLAG" => SWITCH_ALOLA_HAIR_COLLECTION,
|
||||
|
||||
|
||||
"MALAMAR_FLAG" => SWITCH_KALOS_HAIR_COLLECTION,
|
||||
"MUNNA_FLAG" => SWITCH_UNOVA_HAIR_COLLECTION,
|
||||
"MUSHARNA_FLAG" => SWITCH_UNOVA_HAIR_COLLECTION,
|
||||
|
||||
"NUMEL_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"SEALEO_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"SPHEAL_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"SPINDA_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"SKITTY_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"TROPIUS_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"WINGULL_FLAG" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
|
||||
|
||||
#Unlockables
|
||||
"BLASTOISE" => SWITCH_BEAT_THE_LEAGUE,
|
||||
"CHARIZARD" => SWITCH_BEAT_THE_LEAGUE,
|
||||
"VENUSAUR" => SWITCH_BEAT_THE_LEAGUE,
|
||||
"COMPUTER_HILLS" => SWITCH_BEAT_THE_LEAGUE,
|
||||
"GAMEBOY_FUSIONS" => SWITCH_BEAT_THE_LEAGUE,
|
||||
|
||||
"GROUDON" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"KYOGRE" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"RAYQUAZA" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"HOENN_GREETINGS " => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"RUBY" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"SAPPHIRE" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"EMERALD" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"BARS_BOACH" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
"RIVALS" => SWITCH_HOENN_HAIR_COLLECTION,
|
||||
|
||||
|
||||
"WEATHER_WAR" => SWITCH_BEAT_MT_SILVER,
|
||||
"HOENN_STARTERS" => SWITCH_BEAT_MT_SILVER,
|
||||
"GROUDON_FUSION" => SWITCH_BEAT_MT_SILVER ,
|
||||
"KYOGRE_FUSION" => SWITCH_BEAT_MT_SILVER ,
|
||||
"HOENN_CREDITS" => SWITCH_BEAT_MT_SILVER ,
|
||||
"CYNTHIA" => SWITCH_BEAT_MT_SILVER ,
|
||||
"TIME_GEAR" => SWITCH_BEAT_MT_SILVER ,
|
||||
"RAYQUAZA_PATTERN" => SWITCH_BEAT_MT_SILVER,
|
||||
|
||||
"ARCEUS_COSMIC_STEPS" => SWITCH_FINISHED_ARCEUS_EVENT ,
|
||||
"ARCEUS_SILVALLY" => SWITCH_FINISHED_ARCEUS_EVENT ,
|
||||
"ARCEUS_SYMBOL" => SWITCH_FINISHED_ARCEUS_EVENT ,
|
||||
|
||||
|
||||
"RESHIRAM" => SWITCH_UNOVA_HAIR_COLLECTION,
|
||||
"ZEKROM" => SWITCH_UNOVA_HAIR_COLLECTION,
|
||||
"MUNNA_PATTERN" => SWITCH_UNOVA_HAIR_COLLECTION,
|
||||
|
||||
|
||||
"ZYGARDE_PATTERN" => SWITCH_KALOS_HAIR_COLLECTION,
|
||||
|
||||
"DUEL" => SWITCH_PALDEA_HAIR_COLLECTION,
|
||||
"AKALA_ISLAND" => SWITCH_ALOLA_HAIR_COLLECTION,
|
||||
|
||||
|
||||
"DARKRAI" => SWITCH_CAUGHT_DARKRAI,
|
||||
"MOONLIGHT_BALL" => SWITCH_CAUGHT_MELOETTA,
|
||||
"DIANCIE_CARBINK" => SWITCH_PINKAN_FINISHED,
|
||||
|
||||
"ROCKET_LOGO" => SWITCH_FINISHED_ROCKET_QUESTS_CERULEAN,
|
||||
"MEOWTH_ROCKET" => SWITCH_FINISHED_ROCKET_QUESTS_CELADON,
|
||||
"ROCKET_JAMES_INKAY" => SWITCH_PINKAN_FINISHED,
|
||||
|
||||
"BOULDERBADGE" => SWITCH_GOT_BADGE_1,
|
||||
"CASCADEBADGE" => SWITCH_GOT_BADGE_2,
|
||||
"THUNDERBADGE" => SWITCH_GOT_BADGE_3,
|
||||
"RAINBOWBADGE" => SWITCH_GOT_BADGE_4,
|
||||
"SOULBADGE" => SWITCH_GOT_BADGE_5,
|
||||
"MARSHBADGE" => SWITCH_GOT_BADGE_6,
|
||||
"VOLCANOBADGE" => SWITCH_GOT_BADGE_7,
|
||||
"EARTHBADGE" => SWITCH_GOT_BADGE_8,
|
||||
"PLAINBADGE" => SWITCH_GOT_BADGE_9,
|
||||
"HIVEBADGE" => SWITCH_GOT_BADGE_10,
|
||||
"ZEPHYRBADGE" => SWITCH_GOT_BADGE_11,
|
||||
"RISINGBADGE" => SWITCH_GOT_BADGE_12,
|
||||
"FOGBADGE" => SWITCH_GOT_BADGE_13,
|
||||
"GLACIERBADGE" => SWITCH_GOT_BADGE_14,
|
||||
"STORMBADGE" => SWITCH_GOT_BADGE_15,
|
||||
"MINERALBADGE" => SWITCH_GOT_BADGE_16,
|
||||
}
|
||||
|
||||
def unlock_card_background(id)
|
||||
$Trainer.unlocked_card_backgrounds = [] if !$Trainer.unlocked_card_backgrounds
|
||||
$Trainer.unlocked_card_backgrounds << id
|
||||
end
|
||||
|
||||
def getDisplayedName(card_id)
|
||||
return card_id.downcase.gsub('_', ' ').gsub('flags/', 'Team ').split.map(&:capitalize).join(' ')
|
||||
end
|
||||
|
||||
|
||||
|
||||
def purchaseCardBackground(price = 1000)
|
||||
$Trainer.unlocked_card_backgrounds = [] if ! $Trainer.unlocked_card_backgrounds
|
||||
purchasable_cards = []
|
||||
current_city = pbGet(VAR_CURRENT_MART)
|
||||
current_city = :PEWTER if !current_city.is_a?(Symbol)
|
||||
for card in CARD_BACKGROUND_CITY_EXCLUSIVES.keys
|
||||
purchasable_cards << card if current_city == CARD_BACKGROUND_CITY_EXCLUSIVES[card] && !$Trainer.unlocked_card_backgrounds.include?(card)
|
||||
end
|
||||
for card in CARD_BACKGROUND_DEFAULT_PURCHASABLE
|
||||
purchasable_cards << card if !$Trainer.unlocked_card_backgrounds.include?(card)
|
||||
end
|
||||
for card in CARD_BACKGROUND_UNLOCKABLES.keys
|
||||
purchasable_cards << card if $game_switches[CARD_BACKGROUND_UNLOCKABLES[card]] && !$Trainer.unlocked_card_backgrounds.include?(card)
|
||||
end
|
||||
|
||||
echoln $Trainer.unlocked_card_backgrounds
|
||||
|
||||
if purchasable_cards.length <= 0
|
||||
pbMessage(_INTL("There are no more Trainer Card backgrounds available for purchase!"))
|
||||
return
|
||||
end
|
||||
|
||||
commands = []
|
||||
index = 0
|
||||
for card in purchasable_cards
|
||||
index += 1
|
||||
name = getDisplayedName(card)
|
||||
commands.push([index, name, card])
|
||||
end
|
||||
pbMessage(_INTL("\\GWhich background would you like to purchase?"))
|
||||
chosen = pbListScreen(_INTL("Trainer card"), TrainerCardBackgroundLister.new(purchasable_cards))
|
||||
echoln chosen
|
||||
if chosen != nil
|
||||
name = getDisplayedName(chosen)
|
||||
if pbConfirmMessage(_INTL("\\GPurchase the \\C[1]{1} Trainer Card background\\C[0] for ${2}?", name, price.to_s))
|
||||
if $Trainer.money < price
|
||||
pbSEPlay("GUI sel buzzer", 80)
|
||||
pbMessage(_INTL("\\G\\C[2]Insufficient funds"))
|
||||
return false
|
||||
end
|
||||
pbSEPlay("Mart buy item")
|
||||
$Trainer.money -= price
|
||||
unlock_card_background(chosen)
|
||||
pbSEPlay("Item get")
|
||||
pbMessage(_INTL("\\GYou purchased the {1} Trainer Card background!", name))
|
||||
if pbConfirmMessage(_INTL("Would you like to swap your current Trainer Card for the newly purchased one?"))
|
||||
pbSEPlay("GUI trainer card open")
|
||||
$Trainer.card_background = chosen
|
||||
else
|
||||
pbMessage(_INTL("You can swap the background at anytime when viewing your Trainer Card."))
|
||||
end
|
||||
echoln $Trainer.unlocked_card_backgrounds
|
||||
return true
|
||||
end
|
||||
else
|
||||
pbSEPlay("computerclose")
|
||||
end
|
||||
end
|
||||
|
||||
class TrainerCardBackgroundLister
|
||||
BASE_TRAINER_CARD_PATH = "Graphics/Pictures/Trainer Card/backgrounds"
|
||||
|
||||
def initialize(cardsList)
|
||||
@sprite = SpriteWrapper.new
|
||||
@sprite.bitmap = nil
|
||||
@sprite.x = 250
|
||||
@sprite.y = 100
|
||||
@sprite.z = -2
|
||||
@sprite.zoom_x = 0.5
|
||||
@sprite.zoom_y = 0.5
|
||||
|
||||
@frame = SpriteWrapper.new
|
||||
@frame.bitmap = AnimatedBitmap.new("Graphics/Pictures/Trainer Card/overlay").bitmap
|
||||
@frame.x = 250
|
||||
@frame.y = 100
|
||||
@frame.z = -2
|
||||
@frame.zoom_x = 0.5
|
||||
@frame.zoom_y = 0.5
|
||||
|
||||
@commands = []
|
||||
@cardsList = cardsList
|
||||
@index = 0
|
||||
end
|
||||
|
||||
def dispose
|
||||
@sprite.bitmap.dispose if @sprite.bitmap
|
||||
@sprite.dispose
|
||||
@frame.bitmap.dispose if @sprite.bitmap
|
||||
@frame.dispose
|
||||
end
|
||||
|
||||
def setViewport(viewport)
|
||||
@sprite.viewport = viewport
|
||||
@frame.viewport = viewport
|
||||
end
|
||||
|
||||
def startIndex
|
||||
return @index
|
||||
end
|
||||
|
||||
def commands
|
||||
@commands.clear
|
||||
for i in 0...@cardsList.length
|
||||
card_id = @cardsList[i]
|
||||
card_name = getDisplayedName(@cardsList[i])
|
||||
@commands.push(card_name)
|
||||
end
|
||||
@commands << _INTL("Cancel")
|
||||
return @commands
|
||||
end
|
||||
|
||||
def value(index)
|
||||
return nil if index < 0
|
||||
return nil if index == @commands.length
|
||||
return @cardsList[index]
|
||||
end
|
||||
|
||||
def refresh(index)
|
||||
return if index >= @cardsList.length
|
||||
return if index < 0
|
||||
@sprite.bitmap.dispose if @sprite.bitmap
|
||||
card_id = @cardsList[index]
|
||||
trainer_card_path = "#{BASE_TRAINER_CARD_PATH}/#{card_id}"
|
||||
echoln index
|
||||
echoln @cardsList.length
|
||||
@sprite.bitmap = AnimatedBitmap.new(trainer_card_path).bitmap
|
||||
#sprite.ox = @sprite.bitmap.width/2 if @sprite.bitmap
|
||||
#@sprite.oy = @sprite.bitmap.height/2 if @sprite
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,75 @@
|
||||
class PokemonStorage
|
||||
def wallpaperLottery
|
||||
cmd_play = _INTL("Play!")
|
||||
cmd_info = _INTL("Info")
|
||||
cmd_cancel = _INTL("Cancel")
|
||||
commands = [cmd_play, cmd_info, cmd_cancel]
|
||||
|
||||
$Trainer.quest_points = initialize_quest_points unless $Trainer.quest_points
|
||||
choice = pbMessage(_INTL("\\qpWould you like to play the Wallpaper Lottery? (Costs \\C[1]1 Quest point\\C[0])"),commands,2)
|
||||
|
||||
case commands[choice]
|
||||
when cmd_play
|
||||
if $Trainer.quest_points <= 0
|
||||
pbMessage(_INTL("You don't have any \\C[1]Quest points\\C[0]. Complete quests to obtain more!"))
|
||||
return
|
||||
end
|
||||
|
||||
locked_wallpapers = []
|
||||
for i in BASICWALLPAPERQTY..allWallpapers.length-1
|
||||
locked_wallpapers << i unless isAvailableWallpaper?(i)
|
||||
end
|
||||
if locked_wallpapers.empty?
|
||||
pbMessage(_INTL("You don't have any wallpapers left to unlock!"))
|
||||
return
|
||||
end
|
||||
|
||||
unlocked_index = locked_wallpapers.sample
|
||||
$Trainer.quest_points -= 1
|
||||
|
||||
|
||||
$game_system.bgm_memorize
|
||||
$game_system.bgm_stop
|
||||
|
||||
pbWait(8)
|
||||
pbSEPlay("BW_exp")
|
||||
pbWait(90)
|
||||
$game_system.bgm_restore
|
||||
obtain_wallpaper(unlocked_index)
|
||||
when cmd_info
|
||||
pbMessage(_INTL("The Wallpaper Lottery allows you to unlock \\C[1]new wallpapers\\C[0] for your PC boxes background."))
|
||||
pbMessage(_INTL("Participating in the lottery costs \\C[1]1 Quest point\\C[0]. You obtain one Quest Point per quest that you complete."))
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def obtain_wallpaper(wallpaper_id)
|
||||
wallpaper_name = allWallpapers[wallpaper_id]
|
||||
pbUnlockWallpaper(wallpaper_id)
|
||||
path = "Graphics/Pictures/Storage/Wallpapers/box_#{wallpaper_id}"
|
||||
pictureViewport = showPicture(path, 50,-45)
|
||||
musical_effect = "Key item get"
|
||||
pbMessage(_INTL("\\qp\\me[{1}]Obtained a new wallpaper: \\c[1]{2}\\c[0]!", musical_effect, wallpaper_name))
|
||||
pictureViewport.dispose if pictureViewport
|
||||
end
|
||||
end
|
||||
|
||||
class WallpaperLotteryPC
|
||||
def shouldShow?
|
||||
return player_has_quest_journal?
|
||||
end
|
||||
|
||||
def name
|
||||
return _INTL("Wallpaper Lottery")
|
||||
end
|
||||
|
||||
def access
|
||||
pbMessage(_INTL("\\se[PC access]Accessed the Wallpaper Lottery."))
|
||||
$PokemonStorage.wallpaperLottery
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
PokemonPCList.registerPC(WallpaperLotteryPC.new)
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
HIDDEN_MAPS_STEPS = 1500
|
||||
HIDDEN_MAP_ALWAYS = [178,655,570,356]
|
||||
RANDOM_HIDDEN_MAP_LIST = [8,109,431,446,402,403,467,468,10,23,167,16,19,78,185,86,
|
||||
491,90,40,342,490,102,103,104,105,106,1,12,413,445,484,485,486,140,350,146,
|
||||
149,304,356,307,409,351,495,154,349,322,323,544,198,144,155,444,58,59,229,52,53,54,
|
||||
55,98,173,174,181,187,95,159,162,437,440,438,57,171,528,265,288,364,329,
|
||||
335,254,261,262,266,230,145,147,258,284,283,267,586,285,286,287,300,311,47,580,529,
|
||||
635,638,646,560,559,526,600,564,594,566,562,619,563,603,561,597,633,640,641,621,312,
|
||||
670,692,643,523,698,
|
||||
602,642,623,569,588,573,362,645,651,376,762
|
||||
]
|
||||
|
||||
Events.onMapUpdate+=proc {|sender,e|
|
||||
#next if !$game_switches[HIDDENMAPSWITCH]
|
||||
if $PokemonGlobal.stepcount % HIDDEN_MAPS_STEPS == 0
|
||||
changeHiddenMap()
|
||||
end
|
||||
}
|
||||
def changeHiddenMap()
|
||||
i = rand(RANDOM_HIDDEN_MAP_LIST.length-1)
|
||||
pbSet(VAR_CURRENT_HIDDEN_MAP,RANDOM_HIDDEN_MAP_LIST[i])
|
||||
end
|
||||
|
||||
Events.onWildPokemonCreate+=proc {|sender,e|
|
||||
if player_on_hidden_ability_map || isAlwaysHiddenAbilityMap($game_map.map_id)
|
||||
pokemon=e[0]
|
||||
chosenAbility = pokemon.getAbilityList.sample #format: [[:ABILITY, index],...]
|
||||
pokemon.ability = chosenAbility[0]
|
||||
pokemon.ability_index = chosenAbility[1]
|
||||
end
|
||||
}
|
||||
|
||||
def isAlwaysHiddenAbilityMap(mapId)
|
||||
return HIDDEN_MAP_ALWAYS.include? mapId
|
||||
end
|
||||
|
||||
def player_on_hidden_ability_map
|
||||
return $game_map.map_id== pbGet(226)
|
||||
end
|
||||
|
||||
def Kernel.getMapName(id)
|
||||
mapinfos = pbLoadMapInfos
|
||||
return _INTL("Unknown location") if !mapinfos[id]
|
||||
return mapinfos[id].name
|
||||
end
|
||||
128
Data/Scripts/052_InfiniteFusion/Gameplay/Items/New Balls.rb
Normal file
128
Data/Scripts/052_InfiniteFusion/Gameplay/Items/New Balls.rb
Normal file
@@ -0,0 +1,128 @@
|
||||
###################
|
||||
## NEW POKEBALLS #
|
||||
###################
|
||||
|
||||
#GENDER BALL (24) - switch le gender du pokemon
|
||||
#catch rate: pokeball
|
||||
BallHandlers::OnCatch.add(:GENDERBALL,proc{|ball,battle,pokemon|
|
||||
if pokemon.gender == 0
|
||||
pokemon.makeFemale
|
||||
elsif pokemon.gender == 1
|
||||
pokemon.makeMale
|
||||
end
|
||||
})
|
||||
|
||||
#BOOST BALL 25 - rend le pokemon traded
|
||||
#catch rate: 80% pokeball
|
||||
BallHandlers::ModifyCatchRate.add(:TRADEBALL,proc{|ball,catchRate,battle,pokemon|
|
||||
catchRate=(catchRate*0.8).floor(1)
|
||||
next catchRate
|
||||
})
|
||||
BallHandlers::OnCatch.add(:TRADEBALL,proc{|ball,battle,pokemon|
|
||||
pokemon.obtain_method = 2
|
||||
})
|
||||
|
||||
#ABILITY BALL 26 - change l'ability
|
||||
#catch rate: 60% pokeball
|
||||
BallHandlers::ModifyCatchRate.add(:ABILITYBALL,proc{|ball,catchRate,battle,pokemon|
|
||||
catchRate=(catchRate*0.6).floor(1)
|
||||
next catchRate
|
||||
})
|
||||
BallHandlers::OnCatch.add(:ABILITYBALL,proc{|ball,battle,pokemon|
|
||||
species = getSpecies(dexNum(pokemon))
|
||||
ability = species.hidden_abilities[-1]
|
||||
pokemon.ability = ability
|
||||
pokemon.ability_index= getAbilityIndexFromID(ability,pokemon)
|
||||
})
|
||||
|
||||
#VIRUS BALL 27 - give pokerus
|
||||
#catch rate: 40% pokeball
|
||||
BallHandlers::ModifyCatchRate.add(:VIRUSBALL,proc{|ball,catchRate,battle,pokemon|
|
||||
catchRate=(catchRate*0.4).floor(1)
|
||||
next catchRate
|
||||
})
|
||||
BallHandlers::OnCatch.add(:VIRUSBALL,proc{|ball,battle,pokemon|
|
||||
pokemon.givePokerus
|
||||
})
|
||||
|
||||
#SHINY BALL 28 - rend shiny
|
||||
#catchrate: 20% pokeball
|
||||
BallHandlers::ModifyCatchRate.add(:SHINYBALL,proc{|ball,catchRate,battle,pokemon|
|
||||
catchRate=(catchRate*0.2).floor(1)
|
||||
next catchRate
|
||||
})
|
||||
BallHandlers::OnCatch.add(:SHINYBALL,proc{|ball,battle,pokemon|
|
||||
pokemon.glitter=true
|
||||
})
|
||||
|
||||
#PERFECTBALL 29
|
||||
#catch rate: 10% pokeball
|
||||
BallHandlers::ModifyCatchRate.add(:PERFECTBALL,proc{|ball,catchRate,battle,pokemon|
|
||||
catchRate=(catchRate*0.1).floor(1)
|
||||
next catchRate
|
||||
})
|
||||
BallHandlers::OnCatch.add(:PERFECTBALL,proc{|ball,battle,pokemon|
|
||||
stats = [:ATTACK, :SPECIAL_ATTACK, :SPECIAL_DEFENSE, :SPEED, :DEFENSE, :HP]
|
||||
first = rand(stats.length)
|
||||
second = rand(stats.length)
|
||||
pokemon.iv[stats[first]] = 31
|
||||
pokemon.iv[stats[second]] = 31
|
||||
})
|
||||
|
||||
|
||||
#DREAMBALL - endormi
|
||||
BallHandlers::ModifyCatchRate.add(:DREAMBALL,proc{|ball,catchRate,battle,battler|
|
||||
battler.status = :SLEEP
|
||||
next catchRate
|
||||
})
|
||||
#TOXICBALL - empoisonné
|
||||
BallHandlers::ModifyCatchRate.add(:TOXICBALL,proc{|ball,catchRate,battle,battler|
|
||||
battler.status = :POISON
|
||||
next catchRate
|
||||
})
|
||||
#SCORCHBALL - brulé
|
||||
BallHandlers::ModifyCatchRate.add(:SCORCHBALL,proc{|ball,catchRate,battle,battler|
|
||||
battler.status = :BURN
|
||||
next catchRate
|
||||
})
|
||||
#FROSTBALL - frozen
|
||||
BallHandlers::ModifyCatchRate.add(:FROSTBALL,proc{|ball,catchRate,battle,battler|
|
||||
battler.status = :FROZEN
|
||||
next catchRate
|
||||
})
|
||||
#SPARKBALL - paralizé
|
||||
BallHandlers::ModifyCatchRate.add(:SPARKBALL,proc{|ball,catchRate,battle,battler|
|
||||
battler.status = :PARALYSIS
|
||||
next catchRate
|
||||
})
|
||||
#PUREBALL - marche mieux quand pas de status
|
||||
BallHandlers::ModifyCatchRate.add(:PUREBALL,proc{|ball,catchRate,battle,battler|
|
||||
catchRate=(catchRate*7/2).floor if battler.status ==0
|
||||
next catchRate
|
||||
})
|
||||
#STATUSBALL - marche mieux quand any status
|
||||
BallHandlers::ModifyCatchRate.add(:STATUSBALL,proc{|ball,catchRate,battle,battler|
|
||||
catchRate=(catchRate*5/2).floor if battler.status !=0
|
||||
next catchRate
|
||||
})
|
||||
|
||||
#FUSIONBALL - marche mieux quand fusedr
|
||||
BallHandlers::ModifyCatchRate.add(:FUSIONBALL,proc{|ball,catchRate,battle,battler|
|
||||
catchRate*=3 if GameData::Species.get(battler.species).id_number > Settings::NB_POKEMON
|
||||
next catchRate
|
||||
})
|
||||
|
||||
#CANDY BALL - +5 level
|
||||
#catchrate: 80% pokeball
|
||||
BallHandlers::ModifyCatchRate.add(:CANDYBALL,proc{|ball,catchRate,battle,pokemon|
|
||||
catchRate=(catchRate*0.8).floor
|
||||
next catchRate
|
||||
})
|
||||
BallHandlers::OnCatch.add(:CANDYBALL,proc{|ball,battle,pokemon|
|
||||
pokemon.level = pokemon.level+5
|
||||
})
|
||||
#FIRECRACKER
|
||||
BallHandlers::ModifyCatchRate.add(:FIRECRACKER,proc{|ball,catchRate,battle,battler|
|
||||
battler.hp -= 10
|
||||
next 0
|
||||
})
|
||||
141
Data/Scripts/052_InfiniteFusion/Gameplay/Items/New HMs.rb
Normal file
141
Data/Scripts/052_InfiniteFusion/Gameplay/Items/New HMs.rb
Normal file
@@ -0,0 +1,141 @@
|
||||
|
||||
#===============================================================================
|
||||
# Rock Smash
|
||||
#===============================================================================
|
||||
|
||||
|
||||
def pbRockSmashRandomEncounter
|
||||
if rand(100)<30
|
||||
if pbEncounter(:RockSmash)
|
||||
return
|
||||
else
|
||||
pbDefaultRockSmashEncounter(5,15)
|
||||
end
|
||||
else
|
||||
rockSmashItem(false)
|
||||
end
|
||||
end
|
||||
|
||||
def pbDefaultRockSmashEncounter(minLevel,maxLevel)
|
||||
level =rand((maxLevel-minLevel).abs)+minLevel
|
||||
pbWildBattle(:GEODUDE,level)
|
||||
return true
|
||||
end
|
||||
|
||||
#FOR ROCK TUNNEL AND CERULEAN CAVE (+diamond)
|
||||
def pbRockSmashRandomEncounterSpecial
|
||||
if rand(100)<35
|
||||
pbEncounter(:RockSmash)
|
||||
else
|
||||
rockSmashItem(true)
|
||||
end
|
||||
end
|
||||
|
||||
def getRockSmashItemList(inclRareItems)
|
||||
basicItems = [:ROCKGEM, :GROUNDGEM,:STEELGEM,
|
||||
:HARDSTONE,:HARDSTONE,:HARDSTONE,:ROCKGEM,
|
||||
:SMOOTHROCK,:STARDUST,:HEARTSCALE,:HEARTSCALE,
|
||||
:HEARTSCALE,:SOFTSAND,:HEARTSCALE,:RAREBONE]
|
||||
|
||||
rareItems = [:RAREBONE,:STARDUST,:ETHER,
|
||||
:REVIVE,:NUGGET,:DIAMOND]
|
||||
|
||||
fossilItems = [:ROOTFOSSIL,:CLAWFOSSIL,:DOMEFOSSIL,:HELIXFOSSIL,
|
||||
:SKULLFOSSIL,:ARMORFOSSIL,:JAWFOSSIL,:SAILFOSSIL]
|
||||
|
||||
# Kernel.pbMessage(inclRareItems.to_s)
|
||||
|
||||
itemsList = inclRareItems ? basicItems + basicItems + rareItems : basicItems
|
||||
|
||||
#beaten league
|
||||
if $game_switches[12]
|
||||
itemsList += fossilItems
|
||||
end
|
||||
return itemsList
|
||||
end
|
||||
|
||||
def rockSmashItem(isDark=false)
|
||||
chance = 50
|
||||
if rand(100)< chance
|
||||
if rand(5) == 0 && !hatUnlocked?(HAT_AERODACTYL)
|
||||
obtainHat(HAT_AERODACTYL)
|
||||
else
|
||||
itemsList = getRockSmashItemList(isDark)
|
||||
i = rand(itemsList.length)
|
||||
Kernel.pbItemBall(itemsList[i],1,nil,false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#Used in underwater maps
|
||||
def pbRockSmashRandomEncounterDive
|
||||
if rand(100)<25
|
||||
pbEncounter(:RockSmash)
|
||||
else
|
||||
if rand(100)<20
|
||||
itemsList = [:WATERGEM,:STEELGEM,
|
||||
:HEARTSCALE,:HEARTSCALE,:HARDSTONE,:ROCKGEM,
|
||||
:SMOOTHROCK,:WATERSTONE,:PEARL,:HEARTSCALE,
|
||||
:HEARTSCALE,:HEARTSCALE,:SHOALSHELL,:BIGPEARL]
|
||||
|
||||
i = rand(itemsList.length)
|
||||
Kernel.pbItemBall(itemsList[i],1,nil,false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
############### MORNING SUN / MOONLIGHT
|
||||
HiddenMoveHandlers::CanUseMove.add(:MORNINGSUN,proc{|move,pkmn|
|
||||
mapMetadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
if !mapMetadata || !mapMetadata.outdoor_map
|
||||
Kernel.pbMessage(_INTL("Can't use that here."))
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:MORNINGSUN,proc{|move,pokemon|
|
||||
Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(pokemon)
|
||||
pbFadeOutIn(99999){
|
||||
pbSkipTime(9)
|
||||
newTime = pbGetTimeNow.strftime("%I:%M %p")
|
||||
Kernel.pbMessage(_INTL("{1} waited until morning...",$Trainer.name))
|
||||
Kernel.pbMessage(_INTL("The time is now {1}",newTime))
|
||||
$game_screen.weather(:None,0,0)
|
||||
$game_map.refresh
|
||||
}
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:MOONLIGHT,proc{|move,pkmn|
|
||||
mapMetadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
if !mapMetadata || !mapMetadata.outdoor_map
|
||||
Kernel.pbMessage(_INTL("Can't use that here."))
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
HiddenMoveHandlers::UseMove.add(:MOONLIGHT,proc{|move,pokemon|
|
||||
Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(pokemon)
|
||||
pbFadeOutIn(99999){
|
||||
pbSkipTime(21)
|
||||
newTime = pbGetTimeNow.strftime("%I:%M %p")
|
||||
Kernel.pbMessage(_INTL("{1} waited until night...",$Trainer.name))
|
||||
Kernel.pbMessage(_INTL("The time is now {1}",newTime))
|
||||
$game_screen.weather(:None,0,0)
|
||||
$game_map.refresh
|
||||
}
|
||||
next true
|
||||
})
|
||||
|
||||
def pbSkipTime(newTime)
|
||||
currentTime = pbGetTimeNow.hour
|
||||
hoursToAdd = newTime - currentTime
|
||||
$game_variables[UnrealTime::EXTRA_SECONDS] += hoursToAdd*3600
|
||||
end
|
||||
2204
Data/Scripts/052_InfiniteFusion/Gameplay/Items/New Items effects.rb
Normal file
2204
Data/Scripts/052_InfiniteFusion/Gameplay/Items/New Items effects.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
class VariableCurrencyMartAdapter < PokemonMartAdapter
|
||||
def initialize(currency)
|
||||
@currency_variable = currency
|
||||
end
|
||||
def getMoney
|
||||
return pbGet(@currency_variable).to_i
|
||||
end
|
||||
|
||||
def getMoneyString
|
||||
return pbGet(@currency_variable).to_s
|
||||
end
|
||||
|
||||
def setMoney(value)
|
||||
pbSet(@currency_variable,value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def pbVariablePokemonMart(stock,currencyVariable,currency_name="Points",speech=nil,cantsell=true)
|
||||
for i in 0...stock.length
|
||||
stock[i] = GameData::Item.get(stock[i]).id
|
||||
stock[i] = nil if GameData::Item.get(stock[i]).is_important? && $PokemonBag.pbHasItem?(stock[i])
|
||||
end
|
||||
stock.compact!
|
||||
commands = []
|
||||
cmdBuy = -1
|
||||
cmdSell = -1
|
||||
cmdQuit = -1
|
||||
commands[cmdBuy = commands.length] = _INTL("Buy")
|
||||
commands[cmdSell = commands.length] = _INTL("Sell") if !cantsell
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
cmd = pbMessage(
|
||||
speech ? speech : _INTL("Welcome! How may I serve you?"),
|
||||
commands,cmdQuit+1)
|
||||
loop do
|
||||
if cmdBuy>=0 && cmd==cmdBuy
|
||||
adapter = VariableCurrencyMartAdapter.new(currencyVariable)
|
||||
scene = PokemonMart_Scene.new(currency_name)
|
||||
screen = PokemonMartScreen.new(scene,stock,adapter)
|
||||
screen.pbBuyScreen
|
||||
elsif cmdSell>=0 && cmd==cmdSell #NOT IMPLEMENTED
|
||||
scene = PokemonMart_Scene.new(currency_name)
|
||||
screen = PokemonMartScreen.new(scene,stock,adapter)
|
||||
screen.pbSellScreen
|
||||
else
|
||||
pbMessage(_INTL("Please come again!"))
|
||||
break
|
||||
end
|
||||
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
|
||||
commands,cmdQuit+1)
|
||||
end
|
||||
$game_temp.clear_mart_prices
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
# nerf: remove x kg from each generated pokemon
|
||||
|
||||
def generate_weight_contest_entries(species, level, resultsVariable, nerf = 0)
|
||||
# echoln "Generating Pokemon"
|
||||
pokemon1 = pbGenerateWildPokemon(species, level) # Pokemon.new(species,level)
|
||||
pokemon2 = pbGenerateWildPokemon(species, level) # Pokemon.new(species,level)
|
||||
new_weights = []
|
||||
new_weights << calculate_pokemon_weight(pokemon1, nerf)
|
||||
new_weights << calculate_pokemon_weight(pokemon2, nerf)
|
||||
echoln new_weights
|
||||
echoln "(nerfed by -#{nerf})"
|
||||
pbSet(resultsVariable, new_weights.max)
|
||||
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
def pbRelearnEggMoveScreen(pkmn)
|
||||
retval = true
|
||||
pbFadeOutIn {
|
||||
scene = MoveRelearner_Scene.new
|
||||
screen = MoveRelearnerScreen.new(scene)
|
||||
retval = screen.pbStartScreenEgg(pkmn)
|
||||
}
|
||||
return retval
|
||||
end
|
||||
|
||||
class MoveRelearnerScreen
|
||||
def pbStartScreenEgg(pkmn)
|
||||
baby = pbGetBabySpecies(pkmn.species)
|
||||
moves = pbGetSpeciesEggMoves(baby)
|
||||
|
||||
@scene.pbStartScene(pkmn, moves)
|
||||
loop do
|
||||
move = @scene.pbChooseMove
|
||||
if move
|
||||
if @scene.pbConfirm(_INTL("Teach {1}?", GameData::Move.get(move).name))
|
||||
if pbLearnMove(pkmn, move)
|
||||
@scene.pbEndScene
|
||||
return true
|
||||
end
|
||||
end
|
||||
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?", pkmn.name))
|
||||
@scene.pbEndScene
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,69 @@
|
||||
def fossilsGuyBattle(level = 20, end_message = "")
|
||||
team = getFossilsGuyTeam(level)
|
||||
customTrainerBattle("Miguel",
|
||||
:SUPERNERD,
|
||||
team,
|
||||
level,
|
||||
end_message
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def getFossilsGuyTeam(level)
|
||||
base_poke_evolution_level = 20
|
||||
fossils_evolution_level_1 = 30
|
||||
fossils_evolution_level_2 = 50
|
||||
|
||||
fossils = []
|
||||
base_poke = level <= base_poke_evolution_level ? :B88H109 : :B89H110
|
||||
team = []
|
||||
team << Pokemon.new(base_poke, level)
|
||||
|
||||
# Mt. Moon fossil
|
||||
if $game_switches[SWITCH_PICKED_HELIC_FOSSIL]
|
||||
fossils << :KABUTO if level < fossils_evolution_level_1
|
||||
fossils << :KABUTOPS if level >= fossils_evolution_level_1
|
||||
elsif $game_switches[SWITCH_PICKED_DOME_FOSSIL]
|
||||
fossils << :OMANYTE if level < fossils_evolution_level_1
|
||||
fossils << :OMASTAR if level >= fossils_evolution_level_1
|
||||
end
|
||||
|
||||
# S.S. Anne fossil
|
||||
if $game_switches[SWITCH_PICKED_LILEEP_FOSSIL]
|
||||
fossils << :ANORITH if level < fossils_evolution_level_1
|
||||
fossils << :ARMALDO if level >= fossils_evolution_level_1
|
||||
|
||||
elsif $game_switches[SWITCH_PICKED_ANORITH_FOSSIL]
|
||||
fossils << :LILEEP if level < fossils_evolution_level_1
|
||||
fossils << :CRADILY if level >= fossils_evolution_level_1
|
||||
end
|
||||
# Celadon fossil
|
||||
if $game_switches[SWITCH_PICKED_ARMOR_FOSSIL]
|
||||
fossils << :CRANIDOS if level < fossils_evolution_level_2
|
||||
fossils << :RAMPARDOS if level >= fossils_evolution_level_2
|
||||
|
||||
elsif $game_switches[SWITCH_PICKED_SKULL_FOSSIL]
|
||||
fossils << :SHIELDON if level < fossils_evolution_level_2
|
||||
fossils << :BASTIODON if level >= fossils_evolution_level_2
|
||||
end
|
||||
|
||||
skip_next = false
|
||||
for index in 0..fossils.length
|
||||
if index == fossils.length - 1
|
||||
team << Pokemon.new(fossils[index], level)
|
||||
else
|
||||
if skip_next
|
||||
skip_next = false
|
||||
next
|
||||
end
|
||||
head_poke = fossils[index]
|
||||
body_poke = fossils[index + 1]
|
||||
if head_poke && body_poke
|
||||
newPoke = getFusionSpecies(dexNum(body_poke), dexNum(head_poke))
|
||||
team << Pokemon.new(newPoke, level)
|
||||
skip_next = true
|
||||
end
|
||||
end
|
||||
end
|
||||
return team
|
||||
end
|
||||
205
Data/Scripts/052_InfiniteFusion/Gameplay/NPCs/FusionMoveTutor.rb
Normal file
205
Data/Scripts/052_InfiniteFusion/Gameplay/NPCs/FusionMoveTutor.rb
Normal file
@@ -0,0 +1,205 @@
|
||||
def pbSpecialTutor(pokemon,legendaries=false)
|
||||
retval = true
|
||||
tutorUtil = FusionTutorService.new(pokemon)
|
||||
pbFadeOutIn {
|
||||
scene = MoveRelearner_Scene.new
|
||||
screen = MoveRelearnerScreen.new(scene)
|
||||
moves = tutorUtil.getCompatibleMoves(legendaries)
|
||||
if !moves.empty?
|
||||
retval = screen.pbStartScreen(pokemon, moves)
|
||||
else
|
||||
return false
|
||||
end
|
||||
}
|
||||
return retval
|
||||
end
|
||||
|
||||
def pbShowRareTutorFullList(includeLegendaries = false)
|
||||
tutorUtil = FusionTutorService.new(nil)
|
||||
tutorUtil.setShowList(true)
|
||||
pbFadeOutIn {
|
||||
scene = MoveRelearner_Scene.new
|
||||
screen = MoveRelearnerScreen.new(scene)
|
||||
moves = tutorUtil.getCompatibleMoves(includeLegendaries)
|
||||
screen.pbStartScreen(nil, moves)
|
||||
}
|
||||
return false
|
||||
end
|
||||
|
||||
def pbCheckRareTutorCompatibleMoves(pokemon, includeLeshgendaries)
|
||||
tutorUtil = FusionTutorService.new(pokemon)
|
||||
return tutorUtil.has_compatible_move(includeLeshgendaries)
|
||||
end
|
||||
|
||||
def showRandomRareMoveConditionExample(legendary = false)
|
||||
example = legendary ? getlegendaryConditionExample : getRegularConditionExample
|
||||
text = "For example, " + example
|
||||
pbMessage(text)
|
||||
end
|
||||
|
||||
def getRegularConditionExample()
|
||||
list = [
|
||||
_INTL("a Sandslash fusion which has the electric type will be able to learn the move Zing Zap."),
|
||||
_INTL("any Pokémon that is both Flying and Fighting type will be able to learn the move Flying Press."),
|
||||
_INTL("the move Shadow Bone can only be learned by ghost-type Marowak fusions."),
|
||||
_INTL("any Pokémon that is both Ghost and Grass type will be able to learn the move Trick or Treat."),
|
||||
_INTL("the move Forest's Curse can only be learned by Ghost/Grass typed Pokémon."),
|
||||
_INTL("a grass-type fusion of a spiky Pokémon such as Jolteon will be able to learn the move Spiky Shield."),
|
||||
_INTL("only a ground-type fusion of Grimer or Muk will be able to learn the move Shore Up."),
|
||||
_INTL("any ice-type fusion that can already learn the move Crabhammer will also be able to learn the move Ice Hammer."),
|
||||
_INTL("only water-type fusions of a ninja-like Pokémon such as Ninjask or Zoroark will be able to learn the move Water Shuriken."),
|
||||
]
|
||||
return list.sample
|
||||
end
|
||||
|
||||
def getlegendaryConditionExample()
|
||||
list = [
|
||||
_INTL("any Rotom fusion that can already learn the move Thunder Punch can also be taught the move Plasma Fists."),
|
||||
_INTL("only an Electric-type fusion of a legendary Ice-type Pokémon will be able to learn the move Freeze Shock."),
|
||||
_INTL("only a Fire-type fusion of a legendary Ice-type Pokémon will be able to learn the move Ice Burn."),
|
||||
_INTL("any Pokémon that is both Flying and Dark type will be able to learn the move Oblivion Wing."),
|
||||
_INTL("a ground-type fusion of a spiky Pokémon such as Ferrothorn will be able to learn the move Thousand Arrows."),
|
||||
_INTL("any steel-type Pokémon that can already learn the move Double Slap will be able to learn Double Iron Bash."),
|
||||
_INTL("any Pokémon that is both Fairy and Rock type will be able to learn the move Diamond Storm."),
|
||||
_INTL("any water-type Pokémon that can already learn the move Eruption can also be taught the move Steam Eruption"),
|
||||
]
|
||||
return list.sample
|
||||
end
|
||||
|
||||
class FusionTutorService
|
||||
|
||||
def has_compatible_move(include_legendaries = false)
|
||||
return !getCompatibleMoves(include_legendaries).empty?
|
||||
end
|
||||
|
||||
def initialize(pokemon)
|
||||
@pokemon = pokemon
|
||||
@show_full_list = false
|
||||
end
|
||||
|
||||
def setShowList(value)
|
||||
@show_full_list = value
|
||||
end
|
||||
|
||||
#todo: these moves
|
||||
# DRAGONHAMMER
|
||||
# FIRELASH
|
||||
# BEAKBLAST
|
||||
# CHATTER
|
||||
# LEAFAGE
|
||||
# HEADCHARGE
|
||||
# HYPERSPACEHOLE
|
||||
# HOLDBACK
|
||||
# CELEBRATE
|
||||
# HEARTSWAP
|
||||
|
||||
def getCompatibleMoves(includeLegendaries = false)
|
||||
compatibleMoves = []
|
||||
#normal moves
|
||||
if !includeLegendaries
|
||||
compatibleMoves << :ATTACKORDER if is_fusion_of([:BEEDRILL])
|
||||
# compatibleMoves << :FIRSTIMPRESSION if is_fusion_of([:SCYTHER, :SCIZOR, :PINSIR, :FARFETCHD, :TRAPINCH, :VIBRAVA, :FLYGON, :KABUTOPS, :ARMALDO])
|
||||
compatibleMoves << :POLLENPUFF if is_fusion_of([:BUTTERFREE, :CELEBI, :VILEPLUME, :PARASECT, :BRELOOM])
|
||||
compatibleMoves << :LUNGE if is_fusion_of([:SPINARAK, :ARIADOS, :JOLTIK, :GALVANTULA, :VENOMOTH, :VOLCARONA, :PINSIR, :PARASECT, :LEDIAN, :DODUO, :DODRIO, :STANTLER])
|
||||
compatibleMoves << :DEFENDORDER if is_fusion_of([:BEEDRILL])
|
||||
compatibleMoves << :HEALORDER if is_fusion_of([:BEEDRILL])
|
||||
compatibleMoves << :POWDER if is_fusion_of([:BUTTERFREE, :VENOMOTH, :VOLCARONA, :PARASECT, :BRELOOM])
|
||||
compatibleMoves << :TAILGLOW if is_fusion_of([:MAREEP, :FLAAFFY, :AMPHAROS, :LANTURN, :ZEKROM, :RESHIRAM])
|
||||
compatibleMoves << :DARKESTLARIAT if is_fusion_of([:SNORLAX, :REGIGIGAS, :POLIWRATH, :MACHAMP, :ELECTIVIRE, :DUSKNOIR, :SWAMPERT, :KROOKODILE, :GOLURK])
|
||||
compatibleMoves << :PARTINGSHOT if is_fusion_of([:MEOWTH, :PERSIAN, :SANDILE, :KROKOROK, :KROOKODILE, :UMBREON])
|
||||
compatibleMoves << :TOPSYTURVY if is_fusion_of([:HITMONTOP, :WOBBUFFET])
|
||||
# compatibleMoves << :CLANGINGSCALES if is_fusion_of([:EKANS, :ARBOK, :GARCHOMP, :FLYGON, :HAXORUS])
|
||||
compatibleMoves << :ZINGZAP if is_fusion_of([:PICHU, :PIKACHU, :RAICHU, :VOLTORB, :ELECTRODE]) || (is_fusion_of([:SANDSLASH, :GOLEM]) && hasType(:ELECTRIC))
|
||||
compatibleMoves << :PARABOLICCHARGE if is_fusion_of([:PICHU, :PIKACHU, :RAICHU, :MAGNEMITE, :MAGNETON, :MAGNEZONE, :MAREEP, :FLAAFFY, :AMPHAROS, :ELEKID, :ELECTABUZZ, :ELECTIVIRE, :ZAPDOS, :CHINCHOU, :LANTURN, :RAIKOU, :KLINK, :KLANG, :KLINKLANG, :ROTOM, :STUNFISK])
|
||||
compatibleMoves << :ELECTRIFY if is_fusion_of([:KLINK, :KLANG, :KLINKLANG]) || hasType(:ELECTRIC)
|
||||
compatibleMoves << :AROMATICMIST if is_fusion_of([:WEEZING, :BULBASAUR, :IVYSAUR, :VENUSAUR, :CHIKORITA, :BAYLEEF, :MEGANIUM, :GLOOM, :VILEPLUME, :BELLOSSOM, :ROSELIA, :ROSERADE])
|
||||
compatibleMoves << :FLORALHEALING if is_fusion_of([:SUNFLORA, :BELLOSSOM, :ROSELIA, :ROSERADE])
|
||||
#compatibleMoves << :FLYINGPRESS if is_fusion_of([:TORCHIC, :COMBUSKEN, :BLAZIKEN, :FARFETCHD, :HERACROSS]) || (hasType(:FLYING) && hasType(:FIGHTING))
|
||||
compatibleMoves << :MATBLOCK if is_fusion_of([:MACHOP, :MACHOKE, :MACHAMP, :TYROGUE, :HITMONLEE, :HITMONCHAN, :HITMONTOP])
|
||||
compatibleMoves << :MINDBLOWN if is_fusion_of([:VOLTORB, :ELECTRODE, :EXEGGUTOR])
|
||||
compatibleMoves << :SHELLTRAP if is_fusion_of([:MAGCARGO, :FORRETRESS])
|
||||
compatibleMoves << :HEATCRASH if is_fusion_of([:BLAZIKEN, :RESHIRAM, :GROUDON, :CHARIZARD, :GOLURK, :REGIGIGAS, :RHYDON, :RHYPERIOR, :SNORLAX])
|
||||
compatibleMoves << :SHADOWBONE if is_fusion_of([:MAROWAK]) && hasType(:GHOST)
|
||||
compatibleMoves << :SPIRITSHACKLE if is_fusion_of([:BANETTE, :SPIRITOMB, :DUSKNOIR, :SHEDINJA, :COFAGRIGUS])
|
||||
compatibleMoves << :TRICKORTREAT if (hasType(:GRASS) && hasType(:GHOST)) || is_fusion_of([:GASTLY, :HAUNTER, :GENGAR, :MIMIKYU, :ZORUA, :ZOROARK])
|
||||
compatibleMoves << :TROPKICK if is_fusion_of([:HITMONLEE, :HITMONTOP, :ROSERADE]) || (hasType(:GRASS) && hasType(:FIGHTING))
|
||||
#compatibleMoves << :NEEDLEARM if is_fusion_of([:FERROTHORN])
|
||||
#compatibleMoves << :FORESTSCURSE if (hasType(:GRASS) && hasType(:GHOST))
|
||||
#compatibleMoves << :SPIKYSHIELD if is_fusion_of([:FERROSEED, :FERROTHORN]) || (is_fusion_of([:SANDSLASH, :JOLTEON, :CLOYSTER]) && hasType(:GRASS))
|
||||
compatibleMoves << :STRENGTHSAP if is_fusion_of([:ODDISH, :GLOOM, :VILEPLUME, :BELLOSSOM, :HOPPIP, :SKIPLOOM, :JUMPLUFF, :BELLSPROUT, :WEEPINBELL, :VICTREEBEL, :PARAS, :PARASECT, :DRIFBLIM, :BRELOOM])
|
||||
#compatibleMoves << :SHOREUP if is_fusion_of([:GRIMER, :MUK]) && hasType(:GROUND)
|
||||
compatibleMoves << :ICEHAMMER if (canLearnMove(:CRABHAMMER) || canLearnMove(:GRASSHAMMER) || canLearnMove(:HAMMERARM)) && hasType(:ICE)
|
||||
compatibleMoves << :MULTIATTACK if is_fusion_of([:ARCEUS, :MEW, :GENESECT])
|
||||
# compatibleMoves << :REVELATIONDANCE if is_fusion_of([:KECLEON, :BELLOSSOM, :CLEFAIRY, :CLEFABLE, :CLEFFA])
|
||||
#compatibleMoves << :BANEFULBUNKER if is_fusion_of([:TENTACOOL, :TENTACRUEL, :NIDORINA, :NIDORINO, :NIDOQUEEN, :NIDOKING, :GRIMER, :MUK, :QWILFISH])
|
||||
compatibleMoves << :INSTRUCT if is_fusion_of([:CHIMCHAR, :MONFERNO, :INFERNAPE, :KADABRA, :ALAKAZAM, :SLOWKING])
|
||||
compatibleMoves << :PSYCHICTERRAIN if hasType(:PSYCHIC)
|
||||
#compatibleMoves << :GRASSYTERRAIN if hasType(:GRASS)
|
||||
compatibleMoves << :MISTYTERRAIN if hasType(:FAIRY)
|
||||
compatibleMoves << :SPEEDSWAP if is_fusion_of([:PIKACHU, :RAICHU, :ABRA, :KADABRA, :ALAKAZAM, :PORYGON, :PORYGON2, :PORYGONZ, :MEWTWO, :MEW, :JOLTIK, :GALVANTULA])
|
||||
#compatibleMoves << :ACCELEROCK if is_fusion_of([:AERODACTYL, :KABUTOPS, :ANORITH, :ARMALDO])
|
||||
#compatibleMoves << :ANCHORSHOT if (is_fusion_of([:EMPOLEON, :STEELIX, :BELDUM, :METANG, :METAGROSS, :KLINK, :KLINKLANG, :KLANG, :ARON, :LAIRON, :AGGRON]) && hasType(:WATER)) || (is_fusion_of([:LAPRAS, :WAILORD, :KYOGRE]) && hasType(:STEEL))
|
||||
compatibleMoves << :SPARKLINGARIA if (is_fusion_of([:JYNX, :JIGGLYPUFF, :WIGGLYTUFF]) && hasType(:WATER)) || is_fusion_of([:LAPRAS])
|
||||
#compatibleMoves << :WATERSHURIKEN if is_fusion_of([:NINJASK, :LUCARIO, :ZOROARK, :BISHARP]) && hasType(:WATER)
|
||||
end
|
||||
if includeLegendaries
|
||||
#legendary moves (only available after a certain trigger, maybe a different npc)
|
||||
compatibleMoves << :HYPERSPACEFURY if is_fusion_of([:GIRATINA, :PALKIA, :DIALGA, :ARCEUS])
|
||||
compatibleMoves << :COREENFORCER if is_fusion_of([:GIRATINA, :PALKIA, :DIALGA, :RAYQUAZA])
|
||||
compatibleMoves << :PLASMAFISTS if is_fusion_of([:ELECTABUZZ, :ELECTIVIRE, :ZEKROM]) || (is_fusion_of([:ROTOM]) && canLearnMove(:THUNDERPUNCH))
|
||||
compatibleMoves << :LIGHTOFRUIN if is_fusion_of([:ARCEUS, :MEW, :CELEBI, :JIRACHI])
|
||||
compatibleMoves << :FLEURCANNON if is_fusion_of([:GARDEVOIR, :GALLADE, :SYLVEON, :WIGGLYTUFF])
|
||||
compatibleMoves << :NATURESMADNESS if is_fusion_of([:CELEBI, :KYOGRE, :GROUDON, :ABSOL])
|
||||
compatibleMoves << :GEOMANCY if is_fusion_of([:CELEBI])
|
||||
compatibleMoves << :VCREATE if is_fusion_of([:ENTEI, :HOOH, :TYPHLOSION])
|
||||
compatibleMoves << :MAGMASTORM if is_fusion_of([:MAGCARGO, :TYPHLOSION, :MAGMORTAR, :MAGMAR, :ENTEI, :GROUDON]) || canLearnMove(:ERUPTION)
|
||||
compatibleMoves << :SEARINGSHOT if is_fusion_of([:MAGMORTAR])
|
||||
compatibleMoves << :OBLIVIONWING if is_fusion_of([:MURKROW, :HONCHKROW]) || (hasType(:DARK) && hasType(:FLYING))
|
||||
compatibleMoves << :MOONGEISTBEAM if (is_fusion_of([:CLEFFA, :CLEFAIRY, :CLEFABLE]) && hasType(:DARK)) || is_fusion_of([:DARKRAI, :MISDREAVUS, :MISMAGIUS])
|
||||
compatibleMoves << :SPECTRALTHIEF if is_fusion_of([:HAUNTER, :GENGAR, :BANETTE, :GIRATINA, :HONEDGE, :DOUBLADE, :AEGISLASH])
|
||||
compatibleMoves << :SEEDFLARE if is_fusion_of([:JUMPLUFF, :SUNFLORA])
|
||||
compatibleMoves << :LANDSWRATH if is_fusion_of([:GROUDON])
|
||||
compatibleMoves << :THOUSANDARROWS if is_fusion_of([:SANDSLASH, :JOLTEON, :FERROTHORN]) && hasType(:GROUND)
|
||||
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 << :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 << :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)
|
||||
compatibleMoves << :STEAMERUPTION if canLearnMove(:ERUPTION) && hasType(:WATER)
|
||||
compatibleMoves << :SECRETSWORD if is_fusion_of([:HONEDGE, :DOUBLADE, :AEGISLASH, :GALLADE, :FARFETCHD, :ABSOL, :BISHARP])
|
||||
end
|
||||
return compatibleMoves
|
||||
end
|
||||
|
||||
def is_fusion_of(pokemonList)
|
||||
return true if @show_full_list
|
||||
is_species = false
|
||||
for fusionPokemon in pokemonList
|
||||
if @pokemon.isFusionOf(fusionPokemon)
|
||||
is_species = true
|
||||
end
|
||||
end
|
||||
return is_species
|
||||
end
|
||||
|
||||
def hasType(type)
|
||||
return true if @show_full_list
|
||||
return @pokemon.hasType?(type)
|
||||
end
|
||||
|
||||
def canLearnMove(move)
|
||||
return true if @show_full_list
|
||||
return @pokemon.compatible_with_move?(move)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
class FusionQuiz
|
||||
|
||||
#
|
||||
# Possible difficulties:
|
||||
#
|
||||
# :REGULAR -> 4 options choice
|
||||
#
|
||||
# :ADVANCED -> List of all pokemon
|
||||
#
|
||||
def initialize(difficulty = :REGULAR)
|
||||
@sprites = {}
|
||||
|
||||
|
||||
@previewwindow = nil
|
||||
@difficulty = difficulty
|
||||
@customs_list = getCustomSpeciesList(true, false)
|
||||
@selected_pokemon = nil
|
||||
@head_id = nil
|
||||
@body_id = nil
|
||||
@body_choices = []
|
||||
@head_choices = []
|
||||
@abandonned = false
|
||||
@score = 0
|
||||
@current_streak = 0
|
||||
@streak_multiplier = 0.15
|
||||
end
|
||||
|
||||
|
||||
def start_quiz(nb_rounds = 3)
|
||||
nb_games_played= pbGet(VAR_STAT_FUSION_QUIZ_NB_TIMES)
|
||||
pbSet(VAR_STAT_FUSION_QUIZ_NB_TIMES,nb_games_played+1)
|
||||
|
||||
round_multiplier = 1
|
||||
round_multiplier_increase = 0.1
|
||||
|
||||
for i in 1..nb_rounds
|
||||
if i == nb_rounds
|
||||
pbMessage(_INTL("Get ready! Here comes the final round!"))
|
||||
elsif i == 1
|
||||
pbMessage(_INTL("Get ready! Here comes the first round!"))
|
||||
else
|
||||
pbMessage(_INTL("Get ready! Here comes round {1}!", i))
|
||||
end
|
||||
start_quiz_new_round(round_multiplier)
|
||||
|
||||
rounds_left = nb_rounds - i
|
||||
if rounds_left > 0
|
||||
pbMessage(_INTL("That's it for round {1}. You've cumulated {2} points so far.", i, @score))
|
||||
prompt_next_round = pbMessage(_INTL("Are you ready to move on to the next round?", i), ["Yes", "No"])
|
||||
if prompt_next_round != 0
|
||||
prompt_quit = pbMessage(_INTL("You still have {1} rounds to go. You'll only keep your points if you finish all {2} rounds. Do you really want to quit now?", rounds_left, nb_rounds), ["Yes", "No"])
|
||||
if prompt_quit
|
||||
@abandonned = true
|
||||
break
|
||||
end
|
||||
end
|
||||
round_multiplier += round_multiplier_increase
|
||||
else
|
||||
pbMessage(_INTL("This concludes our quiz! You've cumulated {1} points in total.", @score))
|
||||
pbMessage(_INTL("Thanks for playing with us today!"))
|
||||
end
|
||||
end
|
||||
end_quiz()
|
||||
end
|
||||
|
||||
def end_quiz()
|
||||
hide_fusion_picture
|
||||
Kernel.pbClearText()
|
||||
previous_highest = pbGet(VAR_STAT_FUSION_QUIZ_HIGHEST_SCORE)
|
||||
pbSet(VAR_STAT_FUSION_QUIZ_HIGHEST_SCORE,@score) if @score > previous_highest
|
||||
|
||||
previous_total = pbGet(VAR_STAT_FUSION_QUIZ_TOTAL_PTS)
|
||||
pbSet(VAR_STAT_FUSION_QUIZ_TOTAL_PTS,previous_total+@score)
|
||||
dispose
|
||||
end
|
||||
|
||||
def start_quiz_new_round(round_multiplier = 1)
|
||||
if @difficulty == :ADVANCED
|
||||
base_points_q1 = 500
|
||||
base_points_q1_redemption = 200
|
||||
base_points_q2 = 600
|
||||
base_points_q2_redemption = 200
|
||||
perfect_round_points = 100
|
||||
else
|
||||
base_points_q1 = 300
|
||||
base_points_q1_redemption = 100
|
||||
base_points_q2 = 400
|
||||
base_points_q2_redemption = 100
|
||||
perfect_round_points = 50
|
||||
end
|
||||
|
||||
pick_random_pokemon()
|
||||
show_fusion_picture(true)
|
||||
correct_answers = []
|
||||
|
||||
#OBSCURED
|
||||
correct_answers << new_question(calculate_points_awarded(base_points_q1, round_multiplier), _INTL("Which Pokémon is this fusion's body?"), @body_id, nil, true, :BODY)
|
||||
pbMessage(_INTL("Next question!"))
|
||||
correct_answers << new_question(calculate_points_awarded(base_points_q2, round_multiplier), _INTL("Which Pokémon is this fusion's head?"), @head_id, nil, true, :HEAD)
|
||||
|
||||
#NON-OBSCURED
|
||||
if !correct_answers[0] || !correct_answers[1]
|
||||
show_fusion_picture(false)
|
||||
pbMessage(_INTL("Okay, now's your chance to make up for the points you missed!"))
|
||||
if !correct_answers[0] #1st question redemption
|
||||
new_question(calculate_points_awarded(base_points_q1_redemption, round_multiplier), "Which Pokémon is this fusion's body?", @body_id, @body_choices, false, :BODY)
|
||||
if !correct_answers[1]
|
||||
pbMessage(_INTL("Next question!"))
|
||||
end
|
||||
end
|
||||
|
||||
if !correct_answers[1] #2nd question redemption
|
||||
new_question(calculate_points_awarded(base_points_q2_redemption, round_multiplier), "Which Pokémon is this fusion's head?", @head_id, @head_choices, false, :HEAD)
|
||||
end
|
||||
else
|
||||
pbSEPlay("Applause", 80)
|
||||
pbMessage(_INTL("Wow! A perfect round! You get {1} more points!", perfect_round_points))
|
||||
show_fusion_picture(false, 100)
|
||||
pbMessage(_INTL("Let's see what this Pokémon looked like!"))
|
||||
end
|
||||
current_streak_dialog()
|
||||
hide_fusion_picture()
|
||||
|
||||
end
|
||||
|
||||
def calculate_points_awarded(base_points, round_multiplier)
|
||||
points = base_points * round_multiplier
|
||||
if @current_streak > 0
|
||||
current_streak_multiplier = (@current_streak * @streak_multiplier) - @streak_multiplier
|
||||
points += points * current_streak_multiplier
|
||||
#p (base_points * round_multiplier)
|
||||
#p (points * current_streak_multiplier)
|
||||
end
|
||||
return points
|
||||
end
|
||||
|
||||
def new_question(points_value, question, answer_id, choices, other_chance_later,question_type)
|
||||
points_value = points_value.to_i
|
||||
answer_name = getPokemon(answer_id).real_name
|
||||
answered_correctly = give_answer(question, answer_id, choices,question_type)
|
||||
award_points(points_value) if answered_correctly
|
||||
question_answer_followup_dialog(answered_correctly, answer_name, points_value, other_chance_later)
|
||||
return answered_correctly
|
||||
end
|
||||
|
||||
def increase_streak
|
||||
@current_streak += 1
|
||||
refresh_streak_ui()
|
||||
end
|
||||
|
||||
def break_streak
|
||||
@current_streak = 0
|
||||
refresh_streak_ui()
|
||||
end
|
||||
|
||||
def refresh_streak_ui()
|
||||
shadow_color = Color.new(160,160,160)
|
||||
base_color_low_streak = Color.new(72,72,72)
|
||||
base_color_medium_streak = Color.new(213,254,205)
|
||||
base_color_high_streak = Color.new(100,232,96)
|
||||
|
||||
streak_color= base_color_low_streak
|
||||
streak_color = base_color_medium_streak if @current_streak >= 2
|
||||
streak_color = base_color_high_streak if @current_streak >= 4
|
||||
|
||||
message = _INTL("Streak: {1}",@current_streak)
|
||||
Kernel.pbClearText()
|
||||
Kernel.pbDisplayText(message,420,340,nil,streak_color)
|
||||
end
|
||||
|
||||
def award_points(nb_points)
|
||||
@score += nb_points
|
||||
end
|
||||
|
||||
def question_answer_followup_dialog(answered_correctly, correct_answer, points_awarded_if_win, other_chance_later = false)
|
||||
if !other_chance_later
|
||||
pbMessage(_INTL("And the correct answer was..."))
|
||||
pbMessage("...")
|
||||
pbMessage("#{correct_answer}!")
|
||||
end
|
||||
|
||||
if answered_correctly
|
||||
pbSEPlay("itemlevel", 80)
|
||||
increase_streak
|
||||
pbMessage(_INTL("That's a correct answer!"))
|
||||
pbMessage(_INTL("You're awarded {1} points for your answer. Your current score is {2}", points_awarded_if_win, @score.to_s))
|
||||
else
|
||||
pbSEPlay("buzzer", 80)
|
||||
break_streak
|
||||
pbMessage(_INTL("Unfortunately, that was a wrong answer."))
|
||||
pbMessage(_INTL("But you'll get another chance at it!")) if other_chance_later
|
||||
end
|
||||
end
|
||||
|
||||
def current_streak_dialog()
|
||||
return if @current_streak ==0
|
||||
streak_base_worth= @difficulty == :REGULAR ? 25 : 100
|
||||
if @current_streak % 4 == 0
|
||||
extra_points = (@current_streak/4)*streak_base_worth
|
||||
if @current_streak >= 8
|
||||
pbMessage(_INTL("That's {1} correct answers in a row. You're on a roll!", @current_streak))
|
||||
else
|
||||
pbMessage(_INTL("That's {1} correct answers in a row. You're doing great!", @current_streak))
|
||||
end
|
||||
pbMessage(_INTL("Here's {1} extra points for maintaining a streak!",extra_points))
|
||||
award_points(extra_points)
|
||||
end
|
||||
end
|
||||
|
||||
def show_fusion_picture(obscured = false, x = nil, y = nil)
|
||||
hide_fusion_picture()
|
||||
spriteLoader = BattleSpriteLoader.new
|
||||
bitmap = spriteLoader.load_fusion_sprite(@head_id, @body_id)
|
||||
bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
|
||||
@previewwindow = PictureWindow.new(bitmap)
|
||||
@previewwindow.y = y ? y : 30
|
||||
@previewwindow.x = x ? x : (@difficulty == :ADVANCED ? 275 : 100)
|
||||
@previewwindow.z = 100000
|
||||
if obscured
|
||||
@previewwindow.picture.pbSetColor(255, 255, 255, 200)
|
||||
end
|
||||
end
|
||||
|
||||
def hide_fusion_picture()
|
||||
@previewwindow.dispose if @previewwindow
|
||||
end
|
||||
|
||||
def pick_random_pokemon(save_in_variable = 1)
|
||||
random_pokemon = getRandomCustomFusion(true, @customs_list)
|
||||
@head_id = random_pokemon[0]
|
||||
@body_id = random_pokemon[1]
|
||||
@selected_pokemon = getSpeciesIdForFusion(@head_id, @body_id)
|
||||
pbSet(save_in_variable, @selected_pokemon)
|
||||
end
|
||||
|
||||
def give_answer(prompt_message, answer_id, choices,question_type=:BODY)
|
||||
question_answered = false
|
||||
answer_pokemon_name = getPokemon(answer_id).real_name
|
||||
while !question_answered
|
||||
if @difficulty == :ADVANCED
|
||||
player_answer = prompt_pick_answer_advanced(prompt_message, answer_id)
|
||||
else
|
||||
player_answer = prompt_pick_answer_regular(prompt_message, answer_id, choices,question_type)
|
||||
end
|
||||
confirmed = pbMessage(_INTL("Is this your final answer?"), [_INTL("Yes"), _INTL("No")])
|
||||
if confirmed == 0
|
||||
question_answered = true
|
||||
else
|
||||
should_generate_new_choices = false
|
||||
end
|
||||
end
|
||||
return player_answer == answer_pokemon_name
|
||||
end
|
||||
|
||||
def get_random_pokemon_from_same_egg_group(pokemon, amount_required)
|
||||
pokemon = ::GameData::Species.get(pokemon)
|
||||
egg_groups = getPokemonEggGroups(pokemon)
|
||||
|
||||
# Get a list all pokemon in the same egg group
|
||||
matching_egg_group = []
|
||||
for num in 1..NB_POKEMON
|
||||
next if pokemon.id_number == num
|
||||
next if matching_egg_group.include?(num)
|
||||
new_pokemon = ::GameData::Species.get(num)
|
||||
new_pokemon_egg_groups = getPokemonEggGroups(new_pokemon)
|
||||
matching_egg_group << num if (egg_groups & new_pokemon_egg_groups).any?
|
||||
end
|
||||
|
||||
# Select random pokemon from the list
|
||||
matching_egg_group.shuffle!
|
||||
choices = []
|
||||
for index in 1..amount_required
|
||||
if matching_egg_group[index].nil?
|
||||
# If there's not enough pokemon in the list (e.g. for Ditto), get anything
|
||||
new_pokemon = rand(1..NB_POKEMON) until !choices.include?(new_pokemon) && new_pokemon != pokemon.id_number
|
||||
choices << new_pokemon
|
||||
else
|
||||
choices << matching_egg_group[index]
|
||||
end
|
||||
end
|
||||
|
||||
return choices
|
||||
end
|
||||
|
||||
def prompt_pick_answer_regular(prompt_message, real_answer, choices, question_type=:BODY)
|
||||
if choices && choices.is_a?(Array)
|
||||
commands = choices.shuffle
|
||||
else
|
||||
commands = generate_new_choices(real_answer,question_type)
|
||||
end
|
||||
chosen = pbMessage(prompt_message, commands)
|
||||
return commands[chosen]
|
||||
end
|
||||
|
||||
def generate_new_choices(real_answer,question_type=:BODY)
|
||||
choices = []
|
||||
choices << real_answer
|
||||
choices.push(*get_random_pokemon_from_same_egg_group(real_answer, 3))
|
||||
|
||||
commands = []
|
||||
choices.each do |dex_num, i|
|
||||
species = getPokemon(dex_num)
|
||||
commands.push(species.real_name)
|
||||
end
|
||||
if question_type == :BODY
|
||||
@body_choices = commands
|
||||
else
|
||||
@head_choices = commands
|
||||
end
|
||||
return commands.shuffle
|
||||
end
|
||||
|
||||
def prompt_pick_answer_advanced(prompt_message, answer)
|
||||
commands = []
|
||||
for dex_num in 1..NB_POKEMON
|
||||
species = getPokemon(dex_num)
|
||||
commands.push([dex_num - 1, species.real_name, species.real_name])
|
||||
end
|
||||
pbMessage(prompt_message)
|
||||
return pbChooseList(commands, 0, nil, 1)
|
||||
end
|
||||
|
||||
def get_score
|
||||
return @score
|
||||
end
|
||||
|
||||
def player_abandonned
|
||||
return @abandonned
|
||||
end
|
||||
|
||||
def dispose
|
||||
@previewwindow.dispose
|
||||
end
|
||||
|
||||
end
|
||||
@@ -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
|
||||
@@ -0,0 +1,16 @@
|
||||
def playPokeFluteAnimation
|
||||
# return if $Trainer.outfit != 0
|
||||
# $game_player.setDefaultCharName("players/pokeflute", 0, false)
|
||||
# Graphics.update
|
||||
# Input.update
|
||||
# pbUpdateSceneMap
|
||||
end
|
||||
|
||||
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]
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
def isPlayerMale()
|
||||
return pbGet(VAR_TRAINER_GENDER) == GENDER_MALE
|
||||
end
|
||||
|
||||
def isPlayerFemale()
|
||||
return pbGet(VAR_TRAINER_GENDER) == GENDER_FEMALE
|
||||
end
|
||||
|
||||
def getPlayerGenderId()
|
||||
return pbGet(VAR_TRAINER_GENDER)
|
||||
end
|
||||
|
||||
|
||||
def isPostgame?()
|
||||
return $game_switches[SWITCH_BEAT_THE_LEAGUE]
|
||||
end
|
||||
99
Data/Scripts/052_InfiniteFusion/Gameplay/Player/Starters.rb
Normal file
99
Data/Scripts/052_InfiniteFusion/Gameplay/Player/Starters.rb
Normal file
@@ -0,0 +1,99 @@
|
||||
def obtainStarter(starterIndex = 0)
|
||||
if ($game_switches[SWITCH_LEGENDARY_MODE])
|
||||
generated_list = pbGet(VAR_LEGENDARY_STARTERS_CHOICES)
|
||||
if generated_list.is_a?(Array)
|
||||
startersList = generated_list
|
||||
else
|
||||
startersList = generate_legendary_mode_starters
|
||||
pbSet(VAR_LEGENDARY_STARTERS_CHOICES,startersList)
|
||||
end
|
||||
starter = startersList[starterIndex]
|
||||
elsif ($game_switches[SWITCH_RANDOM_STARTERS])
|
||||
starter = obtainRandomizedStarter(starterIndex)
|
||||
else
|
||||
startersList = Settings::DEFAULT_STARTERS
|
||||
if $game_switches[SWITCH_JOHTO_STARTERS]
|
||||
startersList = Settings::JOHTO_STARTERS
|
||||
elsif $game_switches[SWITCH_HOENN_STARTERS]
|
||||
startersList = Settings::HOENN_STARTERS
|
||||
elsif $game_switches[SWITCH_SINNOH_STARTERS]
|
||||
startersList = Settings::SINNOH_STARTERS
|
||||
elsif $game_switches[SWITCH_KALOS_STARTERS]
|
||||
startersList = Settings::KALOS_STARTERS
|
||||
elsif $game_switches[SWITCH_MIXED_STARTERS]
|
||||
if $game_temp.starter_options
|
||||
startersList = $game_temp.starter_options
|
||||
else
|
||||
$game_temp.starter_options = generate_mixed_starters_list
|
||||
startersList = $game_temp.starter_options
|
||||
end
|
||||
end
|
||||
starter = startersList[starterIndex]
|
||||
end
|
||||
return GameData::Species.get(starter)
|
||||
end
|
||||
|
||||
def generate_mixed_starters_list
|
||||
grass_option = Settings::GRASS_STARTERS.sample
|
||||
fire_option = Settings::FIRE_STARTERS.sample
|
||||
water_option = Settings::WATER_STARTERS.sample
|
||||
return [grass_option, fire_option, water_option]
|
||||
end
|
||||
|
||||
# body0
|
||||
# head 1
|
||||
def setRivalStarter(starterIndex1, starterIndex2)
|
||||
starter1 = obtainStarter(starterIndex1)
|
||||
starter2 = obtainStarter(starterIndex2)
|
||||
|
||||
ensureRandomHashInitialized()
|
||||
if $game_switches[SWITCH_RANDOM_WILD_TO_FUSION] || $game_switches[SWITCH_LEGENDARY_MODE] # if fused starters, only take index 1
|
||||
starter = obtainStarter(starterIndex1)
|
||||
else
|
||||
starter_body = starter1.id_number
|
||||
starter_head = starter2.id_number
|
||||
starter = getFusionSpecies(starter_body, starter_head).id_number
|
||||
end
|
||||
if $game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE]
|
||||
starterSpecies = GameData::Species.get(starter)
|
||||
starter = GameData::Species.get(starterSpecies.get_baby_species(false)).id_number
|
||||
end
|
||||
pbSet(VAR_RIVAL_STARTER, starter)
|
||||
$game_switches[SWITCH_DEFINED_RIVAL_STARTER] = true
|
||||
return starter
|
||||
end
|
||||
|
||||
def setStarterEasterEgg
|
||||
should_apply_easter_egg = true
|
||||
case $Trainer.name.downcase
|
||||
when "ash"
|
||||
starter = :PIKACHU
|
||||
rival_starter_body = :EEVEE
|
||||
rival_starter_head = :EEVEE
|
||||
when "gary"
|
||||
starter = :EEVEE
|
||||
rival_starter_body = :PIKACHU
|
||||
rival_starter_head = :PIKACHU
|
||||
when "god"
|
||||
starter = :BIDOOF
|
||||
rival_starter_body = :ARCEUS
|
||||
rival_starter_head = :OMANYTE
|
||||
when "?"
|
||||
starter = getSpecies(rand(NB_POKEMON))
|
||||
rival_starter_body = getSpecies(rand(NB_POKEMON))
|
||||
rival_starter_head = getSpecies(rand(NB_POKEMON))
|
||||
when "schrroms", "frogman", "frogzilla", "chardub"
|
||||
starter = fusionOf(:POLIWAG,:MACHAMP)
|
||||
rival_starter_body = :POLIWAG
|
||||
rival_starter_head = :MACHAMP
|
||||
else
|
||||
should_apply_easter_egg = false
|
||||
end
|
||||
|
||||
if should_apply_easter_egg
|
||||
pbSet(VAR_PLAYER_STARTER_CHOICE,getDexNumberForSpecies(starter))
|
||||
pbSet(VAR_RIVAL_STARTER_HEAD_CHOICE,getDexNumberForSpecies(rival_starter_head))
|
||||
pbSet(VAR_RIVAL_STARTER_BODY_CHOICE,getDexNumberForSpecies(rival_starter_body))
|
||||
$game_switches[SWITCH_CUSTOM_STARTERS] = true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
def pbGetCurrentRegion(defaultRegion = -1)
|
||||
return -1
|
||||
end
|
||||
@@ -0,0 +1,89 @@
|
||||
class PokedexUtils
|
||||
# POSSIBLE_ALTS = ["", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
|
||||
# "r", "s", "t", "u", "v", "w", "x", "y", "z", "aa", "ab", "ac", "ad", "ae", "af", "ag", "ah",
|
||||
# "ai", "aj", "ak", "al", "am", "an", "ao", "ap", "aq", "ar", "as", "at", "au", "av", "aw", "ax",
|
||||
# "ay", "az"]
|
||||
|
||||
def getAltLettersList()
|
||||
return ('a'..'z').to_a + ('aa'..'az').to_a
|
||||
end
|
||||
|
||||
def getBaseSpritesAlts(dex_number)
|
||||
return $game_temp.base_sprites_list[dex_number]
|
||||
end
|
||||
|
||||
def getLocalBaseSpriteAlts(dex_number)
|
||||
local_sprite_alts = []
|
||||
baseFilename = "#{dex_number}"
|
||||
possible_alt_letters = getAltLettersList()
|
||||
possible_alt_letters << ""
|
||||
possible_alt_letters.each { |alt_letter|
|
||||
spritename = "#{baseFilename}#{alt_letter}"
|
||||
local_path = "#{Settings::CUSTOM_BASE_SPRITES_FOLDER}/#{spritename}.png"
|
||||
if pbResolveBitmap(local_path)
|
||||
local_sprite_alts << getLocalSpriteID(local_path)
|
||||
end
|
||||
}
|
||||
return local_sprite_alts
|
||||
end
|
||||
|
||||
def getLocalFusionSpriteAlts(head_id,body_id)
|
||||
local_sprite_alts = []
|
||||
baseFilename = "#{head_id}.#{body_id}"
|
||||
possible_alt_letters = getAltLettersList()
|
||||
possible_alt_letters << ""
|
||||
possible_alt_letters.each { |alt_letter|
|
||||
spritename = "#{baseFilename}#{alt_letter}"
|
||||
local_path = "#{Settings::CUSTOM_BATTLERS_FOLDER_INDEXED}/#{head_id.to_s}/#{spritename}.png"
|
||||
if pbResolveBitmap(local_path)
|
||||
local_sprite_alts << getLocalSpriteID(local_path)
|
||||
end
|
||||
}
|
||||
return local_sprite_alts
|
||||
end
|
||||
|
||||
def getLocalSpriteID(sprite_path)
|
||||
return "local_#{sprite_path}"
|
||||
end
|
||||
|
||||
def getFusionSpriteAlts(head_id, body_id)
|
||||
sprite_id = get_fusion_symbol(head_id,body_id)
|
||||
return $game_temp.custom_sprites_list[sprite_id]
|
||||
end
|
||||
|
||||
def pbGetAvailableAlts(species, includeAutogens=false)
|
||||
dex_number = getDexNumberForSpecies(species)
|
||||
if isFusion(dex_number)
|
||||
body_id = getBodyID(dex_number)
|
||||
head_id = getHeadID(dex_number,body_id)
|
||||
available_alts = getFusionSpriteAlts(head_id,body_id)
|
||||
available_alts = [] if !available_alts
|
||||
local_alts = getLocalFusionSpriteAlts(head_id,body_id)
|
||||
else
|
||||
available_alts= getBaseSpritesAlts(dex_number)
|
||||
available_alts = [] if !available_alts
|
||||
local_alts = getLocalBaseSpriteAlts(dex_number)
|
||||
end
|
||||
available_alts += local_alts if local_alts
|
||||
available_alts << "autogen" if includeAutogens
|
||||
return available_alts
|
||||
end
|
||||
|
||||
|
||||
#todo: return array for split evolution lines that have multiple final evos
|
||||
def getFinalEvolution(species)
|
||||
#ex: [[B3H4,Level 32],[B2H5, Level 35]]
|
||||
evolution_line = species.get_evolutions
|
||||
return species if evolution_line.empty?
|
||||
finalEvoId = evolution_line[0][0]
|
||||
return evolution_line[]
|
||||
for evolution in evolution_line
|
||||
evoSpecies = evolution[0]
|
||||
p GameData::Species.get(evoSpecies).get_evolutions
|
||||
isFinalEvo = GameData::Species.get(evoSpecies).get_evolutions.empty?
|
||||
return evoSpecies if isFinalEvo
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,377 @@
|
||||
class PokemonPokedexInfo_Scene
|
||||
#todo add indicator to show which one is the main sprite -
|
||||
# also maybe add an indicator in main list for when a sprite has available alts
|
||||
|
||||
Y_POSITION_SMALL = 40 #90
|
||||
Y_POSITION_BIG = 60
|
||||
X_POSITION_PREVIOUS = -30 #20
|
||||
X_POSITION_SELECTED = 105
|
||||
X_POSITION_NEXT = 340 #380
|
||||
|
||||
Y_POSITION_BG_SMALL = 70
|
||||
Y_POSITION_BG_BIG = 93
|
||||
X_POSITION_BG_PREVIOUS = -1
|
||||
X_POSITION_BG_SELECTED = 145
|
||||
X_POSITION_BG_NEXT = 363
|
||||
|
||||
def drawPageForms()
|
||||
#@selected_index=0
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_forms")
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
|
||||
#alts_list= pbGetAvailableAlts
|
||||
@selected_index = 0 if !@selected_index
|
||||
update_displayed
|
||||
end
|
||||
|
||||
def init_selected_bg
|
||||
@sprites["bgSelected_previous"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["bgSelected_previous"].x = X_POSITION_BG_PREVIOUS
|
||||
@sprites["bgSelected_previous"].y = Y_POSITION_BG_SMALL
|
||||
@sprites["bgSelected_previous"].setBitmap("Graphics/Pictures/Pokedex/bg_forms_selected_small")
|
||||
@sprites["bgSelected_previous"].visible = false
|
||||
|
||||
@sprites["bgSelected_center"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["bgSelected_center"].x = X_POSITION_BG_SELECTED
|
||||
@sprites["bgSelected_center"].y = Y_POSITION_BG_BIG
|
||||
@sprites["bgSelected_center"].setBitmap("Graphics/Pictures/Pokedex/bg_forms_selected_large")
|
||||
@sprites["bgSelected_center"].visible = false
|
||||
|
||||
@sprites["bgSelected_next"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["bgSelected_next"].x = X_POSITION_BG_NEXT
|
||||
@sprites["bgSelected_next"].y = Y_POSITION_BG_SMALL
|
||||
@sprites["bgSelected_next"].setBitmap("Graphics/Pictures/Pokedex/bg_forms_selected_small")
|
||||
@sprites["bgSelected_next"].visible = false
|
||||
|
||||
@creditsOverlay = BitmapSprite.new(Graphics.width, Graphics.height, @viewport).bitmap
|
||||
|
||||
end
|
||||
|
||||
def initializeSpritesPage(altsList)
|
||||
@forms_list = list_pokemon_forms()
|
||||
@formIndex = 0
|
||||
|
||||
init_selected_bg
|
||||
@speciesData = getSpecies(@species)
|
||||
|
||||
@selected_index = 0
|
||||
|
||||
set_displayed_to_current_alt(altsList)
|
||||
|
||||
@sprites["selectedSprite"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["selectedSprite"].x = X_POSITION_SELECTED
|
||||
@sprites["selectedSprite"].y = Y_POSITION_BIG
|
||||
@sprites["selectedSprite"].z = 999999
|
||||
@sprites["selectedSprite"].visible = false
|
||||
@sprites["selectedSprite"].zoom_x = 1
|
||||
@sprites["selectedSprite"].zoom_y = 1
|
||||
|
||||
@sprites["previousSprite"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["previousSprite"].x = X_POSITION_PREVIOUS
|
||||
@sprites["previousSprite"].y = Y_POSITION_SMALL
|
||||
@sprites["previousSprite"].visible = false
|
||||
@sprites["previousSprite"].zoom_x = Settings::FRONTSPRITE_SCALE #/2
|
||||
@sprites["previousSprite"].zoom_y = Settings::FRONTSPRITE_SCALE #/2
|
||||
|
||||
@sprites["nextSprite"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["nextSprite"].x = X_POSITION_NEXT
|
||||
@sprites["nextSprite"].y = Y_POSITION_SMALL
|
||||
@sprites["nextSprite"].visible = false
|
||||
@sprites["nextSprite"].zoom_x = Settings::FRONTSPRITE_SCALE #/2
|
||||
@sprites["nextSprite"].zoom_y = Settings::FRONTSPRITE_SCALE #/2
|
||||
|
||||
@sprites["selectedSprite"].z = 9999999
|
||||
@sprites["previousSprite"].z = 9999999
|
||||
@sprites["nextSprite"].z = 9999999
|
||||
|
||||
@selected_pif_sprite = get_pif_sprite(@available[@selected_index])
|
||||
@previous_pif_sprite = get_pif_sprite(@available[@selected_index - 1])
|
||||
@next_pif_sprite = get_pif_sprite(@available[@selected_index + 1])
|
||||
|
||||
@sprites["selectedSprite"].bitmap = load_pif_sprite(@selected_pif_sprite)
|
||||
if altsList.size >= 2
|
||||
@sprites["nextSprite"].bitmap = load_pif_sprite(@next_pif_sprite)
|
||||
@sprites["nextSprite"].visible = true
|
||||
end
|
||||
|
||||
if altsList.size >= 3
|
||||
animated_bitmap =
|
||||
@sprites["previousSprite"].bitmap = load_pif_sprite(@previous_pif_sprite)
|
||||
@sprites["previousSprite"].visible = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def load_pif_sprite(pif_sprite)
|
||||
animated_bitmap = @spritesLoader.load_pif_sprite_directly(pif_sprite)
|
||||
return animated_bitmap.bitmap if animated_bitmap
|
||||
return nil
|
||||
end
|
||||
|
||||
def get_substitution_id(dex_number)
|
||||
if isFusion(dex_number)
|
||||
body_id = getBodyID(dex_number)
|
||||
head_id = getHeadID(dex_number, body_id)
|
||||
species_id = [head_id, body_id]
|
||||
else
|
||||
species_id = dex_number
|
||||
end
|
||||
return species_id
|
||||
end
|
||||
|
||||
def set_displayed_to_current_alt(altsList)
|
||||
dex_number = getDexNumberForSpecies(@species)
|
||||
species_id = get_substitution_id(dex_number)
|
||||
initialize_alt_sprite_substitutions()
|
||||
return if !$PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
|
||||
current_sprite = $PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
|
||||
index = @selected_index
|
||||
for alt in altsList
|
||||
if alt == current_sprite.alt_letter
|
||||
@selected_index = index
|
||||
return
|
||||
end
|
||||
index += 1
|
||||
end
|
||||
end
|
||||
|
||||
def pbGetAvailableForms(species = nil)
|
||||
chosen_species = species != nil ? species : @species
|
||||
dex_num = getDexNumberForSpecies(chosen_species)
|
||||
includeAutogens = isFusion(dex_num)
|
||||
return PokedexUtils.new.pbGetAvailableAlts(chosen_species, includeAutogens)
|
||||
end
|
||||
|
||||
def hide_all_selected_windows
|
||||
@sprites["bgSelected_previous"].visible = false if @sprites["bgSelected_previous"]
|
||||
@sprites["bgSelected_center"].visible = false if @sprites["bgSelected_center"]
|
||||
@sprites["bgSelected_next"].visible = false if @sprites["bgSelected_next"]
|
||||
end
|
||||
|
||||
def update_selected
|
||||
hide_all_selected_windows
|
||||
previous_index = @selected_index == 0 ? @available.size - 1 : @selected_index - 1
|
||||
next_index = @selected_index == @available.size - 1 ? 0 : @selected_index + 1
|
||||
|
||||
get_pif_sprite(@available[@selected_index])
|
||||
@sprites["bgSelected_previous"].visible = true if is_main_sprite(previous_index) && @available.size > 2
|
||||
@sprites["bgSelected_center"].visible = true if is_main_sprite(@selected_index)
|
||||
@sprites["bgSelected_next"].visible = true if is_main_sprite(next_index) && @available.size > 1
|
||||
end
|
||||
|
||||
def get_pif_sprite(alt_letter)
|
||||
dex_number = getDexNumberForSpecies(@species) #@species is a symbol when called from the summary screen and an int from the pokedex... Would be nice to refactor
|
||||
if isFusion(dex_number)
|
||||
body_id = getBodyID(dex_number)
|
||||
head_id = getHeadID(dex_number, body_id)
|
||||
|
||||
#Autogen sprite
|
||||
if alt_letter == "autogen"
|
||||
pif_sprite = PIFSprite.new(:AUTOGEN, head_id, body_id)
|
||||
#Imported custom sprite
|
||||
else
|
||||
#Spritesheet custom sprite
|
||||
pif_sprite = PIFSprite.new(:CUSTOM, head_id, body_id, alt_letter)
|
||||
end
|
||||
else
|
||||
pif_sprite = PIFSprite.new(:BASE, dex_number, nil, alt_letter)
|
||||
end
|
||||
#use local sprites instead if they exist
|
||||
if alt_letter && isLocalSprite(alt_letter)
|
||||
sprite_path = alt_letter.split("_", 2)[1]
|
||||
pif_sprite.local_path = sprite_path
|
||||
end
|
||||
#pif_sprite.dump_info
|
||||
return pif_sprite
|
||||
end
|
||||
|
||||
def isLocalSprite(alt_letter)
|
||||
return alt_letter.start_with?("local_")
|
||||
end
|
||||
|
||||
def isBaseSpritePath(path)
|
||||
filename = File.basename(path).downcase
|
||||
return filename.match?(/\A\d+\.png\Z/)
|
||||
end
|
||||
|
||||
def update_displayed
|
||||
nextIndex = @selected_index + 1
|
||||
previousIndex = @selected_index - 1
|
||||
if nextIndex > @available.size - 1
|
||||
nextIndex = 0
|
||||
end
|
||||
if previousIndex < 0
|
||||
previousIndex = @available.size - 1
|
||||
end
|
||||
@selected_pif_sprite = get_pif_sprite(@available[@selected_index])
|
||||
|
||||
|
||||
@previous_pif_sprite = get_pif_sprite(@available[previousIndex])
|
||||
@next_pif_sprite = get_pif_sprite(@available[nextIndex])
|
||||
|
||||
@sprites["previousSprite"].bitmap = load_pif_sprite(@previous_pif_sprite) if previousIndex != nextIndex
|
||||
@sprites["selectedSprite"].bitmap = load_pif_sprite(@selected_pif_sprite)
|
||||
@sprites["nextSprite"].bitmap = load_pif_sprite(@next_pif_sprite)
|
||||
|
||||
#selected_bitmap = @sprites["selectedSprite"].getBitmap
|
||||
# sprite_path = selected_bitmap.path
|
||||
#isBaseSprite = isBaseSpritePath(@available[@selected_index])
|
||||
is_generated = @selected_pif_sprite.type == :AUTOGEN
|
||||
spritename = @selected_pif_sprite.to_filename()
|
||||
showSpriteCredits(spritename, is_generated)
|
||||
|
||||
update_selected
|
||||
end
|
||||
|
||||
def showSpriteCredits(filename, generated_sprite = false)
|
||||
@creditsOverlay.dispose
|
||||
|
||||
spritename = File.basename(filename, '.*')
|
||||
|
||||
if !generated_sprite
|
||||
discord_name = getSpriteCredits(spritename)
|
||||
discord_name = "Unknown artist" if !discord_name
|
||||
else
|
||||
#todo give credits to Japeal - need to differenciate unfused sprites
|
||||
discord_name = "" #"Japeal\n(Generated)"
|
||||
end
|
||||
discord_name = "Imported sprite" if @selected_pif_sprite.local_path
|
||||
author_name = File.basename(discord_name, '#*')
|
||||
|
||||
x = Graphics.width / 2
|
||||
label_base_color = Color.new(248, 248, 248)
|
||||
label_shadow_color = Color.new(104, 104, 104)
|
||||
@creditsOverlay = BitmapSprite.new(Graphics.width, Graphics.height, @viewport).bitmap
|
||||
split_name = splitSpriteCredits(author_name, @creditsOverlay, @creditsOverlay.width - 20)
|
||||
line_height = @creditsOverlay.text_size(author_name).height
|
||||
textpos = split_name.each_with_index.map { |name, index|
|
||||
y = (Graphics.height - 60) + (line_height * ((index + 1) - ((split_name.length.to_f + 1) / 2)))
|
||||
[name, x, y, 2, label_base_color, label_shadow_color]
|
||||
}
|
||||
pbDrawTextPositions(@creditsOverlay, textpos)
|
||||
end
|
||||
|
||||
def list_pokemon_forms
|
||||
dexNum = dexNum(@species)
|
||||
if dexNum > NB_POKEMON
|
||||
body_id = getBodyID(dexNum)
|
||||
else
|
||||
if @species.is_a?(Symbol)
|
||||
body_id = get_body_number_from_symbol(@species)
|
||||
else
|
||||
body_id = dexNum
|
||||
end
|
||||
end
|
||||
forms_list = []
|
||||
found_last_form = false
|
||||
form_index = 0
|
||||
while !found_last_form
|
||||
form_index += 1
|
||||
form_path = Settings::BATTLERS_FOLDER + body_id.to_s + "_" + form_index.to_s
|
||||
if File.directory?(form_path)
|
||||
forms_list << form_index
|
||||
else
|
||||
found_last_form = true
|
||||
end
|
||||
end
|
||||
return forms_list
|
||||
end
|
||||
|
||||
def pbChooseAlt(brief = false)
|
||||
loop do
|
||||
@sprites["rightarrow"].visible = true
|
||||
@sprites["leftarrow"].visible = true
|
||||
if @forms_list.length >= 1
|
||||
@sprites["uparrow"].visible = true
|
||||
@sprites["downarrow"].visible = true
|
||||
end
|
||||
multiple_forms = @forms_list.length > 0
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::LEFT)
|
||||
pbPlayCursorSE
|
||||
@selected_index -= 1 #(index+@available.length-1)%@available.length
|
||||
if @selected_index < 0
|
||||
@selected_index = @available.size - 1
|
||||
end
|
||||
update_displayed
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
pbPlayCursorSE
|
||||
@selected_index += 1
|
||||
if @selected_index > @available.size - 1
|
||||
@selected_index = 0
|
||||
end
|
||||
update_displayed
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
if select_sprite(brief)
|
||||
@endscene = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
@sprites["uparrow"].visible = false
|
||||
@sprites["downarrow"].visible = false
|
||||
end
|
||||
|
||||
def is_main_sprite(index = nil)
|
||||
dex_number = getDexNumberForSpecies(@species)
|
||||
if !index
|
||||
index = @selected_index
|
||||
end
|
||||
species_id = get_substitution_id(dex_number)
|
||||
|
||||
current_pif_sprite = $PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
selected_pif_sprite = get_pif_sprite(@available[index])
|
||||
|
||||
if current_pif_sprite
|
||||
return current_pif_sprite.equals(selected_pif_sprite)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def sprite_is_alt(sprite_path)
|
||||
spritename = File.basename(sprite_path, '.*')
|
||||
return spritename.match?(/[a-zA-Z]/)
|
||||
end
|
||||
|
||||
def select_sprite(brief = false)
|
||||
if @available.length > 1
|
||||
if is_main_sprite()
|
||||
if brief
|
||||
pbMessage(_INTL("This sprite will remain the displayed sprite"))
|
||||
return true
|
||||
else
|
||||
pbMessage(_INTL("This sprite is already the displayed sprite"))
|
||||
end
|
||||
else
|
||||
message = _INTL('Would you like to use this sprite instead of the current sprite?')
|
||||
if pbConfirmMessage(message)
|
||||
swap_main_sprite()
|
||||
return true
|
||||
end
|
||||
end
|
||||
else
|
||||
pbMessage(_INTL("This is the only sprite available for this Pokémon!"))
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def swap_main_sprite
|
||||
species_number = dexNum(@species)
|
||||
substitution_id = get_substitution_id(species_number)
|
||||
$PokemonGlobal.alt_sprite_substitutions[substitution_id] = @selected_pif_sprite
|
||||
end
|
||||
end
|
||||
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :alt_sprite_substitutions
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
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
|
||||
|
||||
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
|
||||
@@ -0,0 +1,148 @@
|
||||
KANTO_DARKNESS_STAGE_1 = [
|
||||
50, # Lavender town
|
||||
409, # Route 8
|
||||
351, # Route 9 (east)
|
||||
495, # Route 9 (west)
|
||||
154, # Route 10
|
||||
108, # Saffron city
|
||||
1, # Cerulean City
|
||||
387, # Cerulean City (race)
|
||||
106, # Route 4
|
||||
8, # Route 24
|
||||
9, # Route 25
|
||||
400, # Pokemon Tower
|
||||
401, # Pokemon Tower
|
||||
402, # Pokemon Tower
|
||||
403, # Pokemon Tower
|
||||
467, # Pokemon Tower
|
||||
468, # Pokemon Tower
|
||||
469, # Pokemon Tower
|
||||
159, # Route 12
|
||||
349, # Rock tunnel
|
||||
350, # Rock tunnel
|
||||
512, # Rock tunnel (outdoor)
|
||||
12, # Route 5
|
||||
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_2 = [
|
||||
95, # Celadon city
|
||||
436, # Celadon city dept store (roof)
|
||||
143, # Route 23
|
||||
167, # Crimson city
|
||||
413, # Route 7
|
||||
438, # Route 16
|
||||
146, # Route 17
|
||||
106, # Route 4
|
||||
19, # Vermillion City
|
||||
36, # S.S. Anne deck
|
||||
16, # Route 6
|
||||
437, # Route 13
|
||||
155, # Route 11
|
||||
140, # Diglett cave
|
||||
398, # Diglett cave
|
||||
399, # Diglett cave
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_3 = [
|
||||
472, # Fuchsia city
|
||||
445, # Safari Zone 1
|
||||
484, # Safari Zone 2
|
||||
485, # Safari Zone 3
|
||||
486, # Safari Zone 4
|
||||
487, # Safari Zone 5
|
||||
444, # Route 15
|
||||
440, # Route 14
|
||||
712, # Creepy house
|
||||
517, # Route 18
|
||||
57, # Route 19
|
||||
227, # Route 19 (underwater)
|
||||
56, # Route 19 (surf race)
|
||||
58, # Route 20
|
||||
480, # Route 20 underwater 1
|
||||
228, # Route 20 underwater 2
|
||||
98, # Cinnabar island
|
||||
58, # Route 21
|
||||
827, # Mt. Moon summit
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_4 = KANTO_OUTDOOR_MAPS
|
||||
|
||||
def darknessEffectOnCurrentMap()
|
||||
return if !$game_switches
|
||||
return if !$game_switches[SWITCH_KANTO_DARKNESS]
|
||||
return darknessEffectOnMap($game_map.map_id)
|
||||
end
|
||||
|
||||
def darknessEffectOnMap(map_id)
|
||||
return if !$game_switches
|
||||
return if !$game_switches[SWITCH_KANTO_DARKNESS]
|
||||
return if !KANTO_OUTDOOR_MAPS.include?(map_id)
|
||||
dark_maps = []
|
||||
dark_maps += KANTO_DARKNESS_STAGE_1 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_1]
|
||||
dark_maps += KANTO_DARKNESS_STAGE_2 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_2]
|
||||
dark_maps += KANTO_DARKNESS_STAGE_3 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_3]
|
||||
dark_maps = KANTO_OUTDOOR_MAPS if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_4]
|
||||
return dark_maps.include?(map_id)
|
||||
end
|
||||
|
||||
def apply_darkness()
|
||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||
darkness = $PokemonTemp.darknessSprite
|
||||
darkness.radius = 276
|
||||
while darkness.radius > 64
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
darkness.radius -= 4
|
||||
end
|
||||
$PokemonGlobal.flashUsed = false
|
||||
$PokemonTemp.darknessSprite.dispose
|
||||
Events.onMapSceneChange.trigger(self, $scene, true)
|
||||
end
|
||||
|
||||
def isInMtMoon()
|
||||
mt_moon_maps = [102, 103, 105, 496, 104]
|
||||
return mt_moon_maps.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
def getMtMoonDirection()
|
||||
maps_east = [380, # Pewter city
|
||||
490, # Route 3
|
||||
303, # indigo plateau
|
||||
145, # Route 26
|
||||
147, # Route 27
|
||||
]
|
||||
maps_south = [
|
||||
8, # Route 24
|
||||
9, # Route 25
|
||||
143, # Route 23
|
||||
167, # Crimson city
|
||||
]
|
||||
maps_west = [
|
||||
106, # route 4
|
||||
1, # cerulean
|
||||
495, # route 9
|
||||
351, # route 9
|
||||
10 # cerulean cape
|
||||
]
|
||||
return 2 if maps_south.include?($game_map.map_id)
|
||||
return 4 if maps_west.include?($game_map.map_id)
|
||||
return 6 if maps_east.include?($game_map.map_id)
|
||||
return 8 # north (most maps)
|
||||
end
|
||||
|
||||
def getNextLunarFeatherHint()
|
||||
nb_feathers = pbGet(VAR_LUNAR_FEATHERS)
|
||||
case nb_feathers
|
||||
when 0
|
||||
return _INTL("Find the first feather in the northernmost dwelling in the port of exquisite sunsets...")
|
||||
when 1
|
||||
return _INTL("Amidst a nursery for Pokémon youngsters, the second feather hides, surrounded by innocence.")
|
||||
when 2
|
||||
return _INTL("Find the next one in the inn where water meets rest")
|
||||
when 3
|
||||
return _INTL("Find the next one inside the lone house in the city at the edge of civilization.")
|
||||
when 4
|
||||
return _INTL("The final feather lies back in the refuge for orphaned Pokémon...")
|
||||
else
|
||||
return _INTL("Lie in the bed... Bring me the feathers...")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
#Eevee quest
|
||||
Events.onStepTaken+=proc {|sender,e|
|
||||
next if !$game_switches[173]
|
||||
next if !$game_switches[179] #If not outside of building
|
||||
$game_variables[102]+=1
|
||||
|
||||
if $game_variables[102] % 100 == 0 then
|
||||
$game_variables[101]+=1
|
||||
end
|
||||
|
||||
if $game_variables[102] >= 400 then
|
||||
if $game_variables[102] % 100 == 0 then
|
||||
Kernel.pbMessage(_INTL("Eevee is getting tired. You should head back soon!"))
|
||||
cry=pbResolveAudioSE(pbCryFile(133))
|
||||
pbSEPlay(cry,100,100)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
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 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 isTuesdayNight()
|
||||
day = getDayOfTheWeek()
|
||||
hour = pbGetTimeNow().hour
|
||||
echoln hour
|
||||
return (day == :TUESDAY && hour >= 20) || (day == :WEDNESDAY && hour < 5)
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
def getBlackMarketOriginalTrainer
|
||||
randomTrainer = GameData::Trainer.list_all.values.sample
|
||||
return randomTrainer
|
||||
# trainer = NPCTrainer.new("", randomTrainer.id)
|
||||
# return trainer
|
||||
end
|
||||
|
||||
|
||||
198
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/QuestIcons.rb
Normal file
198
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/QuestIcons.rb
Normal file
@@ -0,0 +1,198 @@
|
||||
def setDialogIconOff(eventId=nil)
|
||||
eventId = @event_id if !eventId
|
||||
event = $game_map.events[eventId]
|
||||
event.setDialogIconManualOffValue(true)
|
||||
event.setTradeIconManualOffValue(true)
|
||||
end
|
||||
|
||||
def setDialogIconOn(eventId=nil)
|
||||
eventId = @event_id if !eventId
|
||||
event = $game_map.events[eventId]
|
||||
event.setDialogIconManualOffValue(false)
|
||||
event.setTradeIconManualOffValue(false)
|
||||
|
||||
end
|
||||
class Game_Event < Game_Character
|
||||
#set from analyzing the event's content at load
|
||||
attr_accessor :show_quest_icon
|
||||
attr_accessor :show_dialog_icon
|
||||
attr_accessor :show_trade_icon
|
||||
|
||||
#set manually from inside the event when triggered
|
||||
attr_accessor :quest_icon_manual_off
|
||||
attr_accessor :dialog_icon_manual_off
|
||||
attr_accessor :trade_icon_manual_off
|
||||
|
||||
QUEST_NPC_TRIGGER = "questNPC"
|
||||
MAPS_WITH_NO_ICONS = [] #Maps in which the game shouldn't try to look for quest icons(e.g. maps with a lot of events - mostly for possible performance issues)
|
||||
DIALOG_ICON_COMMENT_TRIGGER=["dialogIcon"]
|
||||
TRADE_ICON_COMMENT_TRIGGER=["tradeIcon"]
|
||||
|
||||
alias eventQuestIcon_init initialize
|
||||
def initialize(map_id, event, map=nil)
|
||||
eventQuestIcon_init(map_id, event, map)
|
||||
addQuestMarkersToSprite unless MAPS_WITH_NO_ICONS.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
def setDialogIconManualOffValue(value)
|
||||
@dialog_icon_manual_off=value
|
||||
@show_dialog_icon = !@dialog_icon_manual_off
|
||||
end
|
||||
def setQuestIconManualOffValue(value)
|
||||
@quest_icon_manual_off=value
|
||||
@show_quest_icon = !@quest_icon_manual_off
|
||||
end
|
||||
def setTradeIconManualOffValue(value)
|
||||
@trade_icon_manual_off=value
|
||||
@show_trade_icon = !@trade_icon_manual_off
|
||||
end
|
||||
|
||||
def addQuestMarkersToSprite()
|
||||
@show_quest_icon = detectQuestSwitch(self) && !@quest_icon_manual_off
|
||||
@show_dialog_icon = detectDialogueIcon(self) && !@dialog_icon_manual_off
|
||||
@show_trade_icon = detectTradeIcon(self) && !@trade_icon_manual_off
|
||||
end
|
||||
|
||||
def detectDialogueIcon(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
page = pbGetActiveEventPage(event)
|
||||
first_command = page.list[0]
|
||||
return nil if !(first_command.code == 108 || first_command.code == 408)
|
||||
comments = first_command.parameters
|
||||
return comments.any? { |str| DIALOG_ICON_COMMENT_TRIGGER.include?(str) }
|
||||
end
|
||||
|
||||
def detectTradeIcon(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
page = pbGetActiveEventPage(event)
|
||||
first_command = page.list[0]
|
||||
return nil if !(first_command.code == 108 || first_command.code == 408)
|
||||
comments = first_command.parameters
|
||||
return comments.any? { |str| TRADE_ICON_COMMENT_TRIGGER.include?(str) }
|
||||
end
|
||||
|
||||
def detectQuestSwitch(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
name = event.name.clone
|
||||
match = name.match(/#{Regexp.escape(QUEST_NPC_TRIGGER)}\(([^)]+)\)/) # Capture anything inside parentheses
|
||||
return nil unless match
|
||||
quest_id = match[1]
|
||||
quest_id = quest_id.gsub(/^['"]|['"]$/, '') # Remove quotes if they exist
|
||||
return nil if isQuestAlreadyAccepted?(quest_id)
|
||||
|
||||
return quest_id
|
||||
end
|
||||
|
||||
def validateEventIsCompatibleWithIcons(event)
|
||||
return false if event.is_a?(Game_Player)
|
||||
return false if event.erased
|
||||
page = pbGetActiveEventPage(event)
|
||||
return false unless page
|
||||
return false if page.graphic.character_name.empty?
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Sprite_Character
|
||||
|
||||
DIALOGUE_ICON_NAME = "Graphics/Pictures/Quests/dialogIcon"
|
||||
QUEST_ICON_NAME = "Graphics/Pictures/Quests/questIcon"
|
||||
TRADE_ICON_NAME = "Graphics/Pictures/Quests/tradeIcon"
|
||||
|
||||
attr_accessor :questIcon
|
||||
alias questIcon_init initialize
|
||||
def initialize(viewport, character = nil, is_follower=nil)
|
||||
questIcon_init(viewport,character)
|
||||
if character.is_a?(Game_Event) && character.show_dialog_icon
|
||||
addQuestMarkerToSprite(:DIALOG_ICON)
|
||||
end
|
||||
if character.is_a?(Game_Event) && character.show_quest_icon
|
||||
addQuestMarkerToSprite(:QUEST_ICON)
|
||||
end
|
||||
if character.is_a?(Game_Event) && character.show_trade_icon
|
||||
addQuestMarkerToSprite(:TRADE_ICON)
|
||||
end
|
||||
#addQuestMarkersToSprite(character) unless MAPS_WITH_NO_ICONS.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# def addQuestMarkersToSprite(character)
|
||||
# quest_id = detectQuestSwitch(character)
|
||||
# if quest_id
|
||||
# addQuestMarkerToSprite(:QUEST_ICON)
|
||||
# else
|
||||
# addQuestMarkerToSprite(:DIALOG_ICON) if detectDialogueIcon(character)
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
alias questIcon_update update
|
||||
def update
|
||||
questIcon_update
|
||||
updateGameEvent if @character.is_a?(Game_Event)
|
||||
end
|
||||
|
||||
def updateGameEvent
|
||||
removeQuestIcon if !@character.show_dialog_icon && !@character.show_quest_icon && !@character.show_trade_icon
|
||||
positionQuestIndicator if @questIcon
|
||||
end
|
||||
|
||||
alias questIcon_dispose dispose
|
||||
def dispose
|
||||
questIcon_dispose
|
||||
removeQuestIcon
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
# Event name must contain questNPC(x) for a quest icon to be displayed
|
||||
# Where x is the quest ID
|
||||
# if the quest has not already been accepted, the quest marker will be shown
|
||||
|
||||
|
||||
|
||||
|
||||
#type: :QUEST_ICON, :DIALOG_ICON
|
||||
def addQuestMarkerToSprite(iconType)
|
||||
removeQuestIcon if @questIcon
|
||||
@questIcon = Sprite.new(@viewport)
|
||||
case iconType
|
||||
when :QUEST_ICON
|
||||
iconPath = QUEST_ICON_NAME
|
||||
when :DIALOG_ICON
|
||||
iconPath = DIALOGUE_ICON_NAME
|
||||
when :TRADE_ICON
|
||||
iconPath = TRADE_ICON_NAME
|
||||
end
|
||||
return if !iconPath
|
||||
@questIcon.bmp(iconPath)
|
||||
positionQuestIndicator if @questIcon
|
||||
end
|
||||
|
||||
def positionQuestIndicator()
|
||||
return if !@questIcon
|
||||
return if !@questIcon.bitmap
|
||||
|
||||
y_offset =-70
|
||||
|
||||
@questIcon.ox = @questIcon.bitmap.width / 2.0
|
||||
@questIcon.oy = @questIcon.bitmap.height / 2.0
|
||||
|
||||
x_position = @character.screen_x
|
||||
y_position = @character.screen_y + y_offset
|
||||
@questIcon.x = x_position
|
||||
@questIcon.y = y_position
|
||||
@questIcon.z = 999
|
||||
end
|
||||
|
||||
def removeQuestIcon()
|
||||
@questIcon.dispose if @questIcon
|
||||
@questIcon = nil
|
||||
end
|
||||
|
||||
end
|
||||
1154
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/QuestLogScript.rb
Normal file
1154
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/QuestLogScript.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Rewards given by hotel questman after a certain nb. of completed quests
|
||||
#
|
||||
QUEST_REWARDS = [
|
||||
QuestReward.new(1, :HM08, 1, _INTL("This HM will allow you to illuminate dark caves and should help you to progress in your journey!")),
|
||||
QuestReward.new(5, :AMULETCOIN, 1, _INTL("This item will allows you to get twice the money in a battle if the Pokémon holding it took part in it!")),
|
||||
QuestReward.new(10, :LANTERN, 1, _INTL("This will allow you to illuminate caves without having to use a HM! Practical, isn't it?")),
|
||||
QuestReward.new(15, :LINKINGCORD, 3, _INTL("This strange cable triggers the evolution of Pokémon that typically evolve via trade. I know you'll put it to good use!")),
|
||||
QuestReward.new(20, :SLEEPINGBAG, 1, _INTL("This handy item will allow you to sleep anywhere you want. You won't even need hotels anymore!")),
|
||||
QuestReward.new(30, :MISTSTONE, 1, _INTL("This rare stone can evolve any Pokémon, regardless of their level or evolution method. Use it wisely!"), true),
|
||||
QuestReward.new(50, :GSBALL, 1, _INTL("This mysterious ball is rumored to be the key to call upon the protector of Ilex Forest. It's a precious relic.")),
|
||||
QuestReward.new(60, :MASTERBALL, 1, _INTL("This rare ball can catch any Pokémon. Don't waste it!"), true),
|
||||
]
|
||||
@@ -0,0 +1,32 @@
|
||||
def failAllIncompleteRocketQuests()
|
||||
for trainer_quest in $Trainer.quests
|
||||
finishTRQuest("tr_cerulean_1", :FAILURE) if trainer_quest.id == "tr_cerulean_1" && !pbCompletedQuest?("tr_cerulean_1")
|
||||
finishTRQuest("tr_cerulean_2", :FAILURE) if trainer_quest.id == "tr_cerulean_2" && !pbCompletedQuest?("tr_cerulean_2")
|
||||
finishTRQuest("tr_cerulean_3", :FAILURE) if trainer_quest.id == "tr_cerulean_3" && !pbCompletedQuest?("tr_cerulean_3")
|
||||
finishTRQuest("tr_cerulean_4", :FAILURE) if trainer_quest.id == "tr_cerulean_4" && !pbCompletedQuest?("tr_cerulean_4")
|
||||
|
||||
finishTRQuest("tr_celadon_1", :FAILURE) if trainer_quest.id == "tr_celadon_1" && !pbCompletedQuest?("tr_celadon_1")
|
||||
finishTRQuest("tr_celadon_2", :FAILURE) if trainer_quest.id == "tr_celadon_2" && !pbCompletedQuest?("tr_celadon_2")
|
||||
finishTRQuest("tr_celadon_3", :FAILURE) if trainer_quest.id == "tr_celadon_3" && !pbCompletedQuest?("tr_celadon_3")
|
||||
finishTRQuest("tr_celadon_4", :FAILURE) if trainer_quest.id == "tr_celadon_4" && !pbCompletedQuest?("tr_celadon_4")
|
||||
end
|
||||
end
|
||||
|
||||
def Kernel.setRocketPassword(variableNum)
|
||||
abilityIndex = rand(233)
|
||||
speciesIndex = rand(PBSpecies.maxValue - 1)
|
||||
|
||||
word1 = PBSpecies.getName(speciesIndex)
|
||||
word2 = GameData::Ability.get(abilityIndex).name
|
||||
password = _INTL("{1}'s {2}", word1, word2)
|
||||
pbSet(variableNum, password)
|
||||
end
|
||||
|
||||
def initialize_quest_points
|
||||
return if $Trainer.quest_points
|
||||
$Trainer.quest_points = get_completed_quests(false).length
|
||||
end
|
||||
|
||||
def player_has_quest_journal?
|
||||
return $PokemonBag.pbHasItem?(:DEVONSCOPE) || $PokemonBag.pbHasItem?(:NOTEBOOK)
|
||||
end
|
||||
150
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/Quests.rb
Normal file
150
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/Quests.rb
Normal file
@@ -0,0 +1,150 @@
|
||||
def define_quest(quest_id,quest_type,quest_name,quest_description,quest_location,npc_sprite)
|
||||
case quest_type
|
||||
when :HOTEL_QUEST
|
||||
text_color = HotelQuestColor
|
||||
when :FIELD_QUEST
|
||||
text_color = FieldQuestColor
|
||||
when :LEGENDARY_QUEST
|
||||
text_color = LegendaryQuestColor
|
||||
when :ROCKET_QUEST
|
||||
text_color = TRQuestColor
|
||||
end
|
||||
new_quest = Quest.new(quest_id, quest_name, quest_description, npc_sprite, quest_location, quest_location, text_color)
|
||||
QUESTS[quest_id] = new_quest
|
||||
end
|
||||
|
||||
QUESTS = {
|
||||
#Pokemart
|
||||
"pokemart_johto" => Quest.new("pokemart_johto", _INTL("Johto Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Johto region."), "traveler_johto", _INTL("Cerulean City"), HotelQuestColor),
|
||||
"pokemart_hoenn" => Quest.new("pokemart_hoenn", _INTL("Hoenn Pokémon"), _INTL("A traveler in the PokéMart you to show him a Pokémon native to the Hoenn region."), "traveler_hoenn", _INTL("Vermillion City"), HotelQuestColor),
|
||||
"pokemart_sinnoh" => Quest.new("pokemart_sinnoh", _INTL("Sinnoh Pokémon"), _INTL("A traveler in the Department Center wants you to show him a Pokémon native to the Sinnoh region."), "traveler_sinnoh", _INTL("Celadon City"), HotelQuestColor),
|
||||
"pokemart_unova" => Quest.new( "pokemart_unova", _INTL("Unova Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Unova region."), "traveler_unova", _INTL("Fuchsia City"), HotelQuestColor),
|
||||
"pokemart_kalos" => Quest.new("pokemart_kalos", _INTL("Kalos Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Kalos region."), "traveler_kalos", _INTL("Saffron City"), HotelQuestColor),
|
||||
"pokemart_alola" => Quest.new("pokemart_alola", _INTL("Alola Pokémon"), _INTL("A traveler in the PokéMart wants you to show him a Pokémon native to the Alola region."), "traveler_alola", _INTL("Cinnabar Island"), HotelQuestColor),
|
||||
|
||||
|
||||
#Pewter hotel
|
||||
"pewter_1" => Quest.new("pewter_1", _INTL("Mushroom Gathering"), _INTL("A lady in Pewter City wants you to bring her 3 TinyMushroom from Viridian Forest to make a stew."), "BW (74)", _INTL("Pewter City"), HotelQuestColor),
|
||||
"pewter_2" =>Quest.new("pewter_2", _INTL("Lost Medicine"), _INTL("A youngster in Pewter City needs your help to find a lost Revive. He lost it by sitting on a bench somewhere in Pewter City."), "BW (19)", _INTL("Pewter City"), HotelQuestColor),
|
||||
"pewter_3" =>Quest.new("pewter_3", _INTL("Bug Evolution "), _INTL("A Bug Catcher in Pewter City wants you to show him a fully-evolved Bug Pokémon."), "BWBugCatcher_male", _INTL("Pewter City"), HotelQuestColor),
|
||||
"pewter_field_1" => Quest.new("pewter_field_1", _INTL("Nectar garden"), _INTL("An old man wants you to bring differently colored flowers for the city's garden."), "BW (039)", _INTL("Pewter City"), FieldQuestColor),
|
||||
"pewter_field_2" => Quest.new("pewter_field_2", _INTL("I Choose You!"), _INTL("A Pikachu in the PokéMart has lost its official Pokémon League Hat. Find one and give it to the Pikachu!"), "YOUNGSTER_LeagueHat", _INTL("Pewter City"), FieldQuestColor),
|
||||
"pewter_field_3" => Quest.new("pewter_field_3", _INTL("Prehistoric Amber!"), _INTL("Meetup with a scientist in Viridian Forest to look for prehistoric amber."), "BW (82)", _INTL("Pewter City"), FieldQuestColor),
|
||||
|
||||
#Cerulean hotel
|
||||
"cerulean_1" => Quest.new("cerulean_1", _INTL("Playing Cupid"), _INTL("A boy in Cerulean City wants you bring a love letter to a Pokémon Breeder named Maude. She's probably somewhere in one of the routes near Cerulean City"), "BW (18)", _INTL("Cerulean City"), HotelQuestColor),
|
||||
"cerulean_2" => Quest.new("cerulean_2", _INTL("Type Experts"), _INTL("Defeat all of the Type Experts scattered around the Kanto region ({1}/{2})",pbGet(VAR_TYPE_EXPERTS_BEATEN),TOTAL_NB_TYPE_EXPERTS), "expert-normal", _INTL("Cerulean City"), HotelQuestColor),
|
||||
|
||||
#Route 24
|
||||
"cerulean_field_1" => Quest.new("cerulean_field_1", _INTL("Field Research (Part 1)"), _INTL("Professor Oak's aide wants you to catch an Abra."), "BW (82)", _INTL("Route 24"), FieldQuestColor),
|
||||
"cerulean_field_2" => Quest.new("cerulean_field_2", _INTL("Field Research (Part 2)"), _INTL("Professor Oak's aide wants you to encounter every Pokémon on Route 24."), "BW (82)", _INTL("Route 24"), FieldQuestColor),
|
||||
"cerulean_field_3" => Quest.new("cerulean_field_3", _INTL("Field Research (Part 3)"), _INTL("Professor Oak's aide wants you to catch a Buneary using the Pokéradar."), "BW (82)", _INTL("Route 24"), FieldQuestColor),
|
||||
|
||||
#Vermillion City
|
||||
"vermillion_2" => Quest.new("vermillion_2", _INTL("Fishing for Sole"), _INTL("A fisherman wants you to fish up an old boot. Hook it up with the old rod in any body of water."), "BW (71)", _INTL("Cerulean City"), HotelQuestColor),
|
||||
"vermillion_1" => Quest.new("vermillion_1", _INTL("Unusual Types 1"), _INTL("A woman at the hotel wants you to show her a Water/Fire-type Pokémon"), "BW (58)", _INTL("Vermillion City"), HotelQuestColor),
|
||||
"vermillion_3" => Quest.new("vermillion_3", _INTL("Seafood Cocktail "), _INTL("Get some steamed Krabby legs from the S.S. Anne's kitchen and bring them back to the hotel before they get cold"), "BW (36)", _INTL("Vermillion City"), HotelQuestColor),
|
||||
"vermillion_field_1" => Quest.new("vermillion_field_1", _INTL("Building Materials "), _INTL("Get some wooden planks from Viridian City and some Bricks from Pewter City."), "BW (36)", _INTL("Vermillion City"), FieldQuestColor),
|
||||
"vermillion_field_2" => Quest.new("vermillion_field_2", _INTL("Waiter on the Water"), _INTL("The S.S. Anne waiter wants you to take restaurant orders while he went to get a replacement cake."), "BW (53)", _INTL("S.S. Anne"), FieldQuestColor),
|
||||
|
||||
#Celadon City
|
||||
"celadon_1" => Quest.new("celadon_1", _INTL("Sun or Moon"), _INTL("Show the Pokémon that Eevee evolves when exposed to a Moon or Sun stone to help the scientist with her research."), "BW (82)", _INTL("Celadon City"), HotelQuestColor),
|
||||
"celadon_2" => Quest.new("celadon_2", _INTL("For Whom the Bell Tolls"), _INTL("Ring Lavender Town's bell when the time is right to reveal its secret."), "BW (40)", _INTL("Lavender Town"), HotelQuestColor),
|
||||
"celadon_3" => Quest.new("celadon_3", _INTL("Hardboiled"), _INTL("A lady wants you to give her an egg to make an omelette.", "BW (24)"), _INTL("Celadon City"), HotelQuestColor),
|
||||
"celadon_field_1" => Quest.new("celadon_field_1", _INTL("A stroll with Eevee!"), _INTL("Walk Eevee around for a while until it gets tired."), "BW (37)", _INTL("Celadon City"), FieldQuestColor),
|
||||
|
||||
#Fuchsia City
|
||||
"fuchsia_1" => Quest.new("fuchsia_1", _INTL("Bicycle Race!"), _INTL("Go meet the Cyclist at the bottom of Route 17 and beat her time up the Cycling Road!"), "BW032", _INTL("Cycling Road"), HotelQuestColor),
|
||||
"fuchsia_2" => Quest.new("fuchsia_2", _INTL("Lost Pokémon!"), _INTL("Find the lost Chansey's trainer!"), "113", _INTL("Fuchsia City"), HotelQuestColor),
|
||||
"fuchsia_3" => Quest.new("fuchsia_3", _INTL("Cleaning up the Cycling Road"), _INTL("Get rid of all the Pokémon dirtying up the Cycling Road."), "BW (77)", _INTL("Fuchsia City"), HotelQuestColor),
|
||||
"fuchsia_4" => Quest.new("fuchsia_4", _INTL("Bitey Pokémon"), _INTL("A fisherman wants to know what is the sharp-toothed Pokémon that bit him in the Safari Zone's lake."), "BW (71)", _INTL("Fuchsia City"), HotelQuestColor),
|
||||
|
||||
#Crimson City
|
||||
"crimson_1" => Quest.new("crimson_1", _INTL("Shellfish Rescue"), _INTL("Put all the stranded Shellders back in the water on the route to Crimson City."), "BW (48)", _INTL("Crimson City"), HotelQuestColor),
|
||||
"crimson_2" => Quest.new("crimson_2", _INTL("Fourth Round Rumble"), _INTL("Defeat Jeanette and her high-level Bellsprout in a Pokémon Battle"), "BW024", _INTL("Crimson City"), HotelQuestColor),
|
||||
"crimson_3" => Quest.new("crimson_3", _INTL("Unusual Types 2"), _INTL("A woman at the hotel wants you to show her a Normal/Ghost-type Pokémon"), "BW (58)", _INTL("Crimson City"), HotelQuestColor),
|
||||
"crimson_4" => Quest.new("crimson_4", _INTL("The Top of the Waterfall"), _INTL("Someone wants you to go investigate the top of a waterfall near Crimson City"), "BW (28)", _INTL("Crimson City"), HotelQuestColor),
|
||||
|
||||
#Saffron City
|
||||
"saffron_1" => Quest.new("saffron_1", _INTL("Lost Puppies"), _INTL("Find all of the missing Growlithe in the routes around Saffron City."), "BW (73)", _INTL("Saffron City"), HotelQuestColor),
|
||||
"saffron_2" => Quest.new("saffron_2", _INTL("Invisible Pokémon"), _INTL("Find an invisible Pokémon in the eastern part of Saffron City."), "BW (57)", _INTL("Saffron City"), HotelQuestColor),
|
||||
"saffron_3" => Quest.new("saffron_3", _INTL("Bad to the Bone!"), _INTL("Find a Rare Bone using Rock Smash."), "BW (72)", _INTL("Saffron City"), HotelQuestColor),
|
||||
"saffron_field_1" => Quest.new("saffron_field_1", _INTL("Dancing Queen!"), _INTL("Dance with the Copycat Girl!"), "BW (24)", _INTL("Saffron City (nightclub)"), FieldQuestColor),
|
||||
|
||||
#Cinnabar Island
|
||||
"cinnabar_1" => Quest.new("cinnabar_1", _INTL("The transformation Pokémon"), _INTL("The scientist wants you to find some Quick Powder that can sometimes be found with wild Ditto in the mansion's basement."), "BW (82)", _INTL("Cinnabar Island"), HotelQuestColor),
|
||||
"cinnabar_2" => Quest.new("cinnabar_2", _INTL("Diamonds and Pearls"), _INTL("Find a Diamond Necklace to save the man's marriage."), "BW (71)", _INTL("Cinnabar Island"), HotelQuestColor),
|
||||
"cinnabar_3" => Quest.new("cinnabar_3", _INTL("Stolen artifact"), _INTL("Recover a stolen vase from a burglar in the Pokémon Mansion"), "BW (21)", _INTL("Cinnabar Island"), HotelQuestColor),
|
||||
|
||||
#Goldenrod City
|
||||
"goldenrod_1" => Quest.new( "goldenrod_1", _INTL("Safari Souvenir!"), _INTL("Bring back a souvenir from the Fuchsia City Safari Zone"), "BW (28)", _INTL("Goldenrod City"), HotelQuestColor),
|
||||
"goldenrod_2" => Quest.new("goldenrod_2", _INTL("The Cursed Forest"), _INTL("A child wants you to find a floating tree stump in Ilex Forest. What could she be talking about?"), "BW109", _INTL("Goldenrod City"), HotelQuestColor),
|
||||
|
||||
"goldenrod_police_1" => Quest.new("goldenrod_police_1", _INTL("Undercover police work!"), _INTL("Go see the police in Goldenrod City to help them with an important police operation."), "BW (80)", _INTL("Goldenrod City"), FieldQuestColor),
|
||||
"pinkan_police" => Quest.new("pinkan_police", _INTL("Pinkan Island!"), _INTL("Team Rocket is planning a heist on Pinkan Island. You joined forces with the police to stop them!"), "BW (80)", _INTL("Goldenrod City"), FieldQuestColor),
|
||||
|
||||
#Violet City
|
||||
"violet_1" => Quest.new("violet_1", _INTL("Defuse the Pinecones!"), _INTL("Get rid of all the Pineco on Route 31 and Route 30"), "BW (64)", _INTL("Violet City"), HotelQuestColor),
|
||||
"violet_2" => Quest.new("violet_2", _INTL("Find Slowpoke's Tail!"), _INTL("Find a SlowpokeTail in some flowers, somewhere around Violet City!"), "BW (19)", _INTL("Violet City"), HotelQuestColor),
|
||||
|
||||
#Blackthorn City
|
||||
"blackthorn_1" => Quest.new( "blackthorn_1", _INTL("Dragon Evolution"), _INTL("A Dragon Tamer in Blackthorn City wants you to show her a fully-evolved Dragon Pokémon."), "BW014", _INTL("Blackthorn City"), HotelQuestColor),
|
||||
"blackthorn_2" => Quest.new("blackthorn_2", _INTL("Sunken Treasure!"), _INTL("Find an old memorabilia on a sunken ship near Cinnabar Island."), "BW (28)", _INTL("Blackthorn City"), HotelQuestColor),
|
||||
"blackthorn_3" => Quest.new("blackthorn_3", _INTL("The Largest Carp"), _INTL("A fisherman wants you to fish up a Magikarp that's exceptionally high-level at Dragon's Den."), "BW (71)", _INTL("Blackthorn City"), HotelQuestColor),
|
||||
|
||||
#Ecruteak City
|
||||
"ecruteak_1" => Quest.new("ecruteak_1", _INTL("Ghost Evolution"), _INTL("A girl in Ecruteak City wants you to show her a fully-evolved Ghost Pokémon."), "BW014", _INTL("Ecruteak City"), HotelQuestColor),
|
||||
|
||||
#Kin Island
|
||||
"kin_1" => Quest.new("kin_1", _INTL("Banana Slamma!"), _INTL("Collect 30 bananas"), "BW059", _INTL("Kin Island"), HotelQuestColor),
|
||||
"kin_2" => Quest.new("kin_2", _INTL("Fallen Meteor"), _INTL("Investigate a crater near Bond Bridge."), "BW009", _INTL("Kin Island"), HotelQuestColor),
|
||||
"kin_field_1" => Quest.new("kin_field_1", _INTL("The rarest fish"), _INTL("A fisherman wants you to show him a Feebas. Apparently they can be fished around the Sevii Islands when it rains."), "BW056", _INTL("Kin Island"), FieldQuestColor),
|
||||
|
||||
"legendary_deoxys_1" => Quest.new("legendary_deoxys_1", _INTL("First Contact"), _INTL("Find the missing pieces of a fallen alien spaceship"), "BW (92)", _INTL("Bond Bridge"), LegendaryQuestColor),
|
||||
"legendary_deoxys_2" => Quest.new("legendary_deoxys_2", _INTL("First Contact (Part 2)"), _INTL("Ask the sailor at Cinnabar Island's harbour to take you to the uncharted island where the spaceship might be located"), "BW (92)", _INTL("Bond Bridge"), LegendaryQuestColor),
|
||||
|
||||
#Necrozma quest
|
||||
"legendary_necrozma_1" => Quest.new("legendary_necrozma_1", _INTL("Mysterious prisms"), _INTL("You found a pedestal with a mysterious prism on it. There seems to be room for more prisms."), "BW_Sabrina", _INTL("Pokémon Tower"), LegendaryQuestColor),
|
||||
"legendary_necrozma_2" => Quest.new("legendary_necrozma_2", _INTL("The long night (Part 1)"), _INTL("A mysterious darkness has shrouded some of the region. Meet Sabrina outside of Saffron City's western gate to investigate."), "BW_Sabrina", _INTL("Lavender Town"), LegendaryQuestColor),
|
||||
"legendary_necrozma_3" => Quest.new("legendary_necrozma_1", _INTL("The long night (Part 2)"), _INTL("The mysterious darkness has expended. Meet Sabrina on top of Celadon City's Dept. Store to figure out the source of the darkness."), "BW_Sabrina", _INTL("Route 7"), LegendaryQuestColor),
|
||||
"legendary_necrozma_4" => Quest.new("legendary_necrozma_4", _INTL("The long night (Part 3)"), _INTL("Fuchsia City appears to be unaffected by the darkness. Go investigate to see if you can find out more information."), "BW_Sabrina", _INTL("Celadon City"), LegendaryQuestColor),
|
||||
"legendary_necrozma_5" => Quest.new("legendary_necrozma_5", _INTL("The long night (Part 4)"), _INTL("The mysterious darkness has expended yet again and strange plants have appeared. Follow the plants to see where they lead."), "BW_koga", _INTL("Fuchsia City"), LegendaryQuestColor),
|
||||
"legendary_necrozma_6" => Quest.new("legendary_necrozma_6", _INTL("The long night (Part 5)"), _INTL("You found a strange fruit that appears to be related to the mysterious darkness. Go see professor Oak to have it analyzed."), "BW029", _INTL("Safari Zone"), LegendaryQuestColor),
|
||||
"legendary_necrozma_7" => Quest.new("legendary_necrozma_7", _INTL("The long night (Part 6)"), _INTL("The strange plant you found appears to glow in the mysterious darkness that now covers the entire region. Try to follow the glow to find out the source of the disturbance."), "BW-oak", _INTL("Pallet Town"), LegendaryQuestColor),
|
||||
|
||||
|
||||
"legendary_meloetta_1" => Quest.new("legendary_meloetta_1", _INTL("A legendary band (Part 1)"), _INTL("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..."), "BW107", _INTL("Saffron City"), LegendaryQuestColor),
|
||||
"legendary_meloetta_2" => Quest.new("legendary_meloetta_2", _INTL("A legendary band (Part 2)"), _INTL("The drummer from a legendary Pokéband wants you to find its former bandmates. The band manager talked about two former guitarists..."), "band_drummer", _INTL("Saffron City"), LegendaryQuestColor),
|
||||
"legendary_meloetta_3" => Quest.new("legendary_meloetta_3", _INTL("A legendary band (Part 3)"), _INTL("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."), "band_drummer", _INTL("Saffron City"), LegendaryQuestColor),
|
||||
"legendary_meloetta_4" => Quest.new("legendary_meloetta_4", _INTL("A legendary band (Part 4)"), _INTL("You assembled the full band! Come watch the show on Saturday night."), "BW117", _INTL("Saffron City"), LegendaryQuestColor),
|
||||
|
||||
"legendary_cresselia_1" => Quest.new(61, _INTL("Mysterious Lunar feathers"), _INTL("A mysterious entity asked you to collect Lunar Feathers for them. It said that they will come at night to tell you where to look. Whoever that may be..."), "lunarFeather", _INTL("Lavender Town"), LegendaryQuestColor),
|
||||
#removed
|
||||
#11 => Quest.new(11, "Powering the Lighthouse", "Catch some Voltorb to power up the lighthouse", QuestBranchHotels, "BW (43)", "Vermillion City", HotelQuestColor),
|
||||
}
|
||||
|
||||
###################
|
||||
# HOENN QUESTS ##
|
||||
# ################
|
||||
|
||||
#route 102
|
||||
define_quest("route_102_rematch",:FIELD_QUEST,_INTL("Trainer Rematches"), _INTL("A lass you battled wants to switch up her team and rematch you!"),_INTL("Route 102"),"NPC_Hoenn_Lass")
|
||||
|
||||
#Route 116
|
||||
define_quest("route116_glasses",:FIELD_QUEST,_INTL("Lost glasses"), _INTL("A trainer has lost their glasses, help him find them!"),_INTL("Route 116"),"NPC_Hoenn_BugManiac")
|
||||
|
||||
#Route 104 (South)
|
||||
define_quest("route104_rivalWeather",:FIELD_QUEST,_INTL("Weather Watch"), _INTL("Help your rival with fieldwork and find a Pokémon that only appears when it's windy!"),_INTL("Route 104"),"rival")
|
||||
|
||||
#Petalburg woods
|
||||
define_quest("petalburgwoods_spores",:FIELD_QUEST,_INTL("Spores Harvest"), _INTL("A scientist has tasked you to collect 4 spore samples from the large mushrooms that can be found in the woods!"),_INTL("Petalburg Woods"),"NPC_Hoenn_Scientist")
|
||||
|
||||
#Route 104 (North)
|
||||
define_quest("route104_oricorio",:FIELD_QUEST,_INTL("Special Flowery Grass"), _INTL("Find an Oricorio in the flowery grass behind the flower shop."),_INTL("Route 104"),"NPC_Hoenn_AromaLady")
|
||||
define_quest("route104_oricorio_forms",:FIELD_QUEST,_INTL("Nectar Flowers"), _INTL("Find all 4 types of nectar flowers to transform Oricorio."),_INTL("Route 104"),"NPC_Hoenn_AromaLady")
|
||||
|
||||
#Route 115
|
||||
define_quest("route115_secretBase",:FIELD_QUEST,_INTL("Your Very Own Secret Base!"), _INTL("Talk to Aarune near his secret base to learn how to make your own."),_INTL("Route 115"),"NPC_Hoenn_AromaLady")
|
||||
|
||||
#Rustboro
|
||||
define_quest("rustboro_whismur",:FIELD_QUEST,_INTL("Volume Booster!"), _INTL("Find a Wingull to fuse with a Whismur to make it louder."),_INTL("Rustboro City"),"NPC_schoolgirl")
|
||||
@@ -0,0 +1,101 @@
|
||||
def validate_regirock_ice_puzzle(solution)
|
||||
for boulder_position in solution
|
||||
x = boulder_position[0]
|
||||
y = boulder_position[1]
|
||||
# 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)
|
||||
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]
|
||||
regi_map = 813
|
||||
switch_ids.each do |event_id|
|
||||
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]
|
||||
|
||||
pressed_switches = []
|
||||
unpressed_switches = []
|
||||
switch_ids.each do |switch_id|
|
||||
is_pressed = pbGetSelfSwitch(switch_id, "A")
|
||||
if is_pressed
|
||||
pressed_switches << switch_id
|
||||
else
|
||||
unpressed_switches << switch_id
|
||||
end
|
||||
end
|
||||
|
||||
for event_id in switch_ids
|
||||
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(VAR_REGI_PUZZLE_SWITCH_PRESSED)
|
||||
solution = "ssBSBGG" # GGSBBss"
|
||||
registeel_ice_reset_switches() if !order.is_a?(String)
|
||||
order << letter
|
||||
pbSet(VAR_REGI_PUZZLE_SWITCH_PRESSED, order)
|
||||
if order == solution
|
||||
echoln "OK"
|
||||
pbSEPlay("Evolution start", nil, 130)
|
||||
elsif order.length >= solution.length
|
||||
registeel_ice_reset_switches()
|
||||
end
|
||||
echoln order
|
||||
end
|
||||
|
||||
def registeel_ice_reset_switches()
|
||||
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(VAR_REGI_PUZZLE_SWITCH_PRESSED, "")
|
||||
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]
|
||||
]
|
||||
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])
|
||||
echoln switch_event.id if switch_event
|
||||
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])
|
||||
echoln switch_event.id if switch_event
|
||||
pbSEPlay("Entering Door")
|
||||
pbSetSelfSwitch(switch_event.id, "A", true) if switch_event
|
||||
end
|
||||
end
|
||||
380
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/TRQuests.rb
Normal file
380
Data/Scripts/052_InfiniteFusion/Gameplay/Quests/TRQuests.rb
Normal file
@@ -0,0 +1,380 @@
|
||||
|
||||
def isWearingTeamRocketOutfit()
|
||||
return false if !$game_switches[SWITCH_JOINED_TEAM_ROCKET]
|
||||
return (isWearingClothes(CLOTHES_TEAM_ROCKET_MALE) || isWearingClothes(CLOTHES_TEAM_ROCKET_FEMALE)) && isWearingHat(HAT_TEAM_ROCKET)
|
||||
end
|
||||
|
||||
def isWearingFavoriteOutfit()
|
||||
favorites = {
|
||||
hat: $Trainer.favorite_hat,
|
||||
hat2: $Trainer.favorite_hat2,
|
||||
clothes: $Trainer.favorite_clothes
|
||||
}
|
||||
favorites.select! { |item, favorite| !favorite.nil? }
|
||||
return false if favorites.empty?
|
||||
return favorites.all? do |item, favorite|
|
||||
case item
|
||||
when :hat
|
||||
$Trainer.hat == favorite
|
||||
when :hat2
|
||||
$Trainer.hat2 == favorite
|
||||
when :clothes
|
||||
$Trainer.clothes == favorite
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def obtainRocketOutfit()
|
||||
Kernel.pbReceiveItem(:ROCKETUNIFORM)
|
||||
gender = pbGet(VAR_TRAINER_GENDER)
|
||||
if gender == GENDER_MALE
|
||||
obtainClothes(CLOTHES_TEAM_ROCKET_MALE)
|
||||
obtainHat(HAT_TEAM_ROCKET)
|
||||
$Trainer.unlocked_clothes << CLOTHES_TEAM_ROCKET_FEMALE
|
||||
else
|
||||
obtainClothes(CLOTHES_TEAM_ROCKET_FEMALE)
|
||||
obtainHat(HAT_TEAM_ROCKET)
|
||||
$Trainer.unlocked_clothes << CLOTHES_TEAM_ROCKET_MALE
|
||||
end
|
||||
#$PokemonBag.pbStoreItem(:ROCKETUNIFORM,1)
|
||||
end
|
||||
|
||||
def acceptTRQuest(id, show_description = true)
|
||||
return if isQuestAlreadyAccepted?(id)
|
||||
|
||||
title = TR_QUESTS[id].name
|
||||
description = TR_QUESTS[id].desc
|
||||
showNewTRMissionMessage(title, description, show_description)
|
||||
addRocketQuest(id)
|
||||
end
|
||||
|
||||
def addRocketQuest(id)
|
||||
$Trainer.quests = [] if $Trainer.quests.class == NilClass
|
||||
quest = TR_QUESTS[id]
|
||||
$Trainer.quests << quest if quest
|
||||
end
|
||||
|
||||
def showNewTRMissionMessage(title, description, show_description)
|
||||
titleColor = 2
|
||||
textColor = 2
|
||||
pbMEPlay("rocketQuest", 80, 110)
|
||||
|
||||
pbCallBub(3)
|
||||
Kernel.pbMessage(_INTL("\\C[{1}]NEW MISSION: ",titleColor) + title)
|
||||
if show_description
|
||||
pbCallBub(3)
|
||||
Kernel.pbMessage("\\C[#{textColor}]" + description)
|
||||
end
|
||||
end
|
||||
|
||||
#status = :SUCCESS, :FAILURE
|
||||
def finishTRQuest(id, status, silent = false)
|
||||
return if pbCompletedQuest?(id)
|
||||
pbMEPlay("Register phone") if status == :SUCCESS && !silent
|
||||
pbMEPlay("Voltorb Flip Game Over") if status == :FAILURE && !silent
|
||||
Kernel.pbMessage("\\C[2]Mission completed!") if status == :SUCCESS && !silent
|
||||
Kernel.pbMessage("\\C[2]Mission Failed...") if status == :FAILURE && !silent
|
||||
|
||||
$game_variables[VAR_KARMA] -= 5 # karma
|
||||
$game_variables[VAR_NB_ROCKET_MISSIONS] += 1 #nb. quests completed
|
||||
|
||||
pbSetQuest(id, true)
|
||||
end
|
||||
|
||||
TR_QUESTS = {
|
||||
"tr_cerulean_1" => Quest.new("tr_cerulean_1", _INTL("Creepy Crawlies"), _INTL("The Team Rocket Captain has tasked you with clearing the bug infestation in the temporary Rocket HQ in Cerulean City"), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
|
||||
"tr_cerulean_2" => Quest.new("tr_cerulean_2", _INTL("No Fishing Zone"), _INTL("Intimidate the fishermen at Nugget Bridge until they leave the area."), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
|
||||
"tr_cerulean_3" => Quest.new("tr_cerulean_3", _INTL("Disobedient Pokémon"), _INTL("Bring back the Pokémon given by the Team Rocket Captain fainted to teach it a lesson."), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
|
||||
"tr_cerulean_4" => Quest.new("tr_cerulean_4", _INTL("Gran Theft Pokémon!"), _INTL("Follow Petrel and go steal a rare Pokémon from a young girl."), "rocket_petrel", _INTL("Cerulean City"), TRQuestColor),
|
||||
|
||||
"tr_celadon_1" => Quest.new("tr_celadon_1", _INTL("Supplying the new grunts"), _INTL("Catch 4 Pokémon with Rocket Balls in the outskirts of Celadon City."), "rocket_archer", _INTL("Celadon City"), TRQuestColor),
|
||||
"tr_celadon_2" => Quest.new("tr_celadon_2", _INTL("Interception!"), _INTL("Intercept the TMs shipment to the Celadon Store and pose as the delivery person to deliver fake TMs."), "rocket_archer", _INTL("Celadon City"), TRQuestColor),
|
||||
"tr_celadon_3" => Quest.new( "tr_celadon_3", _INTL("Pokémon Collector"), _INTL("Go meet a Pokémon collector on Route 22, near Viridian City and get his rare Pokémon."), "rocket_archer", _INTL("Celadon City"), TRQuestColor),
|
||||
"tr_celadon_4" => Quest.new("tr_celadon_4", _INTL("Operation Shutdown"), _INTL("The Team Rocket HQ is being raided! Regroup with the rest of the grunts in Goldenrod Tunnel!"), "rocket_archer", _INTL("Goldenrod City"), TRQuestColor),
|
||||
|
||||
"tr_pinkan" => Quest.new("tr_pinkan", _INTL("Pinkan Island!"), _INTL("Help Team Rocket with a heist on a Pokémon nature preserve!"), "rocket_archer", _INTL("Goldenrod City"), TRQuestColor),
|
||||
|
||||
}
|
||||
|
||||
def calculateSuspicionLevel(answersSoFar, uncertain_answers)
|
||||
echoln answersSoFar
|
||||
|
||||
believable_answers = [
|
||||
[:BIRD, :ICE, :CINNABAR, :DAWN], #articuno
|
||||
[:BIRD, :ELECTRIC, :LAVENDER, :AFTERNOON], #zapdos
|
||||
[:BIRD, :FIRE, :CINNABAR, :SUNSET], #moltres
|
||||
[:BEAST, :ELECTRIC, :CERULEAN, :NIGHT], #raikou
|
||||
[:BEAST, :ELECTRIC, :LAVENDER, :NIGHT], #raikou
|
||||
[:BEAST, :FIRE, :VIRIDIAN, :NOON], #entei
|
||||
[:BEAST, :FIRE, :VIRIDIAN, :SUNSET], #entei
|
||||
[:BEAST, :WATER, :CERULEAN, :DAWN], #suicune
|
||||
[:BEAST, :WATER, :CERULEAN, :NIGHT], #suicune
|
||||
[:FISH, :WATER, :CERULEAN, :NIGHT], #suicune
|
||||
[:FISH, :WATER, :CERULEAN, :DAWN] #suicune
|
||||
]
|
||||
|
||||
min_suspicion_score = Float::INFINITY
|
||||
|
||||
# Iterate over each believable answer
|
||||
believable_answers.each do |believable_answer|
|
||||
suspicion_score = 0
|
||||
length_to_check = [answersSoFar.length, believable_answer.length].min
|
||||
|
||||
# Compare answersSoFar with believable_answer up to the current length
|
||||
length_to_check.times do |i|
|
||||
suspicion_score += 1 unless answersSoFar[i] == believable_answer[i]
|
||||
end
|
||||
|
||||
# Track the minimum suspicion score found
|
||||
min_suspicion_score = [min_suspicion_score, suspicion_score].min
|
||||
end
|
||||
min_suspicion_score += min_suspicion_score if uncertain_answers > 1
|
||||
echoln "suspicion score: #{min_suspicion_score}"
|
||||
return min_suspicion_score
|
||||
end
|
||||
|
||||
##### Gameplay stuff
|
||||
|
||||
def legendaryQuestioning()
|
||||
uncertain_answers = 0
|
||||
answers_so_far = []
|
||||
|
||||
#question 1
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("First off what does the legendary Pokémon look like?"))
|
||||
bodyTypes = { :BIRD => _INTL("A flying creature"), :BEAST => _INTL("A large beast"), :FISH => _INTL("An aquatic creature"), :UNKNOWN => _INTL("I don't know...") }
|
||||
chosen_bodyType = optionsMenu(bodyTypes.values)
|
||||
answers_so_far << bodyTypes.keys[chosen_bodyType]
|
||||
if chosen_bodyType == bodyTypes.length - 1
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("You don't know? Have you even seen that Pokémon?"))
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Hmm... You better have some more information."))
|
||||
uncertain_answers += 1
|
||||
else
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("{1} that's also a legendary Pokémon? That sounds incredible! You have my attention.",bodyTypes.values[chosen_bodyType]))
|
||||
end
|
||||
|
||||
#question 2
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Okay... What about its type?"))
|
||||
types = { :ELECTRIC => _INTL("Electric-type"), :FIRE => _INTL("Fire-type"), :WATER => _INTL("Water-Type"), :ICE => _INTL("Ice-type"), :UNKNOWN => _INTL("I don't know...") }
|
||||
chosen_type = optionsMenu(types.values)
|
||||
answers_so_far << types.keys[chosen_type]
|
||||
|
||||
if chosen_type == types.length - 1
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("So you don't know its type... Hmm..."))
|
||||
uncertain_answers += 1
|
||||
else
|
||||
if chosen_bodyType == bodyTypes.length - 1
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Hmm... So it's an unknown creature that's {1}...",types.values[chosen_type]))
|
||||
else
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Hmm... {1} that's {2}.",bodyTypes.values[chosen_bodyType],types.values[chosen_type]))
|
||||
end
|
||||
susMeter = calculateSuspicionLevel(answers_so_far, uncertain_answers)
|
||||
if susMeter == 0
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("That sounds pretty exciting!"))
|
||||
else
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("I've never heard of such a creature, but keep going."))
|
||||
end
|
||||
end
|
||||
|
||||
#question 3
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("So... Where was this legendary Pokémon sighted?"))
|
||||
locations = { :VIRIDIAN => _INTL("Near Viridian City"), :LAVENDER => _INTL("Near Lavender Town"), :CERULEAN => _INTL("Near Cerulean City"), :CINNABAR => _INTL("Near Cinnabar Island"), :UNKNOWN => _INTL("I don't know") }
|
||||
chosen_location = optionsMenu(locations.values)
|
||||
if chosen_location == locations.length - 1
|
||||
uncertain_answers += 1
|
||||
if uncertain_answers == 3
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Do you even know anything? This has been such a waste of time!"))
|
||||
return 100
|
||||
else
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("How can you not know where it was sighted? Do you know how unhelpful this is to me?"))
|
||||
uncertain_answers += 1
|
||||
end
|
||||
else
|
||||
answers_so_far << locations.keys[chosen_location]
|
||||
susMeter = calculateSuspicionLevel(answers_so_far, uncertain_answers)
|
||||
if susMeter == 0
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("{1}, huh? Ah yes, that would make a lot of sense... How did I not think of this before?",locations.values[chosen_location]))
|
||||
else
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Hmmm... {1}, really? That sounds pretty surprising to me.",locations.values[chosen_location]))
|
||||
end
|
||||
end
|
||||
|
||||
#question 4
|
||||
locations_formatted = { :VIRIDIAN => _INTL("Viridian City"), :LAVENDER => _INTL("Lavender Town"), :CERULEAN => _INTL("Cerulean City"), :CINNABAR => _INTL("Cinnabar Island"), :UNKNOWN => _INTL("that unknown location") }
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("And at what time of the day was that legendary Pokémon seen near {1} exactly?",locations_formatted.values[chosen_location]))
|
||||
time_of_day = { :DAWN => _INTL("At dawn"), :NOON => _INTL("At noon"), :AFTERNOON => _INTL("In the afternoon"), :SUNSET => _INTL("At sunset"), :NIGHT => _INTL("At night") }
|
||||
chosen_time = optionsMenu(time_of_day.values)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("So it was seen near {1} {2}...",locations_formatted.values[chosen_location],time_of_day.values[chosen_time].downcase))
|
||||
answers_so_far << time_of_day.keys[chosen_time]
|
||||
return calculateSuspicionLevel(answers_so_far, uncertain_answers)
|
||||
end
|
||||
|
||||
def sellPokemon(event_id)
|
||||
if $Trainer.party.length <= 1
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("... Wait, I can't take your only Pokémon!"))
|
||||
return false
|
||||
end
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg?
|
||||
})
|
||||
chosenIndex = pbGet(1)
|
||||
chosenPokemon = $Trainer.party[chosenIndex]
|
||||
|
||||
exotic_pokemon_id = pbGet(VAR_EXOTIC_POKEMON_ID)
|
||||
if chosenPokemon.personalID == exotic_pokemon_id
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("Oh, this is the Pokémon you got from the collector, right?"))
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("Yeah, I can't take that one. The collector blabbed to the police so it's too risky."))
|
||||
return false
|
||||
end
|
||||
|
||||
speciesName = GameData::Species.get(chosenPokemon.species).real_name
|
||||
pbCallBub(2, event_id)
|
||||
if pbConfirmMessageSerious(_INTL("You wanna sell me this {1}, is that right?",speciesName))
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("Hmm... Let's see..."))
|
||||
pbWait(10)
|
||||
value = calculate_pokemon_value(chosenPokemon)
|
||||
pbCallBub(2, event_id)
|
||||
if pbConfirmMessageSerious(_INTL("\\GI could give you ${1} for it. Do we have a deal?",value.to_s))
|
||||
payout = (value * 0.7).to_i
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("\\GExcellent. And of course, 30% goes to Team Rocket. So you get ${1}.",payout))
|
||||
$Trainer.money += payout
|
||||
$Trainer.remove_pokemon_at_index(pbGet(1))
|
||||
pbSEPlay("Mart buy item")
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("\\GPleasure doing business with you."))
|
||||
return true
|
||||
else
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("Stop wasting my time!"))
|
||||
end
|
||||
else
|
||||
pbCallBub(2, event_id)
|
||||
pbMessage(_INTL("Stop wasting my time!"))
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def calculate_pokemon_value(pokemon)
|
||||
# Attribute weights adjusted further for lower-level Pokémon
|
||||
catch_rate_weight = 0.5
|
||||
level_weight = 0.2
|
||||
stats_weight = 0.3
|
||||
|
||||
# Constants for the price range
|
||||
min_price = 100
|
||||
max_price = 20000
|
||||
foreign_pokemon_bonus = 3000
|
||||
fused_bonus = 1000
|
||||
# Baseline minimum values for scaling
|
||||
min_catch_rate = 3 # Legendary catch rate
|
||||
min_level = 1 # Minimum level for a Pokémon
|
||||
min_base_stats = 180 # Approximate minimum total stats (e.g., Sunkern)
|
||||
|
||||
# Attribute maximums
|
||||
max_catch_rate = 255 # Easy catch rate Pokémon like Magikarp
|
||||
max_level = 100
|
||||
max_base_stats = 720 # Maximum base stat total (e.g., Arceus)
|
||||
|
||||
# Normalize values based on actual ranges
|
||||
normalized_catch_rate = (max_catch_rate - pokemon.species_data.catch_rate).to_f / (max_catch_rate - min_catch_rate)
|
||||
normalized_level = (pokemon.level - min_level).to_f / (max_level - min_level)
|
||||
normalized_stats = (calcBaseStatsSum(pokemon.species) - min_base_stats).to_f / (max_base_stats - min_base_stats)
|
||||
|
||||
# Apply weights to each component
|
||||
weighted_catch_rate = normalized_catch_rate * catch_rate_weight
|
||||
weighted_level = normalized_level * level_weight
|
||||
weighted_stats = normalized_stats * stats_weight
|
||||
|
||||
# Calculate the total score and scale to price range with a reduced scaling factor
|
||||
total_score = weighted_catch_rate + weighted_level + weighted_stats
|
||||
price = min_price + (total_score * (max_price - min_price) * 0.4) # Lower scaling factor
|
||||
|
||||
# Add foreign Pokémon bonus if applicable
|
||||
is_foreign = !(isKantoPokemon(pokemon.species) || isJohtoPokemon(pokemon.species))
|
||||
price += foreign_pokemon_bonus if is_foreign
|
||||
price += fused_bonus if isSpeciesFusion(pokemon.species)
|
||||
|
||||
price.to_i # Convert to an integer value
|
||||
end
|
||||
|
||||
def updatePinkanBerryDisplay()
|
||||
return if !isOnPinkanIsland()
|
||||
berry_image_width=25
|
||||
|
||||
clear_all_images()
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
nbPinkanBerries = $PokemonBag.pbQuantity(:PINKANBERRY)
|
||||
for i in 1..nbPinkanBerries
|
||||
x_pos=i*berry_image_width
|
||||
y_pos=0
|
||||
$game_screen.pictures[i].show("pinkanberryui",0,x_pos,y_pos)
|
||||
end
|
||||
end
|
||||
|
||||
PINKAN_ISLAND_MAP = 51
|
||||
PINKAN_ISLAND_START_ROCKET = [11,25]
|
||||
PINKAN_ISLAND_START_POLICE = [20,55]
|
||||
def pinkanIslandWarpToStart()
|
||||
$game_temp.player_new_map_id = PINKAN_ISLAND_MAP
|
||||
if $game_switches[SWITCH_PINKAN_SIDE_ROCKET]
|
||||
$game_temp.player_new_x = PINKAN_ISLAND_START_ROCKET[0]
|
||||
$game_temp.player_new_y = PINKAN_ISLAND_START_ROCKET[1]
|
||||
else
|
||||
$game_temp.player_new_x = PINKAN_ISLAND_START_POLICE[0]
|
||||
$game_temp.player_new_y = PINKAN_ISLAND_START_POLICE[1]
|
||||
end
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
$game_switches[Settings::STARTING_OVER_SWITCH] = true
|
||||
$scene.reset_map(true)
|
||||
end
|
||||
|
||||
def isOnPinkanIsland()
|
||||
return Settings::PINKAN_ISLAND_MAPS.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
def pinkanAddAllCaughtPinkanPokemon()
|
||||
for pokemon in $Trainer.party
|
||||
pbStorePokemon(pokemon)
|
||||
end
|
||||
end
|
||||
|
||||
def resetPinkanIsland()
|
||||
$game_switches[SWITCH_BLOCK_PINKAN_WHISTLE]=false
|
||||
$game_switches[SWITCH_LEAVING_PINKAN_ISLAND]=false
|
||||
$game_switches[SWITCH_PINKAN_SIDE_POLICE]=false
|
||||
$game_switches[SWITCH_PINKAN_SIDE_ROCKET]=false
|
||||
$game_switches[SWITCH_PINKAN_FINISHED]=false
|
||||
|
||||
for map_id in Settings::PINKAN_ISLAND_MAPS
|
||||
map = $MapFactory.getMap(map_id,false)
|
||||
for event in map.events.values
|
||||
$game_self_switches[[map_id, event.id, "A"]] = false
|
||||
$game_self_switches[[map_id, event.id, "B"]] = false
|
||||
$game_self_switches[[map_id, event.id, "C"]] = false
|
||||
$game_self_switches[[map_id, event.id, "D"]] = false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,65 @@
|
||||
def generateEggGroupTeam(eggGroup)
|
||||
teamComplete = false
|
||||
generatedTeam = []
|
||||
while !teamComplete
|
||||
species = rand(PBSpecies.maxValue)
|
||||
if getPokemonEggGroups(species).include?(eggGroup)
|
||||
generatedTeam << species
|
||||
end
|
||||
teamComplete = generatedTeam.length == 3
|
||||
end
|
||||
return generatedTeam
|
||||
end
|
||||
|
||||
def generateSimpleTrainerParty(teamSpecies, level)
|
||||
team = []
|
||||
for species in teamSpecies
|
||||
poke = Pokemon.new(species, level)
|
||||
team << poke
|
||||
end
|
||||
return team
|
||||
end
|
||||
|
||||
def Kernel.getRoamingMap(roamingArrayPos)
|
||||
curmap = $PokemonGlobal.roamPosition[roamingArrayPos]
|
||||
mapinfos = $RPGVX ? load_data("Data/MapInfos.rvdata") : load_data("Data/MapInfos.rxdata")
|
||||
text = mapinfos[curmap].name #,(curmap==$game_map.map_id) ? _INTL("(this map)") : "")
|
||||
return text
|
||||
end
|
||||
|
||||
def Kernel.getItemNamesAsString(list)
|
||||
strList = ""
|
||||
for i in 0..list.length - 1
|
||||
id = list[i]
|
||||
name = PBItems.getName(id)
|
||||
strList += name
|
||||
if i != list.length - 1 && list.length > 1
|
||||
strList += ","
|
||||
end
|
||||
end
|
||||
return strList
|
||||
end
|
||||
|
||||
def getCurrentLevelCap()
|
||||
current_max_level = Settings::LEVEL_CAPS[$Trainer.badge_count]
|
||||
current_max_level *= Settings::HARD_MODE_LEVEL_MODIFIER if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return current_max_level
|
||||
end
|
||||
|
||||
def pokemonExceedsLevelCap(pokemon)
|
||||
return false if $Trainer.badge_count >= Settings::NB_BADGES
|
||||
current_max_level = getCurrentLevelCap()
|
||||
return pokemon.level >= current_max_level
|
||||
end
|
||||
|
||||
def get_spritecharacter_for_event(event_id)
|
||||
for sprite in $scene.spriteset.character_sprites
|
||||
if sprite.character.id == event_id
|
||||
return sprite
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def setForcedAltSprites(forcedSprites_map)
|
||||
$PokemonTemp.forced_alt_sprites = forcedSprites_map
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
def reverseFusionSpecies(species)
|
||||
dexId = getDexNumberForSpecies(species)
|
||||
return species if dexId <= NB_POKEMON
|
||||
return species if dexId > (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
body = getBasePokemonID(dexId, true)
|
||||
head = getBasePokemonID(dexId, false)
|
||||
newspecies = (head) * NB_POKEMON + body
|
||||
return getPokemon(newspecies)
|
||||
end
|
||||
|
||||
def replaceFusionSpecies(pokemon, speciesToChange, newSpecies)
|
||||
currentBody = pokemon.species_data.get_body_species_symbol()
|
||||
currentHead = pokemon.species_data.get_head_species_symbol()
|
||||
should_update_body = currentBody == speciesToChange
|
||||
should_update_head = currentHead == speciesToChange
|
||||
|
||||
echoln speciesToChange
|
||||
echoln currentBody
|
||||
echoln currentHead
|
||||
|
||||
return if !should_update_body && !should_update_head
|
||||
|
||||
newSpeciesBody = should_update_body ? newSpecies : currentBody
|
||||
newSpeciesHead = should_update_head ? newSpecies : currentHead
|
||||
|
||||
newSpecies = getFusionSpecies(newSpeciesBody, newSpeciesHead)
|
||||
echoln newSpecies.id_number
|
||||
pokemon.species = newSpecies
|
||||
end
|
||||
|
||||
def npc_fuse_screen(species_head,species_body)
|
||||
head_pokemon = Pokemon.new(species_head,1)
|
||||
body_pokemon = Pokemon.new(species_body,1)
|
||||
return if head_pokemon.isFusion? || body_pokemon.isFusion?
|
||||
npcTrainerFusionScreenPokemon(head_pokemon,body_pokemon)
|
||||
|
||||
end
|
||||
@@ -0,0 +1,79 @@
|
||||
def pbPokemonIconFile(pokemon)
|
||||
bitmapFileName = pbCheckPokemonIconFiles(pokemon.species, pokemon.isEgg?)
|
||||
return bitmapFileName
|
||||
end
|
||||
|
||||
def pbCheckPokemonIconFiles(speciesID, egg = false, dna = false)
|
||||
if egg
|
||||
bitmapFileName = sprintf("Graphics/Icons/iconEgg")
|
||||
return pbResolveBitmap(bitmapFileName)
|
||||
else
|
||||
bitmapFileName = "Graphics/Pokemon/Icons/#{speciesID}"
|
||||
ret = pbResolveBitmap(bitmapFileName)
|
||||
return ret if ret
|
||||
end
|
||||
ret = pbResolveBitmap("Graphics/Icons/iconDNA.png")
|
||||
return ret if ret
|
||||
return pbResolveBitmap("Graphics/Icons/iconDNA.png")
|
||||
end
|
||||
|
||||
def addShinyStarsToGraphicsArray(imageArray, xPos, yPos, shinyBody, shinyHead, debugShiny, srcx = nil, srcy = nil, width = nil, height = nil,
|
||||
showSecondStarUnder = false, showSecondStarAbove = false)
|
||||
color = debugShiny ? Color.new(0, 0, 0, 255) : nil
|
||||
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
|
||||
if shinyBody && shinyHead
|
||||
if showSecondStarUnder
|
||||
yPos += 15
|
||||
elsif showSecondStarAbove
|
||||
yPos -= 15
|
||||
else
|
||||
xPos -= 15
|
||||
end
|
||||
imageArray.push(["Graphics/Pictures/shiny", xPos, yPos, srcx, srcy, width, height, color])
|
||||
end
|
||||
# if onlyOutline
|
||||
# imageArray.push(["Graphics/Pictures/shiny_black",xPos,yPos,srcx,srcy,width,height,color])
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
def pbBitmap(path)
|
||||
if !pbResolveBitmap(path).nil?
|
||||
bmp = RPG::Cache.load_bitmap_path(path)
|
||||
bmp.storedPath = path
|
||||
else
|
||||
p "Image located at '#{path}' was not found!" if $DEBUG
|
||||
bmp = Bitmap.new(1, 1)
|
||||
end
|
||||
return bmp
|
||||
end
|
||||
|
||||
|
||||
|
||||
# if need to play animation from event route
|
||||
def playAnimation(animationId, x = nil, y = nil)
|
||||
return if !$scene.is_a?(Scene_Map)
|
||||
x = @event.x unless x
|
||||
y = @event.y unless y
|
||||
$scene.spriteset.addUserAnimation(animationId, x, y, true)
|
||||
end
|
||||
|
||||
#Shows a picture, centered in the middle of the screen in a new viewport
|
||||
# Returns the viewport. Use viewport.dispose to get rid of the picture
|
||||
def showPicture(path,x,y,viewport_x=(Graphics.width / 4), viewport_y=0)
|
||||
begin
|
||||
echoln path
|
||||
viewport = Viewport.new(viewport_x, viewport_y, Graphics.width, Graphics.height)
|
||||
sprite = Sprite.new(viewport)
|
||||
|
||||
bitmap = AnimatedBitmap.new(path) if pbResolveBitmap(path)
|
||||
|
||||
sprite.bitmap = bitmap.bitmap
|
||||
sprite.x = x
|
||||
sprite.y = y
|
||||
|
||||
viewport.z = 99999
|
||||
return viewport
|
||||
rescue
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,84 @@
|
||||
def Kernel.getPlateType(item)
|
||||
return :FIGHTING if item == PBItems::FISTPLATE
|
||||
return :FLYING if item == PBItems::SKYPLATE
|
||||
return :POISON if item == PBItems::TOXICPLATE
|
||||
return :GROUND if item == PBItems::EARTHPLATE
|
||||
return :ROCK if item == PBItems::STONEPLATE
|
||||
return :BUG if item == PBItems::INSECTPLATE
|
||||
return :GHOST if item == PBItems::SPOOKYPLATE
|
||||
return :STEEL if item == PBItems::IRONPLATE
|
||||
return :FIRE if item == PBItems::FLAMEPLATE
|
||||
return :WATER if item == PBItems::SPLASHPLATE
|
||||
return :GRASS if item == PBItems::MEADOWPLATE
|
||||
return :ELECTRIC if item == PBItems::ZAPPLATE
|
||||
return :PSYCHIC if item == PBItems::MINDPLATE
|
||||
return :ICE if item == PBItems::ICICLEPLATE
|
||||
return :DRAGON if item == PBItems::DRACOPLATE
|
||||
return :DARK if item == PBItems::DREADPLATE
|
||||
return :FAIRY if item == PBItems::PIXIEPLATE
|
||||
return -1
|
||||
end
|
||||
|
||||
def Kernel.listPlatesInBag()
|
||||
list = []
|
||||
list << PBItems::FISTPLATE if $PokemonBag.pbQuantity(:FISTPLATE) >= 1
|
||||
list << PBItems::SKYPLATE if $PokemonBag.pbQuantity(:SKYPLATE) >= 1
|
||||
list << PBItems::TOXICPLATE if $PokemonBag.pbQuantity(:TOXICPLATE) >= 1
|
||||
list << PBItems::EARTHPLATE if $PokemonBag.pbQuantity(:EARTHPLATE) >= 1
|
||||
list << PBItems::STONEPLATE if $PokemonBag.pbQuantity(:STONEPLATE) >= 1
|
||||
list << PBItems::INSECTPLATE if $PokemonBag.pbQuantity(:INSECTPLATE) >= 1
|
||||
list << PBItems::SPOOKYPLATE if $PokemonBag.pbQuantity(:SPOOKYPLATE) >= 1
|
||||
list << PBItems::IRONPLATE if $PokemonBag.pbQuantity(:IRONPLATE) >= 1
|
||||
list << PBItems::FLAMEPLATE if $PokemonBag.pbQuantity(:FLAMEPLATE) >= 1
|
||||
list << PBItems::SPLASHPLATE if $PokemonBag.pbQuantity(:SPLASHPLATE) >= 1
|
||||
list << PBItems::MEADOWPLATE if $PokemonBag.pbQuantity(:MEADOWPLATE) >= 1
|
||||
list << PBItems::ZAPPLATE if $PokemonBag.pbQuantity(:ZAPPLATE) >= 1
|
||||
list << PBItems::MINDPLATE if $PokemonBag.pbQuantity(:MINDPLATE) >= 1
|
||||
list << PBItems::ICICLEPLATE if $PokemonBag.pbQuantity(:ICICLEPLATE) >= 1
|
||||
list << PBItems::DRACOPLATE if $PokemonBag.pbQuantity(:DRACOPLATE) >= 1
|
||||
list << PBItems::DREADPLATE if $PokemonBag.pbQuantity(:DREADPLATE) >= 1
|
||||
list << PBItems::PIXIEPLATE if $PokemonBag.pbQuantity(:PIXIEPLATE) >= 1
|
||||
return list
|
||||
end
|
||||
|
||||
def getArceusPlateType(heldItem)
|
||||
return :NORMAL if heldItem == nil
|
||||
case heldItem
|
||||
when :FISTPLATE
|
||||
return :FIGHTING
|
||||
when :SKYPLATE
|
||||
return :FLYING
|
||||
when :TOXICPLATE
|
||||
return :POISON
|
||||
when :EARTHPLATE
|
||||
return :GROUND
|
||||
when :STONEPLATE
|
||||
return :ROCK
|
||||
when :INSECTPLATE
|
||||
return :BUG
|
||||
when :SPOOKYPLATE
|
||||
return :GHOST
|
||||
when :IRONPLATE
|
||||
return :STEEL
|
||||
when :FLAMEPLATE
|
||||
return :FIRE
|
||||
when :SPLASHPLATE
|
||||
return :WATER
|
||||
when :MEADOWPLATE
|
||||
return :GRASS
|
||||
when :ZAPPLATE
|
||||
return :ELECTRIC
|
||||
when :MINDPLATE
|
||||
return :PSYCHIC
|
||||
when :ICICLEPLATE
|
||||
return :ICE
|
||||
when :DRACOPLATE
|
||||
return :DRAGON
|
||||
when :DREADPLATE
|
||||
return :DARK
|
||||
when :PIXIEPLATE
|
||||
return :FAIRY
|
||||
else
|
||||
return :NORMAL
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,91 @@
|
||||
def obtainBadgeMessage(badgeName)
|
||||
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $Trainer.name, badgeName))
|
||||
end
|
||||
|
||||
def promptCaughtPokemonAction(pokemon)
|
||||
pickedOption = false
|
||||
return pbStorePokemon(pokemon) if !$Trainer.party_full?
|
||||
return promptKeepOrRelease(pokemon) if isOnPinkanIsland() && !$game_switches[SWITCH_PINKAN_FINISHED]
|
||||
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 promptKeepOrRelease(pokemon)
|
||||
pickedOption = false
|
||||
while !pickedOption
|
||||
command = pbMessage(_INTL("\\ts[]Your team is full!"),
|
||||
[_INTL("Release a party member"), _INTL("Release this #{pokemon.name}"),], 2)
|
||||
echoln ("command " + command.to_s)
|
||||
case command
|
||||
when 0 # SWAP
|
||||
if swapReleaseCaughtPokemon(pokemon)
|
||||
pickedOption = true
|
||||
end
|
||||
else
|
||||
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)
|
||||
|
||||
tmp = $Trainer.party[index]
|
||||
$Trainer.party[index] = $Trainer.party[-1]
|
||||
$Trainer.party[-1] = tmp
|
||||
return true
|
||||
end
|
||||
|
||||
def swapReleaseCaughtPokemon(caughtPokemon)
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg? &&
|
||||
!(poke.isShadow? rescue false)
|
||||
})
|
||||
index = pbGet(1)
|
||||
return false if index == -1
|
||||
releasedPokemon = $Trainer.party[index]
|
||||
pbMessage(_INTL("{1} was released.",releasedPokemon.name))
|
||||
pbRemovePokemonAt(index)
|
||||
pbStorePokemon(caughtPokemon)
|
||||
|
||||
tmp = $Trainer.party[index]
|
||||
$Trainer.party[index] = $Trainer.party[-1]
|
||||
$Trainer.party[-1] = tmp
|
||||
return true
|
||||
end
|
||||
|
||||
def select_any_pokemon()
|
||||
commands = []
|
||||
for dex_num in 1..NB_POKEMON
|
||||
species = getPokemon(dex_num)
|
||||
commands.push([dex_num - 1, species.real_name, species.id])
|
||||
end
|
||||
return pbChooseList(commands, 0, nil, 1)
|
||||
end
|
||||
@@ -0,0 +1,164 @@
|
||||
def unlock_easter_egg_hats()
|
||||
if $Trainer.name.downcase == "ash"
|
||||
$Trainer.hat = HAT_ASH
|
||||
$Trainer.unlock_hat(HAT_ASH)
|
||||
end
|
||||
if $Trainer.name.downcase == "frogman"
|
||||
$Trainer.hat = HAT_FROG
|
||||
$Trainer.unlock_hat(HAT_FROG)
|
||||
end
|
||||
end
|
||||
|
||||
def getPlayerDefaultName(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? "Brendan" : "Red"
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? "May" : "Green"
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultClothes(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? CLOTHES_BRENDAN : DEFAULT_OUTFIT_MALE
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? CLOTHES_MAY : DEFAULT_OUTFIT_FEMALE
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultHat(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAT_BRENDAN : DEFAULT_OUTFIT_MALE
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAT_MAY : DEFAULT_OUTFIT_FEMALE
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultHair(gender)
|
||||
if gender == GENDER_MALE
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAIR_BRENDAN : DEFAULT_OUTFIT_MALE
|
||||
else
|
||||
return Settings::GAME_ID == :IF_HOENN ? HAIR_MAY : DEFAULT_OUTFIT_FEMALE
|
||||
end
|
||||
end
|
||||
|
||||
def setupStartingOutfit()
|
||||
default_clothes_male = getDefaultClothes(GENDER_MALE)
|
||||
default_clothes_female = getDefaultClothes(GENDER_FEMALE)
|
||||
|
||||
default_hat_male = getDefaultHat(GENDER_MALE)
|
||||
default_hat_female = getDefaultHat(GENDER_FEMALE)
|
||||
|
||||
default_hair_male = getDefaultHair(GENDER_MALE)
|
||||
default_hair_female = getDefaultHair(GENDER_FEMALE)
|
||||
|
||||
$Trainer.hat = nil
|
||||
$Trainer.clothes = STARTING_OUTFIT
|
||||
unlock_easter_egg_hats()
|
||||
gender = pbGet(VAR_TRAINER_GENDER)
|
||||
if gender == GENDER_FEMALE
|
||||
$Trainer.unlock_clothes(default_clothes_female, true)
|
||||
$Trainer.unlock_hat(default_hat_female, true)
|
||||
$Trainer.hair = "3_" + default_hair_female if !$Trainer.hair # when migrating old savefiles
|
||||
|
||||
elsif gender == GENDER_MALE
|
||||
$Trainer.unlock_clothes(default_clothes_male, true)
|
||||
$Trainer.unlock_hat(default_hat_male, true)
|
||||
|
||||
echoln $Trainer.hair
|
||||
$Trainer.hair = ("3_" + default_hair_male) if !$Trainer.hair # when migrating old savefiles
|
||||
echoln $Trainer.hair
|
||||
end
|
||||
$Trainer.unlock_hair(default_hair_male, true)
|
||||
$Trainer.unlock_hair(default_hair_female, true)
|
||||
$Trainer.unlock_clothes(STARTING_OUTFIT, true)
|
||||
end
|
||||
|
||||
def give_date_specific_hats()
|
||||
current_date = Time.new
|
||||
# Christmas
|
||||
if (current_date.day == 24 || current_date.day == 25) && current_date.month == 12
|
||||
if !$Trainer.unlocked_hats.include?(HAT_SANTA)
|
||||
pbCallBub(2, @event_id, true)
|
||||
pbMessage(_INTL("Hi! We're giving out a special hat today for the holidays season. Enjoy!"))
|
||||
obtainHat(HAT_SANTA)
|
||||
end
|
||||
end
|
||||
|
||||
# April's fool
|
||||
if (current_date.day == 1 && current_date.month == 4)
|
||||
if !$Trainer.unlocked_hats.include?(HAT_CLOWN)
|
||||
pbCallBub(2, @event_id, true)
|
||||
pbMessage(_INTL("Hi! We're giving out this fun accessory for this special day. Enjoy!"))
|
||||
obtainHat(HAT_CLOWN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def qmarkMaskCheck()
|
||||
if $Trainer.seen_qmarks_sprite
|
||||
unless hasHat?(HAT_QMARKS)
|
||||
obtainHat(HAT_QMARKS)
|
||||
obtainClothes(CLOTHES_GLITCH)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def purchaseDyeKitMenu(hats_kit_price = 0, clothes_kit_price = 0)
|
||||
|
||||
commands = []
|
||||
command_hats = _INTL("Hats Dye Kit (${1})",hats_kit_price)
|
||||
command_clothes = _INTL("Clothes Dye Kit (${1})",clothes_kit_price)
|
||||
command_cancel = _INTL("Cancel")
|
||||
|
||||
commands << command_hats if !$PokemonBag.pbHasItem?(:HATSDYEKIT)
|
||||
commands << command_clothes if !$PokemonBag.pbHasItem?(:CLOTHESDYEKIT)
|
||||
commands << command_cancel
|
||||
|
||||
if commands.length <= 1
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\C[1]Dye Kits\\C[0] can be used to dye clothes all sorts of colours!"))
|
||||
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("You can use them at any time when you change clothes."))
|
||||
return
|
||||
end
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GWelcome! Are you interested in dyeing your outfits different colours?"))
|
||||
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("I make handy \\C[1]Dye Kits\\C[0] from my Smeargle's paint that can be used to dye your outfits any color you want!"))
|
||||
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GWhat's more is that it's reusable so you can go completely wild with it if you want! Are you interested?"))
|
||||
|
||||
choice = optionsMenu(commands, commands.length)
|
||||
case commands[choice]
|
||||
when command_hats
|
||||
if $Trainer.money < hats_kit_price
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Oh, you don't have enough money..."))
|
||||
return
|
||||
end
|
||||
pbMessage(_INTL("\\G\\PN purchased the dye kit."))
|
||||
$Trainer.money -= hats_kit_price
|
||||
pbSEPlay("SlotsCoin")
|
||||
Kernel.pbReceiveItem(:HATSDYEKIT)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GHere you go! Have fun dyeing your hats!"))
|
||||
when command_clothes
|
||||
if $Trainer.money < clothes_kit_price
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("Oh, you don't have enough money..."))
|
||||
return
|
||||
end
|
||||
pbMessage(_INTL("\\G\\PN purchased the dye kit."))
|
||||
$Trainer.money -= clothes_kit_price
|
||||
pbSEPlay("SlotsCoin")
|
||||
Kernel.pbReceiveItem(:CLOTHESDYEKIT)
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("\\GHere you go! Have fun dyeing your clothes!"))
|
||||
end
|
||||
pbCallBub(2, @event_id)
|
||||
pbMessage(_INTL("You can use \\C[1]Dye Kits\\C[0] at any time when you change clothes."))
|
||||
end
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
def pbAddPokemonID(pokemon_id, level = 1, see_form = true, skip_randomize = false)
|
||||
return false if !pokemon_id
|
||||
skip_randomize = true if $game_switches[SWITCH_CHOOSING_STARTER] # when choosing starters
|
||||
if pbBoxesFull?
|
||||
pbMessage(_INTL("There's no more room for Pokémon!\1"))
|
||||
pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
|
||||
return false
|
||||
end
|
||||
if pokemon_id.is_a?(Integer) && level.is_a?(Integer)
|
||||
pokemon = Pokemon.new(pokemon_id, level)
|
||||
species_name = pokemon.speciesName
|
||||
end
|
||||
|
||||
# random species if randomized gift pokemon & wild poke
|
||||
if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !skip_randomize
|
||||
tryRandomizeGiftPokemon(pokemon, skip_randomize)
|
||||
end
|
||||
|
||||
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
|
||||
pbNicknameAndStore(pokemon)
|
||||
$Trainer.pokedex.register(pokemon) if see_form
|
||||
return true
|
||||
end
|
||||
|
||||
def pbHasSpecies?(species)
|
||||
if species.is_a?(String) || species.is_a?(Symbol)
|
||||
id = getID(PBSpecies, species)
|
||||
elsif species.is_a?(Pokemon)
|
||||
id = species.dexNum
|
||||
end
|
||||
for pokemon in $Trainer.party
|
||||
next if pokemon.isEgg?
|
||||
return true if pokemon.dexNum == id
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def getID(pbspecies_unused, species)
|
||||
if species.is_a?(String)
|
||||
return nil
|
||||
elsif species.is_a?(Symbol)
|
||||
return GameData::Species.get(species).id_number
|
||||
elsif species.is_a?(Pokemon)
|
||||
id = species.dexNum
|
||||
end
|
||||
end
|
||||
|
||||
# Check if the Pokemon can learn a TM
|
||||
def CanLearnMove(pokemon, move)
|
||||
species = getID(PBSpecies, pokemon)
|
||||
return false if species <= 0
|
||||
data = load_data("Data/tm.dat")
|
||||
return false if !data[move]
|
||||
return data[move].any? { |item| item == species }
|
||||
end
|
||||
|
||||
def getPokemon(dexNum)
|
||||
if dexNum.is_a?(Integer)
|
||||
if dexNum > NB_POKEMON
|
||||
body_id = getBodyID(dexNum)
|
||||
head_id = getHeadID(dexNum, body_id)
|
||||
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
|
||||
else
|
||||
pokemon_id = dexNum
|
||||
end
|
||||
else
|
||||
pokemon_id = dexNum
|
||||
end
|
||||
|
||||
return GameData::Species.get(pokemon_id)
|
||||
end
|
||||
|
||||
def getSpecies(dexnum)
|
||||
return getPokemon(dexnum.species) if dexnum.is_a?(Pokemon)
|
||||
return getPokemon(dexnum)
|
||||
end
|
||||
|
||||
def getAbilityIndexFromID(abilityID, fusedPokemon)
|
||||
abilityList = fusedPokemon.getAbilityList
|
||||
for abilityArray in abilityList #ex: [:CHLOROPHYLL, 0]
|
||||
ability = abilityArray[0]
|
||||
index = abilityArray[1]
|
||||
return index if ability == abilityID
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def getPokemonEggGroups(species)
|
||||
return GameData::Species.get(species).egg_groups
|
||||
end
|
||||
|
||||
def getAllNonLegendaryPokemon()
|
||||
list = []
|
||||
for i in 1..143
|
||||
list.push(i)
|
||||
end
|
||||
for i in 147..149
|
||||
list.push(i)
|
||||
end
|
||||
for i in 152..242
|
||||
list.push(i)
|
||||
end
|
||||
list.push(246)
|
||||
list.push(247)
|
||||
list.push(248)
|
||||
for i in 252..314
|
||||
list.push(i)
|
||||
end
|
||||
for i in 316..339
|
||||
list.push(i)
|
||||
end
|
||||
for i in 352..377
|
||||
list.push(i)
|
||||
end
|
||||
for i in 382..420
|
||||
list.push(i)
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
|
||||
def isInKantoGeneration(dexNumber)
|
||||
return dexNumber <= 151
|
||||
end
|
||||
|
||||
def isKantoPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
return isInKantoGeneration(dexNum) || isInKantoGeneration(head_dex) || isInKantoGeneration(body_dex)
|
||||
end
|
||||
|
||||
def isInJohtoGeneration(dexNumber)
|
||||
return dexNumber > 151 && dexNumber <= 251
|
||||
end
|
||||
|
||||
def isJohtoPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
return isInJohtoGeneration(dexNum) || isInJohtoGeneration(head_dex) || isInJohtoGeneration(body_dex)
|
||||
end
|
||||
|
||||
def isAlolaPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list = [
|
||||
370, 373, 430, 431, 432, 433, 450, 451, 452,
|
||||
453, 454, 455, 459, 460, 463, 464, 465, 469, 470,
|
||||
471, 472, 473, 474, 475, 476, 477, 498, 499,
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isKalosPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list =
|
||||
[327, 328, 329, 339, 371, 372, 417, 418,
|
||||
425, 426, 438, 439, 440, 441, 444, 445, 446,
|
||||
456, 461, 462, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
|
||||
489, 490, 491, 492, 500,
|
||||
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isUnovaPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list =
|
||||
[
|
||||
330, 331, 337, 338, 348, 349, 350, 351, 359, 360, 361,
|
||||
362, 363, 364, 365, 366, 367, 368, 369, 374, 375, 376, 377,
|
||||
397, 398, 399, 406, 407, 408, 409, 410, 411, 412, 413, 414,
|
||||
415, 416, 419, 420,
|
||||
422, 423, 424, 434, 345,
|
||||
466, 467, 494, 493,
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isSinnohPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list =
|
||||
[254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
|
||||
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 288, 294,
|
||||
295, 296, 297, 298, 299, 305, 306, 307, 308, 315, 316, 317,
|
||||
318, 319, 320, 321, 322, 323, 324, 326, 332, 343, 344, 345,
|
||||
346, 347, 352, 353, 354, 358, 383, 384, 388, 389, 400, 402,
|
||||
403, 429, 468]
|
||||
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
def isHoennPokemon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
poke = getPokemon(species)
|
||||
head_dex = getDexNumberForSpecies(poke.get_head_species())
|
||||
body_dex = getDexNumberForSpecies(poke.get_body_species())
|
||||
list = [252, 253, 276, 277, 278, 279, 280, 281, 282, 283, 284,
|
||||
285, 286, 287, 289, 290, 291, 292, 293, 300, 301, 302, 303,
|
||||
304, 309, 310, 311, 312, 313, 314, 325, 333, 334, 335, 336, 340,
|
||||
341, 342, 355, 356, 357, 378, 379, 380, 381, 382, 385, 386,
|
||||
387, 390, 391, 392, 393, 394, 395, 396, 401, 404, 405, 421,
|
||||
427, 428, 436, 437, 442, 443, 447, 448, 449, 457, 458, 488,
|
||||
495, 496, 497, 501, 502, 503, 504, 505, 506, 507, 508, 509,
|
||||
510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521,
|
||||
522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533,
|
||||
534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545,
|
||||
546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557,
|
||||
558, 559, 560, 561, 562, 563, 564, 565
|
||||
]
|
||||
return list.include?(dexNum) || list.include?(head_dex) || list.include?(body_dex)
|
||||
end
|
||||
|
||||
|
||||
def get_default_moves_at_level(species, level)
|
||||
moveset = GameData::Species.get(species).moves
|
||||
knowable_moves = []
|
||||
moveset.each { |m| knowable_moves.push(m[1]) if m[0] <= level }
|
||||
# Remove duplicates (retaining the latest copy of each move)
|
||||
knowable_moves = knowable_moves.reverse
|
||||
knowable_moves |= []
|
||||
knowable_moves = knowable_moves.reverse
|
||||
# Add all moves
|
||||
moves = []
|
||||
first_move_index = knowable_moves.length - MAX_MOVES
|
||||
first_move_index = 0 if first_move_index < 0
|
||||
for i in first_move_index...knowable_moves.length
|
||||
#moves.push(Pokemon::Move.new(knowable_moves[i]))
|
||||
moves << knowable_moves[i]
|
||||
end
|
||||
return moves
|
||||
end
|
||||
|
||||
def listPokemonIDs()
|
||||
for id in 0..NB_POKEMON
|
||||
pokemon = GameData::Species.get(id).species
|
||||
echoln id.to_s + ": " + "\"" + pokemon.to_s + "\"" + ", "
|
||||
end
|
||||
end
|
||||
|
||||
#IMPORTANT
|
||||
#La méthode def pbCheckEvolution(pokemon,item=0)
|
||||
#dans PokemonFusion (class PokemonFusionScene)
|
||||
#a été modifiée et pour une raison ou une autre ca marche
|
||||
#pas quand on la copie ici.
|
||||
#Donc NE PAS OUBLIER DE LE COPIER AVEC
|
||||
|
||||
|
||||
def isPartPokemon(src, target)
|
||||
return Kernel.isPartPokemon(src, target)
|
||||
end
|
||||
#in: pokemon number
|
||||
def Kernel.isPartPokemon(src, target)
|
||||
|
||||
src = getDexNumberForSpecies(src)
|
||||
target = getDexNumberForSpecies(target)
|
||||
return true if src == target
|
||||
return false if src <= NB_POKEMON
|
||||
bod = getBasePokemonID(src, true)
|
||||
head = getBasePokemonID(src, false)
|
||||
return bod == target || head == target
|
||||
end
|
||||
|
||||
##EDITED HERE
|
||||
#Retourne le pokemon de base
|
||||
#param1 = int
|
||||
#param2 = true pour body, false pour head
|
||||
#return int du pokemon de base
|
||||
def getBasePokemonID(pokemon, body = true)
|
||||
if pokemon.is_a?(Symbol)
|
||||
dex_number = GameData::Species.get(pokemon).id_number
|
||||
pokemon = dex_number
|
||||
end
|
||||
return nil if pokemon <= 0
|
||||
return nil if pokemon >= Settings::ZAPMOLCUNO_NB
|
||||
|
||||
# cname = getConstantName(PBSpecies, pokemon) rescue nil
|
||||
cname = GameData::Species.get(pokemon).id.to_s
|
||||
return pokemon if pokemon <= NB_POKEMON
|
||||
return pokemon if cname == nil
|
||||
|
||||
arr = cname.split(/[B,H]/)
|
||||
|
||||
bod = arr[1]
|
||||
head = arr[2]
|
||||
|
||||
return bod.to_i if body
|
||||
return head.to_i
|
||||
end
|
||||
|
||||
def getGenericPokemonCryText(pokemonSpecies)
|
||||
case pokemonSpecies
|
||||
when 25
|
||||
return "Pika!"
|
||||
when 16, 17, 18, 21, 22, 144, 145, 146, 227, 417, 418, 372 # birds
|
||||
return "Squawk!"
|
||||
when 163, 164
|
||||
return "Hoot!" # owl
|
||||
else
|
||||
return "Guaugh!"
|
||||
end
|
||||
end
|
||||
|
||||
def setPokemonMoves(pokemon, move_ids = [])
|
||||
moves = []
|
||||
move_ids.each { |move_id|
|
||||
moves << Pokemon::Move.new(move_id)
|
||||
}
|
||||
pokemon.moves = moves
|
||||
end
|
||||
|
||||
def changeSpeciesSpecific(pokemon, newSpecies)
|
||||
pokemon.species = newSpecies
|
||||
$Trainer.pokedex.set_seen(newSpecies)
|
||||
$Trainer.pokedex.set_owned(newSpecies)
|
||||
end
|
||||
|
||||
def calculate_pokemon_weight(pokemon, nerf = 0)
|
||||
|
||||
base_weight = pokemon.weight
|
||||
ivs = []
|
||||
pokemon.iv.each { |iv|
|
||||
ivs << iv[1]
|
||||
}
|
||||
level = pokemon.level
|
||||
# Ensure IVs is an array of 6 values and level is between 1 and 100
|
||||
raise "IVs array must have 6 values" if ivs.length != 6
|
||||
raise "Level must be between 1 and 100" unless (1..100).include?(level)
|
||||
|
||||
# Calculate the IV Factor
|
||||
iv_sum = ivs.sum
|
||||
iv_factor = (iv_sum.to_f / 186) * 30 * 10
|
||||
|
||||
# Calculate the Level Factor
|
||||
level_factor = (level.to_f / 100) * 5 * 10
|
||||
|
||||
# Calculate the weight
|
||||
weight = base_weight * (1 + (iv_factor / 100) + (level_factor / 100))
|
||||
weight -= base_weight
|
||||
# Enforce the weight variation limits
|
||||
max_weight = base_weight * 4.00 # 400% increase
|
||||
min_weight = base_weight * 0.5 # 50% decrease
|
||||
|
||||
# Cap the weight between min and max values
|
||||
weight = [[weight, min_weight].max, max_weight].min
|
||||
weight -= nerf if weight - nerf > min_weight
|
||||
return weight.round(2) # Round to 2 decimal places
|
||||
end
|
||||
|
||||
|
||||
def playCry(pokemonSpeciesSymbol)
|
||||
species = GameData::Species.get(pokemonSpeciesSymbol).species
|
||||
GameData::Species.play_cry_from_species(species)
|
||||
end
|
||||
|
||||
def getHiddenPowerName(pokemon)
|
||||
hiddenpower = pbHiddenPower(pokemon)
|
||||
hiddenPowerType = hiddenpower[0]
|
||||
|
||||
echoln hiddenPowerType
|
||||
if Settings::TRIPLE_TYPES.include?(hiddenPowerType)
|
||||
return _INTL("Neutral")
|
||||
end
|
||||
return PBTypes.getName(hiddenPowerType)
|
||||
end
|
||||
|
||||
def has_species_or_fusion?(species, form = -1)
|
||||
return $Trainer.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
|
||||
end
|
||||
@@ -0,0 +1,231 @@
|
||||
###################
|
||||
## CONVERTER #
|
||||
###################
|
||||
def convertAllPokemon()
|
||||
Kernel.pbMessage(_INTL("The game has detected that your previous savefile was from an earlier build of the game."))
|
||||
Kernel.pbMessage(_INTL("In order to play this version, your Pokémon need to be converted to their new Pokédex numbers. "))
|
||||
Kernel.pbMessage(_INTL("If you were playing Randomized mode, the trainers and wild Pokémon will also need to be reshuffled."))
|
||||
|
||||
|
||||
if (Kernel.pbConfirmMessage(_INTL("Convert your Pokémon?")))
|
||||
|
||||
#get previous version
|
||||
msgwindow = Kernel.pbCreateMessageWindow(nil)
|
||||
msgwindow.text = _INTL("What is the last version of the game you played?")
|
||||
choice = Kernel.pbShowCommands(msgwindow, [
|
||||
_INTL("4.7 (September 2020)"),
|
||||
_INTL("4.5-4.6.2 (2019-2020)"),
|
||||
_INTL("4.2-4.4 (2019)"),
|
||||
_INTL("4.0-4.1 (2018-2019)"),
|
||||
_INTL("3.x or earlier (2015-2018)")], -1)
|
||||
case choice
|
||||
when 0
|
||||
prev_total = 381
|
||||
when 1
|
||||
prev_total = 351
|
||||
when 2
|
||||
prev_total = 315
|
||||
when 3
|
||||
prev_total = 275
|
||||
when 4
|
||||
prev_total = 151
|
||||
else
|
||||
prev_total = 381
|
||||
end
|
||||
Kernel.pbDisposeMessageWindow(msgwindow)
|
||||
|
||||
pbEachPokemon { |poke, box|
|
||||
if poke.species >= NB_POKEMON
|
||||
pf = poke.species
|
||||
pBody = (pf / prev_total).round
|
||||
pHead = pf - (prev_total * pBody)
|
||||
|
||||
# Kernel.pbMessage("pbod {1} pHead {2}, species: {3})",pBody,pHead,pf)
|
||||
|
||||
prev_max_value = (prev_total * prev_total) + prev_total
|
||||
if pf >= prev_max_value
|
||||
newSpecies = convertTripleFusion(pf, prev_max_value)
|
||||
if newSpecies == nil
|
||||
boxname = box == -1 ? "Party" : box
|
||||
Kernel.pbMessage(_INTL("Invalid Pokémon detected in box {1}:\n num. {2}, {3} (lv. {4})", boxname, pf, poke.name, poke.level))
|
||||
if (Kernel.pbConfirmMessage(_INTL("Delete Pokémon and continue?")))
|
||||
poke = nil
|
||||
next
|
||||
else
|
||||
Kernel.pbMessage(_INTL("Conversion cancelled. Please restart the game."))
|
||||
Graphics.freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
newSpecies = pBody * NB_POKEMON + pHead
|
||||
poke.species = newSpecies
|
||||
end
|
||||
}
|
||||
Kernel.initRandomTypeArray()
|
||||
if $game_switches[SWITCH_RANDOM_TRAINERS] #randomized trainers
|
||||
Kernel.pbShuffleTrainers()
|
||||
end
|
||||
if $game_switches[956] #randomized pokemon
|
||||
range = pbGet(197) == nil ? 25 : pbGet(197)
|
||||
Kernel.pbShuffleDex(range, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def convertTripleFusion(species, prev_max_value)
|
||||
if prev_max_value == (351 * 351) + 351
|
||||
case species
|
||||
when 123553
|
||||
return 145543
|
||||
when 123554
|
||||
return 145544
|
||||
when 123555
|
||||
return 145545
|
||||
when 123556
|
||||
return 145546
|
||||
when 123557
|
||||
return 145547
|
||||
when 123558
|
||||
return 145548
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
def convertTrainers()
|
||||
if ($game_switches[SWITCH_RANDOM_TRAINERS])
|
||||
Kernel.pbShuffleTrainers()
|
||||
end
|
||||
end
|
||||
|
||||
def convertAllPokemonManually()
|
||||
|
||||
if (Kernel.pbConfirmMessage(_INTL("When you last played the game, where there any gen 2 Pokémon?")))
|
||||
#4.0
|
||||
prev_total = 315
|
||||
else
|
||||
#3.0
|
||||
prev_total = 151
|
||||
end
|
||||
convertPokemon(prev_total)
|
||||
end
|
||||
|
||||
def convertPokemon(prev_total = 275)
|
||||
pbEachPokemon { |poke, box|
|
||||
if poke.species >= NB_POKEMON
|
||||
pf = poke.species
|
||||
pBody = (pf / prev_total).round
|
||||
pHead = pf - (prev_total * pBody)
|
||||
|
||||
newSpecies = pBody * NB_POKEMON + pHead
|
||||
poke.species = newSpecies
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def fixMissedHMs()
|
||||
# Flash
|
||||
if $PokemonBag.pbQuantity(:HM08) < 1 && $PokemonGlobal.questRewardsObtained.include?(:HM08)
|
||||
pbReceiveItem(:HM08)
|
||||
end
|
||||
|
||||
# Cut
|
||||
if $PokemonBag.pbQuantity(:HM01) < 1 && $game_switches[SWITCH_SS_ANNE_DEPARTED]
|
||||
pbReceiveItem(:HM01)
|
||||
end
|
||||
|
||||
# Strength
|
||||
if $PokemonBag.pbQuantity(:HM04) < 1 && $game_switches[SWITCH_SNORLAX_GONE_ROUTE_12]
|
||||
pbReceiveItem(:HM04)
|
||||
end
|
||||
|
||||
# Surf
|
||||
if $PokemonBag.pbQuantity(:HM03) < 1 && $game_self_switches[[107, 1, "A"]]
|
||||
pbReceiveItem(:HM03)
|
||||
end
|
||||
|
||||
# Teleport
|
||||
if $PokemonBag.pbQuantity(:HM07) < 1 && $game_switches[SWITCH_TELEPORT_NPC]
|
||||
pbReceiveItem(:HM07)
|
||||
end
|
||||
|
||||
# Fly
|
||||
if $PokemonBag.pbQuantity(:HM02) < 1 && $game_self_switches[[439, 1, "B"]]
|
||||
pbReceiveItem(:HM02)
|
||||
end
|
||||
|
||||
# Waterfall
|
||||
if $PokemonBag.pbQuantity(:HM05) < 1 && $game_switches[SWITCH_GOT_WATERFALL]
|
||||
pbReceiveItem(:HM05)
|
||||
end
|
||||
|
||||
# Dive
|
||||
if $PokemonBag.pbQuantity(:HM06) < 1 && $game_switches[SWITCH_GOT_DIVE]
|
||||
pbReceiveItem(:HM06)
|
||||
end
|
||||
|
||||
# Rock Climb
|
||||
if $PokemonBag.pbQuantity(:HM10) < 1 && $game_switches[SWITCH_GOT_ROCK_CLIMB]
|
||||
pbReceiveItem(:HM10)
|
||||
end
|
||||
end
|
||||
|
||||
def fixFinishedRocketQuests()
|
||||
fix_broken_TR_quests()
|
||||
|
||||
var_tr_missions_cerulean = 288
|
||||
|
||||
switch_tr_mission_cerulean_4 = 1116
|
||||
switch_tr_mission_celadon_1 = 1084
|
||||
switch_tr_mission_celadon_2 = 1086
|
||||
switch_tr_mission_celadon_3 = 1088
|
||||
switch_tr_mission_celadon_4 = 1110
|
||||
switch_pinkan_done = 1119
|
||||
|
||||
nb_cerulean_missions = pbGet(var_tr_missions_cerulean)
|
||||
|
||||
finishTRQuest("tr_cerulean_1", :SUCCESS, true) if nb_cerulean_missions >= 1 && !pbCompletedQuest?("tr_cerulean_1")
|
||||
echoln pbCompletedQuest?("tr_cerulean_1")
|
||||
finishTRQuest("tr_cerulean_2", :SUCCESS, true) if nb_cerulean_missions >= 2 && !pbCompletedQuest?("tr_cerulean_2")
|
||||
finishTRQuest("tr_cerulean_3", :SUCCESS, true) if nb_cerulean_missions >= 3 && !pbCompletedQuest?("tr_cerulean_3")
|
||||
finishTRQuest("tr_cerulean_4", :SUCCESS, true) if $game_switches[switch_tr_mission_cerulean_4] && !pbCompletedQuest?("tr_cerulean_4")
|
||||
|
||||
finishTRQuest("tr_celadon_1", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_1] && !pbCompletedQuest?("tr_celadon_1")
|
||||
finishTRQuest("tr_celadon_2", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_2] && !pbCompletedQuest?("tr_celadon_2")
|
||||
finishTRQuest("tr_celadon_3", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_3] && !pbCompletedQuest?("tr_celadon_3")
|
||||
finishTRQuest("tr_celadon_4", :SUCCESS, true) if $game_switches[switch_tr_mission_celadon_4] && !pbCompletedQuest?("tr_celadon_4")
|
||||
|
||||
finishTRQuest("tr_pinkan", :SUCCESS, true) if $game_switches[switch_pinkan_done] && !pbCompletedQuest?("tr_pinkan")
|
||||
end
|
||||
|
||||
def fix_broken_TR_quests()
|
||||
for trainer_quest in $Trainer.quests
|
||||
if trainer_quest.id == 0 # tr quests were all set to ID 0 instead of their real ID in v 6.4.0
|
||||
for rocket_quest_id in TR_QUESTS.keys
|
||||
rocket_quest = TR_QUESTS[rocket_quest_id]
|
||||
next if !rocket_quest
|
||||
if trainer_quest.name == rocket_quest.name
|
||||
trainer_quest.id = rocket_quest_id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fix_missing_infinite_splicers
|
||||
return unless Settings::KANTO
|
||||
obtained_infinite_splicers = $game_switches[275]
|
||||
obtained_upgraded_infinite_splicers = $game_self_switches[[703,4,"A"]]
|
||||
if obtained_infinite_splicers && pbQuantity(:INFINITESPLICERS) <= 0 && pbQuantity(:INFINITESPLICERS2) <= 0
|
||||
pbReceiveItem(:INFINITESPLICERS)
|
||||
end
|
||||
if obtained_upgraded_infinite_splicers && pbQuantity(:INFINITESPLICERS2) <= 0
|
||||
pbReceiveItem(:INFINITESPLICERS2)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,159 @@
|
||||
def splitSpriteCredits(name, bitmap, max_width)
|
||||
name_full_width = bitmap.text_size(name).width
|
||||
# use original name if can fit on one line
|
||||
return [ name ] if name_full_width <= max_width
|
||||
|
||||
temp_string = name
|
||||
name_split = []
|
||||
|
||||
# split name by collab separator " & " nearest to max width
|
||||
start_pos = temp_string.index(' & ')
|
||||
temp_pos = nil
|
||||
while start_pos && (bitmap.text_size(temp_string).width > max_width)
|
||||
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
|
||||
if substring_width > max_width
|
||||
name_split << temp_string[0, temp_pos].strip
|
||||
temp_string = temp_string[(temp_pos + 1)..].strip
|
||||
start_pos = temp_string.index(' & ')
|
||||
temp_pos = nil
|
||||
next
|
||||
end
|
||||
|
||||
temp_pos = start_pos
|
||||
start_pos = temp_string.index(' & ', start_pos + 1)
|
||||
end
|
||||
|
||||
# append remainder of " & " split if within max width
|
||||
if temp_pos != nil
|
||||
name_split << temp_string[0, temp_pos].strip
|
||||
temp_string = temp_string[(temp_pos + 1)..].strip
|
||||
end
|
||||
|
||||
# split remaining string by space
|
||||
temp_pos = nil
|
||||
if (bitmap.text_size(temp_string).width > max_width) && (start_pos = temp_string.index(' '))
|
||||
while start_pos && (bitmap.text_size(temp_string).width > max_width)
|
||||
substring_width = bitmap.text_size(temp_string[0, start_pos]).width
|
||||
if substring_width > max_width
|
||||
name_split << temp_string[0, temp_pos].strip
|
||||
temp_string = temp_string[(temp_pos + 1)..].strip
|
||||
start_pos = temp_string.index(' ')
|
||||
temp_pos = nil
|
||||
next
|
||||
end
|
||||
|
||||
temp_pos = start_pos
|
||||
start_pos = temp_string.index(' ', start_pos + 1)
|
||||
end
|
||||
end
|
||||
|
||||
# append remaining text, even if too long for screen
|
||||
name_split << temp_string if temp_string != ''
|
||||
|
||||
return name_split
|
||||
end
|
||||
|
||||
def pbLoadPokemonBitmapSpecies(pokemon, species, back = false, scale = POKEMONSPRITESCALE)
|
||||
ret = nil
|
||||
pokemon = pokemon.pokemon if pokemon.respond_to?(:pokemon)
|
||||
if pokemon.isEgg?
|
||||
bitmapFileName = getEggBitmapPath(pokemon)
|
||||
bitmapFileName = pbResolveBitmap(bitmapFileName)
|
||||
elsif pokemon.species >= ZAPMOLCUNO_NB #zapmolcuno
|
||||
bitmapFileName = getSpecialSpriteName(pokemon.species) #sprintf("Graphics/Battlers/special/144.145.146")
|
||||
bitmapFileName = pbResolveBitmap(bitmapFileName)
|
||||
else
|
||||
#edited here
|
||||
isFusion = species > NB_POKEMON
|
||||
if isFusion
|
||||
poke1 = getBodyID(species)
|
||||
poke2 = getHeadID(species, poke1)
|
||||
else
|
||||
poke1 = species
|
||||
poke2 = species
|
||||
end
|
||||
bitmapFileName = GetSpritePath(poke1, poke2, isFusion)
|
||||
# Alter bitmap if supported
|
||||
alterBitmap = (MultipleForms.getFunction(species, "alterBitmap") rescue nil)
|
||||
end
|
||||
if bitmapFileName && alterBitmap
|
||||
animatedBitmap = AnimatedBitmap.new(bitmapFileName)
|
||||
copiedBitmap = animatedBitmap.copy
|
||||
animatedBitmap.dispose
|
||||
copiedBitmap.each { |bitmap| alterBitmap.call(pokemon, bitmap) }
|
||||
ret = copiedBitmap
|
||||
elsif bitmapFileName
|
||||
ret = AnimatedBitmap.new(bitmapFileName)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbPokemonBitmapFile(species)
|
||||
# Used by the Pokédex
|
||||
# Load normal bitmap
|
||||
#get body and head num
|
||||
isFused = species > NB_POKEMON
|
||||
if isFused
|
||||
if species >= ZAPMOLCUNO_NB
|
||||
path = getSpecialSpriteName(species) + ".png"
|
||||
else
|
||||
poke1 = getBodyID(species) #getBasePokemonID(species,true)
|
||||
poke2 = getHeadID(species, poke1) #getBasePokemonID(species,false)
|
||||
path = GetSpritePath(poke1, poke2, isFused)
|
||||
end
|
||||
else
|
||||
path = GetSpritePath(species, species, false)
|
||||
end
|
||||
ret = sprintf(path) rescue nil
|
||||
if !pbResolveBitmap(ret)
|
||||
ret = "Graphics/Battlers/000.png"
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
def pbLoadPokemonBitmap(pokemon, species, back = false)
|
||||
#species est utilisé par elitebattle mais ca sert a rien
|
||||
return pbLoadPokemonBitmapSpecies(pokemon, pokemon.species, back)
|
||||
end
|
||||
|
||||
def getEggBitmapPath(pokemon)
|
||||
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.hide_custom_eggs
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%s", getConstantName(PBSpecies, pokemon.species)) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
if pokemon.species >= NUM_ZAPMOLCUNO
|
||||
bitmapFileName = "Graphics/Battlers/Eggs/egg_base"
|
||||
else
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%03d", pokemon.species)
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Battlers/Eggs/000")
|
||||
end
|
||||
end
|
||||
end
|
||||
return bitmapFileName
|
||||
end
|
||||
|
||||
def GetSpritePath(poke1, poke2, isFused)
|
||||
#Check if custom exists
|
||||
spritename = GetSpriteName(poke1, poke2, isFused)
|
||||
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES,poke2, spritename)
|
||||
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
|
||||
path = pbResolveBitmap(pathCustom) && $game_variables[196] == 0 ? pathCustom : pathReg
|
||||
return path
|
||||
end
|
||||
|
||||
|
||||
def GetSpritePathForced(poke1, poke2, isFused)
|
||||
#Check if custom exists
|
||||
spritename = GetSpriteName(poke1, poke2, isFused)
|
||||
pathCustom = sprintf("Graphics/%s/indexed/%s/%s.png", DOSSIERCUSTOMSPRITES, poke2, spritename)
|
||||
pathReg = sprintf("Graphics/%s/%s/%s.png", BATTLERSPATH, poke2, spritename)
|
||||
path = pbResolveBitmap(pathCustom) ? pathCustom : pathReg
|
||||
return path
|
||||
end
|
||||
|
||||
|
||||
def GetSpriteName(poke1, poke2, isFused)
|
||||
ret = isFused ? sprintf("%d.%d", poke2, poke1) : sprintf("%d", poke2) rescue nil
|
||||
return ret
|
||||
end
|
||||
@@ -0,0 +1,115 @@
|
||||
def pbGetSelfSwitch(eventId, switch)
|
||||
return $game_self_switches[[@map_id, eventId, switch]]
|
||||
end
|
||||
|
||||
def find_newer_available_version
|
||||
latest_Version = fetch_latest_game_version
|
||||
return nil if !latest_Version
|
||||
return nil if is_higher_version(Settings::GAME_VERSION_NUMBER, latest_Version)
|
||||
return latest_Version
|
||||
end
|
||||
|
||||
def is_higher_version(gameVersion, latestVersion)
|
||||
gameVersion_parts = gameVersion.split('.').map(&:to_i)
|
||||
latestVersion_parts = latestVersion.split('.').map(&:to_i)
|
||||
|
||||
# Compare each part of the version numbers from left to right
|
||||
gameVersion_parts.each_with_index do |part, i|
|
||||
return true if (latestVersion_parts[i].nil? || part > latestVersion_parts[i])
|
||||
return false if part < latestVersion_parts[i]
|
||||
end
|
||||
return latestVersion_parts.length <= gameVersion_parts.length
|
||||
end
|
||||
|
||||
def get_current_game_difficulty
|
||||
return :EASY if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
|
||||
return :HARD if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return :NORMAL
|
||||
end
|
||||
|
||||
def get_difficulty_text
|
||||
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
|
||||
return _INTL("Easy")
|
||||
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return _INTL("Hard")
|
||||
else
|
||||
return _INTL("Normal")
|
||||
end
|
||||
end
|
||||
|
||||
def getLatestSpritepackDate()
|
||||
return Time.new(Settings::NEWEST_SPRITEPACK_YEAR, Settings::NEWEST_SPRITEPACK_MONTH)
|
||||
end
|
||||
|
||||
def new_spritepack_was_released()
|
||||
current_spritepack_date = $PokemonGlobal.current_spritepack_date
|
||||
latest_spritepack_date = getLatestSpritepackDate()
|
||||
if !current_spritepack_date || (current_spritepack_date < latest_spritepack_date)
|
||||
$PokemonGlobal.current_spritepack_date = latest_spritepack_date
|
||||
return true
|
||||
end
|
||||
return false
|
||||
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
|
||||
|
||||
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(_INTL("The game could not open the link in the browser"))
|
||||
pbMessage(_INTL("The link has been copied to your clipboard instead"))
|
||||
end
|
||||
end
|
||||
|
||||
# todo: implement
|
||||
def getMappedKeyFor(internalKey)
|
||||
|
||||
keybinding_fileName = "keybindings.mkxp1"
|
||||
path = System.data_directory + keybinding_fileName
|
||||
|
||||
parse_keybindings(path)
|
||||
|
||||
# echoln Keybindings.new(path).bindings
|
||||
end
|
||||
|
||||
def formatNumberToString(number)
|
||||
return number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
|
||||
end
|
||||
|
||||
def optionsMenu(options = [], cmdIfCancel = -1, startingOption = 0)
|
||||
cmdIfCancel = -1 if !cmdIfCancel
|
||||
result = pbShowCommands(nil, options, cmdIfCancel, startingOption)
|
||||
# echoln "menuResult :#{result}"
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
def displaySpriteWindowWithMessage(pif_sprite, message = "", x = 0, y = 0, z = 0)
|
||||
spriteLoader = BattleSpriteLoader.new
|
||||
sprite_bitmap = spriteLoader.load_pif_sprite_directly(pif_sprite)
|
||||
if sprite_bitmap
|
||||
pictureWindow = PictureWindow.new(sprite_bitmap.bitmap)
|
||||
else
|
||||
pictureWindow = PictureWindow.new("")
|
||||
end
|
||||
|
||||
pictureWindow.opacity = 0
|
||||
pictureWindow.z = z
|
||||
pictureWindow.x = x
|
||||
pictureWindow.y = y
|
||||
pbMessage(message)
|
||||
pictureWindow.dispose
|
||||
end
|
||||
|
||||
def numeric_string?(str)
|
||||
str.match?(/\A\d+\z/)
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
=begin
|
||||
*** Wonder Trade Script by Black Eternity ***
|
||||
This script is to mimic Wonder Trade from an offline perspective.
|
||||
THERE IS NO ONLINE CAPABILITIES OF THIS SCRIPT,
|
||||
ALL CALCULATIONS ARE DONE INTERNALLY.
|
||||
|
||||
To call the script like normal and have ALL Pokemon trade-able, use the following.
|
||||
pbWondertrade(1,[],[])
|
||||
|
||||
Black listed Pokemon are to be added to the Exceptions arrays.
|
||||
Except is the list of pokemon the player is forbidden to trade.
|
||||
Here the player cannot trade any of the following.
|
||||
pbWonderTrade(1,[:PIKACHU,:SQUIRTLE,:CHARMANDER,;BULBASAUR],[])
|
||||
|
||||
Except2 is the list of pokemon the player is forbidden to receive.
|
||||
Here the player cannot receive any of the following.
|
||||
pbWonderTrade(1,[],[:MEWTWO,;MEW,;DEOXYS])
|
||||
|
||||
|
||||
|
||||
The first parameter is the minimum allowed Level of the Pokemon to be traded.
|
||||
For example, you can not trade a Pokemon through Wonder Trade unless its level
|
||||
is greater than or equal to specified level.
|
||||
|
||||
pbWonderTrade(40,[:SQUIRTLE,:CHARMANDER,:BULBASAUR],[:MEWTWO,:MEW,:DEOXYS])
|
||||
*** Only pokemon over level 40 can be traded, you cannot trade starters.
|
||||
*** You cannot receive these legendaries.
|
||||
|
||||
The fourth parameter, which has recently replaced mej71's "hardobtain"
|
||||
is called "rare", this parameter developed also by mej71, will use
|
||||
the Pokemon's rareness and filter the results depending on its values.
|
||||
|
||||
** Rareness is turned on by default, if you wish to disable it, call the
|
||||
function accordingly.
|
||||
|
||||
pbWonderTrade(10,[:SQUIRTLE],[:CHARMANDER,:BULBASAUR],false)
|
||||
** Only Pokemon over level 10, cannot trade Squirtle, cannot
|
||||
** recieve Charmander or Bulbasaur, Rareness disabled.
|
||||
|
||||
It is up to you to use it how you wish, credits will be appreciated.
|
||||
=end
|
||||
|
||||
# List of Randomly selected Trainer Names
|
||||
# These are just names taken from a generator, add custom or change to
|
||||
# whatever you desire.
|
||||
|
||||
|
||||
def pbWonderTrade(lvl, except = [], except2 = [], premiumWonderTrade = true)
|
||||
# for i in 0...except.length # Gets ID of pokemon in exception array
|
||||
# except[i]=getID(PBSpecies,except[i]) if !except[i].is_a?(Integer)
|
||||
# end
|
||||
# for i in 0...except2.length # Gets ID of pokemon in exception array
|
||||
# except2[i]=getID(PBSpecies,except2[i]) if !except2[i].is_a?(Integer)
|
||||
# end
|
||||
# ignoreExcept = rand(100) == 0 #tiny chance to include legendaries
|
||||
#
|
||||
# except+=[]
|
||||
rare = premiumWonderTrade
|
||||
chosen = pbChoosePokemon(1, 2, # Choose eligable pokemon
|
||||
proc {
|
||||
|poke| !poke.egg? && !(poke.isShadow?) && # No Eggs, No Shadow Pokemon
|
||||
(poke.level >= lvl) && !(except.include?(poke.species)) # None under "lvl", no exceptions.
|
||||
})
|
||||
poke = $Trainer.party[pbGet(1)]
|
||||
if !pbConfirmMessage(_INTL("Trade {1} away?",poke.name))
|
||||
return
|
||||
end
|
||||
|
||||
# $PokemonBag.pbStoreItem(poke.item, 1) if poke.item != nil
|
||||
myPoke = poke.species
|
||||
chosenBST = calcBaseStatsSum(myPoke)
|
||||
# The following excecption fields are for hardcoding the blacklisted pokemon
|
||||
# without adding them in the events.
|
||||
#except+=[]
|
||||
except2 += [:ARCEUS, :MEW, :CELEBI, :LUGIA, :HOOH, :MEWTWO]
|
||||
if pbGet(1) >= 0
|
||||
species = 0
|
||||
luck = rand(5) + 1
|
||||
rarecap = (rand(155 + poke.level) / (1 + rand(5))) / luck
|
||||
bonus = 0
|
||||
while (species == 0) # Loop Start
|
||||
bonus += 5 #+ de chance de pogner un bon poke a chaque loop (permet d'eviter infinite loop)
|
||||
|
||||
species = rand(PBSpecies.maxValue) + 1
|
||||
bst = calcBaseStatsSum(species)
|
||||
# Redo the loop if pokemon is too evolved for its level
|
||||
#species=0 if lvl < pbGetMinimumLevel(species)# && pbGetPreviousForm(species) != species # && pbGetPreviousForm(species)!=species
|
||||
# Redo the loop if the species is an exception.
|
||||
species = 0 if checkifBlacklisted(species, except2) && !ignoreExcept #except2.include?(species)
|
||||
#Redo loop if above BST
|
||||
bstLimit = chosenBST + bonus# + $game_variables[120]
|
||||
if !premiumWonderTrade
|
||||
bstLimit-=50
|
||||
end
|
||||
species = 0 if bst > bstLimit
|
||||
if species > 0 && premiumWonderTrade
|
||||
species = 0 if !customSpriteExistsSpecies(species)
|
||||
end
|
||||
if species > 0
|
||||
skipLegendaryCheck = premiumWonderTrade && rand(100) < luck
|
||||
species = 0 if pokemonIsPartLegendary(species) && !$game_switches[SWITCH_BEAT_THE_LEAGUE] && !skipLegendaryCheck
|
||||
end
|
||||
#Redo loop if below BST - 200
|
||||
species = 0 if bst < (chosenBST - 200)
|
||||
|
||||
# raise "{1}'s bst ist {2}, new ist {3}",myPoke,chosenBST,bst
|
||||
|
||||
# species=0 if (except.include?(species) && except2.include?(species))
|
||||
# use this above line instead if you wish to neither receive pokemon that YOU
|
||||
# cannot trade.
|
||||
if rare == true #turn on rareness
|
||||
if species > 0
|
||||
rareness = GameData::Species.get(species).catch_rate
|
||||
species = 0 if rarecap >= rareness
|
||||
end
|
||||
end
|
||||
end
|
||||
randTrainerNames = RandTrainerNames_male + RandTrainerNames_female + RandTrainerNames_others
|
||||
#tname = randTrainerNames[rand(randTrainerNames.size)] # Randomizes Trainer Names
|
||||
pname = RandPokeNick[rand(RandPokeNick.size)] # Randomizes Pokemon Nicknames
|
||||
|
||||
#num of Wondertrade - 1
|
||||
if premiumWonderTrade
|
||||
$game_variables[VAR_PREMIUM_WONDERTRADE_LEFT] -= 1
|
||||
else
|
||||
$game_variables[VAR_STANDARD_WONDERTRADE_LEFT] -= 1
|
||||
end
|
||||
tname = getSpriterCreditForDexNumber(species)
|
||||
tname = randTrainerNames[rand(randTrainerNames.size)] if ! tname
|
||||
newpoke = pbStartTrade(pbGet(1), species, pname, tname, 0, true) # Starts the trade
|
||||
|
||||
echoln newpoke
|
||||
|
||||
#lower level by 1 to prevent abuse
|
||||
if poke.level > 25
|
||||
newpoke.level = poke.level - 1
|
||||
end
|
||||
else
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
def pbGRS(minBST, chosenBST, luck, rare, except2)
|
||||
#pbGenerateRandomSpecies (le nom doit etre short pour etre callé dans events)
|
||||
# The following excecption fields are for hardcoding the blacklisted pokemon
|
||||
# without adding them in the events.
|
||||
#except+=[]
|
||||
except2 += []
|
||||
species = 0
|
||||
#luck = rand(5)+1
|
||||
rarecap = (rand(rare) / (1 + rand(5))) / luck
|
||||
bonus = 0
|
||||
while (species == 0) # Loop Start
|
||||
bonus += 5 #+ de chance de pogner un bon poke a chaque loop (permet d'eviter infinite loop)
|
||||
|
||||
species = rand(PBSpecies.maxValue) + 1
|
||||
bst = calcBaseStatsSum(species)
|
||||
# Redo the loop if pokemon is too evolved for its level
|
||||
#species=0 if lvl < pbGetMinimumLevel(species)# && pbGetPreviousForm(species) != species # && pbGetPreviousForm(species)!=species
|
||||
# Redo the loop if the species is an exception.
|
||||
species = 0 if checkifBlacklisted(species, except2) #except2.include?(species)
|
||||
#Redo loop if above BST
|
||||
species = 0 if bst > chosenBST + $game_variables[120] + bonus
|
||||
|
||||
#Redo loop if below BST - 200
|
||||
species = 0 if bst < (chosenBST - 200)
|
||||
|
||||
# raise "{1}'s bst ist {2}, new ist {3}",myPoke,chosenBST,bst
|
||||
|
||||
# species=0 if (except.include?(species) && except2.include?(species))
|
||||
# use this above line instead if you wish to neither receive pokemon that YOU
|
||||
# cannot trade.
|
||||
if rare == true #turn on rareness
|
||||
rareness = GameData::Species.get(species).catch_rate
|
||||
species = 0 if rarecap >= rareness
|
||||
end
|
||||
end
|
||||
return species
|
||||
end
|
||||
|
||||
#utilisé dans des events - ne pas renommer
|
||||
def calcBaseStats(species)
|
||||
return calcBaseStatsSum(species)
|
||||
end
|
||||
|
||||
|
||||
def calcBaseStatsSum(species)
|
||||
stats = GameData::Species.get(species).base_stats
|
||||
sum = 0
|
||||
sum += stats[:HP]
|
||||
sum += stats[:ATTACK]
|
||||
sum += stats[:DEFENSE]
|
||||
sum += stats[:SPECIAL_ATTACK]
|
||||
sum += stats[:SPECIAL_DEFENSE]
|
||||
sum += stats[:SPEED]
|
||||
return sum
|
||||
#
|
||||
# basestatsum = $pkmn_dex[species][5][0] # HP
|
||||
# basestatsum +=$pkmn_dex[species][5][1] # Attack
|
||||
# basestatsum +=$pkmn_dex[species][5][2] # Defense
|
||||
# basestatsum +=$pkmn_dex[species][5][3] # Speed
|
||||
# basestatsum +=$pkmn_dex[species][5][4] # Special Attack
|
||||
# basestatsum +=$pkmn_dex[species][5][5] # Special Defense
|
||||
# return basestatsum
|
||||
end
|
||||
|
||||
def checkifBlacklisted(species, blacklist)
|
||||
return true if blacklist.include?(getBasePokemonID(species, true))
|
||||
return true if blacklist.include?(getBasePokemonID(species, false))
|
||||
return false
|
||||
end
|
||||
Reference in New Issue
Block a user