Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #The Pokemon for each case
- Patients = [
- :SKITTY,
- :PIKACHU,
- :ZWEILOUS,
- :DITTO,
- :GOTHITELLE
- ]
- #The levels of the patients
- #(mostly done to avoid errors when generating the Pokemon)
- PatientLevels = [
- 10,
- 10,
- 10,
- 10,
- 10,
- 10
- ]
- #The genders of the patients
- #0-male, 1-female, 2 to randomize
- PatientGenders = [
- 2,
- 2,
- 2,
- 2,
- 2,
- 2
- ]
- #The variables for each stat
- MedicalVars = [
- 131,#Voltage
- 132,#Psychic Energy
- 133,#Blood Pressure
- 134,#Heart Rate
- 135,#Temperature
- 136,#Memo
- 137#Energy
- ]
- #The maximum energy for each case
- MaxEnergy = [
- 10,#Case1
- 10,#Case2
- 10,#Case3
- 10,#Case4
- 10#Case5
- ]
- #The maximum comfort for each case
- MaxComfort = [
- 10,#Case1
- 10,#Case2
- 10,#Case3
- 10,#Case4
- 10#Case5
- ]
- #for setting blood pressure- use bloodPress("text")
- def bloodPress(text=nil)
- $game_variables[MedicalVars[2]]=text
- end
- #for setting memo- use memo("Text")
- def memo(text=nil)
- $game_variables[MedicalVars[5]]=text
- end
- #For clearing the stats after a case
- def clearStats
- for i in 0...MedicalVars.length
- var=MedicalVars[i]
- $game_variables[var]=nil
- end
- end
- #For getting the current patient.
- #This saves a Pokemon to a variable so the gender stays the same.
- def genPatient
- caseno=getCase
- pkmn=pbGenPkmn(Patients[caseno],PatientLevels[caseno])
- pkmn.makeNotShiny
- if PatientGenders[caseno]==0
- pkmn.makeMale
- elsif PatientGenders[caseno]==1
- pkmn.makeFemale
- end
- $game_variables[1]=pkmn
- end
- #Should be run after the end of each case
- def newCase
- clearStats
- genPatient
- end
- def medSum
- # oldsprites = pbFadeOutAndHide(@sprites)
- scene = PokemonMedSummary_Scene.new
- screen = PokemonMedSummaryScreen.new(scene)
- screen.pbStartMedScreen
- yield if block_given?
- pbFadeInAndShow(@sprites)#,oldsprites)
- end
- class PokemonMedSummary_Scene
- def pbUpdate
- pbUpdateSpriteHash(@sprites)
- end
- def pbStartMedScene
- caseno=getCase
- @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
- @viewport.z = 99999
- caseno=getCase
- @pokemon = $game_variables[1]
- @page = 1
- @typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
- @sprites = {}
- @sprites["background"] = IconSprite.new(0,0,@viewport)
- case caseno
- when 2
- @sprites["patient"] = AnimatedSprite.new("Graphics/Pictures/Medical Summary/patient_2",2,192,192,3,@viewport)
- when 3
- @sprites["patient"] = AnimatedSprite.new("Graphics/Pictures/Medical Summary/patient_3",4,192,192,10,@viewport)
- else
- @sprites["patient"] = IconSprite.new(104,186,@viewport)
- @sprites["patient"].setBitmap("Graphics/Pictures/Medical Summary/patient_#{caseno}")
- end
- @sprites["patient"].oy = 96
- @sprites["patient"].ox = 96
- @sprites["patient"].x=104
- @sprites["patient"].y=186
- if @sprites["patient"].is_a?(AnimatedSprite)
- @sprites["patient"].play
- end
- # skitty
- case caseno
- when 2
- @sprites["xray"] = IconSprite.new(-35,114,@viewport)
- @sprites["xray"].setBitmap("Graphics/Pictures/Medical Summary/xray_2")
- @sprites["xray"].src_rect.width=247
- @sprites["xray"].src_rect.height=142
- else
- @sprites["xray"] = IconSprite.new(-2,114,@viewport)
- @sprites["xray"].setBitmap("Graphics/Pictures/Medical Summary/xray_#{caseno}")
- @sprites["xray"].src_rect.width=204
- @sprites["xray"].src_rect.height=142
- end
- @sprites["xray"].visible = false
- @sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
- pbSetSystemFont(@sprites["overlay"].bitmap)
- @sprites["movesel"] = MoveSelectionSprite.new(@viewport)
- @sprites["movesel"].visible = false
- @sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow",8,28,40,2,@viewport)
- @sprites["uparrow"].x = 350
- @sprites["uparrow"].y = 56
- @sprites["uparrow"].play
- @sprites["uparrow"].visible = false
- @sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow",8,28,40,2,@viewport)
- @sprites["downarrow"].x = 350
- @sprites["downarrow"].y = 260
- @sprites["downarrow"].play
- @sprites["downarrow"].visible = false
- @sprites["messagebox"] = Window_AdvancedTextPokemon.new("")
- @sprites["messagebox"].viewport = @viewport
- @sprites["messagebox"].visible = false
- @sprites["messagebox"].letterbyletter = true
- pbBottomLeftLines(@sprites["messagebox"],2)
- drawMedPage(@page)
- pbFadeInAndShow(@sprites) { pbUpdate }
- end
- def pbEndScene
- pbFadeOutAndHide(@sprites) { pbUpdate }
- pbDisposeSpriteHash(@sprites)
- @typebitmap.dispose
- @viewport.dispose
- end
- def drawMedPage(page)
- overlay = @sprites["overlay"].bitmap
- overlay.clear
- base = Color.new(248,248,248)
- shadow = Color.new(104,104,104)
- # Set background image
- @sprites["background"].setBitmap("Graphics/Pictures/Medical Summary/bgmed_#{page}")
- imagepos=[]
- # Show the Poké Ball containing the Pokémon
- ballimage = sprintf("Graphics/Pictures/Summary/icon_ball_%02d",@pokemon.ballused)
- imagepos.push([ballimage,14,52])
- # Show status/fainted/Pokérus infected icon
- status = -1
- status = 6 if @pokemon.pokerusStage==1
- status = @pokemon.status-1 if @pokemon.status>0
- status = 5 if @pokemon.hp==0
- if status>=0
- imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
- end
- # Show Pokérus cured icon
- if @pokemon.pokerusStage==2
- imagepos.push([sprintf("Graphics/Pictures/Summary/icon_pokerus"),176,100])
- end
- # Show shininess star
- if @pokemon.shiny?
- imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134])
- end
- caseno=getCase
- #create energy bar
- energy=$game_variables[StatVariables[0]]
- w = (energy*200)/MaxEnergy[caseno]
- w = 1 if w<1
- w = ((w/2).round)*2
- zone=1
- imagepos.push(["Graphics/Pictures/Medical Summary/overlay_stats",4,300,0,zone*6,w,6])
- #create comfort bar
- comfort=$game_variables[StatVariables[2]]
- w = (comfort*200)/MaxComfort[caseno]
- w = 1 if w<1
- w = ((w/2).round)*2
- zone=3
- imagepos.push(["Graphics/Pictures/Medical Summary/overlay_stats",4,364,0,zone*6,w,6])
- # Draw all images
- pbDrawImagePositions(overlay,imagepos)
- # Write various bits of text
- pagename = [_INTL("OBSERVATIONS"),
- _INTL("VITALS")
- ][page-1]
- textpos = [
- [pagename,26,16,0,base,shadow],
- [@pokemon.name,46,54,0,base,shadow],
- [_INTL("ENERGY:"),126,264,1,base,shadow],
- [_INTL("COMFORT:"),126,328,1,base,shadow],
- [_INTL("{1}",energy),146,264,0,base,shadow],
- [_INTL("{1}",comfort),146,328,0,base,shadow],
- [@pokemon.level.to_s,46,84,0,Color.new(64,64,64),Color.new(176,176,176)]
- ]
- # Write the gender symbol
- if @pokemon.male?
- textpos.push([_INTL("♂"),178,54,0,Color.new(24,112,216),Color.new(136,168,208)])
- elsif @pokemon.female?
- textpos.push([_INTL("♀"),178,54,0,Color.new(248,56,32),Color.new(224,152,144)])
- end
- # Draw all text
- pbDrawTextPositions(overlay,textpos)
- # Draw page-specific information
- case page
- when 1; drawMedPageOne
- when 2; drawMedPageTwo
- end
- end
- def drawMedPageOne
- overlay = @sprites["overlay"].bitmap
- base = Color.new(248,248,248)
- shadow = Color.new(104,104,104)
- imagepos = []
- # Draw all images
- pbDrawImagePositions(overlay,imagepos)
- #draw observations
- memo=$game_variables[MedicalVars[5]]
- if memo.is_a?(String)
- drawFormattedTextEx(overlay,232,78,273,memo)
- end
- end
- def drawMedPageTwo
- overlay = @sprites["overlay"].bitmap
- base = Color.new(248,248,248)
- shadow = Color.new(104,104,104)
- base2 = Color.new(64,64,64)
- shadow2 = Color.new(176,176,176)
- ysel=0
- #get the stats
- voltage=$game_variables[MedicalVars[0]]
- psychic=$game_variables[MedicalVars[1]]
- bloodpress=$game_variables[MedicalVars[2]]
- heartrate=$game_variables[MedicalVars[3]]
- temperature=$game_variables[MedicalVars[4]]
- # Write stats and draw bars for them
- textpos = [
- ]
- imagepos = [
- ]
- if temperature!=0
- textpos.push([_INTL("TEMPERATURE"),248,(76+44*ysel),0,base,shadow])
- textpos.push([_INTL("{1}°",temperature),486,(76+44*ysel),1,base2,shadow2])
- w = temperature*2
- zone = 2
- imagepos.push(["Graphics/Pictures/Medical Summary/overlay_stats",248,(110+44*ysel),0,zone*6,w,6])
- ysel+=1
- end
- if heartrate!=0
- textpos.push([_INTL("HEART RATE"),248,(76+44*ysel),0,base,shadow])
- textpos.push([_INTL("{1} bpm",heartrate),486,(76+44*ysel),1,base2,shadow2])
- ysel+=1
- end
- if bloodpress!=0
- textpos.push([_INTL("BLOOD PRESS"),248,(76+44*ysel),0,base,shadow])
- textpos.push([_INTL("{1}",bloodpress),486,(76+44*ysel),1,base2,shadow2])
- ysel+=1
- end
- if psychic!=0
- textpos.push([_INTL("PSYCHIC ENERGY"),248,(76+44*ysel),0,base,shadow])
- textpos.push([_INTL("{1}",psychic),486,(76+44*ysel),1,base2,shadow2])
- w = psychic*2
- zone = 3
- imagepos.push(["Graphics/Pictures/Medical Summary/overlay_stats",248,(110+44*ysel),0,zone*6,w,6])
- ysel+=1
- end
- if voltage!=0
- textpos.push([_INTL("VOLTAGE"),248,(76+44*ysel),0,base,shadow])
- textpos.push([_INTL("{1}",voltage),486,(76+44*ysel),1,base2,shadow2])
- w = voltage*2
- zone = 1
- imagepos.push(["Graphics/Pictures/Medical Summary/overlay_stats",248,(110+44*ysel),0,zone*6,w,6])
- ysel+=1
- end
- # Draw all text and images
- pbDrawTextPositions(overlay,textpos)
- pbDrawImagePositions(overlay,imagepos)
- end
- def pbMedScene
- pbPlayCry(@pokemon)
- loop do
- Graphics.update
- Input.update
- pbUpdate
- dorefresh = false
- if Input.trigger?(Input::A)
- pbSEStop
- pbPlayCry(@pokemon)
- elsif Input.trigger?(Input::B)
- pbPlayCloseMenuSE
- break
- #Xray switching
- elsif Input.trigger?(Input::TAB) && $game_switches[149]==true
- pbSEPlay("GUI summary change page")
- if @sprites["xray"].visible == false
- @sprites["patient"].visible = false
- @sprites["xray"].visible = true
- else
- @sprites["patient"].visible = true
- @sprites["xray"].visible = false
- end
- elsif Input.trigger?(Input::LEFT) && !@pokemon.egg?
- oldpage = @page
- @page -= 1
- @page = 2 if @page<1
- @page = 1 if @page>2
- if @page!=oldpage # Move to next page
- pbSEPlay("GUI summary change page")
- dorefresh = true
- end
- elsif Input.trigger?(Input::RIGHT) && !@pokemon.egg?
- oldpage = @page
- @page += 1
- @page = 2 if @page<1
- @page = 1 if @page>2
- if @page!=oldpage # Move to next page
- pbSEPlay("GUI summary change page")
- dorefresh = true
- end
- end
- if dorefresh
- drawMedPage(@page)
- end
- end
- end
- end
- class PokemonMedSummaryScreen
- def initialize(scene)
- @scene = scene
- end
- def pbStartMedScreen
- @scene.pbStartMedScene
- ret = @scene.pbMedScene
- @scene.pbEndScene
- return ret
- end
- end
- #These are just things I use to test
- def testVars
- for i in 0...MedicalVars.length
- $game_variables[MedicalVars[i]]=rand(90)
- end
- memo("This is a test")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement