Skip to content

Commit

Permalink
0.17.0 patched gender with fusion and other stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
kurayamiblackheart committed Jun 3, 2024
1 parent d657b06 commit dffcba7
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 85 deletions.
2 changes: 1 addition & 1 deletion Data/Scripts/001_Settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '6.0.0'
IF_VERSION = "6.1.4"
GAME_VERSION_NUMBER = "0.16.10"
GAME_VERSION_NUMBER = "0.17.0"

POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
Expand Down
67 changes: 61 additions & 6 deletions Data/Scripts/014_Pokemon/001_Pokemon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class Pokemon
attr_accessor :body_shinyb
attr_accessor :head_shinykrs
attr_accessor :body_shinykrs
attr_accessor :head_gender
attr_accessor :head_nickname
#KurayX - KURAYX_ABOUT_SHINIES
attr_accessor :shinyValue
attr_accessor :shinyR
Expand Down Expand Up @@ -416,6 +418,7 @@ def shinyB?
end
end


############
#KurayX##### - KURAYX_ABOUT_SHINIES
def head_shinyhue?
Expand Down Expand Up @@ -1072,6 +1075,46 @@ def gender
return @gender
end

def predict_gender(ratio)
case ratio
when :AlwaysMale then
outcome_ratio = 0
when :AlwaysFemale then
outcome_ratio = 1
when :Genderless then
outcome_ratio = 2
else
female_chance = GameData::GenderRatio.get(ratio).female_chance
outcome_ratio = ((@personalID & 0xFF) < female_chance) ? 1 : 0
end
return outcome_ratio
end

def head_nickname?
if @head_nickname
return @head_nickname
else
return nil
end
end

def head_nickname=(value)
@head_nickname = value
end

def head_gender?
if @head_gender
return @head_gender
else
# @head_gender=predict_gender(@species_data.head_pokemon.species_data.gender_ratio)
return nil
end
end

def head_gender=(value)
@head_gender = value
end

# Sets this Pokémon's gender to a particular gender (if possible).
# @param value [0, 1] new gender (0 = male, 1 = female)
def gender=(value)
Expand All @@ -1094,6 +1137,10 @@ def forceGenderless
@gender = 2
end

def force_gender=(value)
@gender = value
end

# Makes this Pokémon male.
def makeMale
self.gender = 0;
Expand Down Expand Up @@ -1941,7 +1988,7 @@ def clone
#KurayX
def as_json(options={})
{
"json_version" => "0.6",
"json_version" => "0.7",
"species" => @species,
"form" => @form,
"forced_form" => @forced_form,
Expand Down Expand Up @@ -1999,17 +2046,19 @@ def as_json(options={})
"totalhp" => @totalhp,
"first_moves" => @first_moves.clone,
"owner" => @owner.as_json,
"head_gender" => @head_gender,
"head_nickname" => @head_nickname,
"head_shiny" => @head_shiny,
"body_shiny" => @body_shiny,
"head_shinyhue" => @head_shinyhue,
"body_shinyhue" => @body_shinyhue,
"head_shinyr" => @head_shinyr,
"body_shinyr" => @body_shinyr,
"head_shinyg" => @head_shinyg,
"body_shinyg" => @body_shinyg,
"head_shinyb" => @head_shinyb,
"body_shinyb" => @body_shinyb,
"head_shinykrs" => @head_shinykrs.clone,
"body_shiny" => @body_shiny,
"body_shinyhue" => @body_shinyhue,
"body_shinyr" => @body_shinyr,
"body_shinyg" => @body_shinyg,
"body_shinyb" => @body_shinyb,
"body_shinykrs" => @body_shinykrs.clone,
"kuray_no_evo" => @kuray_no_evo,
"ribbons" => @ribbons.clone,
Expand Down Expand Up @@ -2051,6 +2100,8 @@ def convertjsonver(jsonparse)
return 6
when '0.7'
return 7
when '0.8'
return 8
end
else
return 0
Expand All @@ -2076,6 +2127,10 @@ def jsonload1(jsonparse)
@type2kuray = jsonparse['type2kuray']
@typeoverwrite = jsonparse['typeoverwrite']
end
if json_ver > 6#V.7
@head_gender = jsonparse['head_gender']
@head_nickname = jsonparse['head_nickname']
end
end

def jsonload2(jsonparse)
Expand Down
162 changes: 86 additions & 76 deletions Data/Scripts/016_UI/023_UI_MysteryGift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,22 @@ def pbManageMysteryGifts
# Download all gifts from online
msgwindow=pbCreateMessageWindow
pbMessageDisplay(msgwindow,_INTL("Searching for online gifts...\\wtnp[0]"))
online = pbDownloadToString(Settings::MYSTERY_GIFT_KURAY_URL)
pbDisposeMessageWindow(msgwindow)
if nil_or_empty?(online)
pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]"))
online=[]
newer_version = find_newer_available_version
if !newer_version
online = pbDownloadToString(Settings::MYSTERY_GIFT_KURAY_URL)
pbDisposeMessageWindow(msgwindow)
if nil_or_empty?(online)
pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]"))
online=[]
else
pbMessage(_INTL("Online Mystery Gifts found.\\wtnp[20]"))
online=pbMysteryGiftDecrypt(online)
t=[]
online.each { |gift| t.push(gift[0]) }
online=t
end
else
pbMessage(_INTL("Online Mystery Gifts found.\\wtnp[20]"))
online=pbMysteryGiftDecrypt(online)
t=[]
online.each { |gift| t.push(gift[0]) }
online=t
pbMessageDisplay(sprites["msgwindow"],_INTL("Game not up-to-date, please update first."))
end
# Show list of all gifts.
command=0
Expand Down Expand Up @@ -248,80 +253,85 @@ def pbDownloadMysteryGift(trainer)
pbFadeInAndShow(sprites)
sprites["msgwindow"]=pbCreateMessageWindow
pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]"))
string = pbDownloadToString(Settings::MYSTERY_GIFT_KURAY_URL)
if nil_or_empty?(string)
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
else
online=pbMysteryGiftDecrypt(string)
pending=[]
for gift in online
notgot=true
for j in trainer.mystery_gifts
notgot=false if j[0]==gift[0]
end
pending.push(gift) if notgot
end
if pending.length==0
newer_version = find_newer_available_version
if !newer_version
string = pbDownloadToString(Settings::MYSTERY_GIFT_KURAY_URL)
if nil_or_empty?(string)
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
else
loop do
commands=[]
for gift in pending; commands.push(gift[3]); end
commands.push(_INTL("Cancel"))
pbMessageDisplay(sprites["msgwindow"],_INTL("Choose the gift you want to receive.\\wtnp[0]"))
command=pbShowCommands(sprites["msgwindow"],commands,-1)
if command==-1 || command==commands.length-1
break
else
gift=pending[command]
sprites["msgwindow"].visible=false
if gift[1]==0
sprite=PokemonSprite.new(viewport)
sprite.setOffset(PictureOrigin::Center)
sprite.setPokemonBitmap(gift[2])
sprite.x=Graphics.width/2
sprite.y=-sprite.bitmap.height/2
online=pbMysteryGiftDecrypt(string)
pending=[]
for gift in online
notgot=true
for j in trainer.mystery_gifts
notgot=false if j[0]==gift[0]
end
pending.push(gift) if notgot
end
if pending.length==0
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
else
loop do
commands=[]
for gift in pending; commands.push(gift[3]); end
commands.push(_INTL("Cancel"))
pbMessageDisplay(sprites["msgwindow"],_INTL("Choose the gift you want to receive.\\wtnp[0]"))
command=pbShowCommands(sprites["msgwindow"],commands,-1)
if command==-1 || command==commands.length-1
break
else
sprite=ItemIconSprite.new(0,0,gift[2],viewport)
sprite.x=Graphics.width/2
sprite.y=-sprite.height/2
end
distanceDiff = 8*20/Graphics.frame_rate
loop do
Graphics.update
Input.update
sprite.update
sprite.y+=distanceDiff
break if sprite.y>=Graphics.height/2
end
pbMEPlay("Battle capture success")
(Graphics.frame_rate*3).times do
Graphics.update
Input.update
sprite.update
pbUpdateSceneMap
gift=pending[command]
sprites["msgwindow"].visible=false
if gift[1]==0
sprite=PokemonSprite.new(viewport)
sprite.setOffset(PictureOrigin::Center)
sprite.setPokemonBitmap(gift[2])
sprite.x=Graphics.width/2
sprite.y=-sprite.bitmap.height/2
else
sprite=ItemIconSprite.new(0,0,gift[2],viewport)
sprite.x=Graphics.width/2
sprite.y=-sprite.height/2
end
distanceDiff = 8*20/Graphics.frame_rate
loop do
Graphics.update
Input.update
sprite.update
sprite.y+=distanceDiff
break if sprite.y>=Graphics.height/2
end
pbMEPlay("Battle capture success")
(Graphics.frame_rate*3).times do
Graphics.update
Input.update
sprite.update
pbUpdateSceneMap
end
sprites["msgwindow"].visible=true
pbMessageDisplay(sprites["msgwindow"],_INTL("The gift has been received!")) { sprite.update }
pbMessageDisplay(sprites["msgwindow"],_INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
trainer.mystery_gifts.push(gift)
pending[command]=nil; pending.compact!
opacityDiff = 16*20/Graphics.frame_rate
loop do
Graphics.update
Input.update
sprite.update
sprite.opacity-=opacityDiff
break if sprite.opacity<=0
end
sprite.dispose
end
sprites["msgwindow"].visible=true
pbMessageDisplay(sprites["msgwindow"],_INTL("The gift has been received!")) { sprite.update }
pbMessageDisplay(sprites["msgwindow"],_INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
trainer.mystery_gifts.push(gift)
pending[command]=nil; pending.compact!
opacityDiff = 16*20/Graphics.frame_rate
loop do
Graphics.update
Input.update
sprite.update
sprite.opacity-=opacityDiff
break if sprite.opacity<=0
if pending.length==0
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
break
end
sprite.dispose
end
if pending.length==0
pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
break
end
end
end
else
pbMessageDisplay(sprites["msgwindow"],_INTL("Game not up-to-date, please update first."))
end
pbFadeOutAndHide(sprites)
pbDisposeMessageWindow(sprites["msgwindow"])
Expand Down
6 changes: 5 additions & 1 deletion Data/Scripts/048_Fusion/FusedSpecies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,11 @@ def calculate_growth_rate
#TODO
# ################## UNFINISHED ####################
def calculate_gender
return :Genderless
# We want to give a random gender based on the possibilities of the head and the body.
# We return randomly either @head_pokemon.gender_ratio or @body_pokemon.gender_ratio, turning both of them into an array of 2 values before returning one of the value at random.
# return [@head_pokemon.gender_ratio, @body_pokemon.gender_ratio].sample
return @body_pokemon.gender_ratio
# return :Genderless
end

############################# UTIL METHODS ###############################
Expand Down
2 changes: 2 additions & 0 deletions Data/Scripts/048_Fusion/PokemonFusion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,8 @@ def pbFusionScreen(cancancel = false, superSplicer = false, firstOptionSelected


#exp
@pokemon1.head_gender = @pokemon2.gender
@pokemon1.head_nickname = @pokemon2.nicknamed?
@pokemon1.exp_when_fused_head = @pokemon2.exp
@pokemon1.exp_when_fused_body = @pokemon1.exp
@pokemon1.exp_gained_since_fused = 0
Expand Down
7 changes: 7 additions & 0 deletions Data/Scripts/050_AddOns/New Items effects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1636,11 +1636,18 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
poke2.shinyValue=pokemon.shinyValue
#

# poke1 = body
# poke2 = head

pokemon.exp_gained_since_fused = 0
pokemon.exp_when_fused_head = nil
pokemon.exp_when_fused_body = nil
pokemon.kuraycustomfile = nil
poke2.kuraycustomfile = nil
poke2.name = pokemon.name unless !pokemon.nicknamed?
poke2.force_gender = pokemon.head_gender?
# @pokemon1.head_gender = @pokemon2.gender
# @pokemon1.head_nickname = @pokemon2.nicknamed?

if pokemon.shiny?
pokemon.shiny = false
Expand Down
3 changes: 3 additions & 0 deletions Data/Scripts/052_DemICE's Endgame Challenge/ChallengeMode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ def self.load_all
Metadata.load
MapMetadata.load

puts "New Pokemons skipped."
return#skip new pokemons for now

# Custom Pokemon
id_mon = 0

Expand Down
2 changes: 1 addition & 1 deletion Data/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.10
0.17.0

0 comments on commit dffcba7

Please sign in to comment.