$pubdef : ( $include $lib/Phoex ) $include $lib/alynna $include $lib/rp $include $lib/rps $include $lib/rps2 $include $lib/pokedex $def POKEDEX "$pokedex" match lvar param $def mknum intostr "000" swap strcat dup strlen 3 - strcut swap pop $def mkstr dup not if pop "" then : mkcolor[ a:lines s:color -- a:newlines ] { lines @ foreach var! cur pop { "^" color @ "^" cur @ }cat repeat }array ; : pokedex-types var pokemon var pokenum var attack var attacklev var count var item var value var linestore param @ not if POKEDEX "/types/attack/bynumber" array_get_propvals else param @ " " explode_array then var! types "Known Pokemon" header tellme types @ foreach var! type pop type @ header tellme -1 count ! "" linestore ! POKEDEX "pokemon/byname/" array_get_propvals foreach item ! value ! type @ { "pokemon/" item @ mknum "/type" }dex dup not if pop "None" then { "{" rot "|" ":" subst "}" }cat smatch if count @ 1 + count ! linestore @ { "^Green^" item @ tostr 4 lj "^Yellow^" value @ 16 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then then repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then repeat "Pokedex" footer tellme ; : pokedex-pokemon# var pokemon var pokenum var attack var attacklev var count var item var value var linestore param @ not if POKEDEX "/types/attack/bynumber" array_get_propvals else param @ " " explode_array then var! types "Known Pokemon" header tellme -1 count ! "" linestore ! POKEDEX "pokemon/" array_get_propdirs foreach item ! pop { "/pokemon/" item @ "/name" }dex dup not if pop continue then value ! count @ 1 + count ! linestore @ { "^Green^" item @ tostr 4 lj "^Yellow^" value @ 16 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then "Pokedex" footer tellme ; : pokedex-pokemon var pokemon var pokenum var attack var attacklev var count var item var value var linestore param @ not if "Known Pokemon" header tellme -1 count ! "" linestore ! POKEDEX "pokemon/byname/" array_get_propvals foreach item ! value ! count @ 1 + count ! linestore @ { "^Green^" item @ tostr 4 lj "^Yellow^" value @ 16 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then "Pokedex" footer tellme exit then { "pokemon/" param @ "/name" }cat getdex not if { "pokemon/byname/" param @ }cat getdex param ! then param @ not if "Couldn't find that pokemon, by name or number." "Pokedex" pretty tellme exit then param @ pokenum ! { "pokemon/" param @ "/name" }cat getdex pokemon ! { "Pokedex information for " pokemon @ }cat header tellme { "Number: ^Green^" pokenum @ "^NORMAL^" }cat tellme { "Name: ^Green^" { "pokemon/" pokenum @ "/name" }cat getdex tostr capitalize "^NORMAL^" }cat tellme { "Name (Romanji): ^Green^" { "pokemon/" pokenum @ "/romanji" }cat getdex tostr capitalize "^NORMAL^" }cat tellme { "Type: ^Green^" { "pokemon/" pokenum @ "/type" }cat getdex "^NORMAL^" }cat tellme { "Kind: ^Green^" { "pokemon/" pokenum @ "/kind" }cat getdex mkstr capitalize "^NORMAL^" }cat tellme { "Habitat: ^Green^" { "pokemon/" pokenum @ "/habitat" }cat getdex mkstr capitalize "^NORMAL^" }cat tellme { "Gender ratio: ^Green^" { "pokemon/" pokenum @ "/genderratio" }cat getdex tofloat dup -1 = if pop "Genderless" else 100.0 * 2 round dup "% female, " rot 100.0 swap - "% male" then "^NORMAL^" }cat tellme { "Height: ^Green^" { "pokemon/" pokenum @ "/height" }cat getdex "m^NORMAL^" }cat tellme { "Weight: ^Green^" { "pokemon/" pokenum @ "/weight" }cat getdex "kg^NORMAL^" }cat tellme { "pokemon/" pokenum @ "/evolvesfrom" }cat getdex if { "Evolves from: ^Green^" { "pokemon/" pokenum @ "/evolvesfrom" }cat getdex "^NORMAL^" }cat tellme then { "pokemon/" pokenum @ "/evolution" }cat getdex if { "Evolves to: ^Green^" { "pokemon/" pokenum @ "/evolution" }cat getdex "^NORMAL^" }cat tellme then { "pokemon/" pokenum @ "/evomethod" }cat getdex if { "Evolve method: ^Green^" { "pokemon/" pokenum @ "/evomethod" }cat getdex "^NORMAL^" }cat tellme then { "Stats: HP ATT DEF SPC SDF SPD" }cat tellme { "Base: " pokenum @ HPS basal tostr 3 rj " " pokenum @ ATT basal tostr 3 rj " " pokenum @ DEF basal tostr 3 rj " " pokenum @ SPC basal tostr 3 rj " " pokenum @ SDF basal tostr 3 rj " " pokenum @ SPD basal tostr 3 rj " " " At level: " { "pokemon/" pokenum @ "/baselevel" }cat getdex }tell { "Ceiling: " pokenum @ HPS ceil tostr 3 rj " " pokenum @ ATT ceil tostr 3 rj " " pokenum @ DEF ceil tostr 3 rj " " pokenum @ SPC ceil tostr 3 rj " " pokenum @ SDF ceil tostr 3 rj " " pokenum @ SPD ceil tostr 3 rj " " " At level: 100" }tell { "Growth: " pokenum @ HPS perlev 1 round tostr 3 rj " " pokenum @ ATT perlev 1 round tostr 3 rj " " pokenum @ DEF perlev 1 round tostr 3 rj " " pokenum @ SPC perlev 1 round tostr 3 rj " " pokenum @ SDF perlev 1 round tostr 3 rj " " pokenum @ SPD perlev 1 round tostr 3 rj " " " Per level" }tell { "Cost: Power(" pokenum @ pokepower 1 round ") + Rarity(" pokenum @ pokerarity 1 round ")" pokenum @ pokeevocost if " + EvoCost(" pokenum @ pokeevocost 1 round ")" then " = " pokenum @ pokecost dup 1 round swap "(" swap 0 round ")" }tell "Attacks: " tellme { { POKEDEX { "pokemon/" pokenum @ "/attacks/" }cat array_get_propvals foreach toint swap repeat }dict foreach tostr attack ! tostr attacklev ! ( modified by Whiskey to put Level before attack name purely for a cleaner format ) { attacklev @ "0" smatch if " ^Green^--^NORMAL^" else me @ "xp" getstat level attacklev @ atoi > if " ^Green^ " else " ^Red^ " then attacklev @ atoi "%2i" fmtstring "^NORMAL^" then " ^Yellow^" attack @ }cat tellme repeat "TM/HM Compatibility:" tellme POKEDEX { "/pokemon/" pokenum @ "/machine/" }cat array_get_propvals array_keys array_make 6 wrap_items_fixed "YELLOW" mkcolor atellme "Breed moves:" tellme POKEDEX { "/pokemon/" pokenum @ "/eggmove/" }cat array_get_propvals array_keys array_make 6 wrap_items_fixed "YELLOW" mkcolor atellme "Tutored moves:" tellme POKEDEX { "/pokemon/" pokenum @ "/tutor/" }cat array_get_propvals array_keys array_make 6 wrap_items_fixed "YELLOW" mkcolor atellme "Pokedex info:" tellme { "pokemon/" pokenum @ "/desc/rb" }cat getdex if { "^Red^Red^Normal^/^Blue^Blue^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/rb" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/g" }cat getdex if { "^Yellow^Gold^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/g" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/s" }cat getdex if { "^White^Silver^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/s" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/c" }cat getdex if { "^PURPLE^Crystal^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/c" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/y" }cat getdex if { "^YELLOW^Yellow^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/y" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/ru" }cat getdex if { "^Red^Ruby^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/ru" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/sa" }cat getdex if { "^Blue^Sapphire^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/sa" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/e" }cat getdex if { "^Green^Emerald^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/e" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/lg" }cat getdex if { "^GREEN^Leaf Green^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desclg" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/fr" }cat getdex if { "^RED^Fire Red^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/fr" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/d" }cat getdex if { "^WHITE^Diamond^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/d" }cat getdex wrap78 atellme then { "pokemon/" pokenum @ "/desc/p" }cat getdex if { "^WHITE^Pearl^Normal^:" }cat tellme { "pokemon/" pokenum @ "/desc/p" }cat getdex wrap78 atellme then ( "Breeding Info" header tellme "^White^Can breed with:^Normal" tellme { "pokemon/" pokenum @ "/breedcompat" }cat getdex if -1 count ! "" linestore ! { "pokemon/" pokenum @ "/breedcompat" }cat getdex { "pokemon/" pokenum @ "/osbreedcompat" }cat getdex dup if ":" swap strcat strcat else pop then ":" explode array_make foreach value ! pop count @ 1 + count ! linestore @ { "^Green^" value @ 16 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then else "^Yellow^This pokemon can only breed with its own kind or with pokemon that can breed with anything, like Ditto and Mew.^normal^" tellme then ) "\n" tellme ( "^White^Breeding attacks:^Normal" tellme { "^Green^" { "pokemon/" pokenum @ "/breedmoves" }cat getdex if { "^Green^" { "pokemon/" pokenum @ "/breedmoves" }cat getdex " : " ":" subst "^NORMAL^" }cat tellme else "^Red^None or Unknown^normal^" tellme then "\n" tellme "^Cyan^Tutored attacks:^Normal" tellme { "^Green^" { "pokemon/" pokenum @ "/tutoredmoves" }cat getdex if { "^Green^" { "pokemon/" pokenum @ "/tutoredmoves" }cat getdex " : " ":" subst "^NORMAL^" }cat tellme else "^Red^None or Unknown^normal^" tellme then ) "Pokedex" footer tellme ; : pokedex-attack var count var item var value var linestore param @ not if "Known attacks" header tellme -1 count ! "" linestore ! POKEDEX "/attack/" array_get_propdirs foreach item ! pop count @ 1 + count ! linestore @ { "^Green^" item @ tostr 15 lj "^NORMAL^" }cat strcat linestore ! count @ 5 % 4 = if linestore @ tellme "" linestore ! then repeat count @ 5 % 4 < if linestore @ tellme "" linestore ! then "Pokedex" footer tellme exit then { "attack/" param @ "/id" }cat getdex not if "Couldn't find that special attack." "Pokedex" pretty tellme exit then { "Pokedex information for attack: " param @ }cat header tellme { "Name: ^Green^" { "attack/" param @ "/name" }cat getdex "^NORMAL^" }cat tellme { "Name (Romanji): ^Green^" { "attack/" param @ "/romanji" }cat getdex "^NORMAL^" }cat tellme { "Type: ^Green^" { "attack/" param @ "/type" }cat getdex "^NORMAL^" }cat tellme { "Class: ^Green^" { "attack/" param @ "/class" }cat getdex "^NORMAL^" }cat tellme { "Target: ^Green^" { "attack/" param @ "/target" }cat getdex "^NORMAL^" }cat tellme { "PP: ^Green^" { "attack/" param @ "/pp" }cat getdex "^NORMAL^" }cat tellme { "Base Damage: ^Green^" { "attack/" param @ "/damage" }cat getdex dup "--" smatch if pop "No damage" then "%^NORMAL^" }cat tellme { "Accuracy: ^Green^" { "attack/" param @ "/accuracy" }cat getdex dup "--" smatch if pop "Used on self, 100" then "%^NORMAL^" }cat tellme { "attack/" param @ "/status" }cat getdex if { "Status inflict: ^Green^" { "attack/" param @ "/status" }cat getdex "^NORMAL^" }cat tellme { "Inflict chance: ^Green^" { "attack/" param @ "/statchance" }cat getdex "%^NORMAL^" }cat tellme then { "Desc: ^Green^" { "attack/" param @ "/desc" }cat getdex "^NORMAL^" }cat tellme { " ^Green^" { "attack/" param @ "/desc1" }cat getdex "^NORMAL^" }cat tellme { " ^Green^" { "attack/" param @ "/desc2" }cat getdex "^NORMAL^" }cat tellme { "Misc: ^Green^Calls '" { "attack/" param @ "/subtype" }cat getdex "' subsystem\n with factor '" { "attack/" param @ "/factor" }cat getdex "' and works " { "attack/" param @ "/statchance" }cat getdex dup not if pop 100 then "% of the time ^NORMAL^" }cat tellme { "attack/" param @ "/xp" }cat getdex if { "^Cyan^This attack only requires 1 xp^NORMAL^" }cat tellme then "Pokedex" footer tellme ; : pokedex-item var count var item var value var linestore param @ not if "Known items" header tellme -1 count ! "" linestore ! POKEDEX "/item/" array_get_propdirs foreach item ! pop count @ 1 + count ! linestore @ { "^Green^" item @ tostr 18 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then "Pokedex" footer tellme exit then { "/item/" param @ "/desc" }cat getdex not if "Couldn't find that item." "Pokedex" pretty tellme exit then { "Pokedex information for item: " param @ }cat header tellme { "Name: ^Green^" .pokedex "item/" array_get_propdirs foreach swap pop dup param @ smatch not if pop then repeat "^NORMAL^" }cat tellme { "Type: ^Green^" { "item/" param @ "/type" }cat getdex "^NORMAL^" }cat tellme { "Subtype: ^Green^" { "item/" param @ "/subtype" }cat getdex "^NORMAL^" }cat tellme param @ case "tm*" smatch when { "Desc: ^Green^Training module for the skill/attack " { "tm/" param @ 2 strcut swap pop "/name" }cat getdex "^NORMAL^" }cat tellme end "hm*" smatch when { "Desc: ^Green^Homing module for the skill/attack " { "hm/" param @ 2 strcut swap pop "/name" }cat getdex "^NORMAL^" }cat tellme end default pop { "Desc: ^Green^" { "item/" param @ "/desc" }cat getdex "^NORMAL^" }cat tellme end endcase "Pokedex" footer tellme ; : pokedex-tm var tmname var count var item var value var linestore var oldparam param @ not if "Known TMs" header tellme -1 count ! "" linestore ! POKEDEX "TM/byname/" array_get_propvals foreach swap value ! ":" explode array_make foreach swap pop item ! count @ 1 + count ! linestore @ { "^Green^" item @ tostr 4 rj " ^Yellow^" value @ 15 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then repeat repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then "Pokedex" footer tellme exit then { "TM/" param @ "/name" }cat getdex not if { "TM/byname/" param @ }cat getdex param ! param @ dup oldparam ! ":" explode 1 - popn param ! (***) then { "TM/" param @ "/name" }cat getdex not if "Couldn't find that TM." "Pokedex" pretty tellme exit then { "TM/" param @ "/name" }cat getdex tmname ! { "Pokedex information for " param @ toupper }cat header tellme { "Name: ^Green^" { "TM/" param @ "/name" }cat getdex "^NORMAL^" }cat tellme { "Type: ^Green^" { "attack/" tmname @ "/type" }cat getdex "^NORMAL^" }cat tellme { "PP: ^Green^" { "attack/" tmname @ "/pp" }cat getdex "^NORMAL^" }cat tellme { "Desc: ^Green^" { "attack/" tmname @ "/desc" }cat getdex "^NORMAL^" }cat tellme { "Average cost: ^Green^" { "TM/" param @ "/cost" }cat getdex "^NORMAL^" }cat tellme "Pokedex" footer tellme ; : pokedex-tmlist ; : pokedex-tmalpha ; : pokedex-hm var hmname var item var value var count var linestore param @ not if "Known HMs" header tellme -1 count ! "" linestore ! POKEDEX "HM/byname/" array_get_propvals foreach item ! value ! count @ 1 + count ! linestore @ { "^Green^" item @ tostr 5 lj "^Yellow^" value @ 14 lj "^NORMAL^" }cat strcat linestore ! count @ 4 % 3 = if linestore @ tellme "" linestore ! then repeat count @ 4 % 3 < if linestore @ tellme "" linestore ! then "Pokedex" footer tellme exit then { "HM/" param @ "/name" }cat getdex not if { "HM/byname/" param @ }cat getdex param ! then { "HM/" param @ "/name" }cat getdex not if "Couldn't find that HM." "Pokedex" pretty tellme exit then { "HM/" param @ "/name" }cat getdex hmname ! { "Pokedex information for " param @ toupper }cat header tellme { "Name: ^Green^" { "HM/" param @ "/name" }cat getdex "^NORMAL^" }cat tellme { "Type: ^Green^" { "attack/" hmname @ "/type" }cat getdex "^NORMAL^" }cat tellme { "PP: ^Green^" { "attack/" hmname @ "/pp" }cat getdex "^NORMAL^" }cat tellme { "Desc: ^Green^" { "attack/" hmname @ "/desc" }cat getdex "^NORMAL^" }cat tellme "Pokedex" footer tellme ; : pokedex-breed var pokemon var pokenum var target1 var target2 var tmp var attack var attacklev var count var item var value var linestore param @ not if { "Format: +pokemon/breed =" "Pokedex/Breed" pretty tellme exit then param @ "=" explode tmp ! tmp @ 2 = if target1 ! target2 ! then tmp @ 1 = if me @ target1 ! target2 ! then tmp @ 0 = if { "Format: +pokemon/breed =" "Pokedex/Breed" pretty tellme exit then { "pokemon/" target1 @ "/name" }cat getdex not if { "pokemon/byname/" target1 @ }cat getdex tmp ! tmp @ not if target1 @ pmatch target1 ! target1 @ ok? if target1 @ "pokemon" getstat target1 ! else "" target1 ! then else tmp @ target1 ! then then target1 @ not if "Target 1: Couldn't find that pokemon, by name, number or player." "Pokedex/Breed" pretty tellme exit then { "pokemon/" target2 @ "/name" }cat getdex not if { "pokemon/byname/" target2 @ }cat getdex tmp ! tmp @ not if target2 @ pmatch target2 ! target2 @ ok? if target2 @ "pokemon" getstat target2 ! else "" target2 ! then else tmp @ target2 ! then then target2 @ not if "Target 2: Couldn't find that pokemon, by name, number or player." "Pokedex/Breed" pretty tellme exit then { "Comparing " target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex " " "with " target2 @ " " { "/pokemon/" target2 @ "/name" }cat getdex "..." }cat "Pokedex/Breed" pretty tellme target1 @ target2 @ smatch if "These two pokemon seem to be breeding compatible. (They are the same species of pokemon)" "Pokemon/Breed" pretty tellme { "Chances of successful breeding: " 254.0 256.0 / 100.0 * 2 fchop "%" }cat "Pokedex/Breed" pretty tellme exit then { "pokemon/" target1 @ "/breedcompat" }cat getdex tostr "ALL" smatch if "These two pokemon seem to be breeding compatible. (Target 1 compatible with all)" "Pokemon/Breed" pretty tellme { "Chances of successful breeding: " 128.0 256.0 / 100.0 * 2 fchop "%" }cat "Pokedex/Breed" pretty tellme exit then { "pokemon/" target2 @ "/breedcompat" }cat getdex tostr "ALL" smatch if "These two pokemon seem to be breeding compatible. (Target 2 compatible with all)" "Pokemon/Breed" pretty tellme { "Chances of successful breeding: " 128.0 256.0 / 100.0 * 2 fchop "%" }cat "Pokedex/Breed" pretty tellme exit then ( One is type compatible and theres a type match ) { "pokemon/" target1 @ "/breedcompat" }cat getdex tostr "Type" smatch { "pokemon/" target2 @ "/breedcompat" }cat getdex tostr "Type" smatch or if { "pokemon/" target1 @ "/type" }cat getdex { "pokemon/" target2 @ "/type" }cat getdex smatch if "These two pokemon seem to be breeding compatible. (Type match with a type breeding pokemon or metahuman)" "Breed" pretty tellhere { "Chances of successful breeding: " 160.0 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere exit then then { "/pokemon/" target1 @ "/name" }cat getdex { "{" { { "/pokemon/" target2 @ "/breedcompat" }cat getdex tostr ":" { "/pokemon/" target2 @ "/osbreedcompat" }cat getdex tostr }cat "|" ":" subst "}" }cat smatch if "These two pokemon seem to be breeding compatible." "Pokedex/Breed" pretty tellme { "Approximate chances of successful breeding: " { "/pokemon/" target1 @ "/type" }cat getdex { "/pokemon/" target2 @ "/type" }cat getdex smatch if 177.0 else 51.0 then 256.0 / 100.0 * 2 fchop "%" }cat "Pokemon/Breed" pretty tellme else "These two pokemon cannot (technically) breed with eachother." "Pokemon/Breed" pretty tellme then ; : breedcrit ( i -- i ) 16 - fabs sqrt ; : breed var pokemon var pokenum var target1 var target2 var t1name var t2name var t1ref var t2ref var t1mod var t2mod var tmp var attack var attacklev var count var item var value var linestore var chance var roll param @ not if { "Format: +breed =" "Breed" pretty tellme exit then param @ "=" explode tmp ! tmp @ 2 = if target1 ! target2 ! then tmp @ 1 = if me @ target1 ! target2 ! then tmp @ 0 = if { "Format: +breed =" "Breed" pretty tellme exit then { "pokemon/" target1 @ "/name" }cat getdex not if { "pokemon/byname/" target1 @ }cat getdex tmp ! tmp @ not if target1 @ pmatch target1 ! target1 @ ok? if target1 @ t1ref ! target1 @ name t1name ! target1 @ "pokemon" getstat tostr target1 ! else #-1 t1ref ! "" target1 ! "" t1name ! then else tmp @ target1 ! "" t1name ! then then target1 @ not if "Target 1: Couldn't find that pokemon, by name, number or player." "Breed" pretty tellme exit then { "pokemon/" target2 @ "/name" }cat getdex not if { "pokemon/byname/" target2 @ }cat getdex tmp ! tmp @ not if target2 @ pmatch target2 ! target2 @ ok? if target2 @ t2ref ! target2 @ name t2name ! target2 @ "pokemon" getstat tostr target2 ! else #-1 t2ref ! "" target2 ! "" t2name ! then else tmp @ target2 ! "" t2name ! then then target2 @ not if "Target 2: Couldn't find that pokemon, by name, number or player." "Breed" pretty tellme exit then { "Initiatied by " me @ "..." }cat "Pokedex/Breed" pretty tellhere { "Attempting to breed " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") " "with " t2name @ "(" target2 @ " " { "/pokemon/" target2 @ "/name" }cat getdex ")..." }cat "Pokedex/Breed" pretty tellhere t1ref @ ok? if t1ref @ "s/Fertility" getstat level t1ref @ "t/Fertility" getstat level + toint dup t1mod ! if { t1name @ " has a fertility modifier of " t1mod @ "!" }cat "Breed" pretty tellhere then then t2ref @ ok? if t2ref @ "s/Fertility" getstat level t2ref @ "t/Fertility" getstat level + toint dup t2mod ! if { t2name @ " has a fertility modifier of " t2mod @ "!" }cat "Breed" pretty tellhere then then ( Same species ) target1 @ target2 @ smatch if "These two pokemon seem to be breeding compatible. (Both pokemon are the same species)" "Breed" pretty tellhere { "Chances of successful breeding: " 254.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere { "Rolling 1d256-" t1mod @ t2mod @ + " against " 254 "..." }cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 254 > if { "Breeding unsuccessful. (" roll @ ")" }cat "Breed/Official" pretty tellhere else { "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is now pregnant!" }cat "Breed/Official" pretty tellhere roll @ 16 <= if "Critical hit! Its super-effective!" "Breed/Official" pretty tellhere { t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is going to have " roll @ breedcrit toint " kids!" }cat "Breed/Official" pretty tellhere then then exit then ( Target 1 compatible with all ) { "pokemon/" target1 @ "/breedcompat" }cat getdex tostr "ALL" smatch if "These two pokemon seem to be breeding compatible. (Target 1 compatible with all)" "Breed" pretty tellhere { "Chances of successful breeding: " 128.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere { "Rolling 1d256-" t1mod @ t2mod @ + " against " 128 "..." }cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 128 > if { "Breeding unsuccessful. (" roll @ ")" }cat "Breed/Official" pretty tellhere else { "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is now pregnant!" }cat "Breed/Official" pretty tellhere roll @ 16 <= if "Critical hit! Its super-effective!" "Breed/Official" pretty tellhere { t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is going to have " roll @ breedcrit toint " kids!" }cat "Breed/Official" pretty tellhere then then exit then ( Target 2 compatible with all ) { "pokemon/" target2 @ "/breedcompat" }cat getdex tostr "ALL" smatch if "These two pokemon seem to be breeding compatible. (Target 2 compatible with all)" "Breed" pretty tellhere { "Chances of successful breeding: " 128.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere { "Rolling 1d256-" t1mod @ t2mod @ + " against " 128 "..." }cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 128 > if { "Breeding unsuccessful. (" roll @ ")" }cat "Breed/Official" pretty tellhere else { "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is now pregnant!" }cat "Breed/Official" pretty tellhere roll @ 16 <= if "Critical hit! Its super-effective!" "Breed/Official" pretty tellhere { t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is going to have " roll @ breedcrit toint " kids!" }cat "Breed/Official" pretty tellhere then then exit then ( One is type compatible and theres a type match ) { "pokemon/" target1 @ "/breedcompat" }cat getdex tostr "Type" smatch { "pokemon/" target2 @ "/breedcompat" }cat getdex tostr "Type" smatch or if { "pokemon/" target1 @ "/type" }cat getdex { "pokemon/" target2 @ "/type" }cat getdex smatch if "These two pokemon seem to be breeding compatible. (Type match with a type breeding pokemon or metahuman)" "Breed" pretty tellhere { "Chances of successful breeding: " 160.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere { "Rolling 1d256-" t1mod @ t2mod @ + " against " 160 "..." }cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 160 > if { "Breeding unsuccessful. (" roll @ ")" }cat "Breed/Official" pretty tellhere else { "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is now pregnant!" }cat "Breed/Official" pretty tellhere roll @ 16 <= if "Critical hit! Its super-effective!" "Breed/Official" pretty tellhere { t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is going to have " roll @ breedcrit toint " kids!" }cat "Breed/Official" pretty tellhere then then exit then then ( Pokemon breedlist match ) { "/pokemon/" target1 @ "/name" }cat getdex { "{" { { "/pokemon/" target2 @ "/breedcompat" }cat getdex tostr ":" { "/pokemon/" target2 @ "/osbreedcompat" }cat getdex tostr }cat "|" ":" subst "}" }cat smatch if "These two pokemon seem to be breeding compatible." "Breed" pretty tellhere { "Approximate chances of successful breeding: " { "/pokemon/" target1 @ "/type" }cat getdex { "/pokemon/" target2 @ "/type" }cat getdex smatch if 177.0 else 51.0 then dup toint chance ! t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere { "Rolling 1d256-" t1mod @ t2mod @ + " against " chance @ "..." }cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! chance @ > if { "Breeding unsuccessful. (" roll @ ")" }cat "Breed/Official" pretty tellhere else { "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is now pregnant!" }cat "Breed/Official" pretty tellhere roll @ 16 <= if "Critical hit! Its super-effective!" "Breed/Official" pretty tellhere { t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is going to have " roll @ breedcrit toint " kids!" }cat "Breed/Official" pretty tellhere then then else "These two pokemon cannot (technically) breed with eachother." "Pokemon/Breed" pretty tellhere { "Chances of successful breeding: " 1 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" }cat "Breed" pretty tellhere { "Rolling 1d256-" t1mod @ t2mod @ + " against " 1 "..." }cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 1 > if { "Breeding unsuccessful. (" roll @ ")" }cat "Breed/Official" pretty tellhere else { "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is now pregnant!" }cat "Breed/Official" pretty tellhere roll @ 1 <= if "Critical hit! Its super-effective!" "Breed/Official" pretty tellhere { t1name @ "(" target1 @ " " { "/pokemon/" target1 @ "/name" }cat getdex ") is going to have " 15 roll @ + breedcrit toint " kids!" }cat "Breed/Official" pretty tellhere then then then ; : main param ! command @ "+dex/pokemon" smatch if pokedex-pokemon exit then command @ "+dex/types" smatch if pokedex-types exit then command @ "+dex/pokemon#" smatch if pokedex-pokemon# exit then command @ "+dex/breed" smatch if pokedex-breed exit then command @ "+breed" smatch if breed exit then command @ "+dex/attack" smatch if pokedex-attack exit then command @ "+dex/item" smatch if pokedex-item exit then command @ "+dex/tm" smatch if pokedex-tm exit then command @ "+dex/tmlist" smatch if pokedex-tmlist exit then command @ "+dex/tmalpha" smatch if pokedex-tmalpha exit then command @ "+dex/hm" smatch if pokedex-hm exit then pokedex-pokemon ;