@program #2817 1 10000 d i $include $lib/alynna $include $lib/rp $include $lib/rps $include $lib/rps2 $include $lib/pokedex $def POKEDEX "$pokedex" match lvar param : 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 @ str "^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 str "pokemon/" param @ "/name" cat getdex not if str "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 ! str "pokemon/" param @ "/name" cat getdex pokemon ! str "Pokedex information for " pokemon @ cat header tellme str "Number: ^Green^" pokenum @ "^NORMAL^" cat tellme str "Type: ^Green^" str "pokemon/" pokenum @ "/type" cat getdex "^NORMAL^" cat tellme str "Height: ^Green^" str "pokemon/" pokenum @ "/height" cat getdex "^NORMAL^" cat tellme str "Weight: ^Green^" str "pokemon/" pokenum @ "/weight" cat getdex "^NORMAL^" cat tellme str "pokemon/" pokenum @ "/evolution" cat getdex if str "Evolves to: ^Green^" str "pokemon/" pokenum @ "/evolution" cat getdex "^NORMAL^" cat tellme then str "pokemon/" pokenum @ "/evomethod" cat getdex if str "Evolve method: ^Green^" str "pokemon/" pokenum @ "/evomethod" cat getdex "^NORMAL^" cat tellme then "Attacks: " tellme POKEDEX str "pokemon/" pokenum @ "/attacks/" cat array_get_propvals foreach attacklev ! attack ! str " ^Yellow^" attack @ attacklev @ "0" smatch if " ^Green^learned^NORMAL^" else attacklev @ tofloat me @ "xp" getstat level < if " ^Green^learned at level " attacklev @ "^NORMAL^" else " ^Red^learned at level " attacklev @ "^NORMAL^" then then cat tellme repeat "TM/HM Compatibility:" tellme str "^Green^" str "pokemon/" pokenum @ "/tmhm" cat getdex tostr ":" str "pokemon/" pokenum @ "/tmhm2" cat getdex tostr strcat strcat " " ":" subst "^NORMAL^" cat tellme "Pokedex info:" tellme str "pokemon/" pokenum @ "/desc" cat getdex if str "^Red^Red^Normal^/^Blue^Blue^Normal^: ^Green^" str "pokemon/" pokenum @ "/desc" cat getdex "^NORMAL^" cat tellme then str "pokemon/" pokenum @ "/descg" cat getdex if str "^Yellow^Gold^Normal^: ^Green^" str "pokemon/" pokenum @ "/descg" cat getdex "^NORMAL^" cat tellme then str "pokemon/" pokenum @ "/descs" cat getdex if str "^Grey^Silver^Normal^: ^Green^" str "pokemon/" pokenum @ "/descs" cat getdex "^NORMAL^" cat tellme then "Breeding Info" header tellme "^White^Can breed with:^Normal" tellme str "pokemon/" pokenum @ "/breedcompat" cat getdex if -1 count ! "" linestore ! str "pokemon/" pokenum @ "/breedcompat" cat getdex str "pokemon/" pokenum @ "/osbreedcompat" cat getdex dup if ":" swap strcat strcat else pop then ":" explode array_make foreach value ! pop count @ 1 + count ! linestore @ str "^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 "^White^Breeding attacks:^Normal" tellme str "^Green^" str "pokemon/" pokenum @ "/breedmoves" cat getdex if str "^Green^" str "pokemon/" pokenum @ "/breedmoves" 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 @ str "^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 str "attack/" param @ "/desc" cat getdex not if "Couldn't find that special attack." "Pokedex" pretty tellme exit then str "Pokedex information for attack: " param @ cat header tellme str "Name: ^Green^" param @ "^NORMAL^" cat tellme str "Type: ^Green^" str "attack/" param @ "/type" cat getdex "^NORMAL^" cat tellme str "PP: ^Green^" str "attack/" param @ "/pp" cat getdex "^NORMAL^" cat tellme str "Base Damage: ^Green^" str "attack/" param @ "/damage" cat getdex dup "--" smatch if pop "No damage" then "%^NORMAL^" cat tellme str "Accuracy: ^Green^" str "attack/" param @ "/accuracy" cat getdex dup "--" smatch if pop "Used on self, 100" then "%^NORMAL^" cat tellme str "Desc: ^Green^" str "attack/" param @ "/desc" cat getdex "^NORMAL^" cat tellme str "Misc: ^Green^Calls '" str "attack/" param @ "/subtype" cat getdex "' subsystem with factor '" str "attack/" param @ "/factor" cat getdex "'^NORMAL^" cat tellme "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 @ str "^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 str "/item/" param @ "/desc" cat getdex not if "Couldn't find that item." "Pokedex" pretty tellme exit then str "Pokedex information for item: " param @ cat header tellme str "Name: ^Green^" param @ "^NORMAL^" cat tellme str "Type: ^Green^" str "item/" param @ "/type" cat getdex "^NORMAL^" cat tellme str "Subtype: ^Green^" str "item/" param @ "/subtype" cat getdex "^NORMAL^" cat tellme str "Desc: ^Green^" str "item/" param @ "/desc" cat getdex "^NORMAL^" cat tellme "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 @ str "^Green^" item @ tostr 3 rj " ^Yellow^" value @ 16 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 str "TM/" param @ "/name" cat getdex not if str "TM/byname/" param @ cat getdex param ! param @ dup oldparam ! ":" explode 1 - popn param ! (***) then str "TM/" param @ "/name" cat getdex not if "Couldn't find that TM." "Pokedex" pretty tellme exit then str "TM/" param @ "/name" cat getdex tmname ! str "Pokedex information for TM" oldparam @ cat header tellme str "Name: ^Green^" str "TM/" param @ "/name" cat getdex "^NORMAL^" cat tellme str "Type: ^Green^" str "attack/" tmname @ "/type" cat getdex "^NORMAL^" cat tellme str "PP: ^Green^" str "attack/" tmname @ "/pp" cat getdex "^NORMAL^" cat tellme str "Desc: ^Green^" str "attack/" tmname @ "/desc" cat getdex "^NORMAL^" cat tellme str "Average cost: ^Green^" str "TM/" param @ "/cost" cat getdex "^NORMAL^" cat tellme "Pokedex" footer tellme ; : 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 @ str "^Green^" item @ tostr 3 lj "^Yellow^" value @ 17 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 str "HM/" param @ "/name" cat getdex not if str "HM/byname/" param @ cat getdex param ! then str "HM/" param @ "/name" cat getdex not if "Couldn't find that HM." "Pokedex" pretty tellme exit then str "HM/" param @ "/name" cat getdex hmname ! str "Pokedex information for HM" param @ cat header tellme str "Name: ^Green^" str "HM/" param @ "/name" cat getdex "^NORMAL^" cat tellme str "Type: ^Green^" str "attack/" hmname @ "/type" cat getdex "^NORMAL^" cat tellme str "PP: ^Green^" str "attack/" hmname @ "/pp" cat getdex "^NORMAL^" cat tellme str "Desc: ^Green^" str "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 str "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 str "Format: +pokemon/breed =" "Pokedex/Breed" pretty tellme exit then str "pokemon/" target1 @ "/name" cat getdex not if str "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 str "pokemon/" target2 @ "/name" cat getdex not if str "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 str "Comparing " target1 @ " " str "/pokemon/" target1 @ "/name" cat getdex " " "with " target2 @ " " str "/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 str "Chances of successful breeding: " 254.0 256.0 / 100.0 * 2 fchop "%" cat "Pokedex/Breed" pretty tellme exit then str "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 str "Chances of successful breeding: " 128.0 256.0 / 100.0 * 2 fchop "%" cat "Pokedex/Breed" pretty tellme exit then str "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 str "Chances of successful breeding: " 128.0 256.0 / 100.0 * 2 fchop "%" cat "Pokedex/Breed" pretty tellme exit then str "/pokemon/" target1 @ "/name" cat getdex str "{" str str "/pokemon/" target2 @ "/breedcompat" cat getdex tostr ":" str "/pokemon/" target2 @ "/osbreedcompat" cat getdex tostr cat "|" ":" subst "}" cat smatch if "These two pokemon seem to be breeding compatible." "Pokedex/Breed" pretty tellme str "Approximate chances of successful breeding: " str "/pokemon/" target1 @ "/type" cat getdex str "/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 str "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 str "Format: +breed =" "Breed" pretty tellme exit then str "pokemon/" target1 @ "/name" cat getdex not if str "pokemon/byname/" target1 @ cat getdex tmp ! tmp @ not if target1 @ pmatch target1 ! target1 @ ok? if target1 @ t1ref ! target1 @ name t1name ! target1 @ "pokemon" getstat 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 str "pokemon/" target2 @ "/name" cat getdex not if str "pokemon/byname/" target2 @ cat getdex tmp ! tmp @ not if target2 @ pmatch target2 ! target2 @ ok? if target2 @ t2ref ! target2 @ name t2name ! target2 @ "pokemon" getstat 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 str "Initiatied by " me @ "..." cat "Pokedex/Breed" pretty tellhere str "Attempting to breed " t1name @ "(" target1 @ " " str "/pokemon/" target1 @ "/name" cat getdex ") " "with " t2name @ "(" target2 @ " " str "/pokemon/" target2 @ "/name" cat getdex ")..." cat "Pokedex/Breed" pretty tellhere t1ref @ ok? if t1ref @ "Fertility" getpokestat toint dup t1mod ! if str t1name @ " has a fertility modifier of " t1mod @ "!" cat "Breed" pretty tellhere then then t2ref @ ok? if t2ref @ "Fertility" getpokestat toint dup t2mod ! if str t2name @ " has a fertility modifier of " t2mod @ "!" cat "Breed" pretty tellhere then then target1 @ target2 @ smatch if "These two pokemon seem to be breeding compatible. (Both pokemon are the same species)" "Breed" pretty tellhere str "Chances of successful breeding: " 254.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" cat "Breed" pretty tellhere str "Rolling 1d256-" t1mod @ t2mod @ + " against " 254 "..." cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 254 > if str "Breeding unsuccessful. (" roll @ ")" cat "Breed/Official" pretty tellhere else str "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " str "/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 str t1name @ "(" target1 @ " " str "/pokemon/" target1 @ "/name" cat getdex ") is going to have " roll @ breedcrit toint " kids!" cat "Breed/Official" pretty tellhere then then exit then str "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 str "Chances of successful breeding: " 128.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" cat "Breed" pretty tellhere str "Rolling 1d256-" t1mod @ t2mod @ + " against " 128 "..." cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 128 > if str "Breeding unsuccessful. (" roll @ ")" cat "Breed/Official" pretty tellhere else str "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " str "/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 str t1name @ "(" target1 @ " " str "/pokemon/" target1 @ "/name" cat getdex ") is going to have " roll @ breedcrit toint " kids!" cat "Breed/Official" pretty tellhere then then exit then str "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 str "Chances of successful breeding: " 128.0 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" cat "Breed" pretty tellhere str "Rolling 1d256-" t1mod @ t2mod @ + " against " 128 "..." cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 128 > if str "Breeding unsuccessful. (" roll @ ")" cat "Breed/Official" pretty tellhere else str "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " str "/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 str t1name @ "(" target1 @ " " str "/pokemon/" target1 @ "/name" cat getdex ") is going to have " roll @ breedcrit toint " kids!" cat "Breed/Official" pretty tellhere then then exit then str "/pokemon/" target1 @ "/name" cat getdex str "{" str str "/pokemon/" target2 @ "/breedcompat" cat getdex tostr ":" str "/pokemon/" target2 @ "/osbreedcompat" cat getdex tostr cat "|" ":" subst "}" cat smatch if "These two pokemon seem to be breeding compatible." "Breed" pretty tellhere str "Approximate chances of successful breeding: " str "/pokemon/" target1 @ "/type" cat getdex str "/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 str "Rolling 1d256-" t1mod @ t2mod @ + " against " chance @ "..." cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! chance @ > if str "Breeding unsuccessful. (" roll @ ")" cat "Breed/Official" pretty tellhere else str "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " str "/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 str t1name @ "(" target1 @ " " str "/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 str "Chances of successful breeding: " 1 t1mod @ t2mod @ + + 256.0 / 100.0 * 2 fchop "%%" cat "Breed" pretty tellhere str "Rolling 1d256-" t1mod @ t2mod @ + " against " 1 "..." cat "Breed" pretty tellhere random 256 % t1mod @ t2mod @ + - dup roll ! 1 > if str "Breeding unsuccessful. (" roll @ ")" cat "Breed/Official" pretty tellhere else str "Breeding successful! (" roll @ "): " t1name @ "(" target1 @ " " str "/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 str t1name @ "(" target1 @ " " str "/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/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/hm" smatch if pokedex-hm exit then pokedex-pokemon ; . c q