spriter fight in gallery

This commit is contained in:
infinitefusion
2023-06-17 12:58:57 -04:00
parent 45fe666a35
commit a82a58df33
17 changed files with 173 additions and 41 deletions

View File

@@ -145,6 +145,7 @@ end
#param2 = true pour body, false pour head
#return int du pokemon de base
def getBasePokemonID(pokemon, body = true)
return nil if pokemon <= 0
if pokemon.is_a?(Symbol)
dex_number = GameData::Species.get(pokemon).id_number
pokemon = dex_number

View File

@@ -60,7 +60,7 @@ def addNewTripleFusion(pokemon1,pokemon2,pokemon3,level = 1)
end
pokemon = TripleFusion.new(pokemon1,pokemon2,pokemon3,level)
pokemon.calc_stats
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, pokemon.name))
pbNicknameAndStore(pokemon)
#$Trainer.pokedex.register(pokemon)

View File

@@ -125,11 +125,42 @@ def list_all_spriters()
return names_list
end
def generateCurrentGalleryBattle(level = nil, number_of_pokemon = 3)
spriter_name = pbGet(259)
#set highest level in party if nil
if !level
level = $Trainer.highest_level_pokemon_in_party
end
possible_battlers = []
for i in 0..5
sprite = pbGet(VAR_GALLERY_FEATURED_SPRITES)[i]
species = getPokemonSpeciesFromSprite(sprite)
possible_battlers << species if species
end
selected_battlers_idx = possible_battlers.sample(number_of_pokemon)
party = []
selected_battlers_idx.each { |species|
party << Pokemon.new(species, level)
}
customTrainerBattle(spriter_name,
:PAINTER,
party,
level,
pick_spriter_losing_dialog(spriter_name),
pick_trainer_sprite(spriter_name)
)
end
def generateArtGallery(nbSpritesDisplayed = 6, saveArtistNameInVariable = 1, saveSpritesInVariable = 2, saveAllArtistSpritesInVariable = 3, artistName = nil)
artistName = nil if artistName == 0
creditsMap = map_sprites_by_artist
featuredArtist = artistName ? artistName : getRandomSpriteArtist(creditsMap, nbSpritesDisplayed)
if featuredArtist
if !creditsMap[featuredArtist] #try again if issue
return generateArtGallery(nbSpritesDisplayed,saveSpritesInVariable,saveSpritesInVariable,saveSpritesInVariable,artistName)
end
featuredSprites = creditsMap[featuredArtist].shuffle.take(nbSpritesDisplayed)
pbSet(saveArtistNameInVariable, File.basename(featuredArtist, '#*'))
pbSet(saveSpritesInVariable, featuredSprites)
@@ -143,7 +174,7 @@ def format_artist_name(full_name)
return File.basename(full_name, '#*')
end
def getRandomSpriteArtist(creditsMap = nil, minimumNumberOfSprites = 1, giveUpAfterX = 50)
def getRandomSpriteArtist(creditsMap = nil, minimumNumberOfSprites = 10, giveUpAfterX = 50)
creditsMap = map_sprites_by_artist if !creditsMap
i = 0
while i < giveUpAfterX

View File

@@ -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 = [
"Oh... I lost...",
"I did my best!",
"You're too strong!",
"You win!",
"What a fight!",
"That was fun!",
"Ohh, that's too bad",
"I should've sprited some stronger Pokémon!",
"So much for that!",
"Should've seen that coming!",
"I can't believe it!",
"What a surprise!"
]
index = select_number_from_seed(spriter_name,0,possible_dialogs.size-1)
return possible_dialogs[index]
end

View File

@@ -17,6 +17,12 @@ class TripleFusion < Pokemon
super(:ZAPMOLTICUNO,level,owner,withMoves,recheck_form)
end
def types
return [@species1_data.type1, @species2_data.type1,@species3_data.type1]
end
def baseStats
ret = {}
GameData::Stat.each_main do |s|
@@ -33,6 +39,9 @@ class TripleFusion < Pokemon
return (nicknamed?) ? @name : @species_name
end
def speciesName
return @species_name
end
def generate_triple_fusion_name()
part1 = split_string_with_syllables(@species1_data.name)[0]
@@ -58,6 +67,23 @@ class TripleFusion < Pokemon
end
def ability_id
if !@ability
abil_index = ability_index
if !@ability # Natural ability or no hidden ability defined
chosen_poke_for_ability= rand(1..3)
if chosen_poke_for_ability == 1
@ability = @species1_data.abilities[abil_index] || @species1_data.abilities[0]
elsif chosen_poke_for_ability == 2
@ability = @species2_data.abilities[abil_index] || @species2_data.abilities[0]
else
@ability = @species3_data.abilities[abil_index] || @species3_data.abilities[0]
end
end
end
return @ability
end
end