Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * One screen Day-Care Checker item - by FL (Credits will be apreciated)
- #===============================================================================
- #
- # This script is for Pokémon Essentials. It makes a One screen Day-Care Checker
- # (like in DPP) activated by item. This display the pokémon sprite, names,
- # levels, genders and if them generate an egg.
- #
- #===============================================================================
- #
- # To this script works, put it above main, put a 480x320 background in
- # DCCBACKPATH location and, like any item, you need to add in the "items.txt"
- # and in the script. There an example below using the name DAYCARESIGHT, but
- # you can use any other name changing the DDCITEM and the item that be added in
- # txt. You can change the internal number too:
- #
- # 631,DAYCARESIGHT,DayCare Sight,8,0,"A visor that can be use for see certains Pokémon in Day-Care to monitor their growth.",2,0,6
- #
- #===============================================================================
- #DDCITEM=:DAYCARESIGHT # Change this and the item.txt if you wish another name
- DCCBACKPATH= "Graphics/Pictures/dccbackground" # You can change if you wish
- # If you wish that the pokémon is positioned like in battle (have the distance
- # defined in metadata, even the BattlerAltitude) change the below line to true
- DDCBATTLEPOSITION = false
- class DayCareCheckerScene
- def startScene
- @sprites={}
- @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- @viewport.z=99999
- @pkmn1=$PokemonGlobal.daycare[0][0]
- @pkmn2=$PokemonGlobal.daycare[1][0]
- # If you wish that if there only one pokémon, it became right
- # positioned, them uncomment the four below lines
- #if !@pkmn1 && @pkmn2
- # @pkmn1=@pkmn2
- # @pkmn2=nil
- #end
- textPositions=[]
- baseColor=Color.new(12*8,12*8,12*8)
- shadowColor=Color.new(26*8,26*8,25*8)
- @sprites["background"]=IconSprite.new(0,0,@viewport)
- @sprites["background"].setBitmap(DCCBACKPATH)
- pokemony=Graphics.height/2-32
- pokemonyadjust=pokemony-32
- if @pkmn1
- @sprites["pokemon1"]=PokemonSprite.new(@viewport)
- @sprites["pokemon1"].setPokemonBitmap(@pkmn1)
- @sprites["pokemon1"].mirror=true
- pbPositionPokemonSprite(@sprites["pokemon1"],32,pokemony)
- @sprites["pokemon1"].y=pokemonyadjust + adjustBattleSpriteY(
- @sprites["pokemon1"],@pkmn1.species,1) if DDCBATTLEPOSITION
- textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn1.name,@pkmn1.level.to_s,
- genderString(@pkmn1.gender)),32,44,false,baseColor,shadowColor])
- end
- if @pkmn2
- @sprites["pokemon2"]=PokemonSprite.new(@viewport)
- @sprites["pokemon2"].setPokemonBitmap(@pkmn2)
- pbPositionPokemonSprite(@sprites["pokemon2"],Graphics.width-168,pokemony)
- @sprites["pokemon2"].y=pokemonyadjust + adjustBattleSpriteY(
- @sprites["pokemon2"],@pkmn2.species,1) if DDCBATTLEPOSITION
- textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn2.name,@pkmn2.level.to_s,
- genderString(@pkmn2.gender)),Graphics.width-16,44,true,baseColor,
- shadowColor])
- end
- if Kernel.pbEggGenerated?
- @sprites["egg"]=IconSprite.new(Graphics.width/2-68,pokemony+32,@viewport)
- @sprites["egg"].setBitmap(getEggBitmap(getBabySpecies))
- # To works with different egg sprite sizes
- @sprites["egg"].x-=(@sprites["egg"].bitmap.width/8-16)*3
- # Uncomment the below line to only a egg shadow be show
- #@sprites["egg"].color=Color.new(0,0,0,255)
- end
- @sprites["overlay"]=Sprite.new(@viewport)
- @sprites["overlay"].bitmap=BitmapWrapper.new(Graphics.width,Graphics.height)
- pbSetSystemFont(@sprites["overlay"].bitmap)
- if !textPositions.empty?
- pbDrawTextPositions(@sprites["overlay"].bitmap,textPositions)
- end
- pbFadeInAndShow(@sprites) { update }
- end
- def getEggBitmap(pkmndata)
- species,form = pkmndata
- bitmapFileName=sprintf("Graphics/Battlers/%segg_%d",getConstantName(PBSpecies,species),form) rescue nil
- bitmapFileName=sprintf("Graphics/Battlers/%segg",getConstantName(PBSpecies,species)) if !pbResolveBitmap(bitmapFileName)
- bitmapFileName=sprintf("Graphics/Battlers/%03degg_%d",species,form) if !pbResolveBitmap(bitmapFileName)
- bitmapFileName=sprintf("Graphics/Battlers/%03degg",species) if !pbResolveBitmap(bitmapFileName)
- bitmapFileName=sprintf("Graphics/Battlers/egg") if !pbResolveBitmap(bitmapFileName)
- bitmapFileName=pbResolveBitmap(bitmapFileName)
- return bitmapFileName
- end
- def getBabySpecies
- pokemon0=$PokemonGlobal.daycare[0][0]
- pokemon1=$PokemonGlobal.daycare[1][0]
- mother=nil
- father=nil
- babyspecies=0
- ditto0=pbIsDitto?(pokemon0)
- ditto1=pbIsDitto?(pokemon1)
- if (pokemon0.gender==1 || ditto0)
- babyspecies=(ditto0) ? pokemon1.species : pokemon0.species
- mother=pokemon0
- father=pokemon1
- else
- babyspecies=(ditto1) ? pokemon0.species : pokemon1.species
- mother=pokemon1
- father=pokemon0
- end
- babyspecies=pbGetBabySpecies(babyspecies)
- if isConst?(babyspecies,PBSpecies,:MANAPHY) && hasConst?(PBSpecies,:PHIONE)
- babyspecies=getConst(PBSpecies,:PHIONE)
- elsif isConst?(babyspecies,PBSpecies,:MISSINGNO) && hasConst?(PBSpecies,:KANGASKHAN)
- babyspecies=getConst(PBSpecies,:KANGASKHAN)
- end
- if (isConst?(babyspecies,PBSpecies,:NIDORANfE) && (hasConst?(PBSpecies,:NIDORANmA) || hasConst?(PBSpecies,:NIDORINO) || hasConst?(PBSpecies,:NIDOKING))) ||
- (isConst?(babyspecies,PBSpecies,:NIDORANmA) && (hasConst?(PBSpecies,:NIDORANfE) || hasConst?(PBSpecies,:NIDORINA) || hasConst?(PBSpecies,:NIDOQUEEN)))
- babyspecies=[getConst(PBSpecies,:NIDORANmA),
- getConst(PBSpecies,:NIDORANfE)][rand(2)]
- elsif isConst?(babyspecies,PBSpecies,:NIDORANmA) && hasConst?(PBSpecies,:NIDORANfE)
- babyspecies=[getConst(PBSpecies,:NIDORANmA),
- getConst(PBSpecies,:NIDORANfE)][rand(2)]
- elsif isConst?(babyspecies,PBSpecies,:VOLBEAT) && hasConst?(PBSpecies,:ILLUMISE)
- babyspecies=[getConst(PBSpecies,:VOLBEAT),
- getConst(PBSpecies,:ILLUMISE)][rand(2)]
- elsif isConst?(babyspecies,PBSpecies,:ILLUMISE) && hasConst?(PBSpecies,:VOLBEAT)
- babyspecies=[getConst(PBSpecies,:VOLBEAT),
- getConst(PBSpecies,:ILLUMISE)][rand(2)]
- elsif isConst?(babyspecies,PBSpecies,:TRIFOX) && mother.form==0 &&
- !isConst?(mother.item,PBItems,:VOLCANICINCENSE) &&
- !isConst?(father.item,PBItems,:VOLCANICINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:TRIFOX) && mother.form==1 &&
- !isConst?(mother.item,PBItems,:MINTINCENSE) &&
- !isConst?(father.item,PBItems,:MINTINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:MUNCHLAX) &&
- !isConst?(mother.item,PBItems,:FULLINCENSE) &&
- !isConst?(father.item,PBItems,:FULLINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:WYNAUT) &&
- !isConst?(mother.item,PBItems,:LAXINCENSE) &&
- !isConst?(father.item,PBItems,:LAXINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:HAPPINY) &&
- !isConst?(mother.item,PBItems,:LUCKINCENSE) &&
- !isConst?(father.item,PBItems,:LUCKINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:MIMEJR) &&
- !isConst?(mother.item,PBItems,:ODDINCENSE) &&
- !isConst?(father.item,PBItems,:ODDINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:CHINGLING) &&
- !isConst?(mother.item,PBItems,:PUREINCENSE) &&
- !isConst?(father.item,PBItems,:PUREINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:BONSLY) &&
- !isConst?(mother.item,PBItems,:ROCKINCENSE) &&
- !isConst?(father.item,PBItems,:ROCKINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:BUDEW) &&
- !isConst?(mother.item,PBItems,:ROSEINCENSE) &&
- !isConst?(father.item,PBItems,:ROSEINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:AZURILL) &&
- !isConst?(mother.item,PBItems,:SEAINCENSE) &&
- !isConst?(father.item,PBItems,:SEAINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- elsif isConst?(babyspecies,PBSpecies,:MANTYKE) &&
- !isConst?(mother.item,PBItems,:WAVEINCENSE) &&
- !isConst?(father.item,PBItems,:WAVEINCENSE)
- babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
- end
- form=0
- if !isConst?(babyspecies,PBSpecies,:ROTOM)
- form=mother.form
- end
- return [babyspecies,form]
- end
- def genderString(gender)
- ret=" "
- if gender==0
- ret=" ♂"
- elsif gender==1
- ret=" ♀"
- end
- return ret
- end
- def middleScene
- loop do
- Graphics.update
- Input.update
- self.update
- if Input.trigger?(Input::B) || Input.trigger?(Input::C)
- break
- end
- end
- end
- def update
- pbUpdateSpriteHash(@sprites)
- end
- def endScene
- pbFadeOutAndHide(@sprites) { update }
- pbDisposeSpriteHash(@sprites)
- @viewport.dispose
- end
- end
- class DayCareChecker
- def initialize(scene)
- @scene=scene
- end
- def startScreen
- @scene.startScene
- @scene.middleScene
- @scene.endScene
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement