@program $lib/rps2 1 10000 d i $include $lib/rp $include $lib/rps $include $lib/alynna $include $lib/pokedex var param var target var stat var value var dicestore var dicestore4 var attacklevel var thestat var metype $def INFORM "PokeRP" pretty tellme $def AVATAR #21 $def MAXVOTES me @ staff? if 256 else me @ "maxvotes" getstatint if me @ "maxvotes" getstatint else 4 then then $libdef getpokestat : getpokestat ( d s -- ? ) var target var item item ! target ! target @ "s/" item @ strcat getstat toint level dup 2 * swap nd4 + target @ "t/" item @ strcat getstat toint + ; PUBLIC getpokestat $libdef levelhandler : levelhandler ( d -- i ) var target var lastlevel var curlevel target ! target @ "lastlevel" getstat toint lastlevel ! target @ "xp" getstatint level toint curlevel ! curlevel @ lastlevel @ > if str target @ " grew to level " curlevel @ "!" cat "Level" pretty target @ swap ansi_notify target @ "lastlevel" target @ "xp" getstatint level setstat 1 else 0 then ; PUBLIC levelhandler $libdef ballhandler : ballhandler ( i s d s -- i ) var item var target var isubtype var ballpower var roll var stat var value var tmp var cmpme var cmptgt var speed var accuracy item ! target ! Isubtype ! isubtype @ toint 0 > if isubtype @ tofloat ballpower ! else 10.0 ballpower ! then str "Ball power of '" item @ "': " ballpower @ 2 fchop cat "Pokeball" pretty tellhere me @ "xp" getstatint target @ "xp" getstatint - level tmp ! ballpower @ tmp @ 100.0 / 1.0 + * ballpower ! str "Level factor of '" me @ "', trying to capture '" target @ "': " tmp @ toint "%%, new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere target @ "hp" getstatint 1.0 * target @ maxhp 1.0 * / tmp ! tmp @ 1.0 < if ballpower @ 1 tmp @ / * ballpower ! str "Weakness factor of '" target @ "': " 100 tmp @ 100 * - toint "%%, new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere then target @ "pokemorph" getstatint case 0 = when end 1 = when ballpower @ 0.66 * ballpower ! str "Pokemorph strength against ball, 33%% penalty: new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere end 2 = when ballpower @ 0.83 * ballpower ! str "Poketaur strength against ball, 16%% penalty: new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere end endcase ( Now factor in different ball types ) str "pokemon/" target @ iam "/type" cat getdex tostr isubtype @ tostr smatch if ballpower @ 50 + ballpower ! str "Pokemon type match using '" item @ "' to capture '" target @ "': +50 to ballpower, new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere then ( Love ball ) isubtype @ "Love" smatch if me @ "sex" getpropstr capitalize 1 strcut pop cmpme ! target @ "sex" getpropstr capitalize 1 strcut pop cmptgt ! 0 cmpme @ "M" smatch cmptgt @ "F" smatch and if pop 1 then cmpme @ "F" smatch cmptgt @ "M" smatch and if pop 1 then cmpme @ "H" smatch cmptgt @ "H" smatch or if pop 1 then if ballpower @ 50 + ballpower ! str "Pokemon ball type match using '" item @ "' to capture '" target @ "': +50 to ballpower, new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere then then ( Level ball ) isubtype @ "Level" smatch if target @ "xp" getstatint level 20 < if ballpower @ 50 + ballpower ! str "Pokemon ball type match using '" item @ "' to capture '" target @ "': +50 to ballpower, new ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere then then ( Friend ball ) isubtype @ "Friend" smatch if 0 ballpower ! str "Pokemon ball type match using '" item @ "' to capture '" target @ "': New ball power [" ballpower @ 2 fchop "]" cat "Pokeball" pretty tellhere then ( Try to capture ) isubtype @ "Friend" smatch not if me @ "accuracy" getpokestat toint accuracy ! target @ "speed" getpokestat toint speed ! accuracy @ 0 > if str me @ "'s accuracy modifier increased chances of capture by " accuracy @ "!" cat "Pokeball" pretty tellme then accuracy @ 0 < if str me @ "'s accuracy modifier decreased chances of capture by " accuracy @ abs "!" cat "Pokeball" pretty tellme then speed @ 0 > if str me @ "'s speed modifier decreased chances of capture by " speed @ "!" cat "Pokeball" pretty tellme then speed @ 0 < if str me @ "'s speed modifier increased chances of capture by " speed @ abs "!" cat "Pokeball" pretty tellme then str "Attempting to capture '" target @ "'... rolling 1d100-" accuracy @ speed @ - " against " ballpower @ toint cat "Pokeball" pretty tellhere random 100 % accuracy @ - speed @ + roll ! roll @ ballpower @ <= if str target @ " was captured! " me @ " now owns " target @ ". (" roll @ ")" cat "Pokeball" pretty tellhere me @ "p/" target @ name strcat target @ setstat target @ "q/" me @ name strcat me @ setstat else str target @ " got away! (" roll @ ")" cat "Pokeball" pretty tellhere then else target @ str me @ " just dropped a friend ball in front of you! If you wish to be owned by them type '+pokemon/owner " me @ "'" cat "Pokeball" pretty notify then pop 1 ; PUBLIC ballhandler $libdef itemhandler : itemhandler ( d s -- i ) var target var item var itype var isubtype var stat var value item ! target ! str "item/" item @ "/type" cat getdex tostr itype ! str "item/" item @ "/subtype" cat getdex tostr isubtype ! 0 ( Ball handler, pass off to ball handler ) itype @ "Ball" smatch if isubtype @ target @ item @ ballhandler then ( Key item handler ) itype @ "Key" smatch if target @ "k/" item @ strcat isubtype @ setstat str target @ " just received key item " item @ "!" cat "Item" pretty tellhere pop 1 then ( Lucky Egg ) itype @ "XP" smatch if target @ "xp" over over getstat isubtype @ tofloat + setstat str target @ " just received " isubtype @ "xp from " item @ "!" cat "Item" pretty tellhere pop 1 then ( Apricorn handler ) itype @ "Apricorn" smatch if target @ "m/" isubtype @ " Ball" strcat strcat over over getstat 1 + setstat str target @ " just refined a " item @ " into an " isubtype @ " Ball!" cat "Item" pretty tellhere pop 1 then ( TM handler ) itype @ "TM" smatch if isubtype @ toint 100 <= if isubtype @ str "{" str "pokemon/" target @ iam "/tmhm" cat getdex str "pokemon/" target @ iam "/tmhm2" cat getdex dup if tostr "|" swap strcat strcat else pop then "|" ":" subst "}" cat smatch if target @ str "a/" str "tm/" isubtype @ "/name" cat getdex tostr cat over over getstat 1 + setstat str "TM" isubtype @ " was installed on " target @ "." cat "Item/TM" pretty tellhere pop 1 else str "TM" isubtype @ " is incompatible with " target @ "!" cat "Item/TM" pretty tellhere then else target @ str "a/" str "tm/" isubtype @ "/name" cat getdex tostr cat over over getstat 1 + setstat str "TM" isubtype @ " was installed on " target @ "." cat "Item/TM" pretty tellhere pop 1 then then ( HM handler ) itype @ "HM" smatch if isubtype @ toint 100 <= if "H" isubtype @ strcat str "{" str "pokemon/" target @ iam "/tmhm" cat getdex str "pokemon/" target @ iam "/tmhm2" cat getdex dup if tostr "|" swap strcat strcat else pop then "|" ":" subst "}" cat smatch if target @ str "a/" str "hm/" isubtype @ "/name" cat getdex tostr cat over over getstat 1 + setstat str "HM" isubtype @ " was installed on " target @ "." cat "Item/HM" pretty tellhere pop 1 else str "HM" isubtype @ " is incompatible with " target @ "!" cat "Item/HM" pretty tellhere then else target @ str "a/" str "hm/" isubtype @ "/name" cat getdex tostr cat over over getstat 1 + setstat str "HM" isubtype @ " was installed on " target @ "." cat "Item/HM" pretty tellhere pop 1 then then ( Cure Handler ) itype @ "Cure" smatch if isubtype @ toint 0 > if target @ "HP" getstatint isubtype @ toint + dup target @ maxhp > if pop target @ maxhp then target @ "HP" rot setstat str target @ "'s HP was raised by " isubtype @ "." cat "Item/Cure" pretty tellhere pop 1 else isubtype @ "All" smatch if target @ "hp" target @ maxhp setstat target @ "status" 0 setstat target @ "@rp/a/" array_get_propvals foreach value ! stat ! target @ str "a/" stat @ "/pp" cat str "attack/" stat @ "/pp" cat getdex toint setstat repeat str target @ " was completely healed and all PP restored!" cat "Item/Cure" pretty tellhere pop 1 then isubtype @ "PP" smatch if target @ "@rp/a/" array_get_propvals foreach value ! stat ! target @ str "a/" stat @ "/pp" cat str "attack/" stat @ "/pp" cat getdex toint setstat repeat str target @ "'s PP was completely restored!" cat "Item/Cure" pretty tellhere pop 1 then isubtype @ "Confusion" smatch if target @ "status" getstat 1 = if target @ "status" 0 setstat str target @ "'s confused no more!" cat "Item/Cure" pretty tellhere pop 1 else str "It had no effect on " target @ "!" cat "Item/Cure" pretty tellhere pop 1 then then isubtype @ "Frozen" smatch if target @ "status" getstat 2 = if target @ "status" 0 setstat str target @ "'s not frozen anymore!" cat "Item/Cure" pretty tellhere pop 1 else str "It had no effect on " target @ "!" cat "Item/Cure" pretty tellhere pop 1 then then isubtype @ "Burn" smatch if target @ "status" getstatint 3 = if target @ "status" 0 setstat str target @ " is no longer burned!" cat "Item/Cure" pretty tellhere pop 1 else str "It had no effect on " target @ "!" cat "Item/Cure" pretty tellhere pop 1 then then isubtype @ "Sleep" smatch if target @ "status" getstatint 4 = if target @ "status" 0 setstat str target @ " woke up!" cat "Item/Cure" pretty tellhere pop 1 else str "It had no effect on " target @ "!" cat "Item/Cure" pretty tellhere pop 1 then then isubtype @ "Paralyze" smatch if target @ "status" getstat 5 = if target @ "status" 0 setstat str target @ " can move again!" cat "Item/Cure" pretty tellhere pop 1 else str "It had no effect on " target @ "!" cat "Item/Cure" pretty tellhere pop 1 then then isubtype @ "Poison" smatch if target @ "status" getstat 6 = if target @ "status" 0 setstat str target @ " is no longer poisoned!" cat "Item/Cure" pretty tellhere pop 1 else str "It had no effect on " target @ "!" cat "Item/Cure" pretty tellhere pop 1 then then then then ( Moo Handler ) itype @ "Moo" smatch if isubtype @ toint 0 > if target @ "HP" getstatint target @ maxhp isubtype @ toint 100 / * + dup target @ maxhp > if pop target @ maxhp then target @ "HP" rot setstat str target @ "'s HP was raised by " isubtype @ "." cat "Item/Cure" pretty tellhere pop 1 then then ( Equip handler ) itype @ "Equip" smatch if target @ str "e/" item @ capitalize cat tostr over over getstat 1 + setstat str "Equip " item @ "(type " isubtype @ ") was set up on " target @ "." cat "Item/Equip" pretty tellhere pop 1 then ( permstat handler ) itype @ "Attack" smatch if isubtype @ atoi value ! target @ "s/Attack" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Defense" smatch if isubtype @ atoi value ! target @ "s/Defense" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Special" smatch if isubtype @ atoi value ! target @ "s/Special" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Special-Def" smatch if isubtype @ atoi value ! target @ "s/Special-Def" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Accuracy" smatch if isubtype @ atoi value ! target @ "s/Accuracy" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Speed" smatch if isubtype @ atoi value ! target @ "s/Speed" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Fertility" smatch if isubtype @ atoi value ! target @ "s/Fertility" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Max-HP" smatch if isubtype @ atoi value ! target @ "s/Max-HP" over over getstat level value @ + level2xp dup -256 < if pop -256 then dup 256 > if pop 256 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s level in " itype @ " by " value @ abs "." cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Attack" smatch if isubtype @ atoi value ! target @ "t/Attack" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Defense" smatch if isubtype @ atoi value ! target @ "t/Defense" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Special" smatch if isubtype @ atoi value ! target @ "t/Special" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Special-Def" smatch if isubtype @ atoi value ! target @ "t/Special-Def" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Accuracy" smatch if isubtype @ atoi value ! target @ "t/Accuracy" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Speed" smatch if isubtype @ atoi value ! target @ "t/Speed" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Fertility" smatch if isubtype @ atoi value ! target @ "t/Fertility" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then itype @ "Temp-Max-HP" smatch if isubtype @ atoi value ! target @ "t/Max-HP" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 < if str "Item " item @ " has lowered " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere else str "Item " item @ " has raised " target @ "'s " itype @ " by " value @ abs " temporarily!" cat "Item" pretty tellhere then pop 1 then ( handle virtual items ) "$pokedex" match "/item/" item @ "/" strcat strcat propdir? not if pop 1 then ; PUBLIC itemhandler : isepic ( s -- i ) var value var stat var rollx var target target ! me @ "@rp/e/" array_get_propvals foreach value ! stat ! str "item/" stat @ "/type" cat getdex tostr "Equip" smatch if str "item/" stat @ "/subtype" cat getdex tostr str "attack/" target @ "/type" cat getdex tostr smatch if value @ level toint nd4 rollx ! str "Equipment '" stat @ "' enhanced attack '" target @ "'! (+" rollx @ ")" cat "Equip" pretty tellhere rollx @ exit then then repeat 0 ; $libdef stathandler : stathandler ( target.d -- abort?.i ) var target var status var factor var roll target ! ( by default, dont abort ) 0 ( Status ailments ) target @ "status" getstatint 0 > if target @ "status" getstat toint status ! target @ "statusfactor" getstat toint factor ! status @ case ( Confuse ) 1 = when target @ "statusfactor" factor @ 1 - dup factor ! setstat factor @ if random 100 % 50 < if str target @ " is confused! It hurt itself in the confusion! ^RED^" random target @ "xp" getstat toint level 2 * int % dup roll ! "^NORMAL^ damage!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except target @ 0 roll @ - adjusthp target @ isfainted? if str target @ " has fainted!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 then pop 1 else str target @ " is confused!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except then else target @ "status" 0 setstat str target @ " is confused no more!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except then end ( Frozen ) 2 = when str target @ " is frozen! They cannot attack!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 end ( Burn ) 3 = when str target @ " is hurt by the burn! ^RED^" random factor @ % dup roll ! "^NORMAL^ damage!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except target @ 0 roll @ - adjusthp target @ isfainted? if str target @ " has fainted!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 then end ( Sleep ) 4 = when target @ "statusfactor" factor @ 1 - dup factor ! setstat factor @ if str target @ " is asleep! They cannot attack!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 else target @ "status" 0 setstat str target @ " woke up!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except then end ( Poison ) 5 = when str target @ " is hurt by the poison! ^RED^" random factor @ % dup roll ! "^NORMAL^ damage!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except target @ 0 roll @ - adjusthp target @ isfainted? if str target @ " has fainted!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 then end ( Paralyze ) 6 = when random 100 % 50 < if str target @ " is paralyzed! They cannot attack!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 then end ( Fainted ) 9 = when str target @ " is fainted! They cannot attack! Heck, they shouldn't even be here, they should be at a pokemon center recovering!" cat "PokeBattle" pretty target @ location #-1 rot ansi_notify_except pop 1 end endcase then ; PUBLIC stathandler $libdef attackhandler : attackhandler ( target.d damage.i stat.i param.s -- damage.i stat.i ) var stat var param var damage var target var subtype var factor var tmp var value param ! stat ! damage ! target ! str "attack/" param @ "/subtype" cat getdex tostr subtype ! str "attack/" param @ "/factor" cat getdex tostr factor ! ( begin handling ) ( tempstat handler ) subtype @ "Attack" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Attack" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s attack power raised by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s attack power fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then subtype @ "Defense" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Defense" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s defense power raised by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s defense power fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then subtype @ "Special" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Special" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s special power rose by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s special power fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then subtype @ "Special-Def" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Special-Def" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s special defense rose by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s special defense fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then subtype @ "SpecialDef" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Special-Def" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s special defense rose by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s special defense fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then subtype @ "Accuracy" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Accuracy" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s accuracy rose by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s accuracy fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then subtype @ "Speed" smatch if factor @ toint value ! value @ stat @ 50.0 / dup 2.0 > if pop 2.0 then * toint value ! target @ "t/Speed" over over getstat value @ + dup -100 < if pop -100 then dup 100 > if pop 100 then setstat value @ 0 > if str target @ "'s speed rose by " value @ dup float? if int then "!" cat "PokeBattle" pretty tellhere then value @ 0 < if str target @ "'s speed fell by " value @ dup float? if int then abs "!" cat "PokeBattle" pretty tellhere then then ( Status effects ) subtype @ "{Confuse|Freeze|Burn|Sleep|Poison|Paralyze|Flinch}" smatch if random 100 % dup tmp ! factor @ atoi < if subtype @ case "Confuse" smatch when target @ "status" 1 setstat target @ "statusfactor" random 4 % 2 + setstat str target @ " is confused! (" factor @ "/" tmp @ ")" cat "PokeBattle" pretty tellhere end "Freeze" smatch when target @ "status" 2 setstat str target @ " is frozen! It wont be able to attack! (" factor @ "/" tmp @ ")" cat "PokeBattle" pretty tellhere end "Burn" smatch when target @ "status" 3 setstat target @ "statusfactor" damage @ setstat str target @ " is burned! (" factor @ "/" tmp @ ")" cat "PokeBattle" pretty tellhere end "Sleep" smatch when target @ "status" 4 setstat target @ "statusfactor" random 4 % 2 + setstat str target @ " has been put to sleep! (" factor @ "/" tmp @ ")" cat "PokeBattle" pretty tellhere end "Poison" smatch when target @ "status" 5 setstat target @ "statusfactor" damage @ setstat str target @ " is poisoned! (" factor @ "/" tmp @ ")" cat "PokeBattle" pretty tellhere end "Paralyze" smatch when target @ "status" 6 setstat str target @ " is paralyzed! It may not be able to attacked! (" factor @ "/" tmp @ ")" cat "Pokebattle" pretty tellhere end "Flinch" smatch when str target @ " flinched! " me @ " gets to attack again! (" factor @ "/" tmp @ ")" cat "Pokebattle" pretty tellhere end endcase then then damage @ stat @ ; PUBLIC attackhandler : dostab me @ "/@rp/pokemon" getprop "$pokedex" match swap "/pokemon/" swap strcat "/type" strcat getprop ":" explode array_make 0 swap foreach swap pop "$pokedex" match swap "/types/attack/byname/" swap strcat getprop metype @ stringcmp if else 1 break then repeat if else exit then pop .2 + "(STAB) Attack is the same type as the pokemon using it." "PokeBattle" pretty tellhere ; : doAddMulti attacklevel @ ":" explode array_make foreach swap pop dup string? if "-3" smatch if "-3" attacklevel ! exit then else pop then repeat thestat @ -3 < if "-3" attacklevel ! exit then thestat @ 3 > if "3" attacklevel ! exit then thestat @ intostr attacklevel ! ("DEBUG! " attacklevel @ strcat tellhere) ; : damagemodifiers ( d i s -- s i ) var target var attack var attacktype var message var orig var damage var tmp1 var tmp2 attack ! dup orig ! damage ! target ! "" message ! str "attack/" param @ "/type" cat getdex attacktype ! attacktype @ "{Bug|Fighting|Flying|Ghost|Ground|Normal|Poison|Rock|Steel}" smatch if (physical) me @ "Attack" getpokestat if damage @ me @ "Attack" getpokestat dup tmp1 ! + damage ! str message @ me @ "(" tmp1 @ int "%%)" cat message ! then target @ "Defense" getpokestat if damage @ target @ "Defense" getpokestat dup tmp2 ! - damage ! str message @ " - " target @ "(" tmp2 @ int "%%)" cat message ! then message @ if str "Physical damage mods: Original(" orig @ "%%) + (" message @ " = " tmp1 @ tmp2 @ - int "%% damage modifier) = new target " damage @ int "%% damage." cat message ! then else (special) me @ "Special" getpokestat if damage @ me @ "Special" getpokestat dup tmp1 ! + damage ! str message @ me @ "(" tmp1 @ int "%%)" cat message ! then target @ "Special-Def" getpokestat if damage @ target @ "Special-Def" getpokestat dup tmp2 ! - damage ! str message @ " - " target @ "(" tmp2 @ int "%%)" cat message ! then message @ if str "Special damage mods: Original(" orig @ "%%) + (" message @ " = " tmp1 @ tmp2 @ - int "%% damage modifier) = new target " damage @ int "%% damage." cat message ! then then damage @ 0 < if random 10 % 1 + damage ! then message @ damage @ ; : pokebattle ( -- ) var params var target var targettype var accuracy var critical var canattack var attackfactor var damage var critlevel var tmp var mytemp 0 dup stat ! value ! ( Stat handler. If it returns true, abort now. ) me @ stathandler if exit then param @ "=" explode params ! params @ 1 = if ( Using attack on myself ) param ! me @ target ! ( PP check ) me @ str "a/" param @ "/pp" cat getstatint 0 <= if str "You are out of PP in the attack [" param @ "]." cat "Battle" pretty tellme exit then ( Roll it ) me @ "a/" param @ strcat getstatint level toint 1 + nd6 stat ! ( Show it ) str me @ " rolled [^GREEN^" param @ "^NORMAL^]: ^CYAN^" stat @ " (" stat @ successlevel ")" cat "PokeBattle" pretty tellhere ( Factor in any equip bonuses ) stat @ param @ isepic dup tmp ! + stat ! ( And if there were any show those ) tmp @ if str "[^GREEN^" param @ "^NORMAL^]: ^CYAN^" stat @ " (" stat @ successlevel ")" cat "PokeBattle" pretty tellhere then target @ 0 stat @ param @ attackhandler stat ! damage ! ( Describe the attack ) str "attack/" param @ "/desc" cat getdex tostr "PokeBattle" pretty tellme ( And take a PP away ) me @ str "a/" param @ "/pp" cat me @ str "a/" param @ "/pp" cat getstatint 1 - setstat then params @ 2 = if param ! target ! ( Using attack on someone else ) me @ str "a/" param @ "/pp" cat getstatint 0 <= if str "You are out of PP in the attack [" param @ "]." cat "PokeBattle" pretty tellme exit then ( Check for 'self' attacks ) (str "attack/" param @ "/accuracy" cat getdex tostr "--" smatch if str "You can only use this ability on yourself!" cat "PokeBattle" pretty tellme exit then) ( Roll it ) me @ "a/" param @ strcat getstatint level toint 1 + nd6 stat ! ( If the target is not ok, roll it on myself ) target @ match target ! target @ ok? not if me @ target ! str me @ " rolled [^GREEN^" param @ "^NORMAL^]: ^CYAN^" stat @ " (" stat @ successlevel ")" cat "PokeBattle" pretty tellhere ( Factor in any equip bonuses ) stat @ param @ isepic dup tmp ! + stat ! ( Show them if there are any ) tmp @ if str "[^GREEN^" param @ "^NORMAL^]: ^CYAN^" stat @ " (" stat @ successlevel ")" cat "PokeBattle" pretty tellhere then ( Describe the attack ) str "attack/" param @ "/desc" cat getdex tostr "PokeBattle" pretty tellme ( Else If the target is ok, roll it them ) else ( Show the roll ) str me @ " rolled [^GREEN^" param @ "^NORMAL^] against [^GREEN^" target @ "^NORMAL^]: ^CYAN^" stat @ " (" stat @ successlevel ")" cat "PokeBattle" pretty tellhere ( Factor in any equip bonuses ) stat @ param @ isepic dup tmp ! + stat ! ( And show them, if any ) tmp @ if str "[^GREEN^" param @ "^NORMAL^]: ^CYAN^" stat @ " (" stat @ successlevel ")" cat "PokeBattle" pretty tellhere then ( And compare the pokemon to see if its No effect, Not effective, normal or effective ) str "Attack type [^GREEN^" str "attack/" param @ "/type" cat getdex dup not if pop "Normal" then "^NORMAL^] " "against pokemon type [^GREEN^" str "pokemon/" target @ "pokemon" getstat "/type" cat getdex "^NORMAL^] " cat "PokeBattle" pretty tellhere "/types/attack/byname/" str "attack/" param @ "/type" cat getdex dup not if pop "Normal" then strcat getdex metype ! "/types/attack/byname/" str "pokemon/" target @ "pokemon" getstat "/type" cat getdex dup not if pop "Normal" then ":" explode array_make "" mytemp ! foreach swap pop swap dup rot strcat getdex mytemp @ swap ":" strcat strcat mytemp ! repeat mytemp @ targettype ! pop (type:type:type: setup for ttype) ( Test for a critical hit or a critical miss ) random 100 % me @ "Speed" getpokestat + target @ "Speed" getpokestat - int critlevel ! critlevel @ 10 <= if str target @ " evades! (" critlevel @ ")" cat "Pokebattle" pretty tellhere exit then critlevel @ 90 >= if str "Critical hit! (+" stat @ random critlevel @ 50 - % dup tmp ! + stat ! tmp @ ") (" critlevel @ ")" cat "CritCheck" pretty tellhere then ( Do an accuracy test on the attack ) random 100 % me @ "Accuracy" getpokestat - critlevel ! critlevel @ str "attack/" param @ "/accuracy" cat getdex toint dup 0 = if pop 100 then >= if str "Rolling 1d100 against " str "attack/" param @ "/accuracy" cat getdex toint dup 0 = if pop 100 then "... Missed! (" critlevel @ int ") (Accuracy: " me @ "Accuracy" getpokestat int ")" cat "PokeBattle" pretty tellhere exit else str "Rolling 1d100 against " str "attack/" param @ "/accuracy" cat getdex toint dup 0 = if pop 100 then "... Hit! (" critlevel @ int ") (Accuracy: " me @ "Accuracy" getpokestat int ")" cat "PokeBattle" pretty tellhere then ( If this attack has no damage factor, indicate so ) str "attack/" param @ "/damage" cat getdex tostr "--" smatch if "This attack does no damage." "PokeBattle" pretty tellhere ( Call the attackhandler ) target @ 0 stat @ param @ attackhandler stat ! pop ( or else lets do an attack by the attack type ) else ( Save the attack factor as a percentage ) str "attack/" param @ "/damage" cat getdex toint attackfactor ! ( Damage modifiers ) target @ attackfactor @ param @ damagemodifiers attackfactor ! dup if "PokeBattle" pretty tellhere else pop then attackfactor @ 100.0 / attackfactor ! ( And the attack level as a string based number ) ( **BEGIN MULTITYPE CODE** ) (str "/types/attack/" metype @ "/" targettype @ cat getdex attacklevel !) (<-- Old code) "" mytemp ! targettype @ ":" explode depth rotate pop 1 - array_make (This will give us an array of all set types) foreach swap pop thestat ! str "/types/attack/" metype @ "/" thestat @ cat getdex ":" strcat mytemp @ swap strcat mytemp ! repeat (This leaves the various numerical values in val:val:val: format) mytemp @ attacklevel ! attacklevel @ ":" explode depth rotate pop 1 - array_make 0 swap foreach swap pop atoi + repeat thestat ! doAddMulti ( ** END MULTITYPE CODE** ) ( No effect! ) attacklevel @ "-3" smatch if ( Calculate damage and store ) 0 damage ! str "It has no effect! ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere then ( Its not very effective... ) attacklevel @ "-2" smatch if ( Calculate damage and store ) stat @ 0.25 dostab random 50 % 100.0 / + * attackfactor @ * toint damage ! ( Call the attackhandler ) target @ damage @ stat @ param @ attackhandler stat ! damage ! ( Display final call ) str "It's not very effective (x2), ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere ( hurt them ) target @ 0 damage @ - adjusthp then ( Its not very effective... ) attacklevel @ "-1" smatch if ( Calculate damage and store ) stat @ 0.5 dostab random 50 % 100.0 / + * attackfactor @ * toint damage ! ( Call the attackhandler ) target @ damage @ stat @ param @ attackhandler stat ! damage ! ( Display final call ) str "It's not very effective, ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere ( hurt them ) target @ 0 damage @ - adjusthp then ( Normal attack... ) attacklevel @ "0" smatch if ( Calculate damage and store ) stat @ 1 dostab random 50 % 100.0 / + * attackfactor @ * toint damage ! ( Call the attackhandler ) target @ damage @ stat @ param @ attackhandler stat ! damage ! ( Display final call ) str "Normal attack, ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere ( hurt them ) target @ 0 damage @ - adjusthp then ( Its super-effective... ) attacklevel @ "1" smatch if ( Calculate damage and store ) stat @ 1.5 dostab random 50 % 100.0 / + * attackfactor @ * toint damage ! ( Call the attackhandler ) target @ damage @ stat @ param @ attackhandler stat ! damage ! ( Display final call ) str "It's super-effective! ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere ( hurt them ) target @ 0 damage @ - adjusthp then ( Its super-effective... ) attacklevel @ "2" smatch if ( Calculate damage and store ) stat @ 2 dostab random 50 % 100.0 / + * attackfactor @ * toint damage ! ( Call the attackhandler ) target @ damage @ stat @ param @ attackhandler stat ! damage ! ( Display final call ) str "It's super-effective! (x2) ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere ( hurt them ) target @ 0 damage @ - adjusthp then ( Its super-effective... ) attacklevel @ "3" smatch if ( Calculate damage and store ) stat @ 2.5 dostab random 50 % 100.0 / + * attackfactor @ * toint damage ! ( Call the attackhandler ) target @ damage @ stat @ param @ attackhandler stat ! damage ! ( Display final call ) str "It's super-effective! (x2.5) ^Red^" damage @ "^ ^ damage. (Attack power is " attackfactor @ 100.0 * toint "%%)" cat "PokeBattle" pretty tellhere ( hurt them ) target @ 0 damage @ - adjusthp then then ( Describe the attack ) str "Notes on this attack: " str "attack/" param @ "/desc" cat getdex tostr cat "%%" "%" subst "PokeBattle" pretty tellhere then ( And take a PP away ) me @ str "a/" param @ "/pp" cat me @ str "a/" param @ "/pp" cat getstatint 1 - setstat ( Faint check ) target @ isfainted? if str target @ " has fainted!!!" cat "PokeBattle" pretty tellhere then then ; PUBLIC pokebattle : coststr ( f -- s ) dup 0.001 = if pop "FREE " exit then dup -0.001 = if pop "FREE*" exit then dup -0.001 < if 2 fchop "*" strcat exit then 2 fchop " " strcat ; : pokestore ( -- ) var stat var value var icost var item var qty var target me @ location target ! command @ case "+store" stringcmp not when "^YELLOW^+--------------------------------+----------+----------+^NORMAL^" tellme "^YELLOW^|^NORMAL^Items available ^YELLOW^|^NORMAL^ Buy$ ^YELLOW^|^NORMAL^ Sell $ ^YELLOW^|^NORMAL^" tellme "^YELLOW^+--------------------------------+----------+----------+^NORMAL^" tellme target @ "@rp/m/" array_get_propvals foreach value ! stat ! str "^YELLOW^|^NORMAL^" stat @ 32 lj "^YELLOW^|^NORMAL^" value @ coststr 10 rj "^YELLOW^|^NORMAL^" value @ 2 / coststr 10 rj "^YELLOW^|^NORMAL^" cat tellme repeat "^YELLOW^+--------------------------------+----------+----------+^NORMAL^" tellme end "+store/buy" stringcmp not when param @ "=" explode case 2 = when item ! toint qty ! end 1 = when item ! 1 qty ! end default "+store/buy [=]" "$" pretty tellme exit end endcase me @ target ! qty @ 1 < if "You cannot buy zero or negative amount of an item." "$" pretty tellme exit then me @ location "m/" item @ strcat getstatfloat icost ! icost @ 0 = if str "Item [" item @ "] not available in the store." cat "$" pretty tellme exit then ( Handle free items ) icost @ -0.001 = if me @ "m/" item @ strcat -1 setstat str me @ " got item [^YELLOW^" item @ "^NORMAL^] for ^GREEN^FREE^NORMAL^ for unlimited use." cat "$" pretty tellhere exit then icost @ 0.001 = if me @ "m/" item @ strcat getstatint 1 + me @ "m/" item @ strcat rot setstat str me @ " got item [^YELLOW^" item @ "^NORMAL^] for ^GREEN^FREE^NORMAL^." cat "$" pretty tellhere exit then ( Handle items that manipulate money ) icost @ 0 < if ( Pay for unlimited use ) 0 icost @ - icost ! me @ "yen" getstatfloat icost @ >= if me @ "yen" getstatfloat icost @ - me @ swap "yen" swap setstat me @ "m/" item @ strcat -1 setstat str me @ " buys [^YELLOW^" item @ "^NORMAL^] for ^GREEN^$" icost @ qty @ * 2 fchop "^NORMAL^ for unlimited uses" cat "$" pretty tellhere else str "You dont have enough yen! Cost: [$" icost @ qty @ * 2 fchop "]." cat "$" pretty tellme then else ( pay per use ) me @ "yen" getstatfloat icost @ qty @ * >= if me @ "yen" getstatfloat icost @ qty @ * - me @ swap "yen" swap setstat me @ "m/" item @ strcat getstatint qty @ + me @ "m/" item @ strcat rot setstat str me @ " buys " qty @ " [^YELLOW^" item @ "^NORMAL^](s) for ^GREEN^$" icost @ qty @ * 2 fchop "^NORMAL^." cat "$" pretty tellhere else str "You dont have enough yen! Cost: [$" icost @ qty @ * 2 fchop "]." cat "$" pretty tellme then then end "+store/sell" stringcmp not when param @ "=" explode case 2 = when item ! toint qty ! end 1 = when item ! 1 qty ! end default "+store/sell [=]" "$" pretty tellme exit end endcase me @ target ! qty @ 1 < if "You cannot sell zero or negative amount of an item." "$" pretty tellme exit then me @ location "m/" item @ strcat getstatfloat icost ! icost @ 0 = if str "Item [" item @ "] not sellable in the store." cat "$" pretty tellme exit then me @ "m/" item @ strcat getstatint if ( Handle free items ) icost @ 0.001 <= if me @ "m/" item @ strcat 0 setstat str me @ " trashes item [^YELLOW^" item @ "^NORMAL^]. (Sold for FREE)." cat "$" pretty tellme exit then ( Handle items that manipulate money ) me @ "m/" item @ strcat getstatint qty @ >= if me @ "yen" getstatfloat icost @ qty @ * 2 / + me @ swap "yen" swap setstat me @ "m/" item @ strcat getstatint qty @ - me @ "m/" item @ strcat rot setstat str me @ " sells " qty @ " [^YELLOW^" item @ "^NORMAL^](s) for ^GREEN^$" icost @ qty @ * 2 / 2 fchop "^NORMAL^." cat "$" pretty tellhere else str "You dont have enough of these!" cat "$" pretty tellme then then end "+store/trash" stringcmp not when param @ item ! me @ "m/" item @ strcat getstatint 0 = if "None of that item to trash." "$" pretty tellme else me @ "m/" item @ strcat 0 setstat str "Item(s) " item @ " trashed." cat "$" pretty tellme then end default "Invalid command." "Store" pretty tellme end endcase ; PUBLIC pokestore : pokeheal ( -- ) var target var stat var value param @ "" stringcmp not if me @ target ! else param @ pmatch target ! then target @ #-1 dbcmp if param @ match target ! target @ #-1 dbcmp if str "Target " param @ " not found." cat "PokeHeal" pretty tellme exit then then target @ #-2 dbcmp if str "Target " param @ " matched more than once, be more specific." cat "PokeHeal" pretty tellme exit then here "pokecenter" getstatint not if "This isnt a PokeCenter!" "PokeHeal" pretty tellme exit then str "Welcome to our PokeCenter, " me @ ", would you like us to heal your pokemon?" cat "PokeHeal" pretty tellhere str "We will need your pokemon (" target @ ") for a moment..." cat "PokeHeal" pretty tellhere str "( Now healing " target @ "... )" cat "PokeHeal" pretty tellhere target @ "hp" target @ maxhp setstat target @ "status" 0 setstat target @ "@rp/a/" array_get_propvals foreach value ! stat ! target @ str "a/" stat @ "/pp" cat str "attack/" stat @ "/pp" cat getdex toint setstat repeat target @ "@rp/t/" array_get_propvals foreach value ! stat ! target @ str "t/" stat @ cat 0 setstat repeat str "Your pokemon (" target @ ") are healed, please come again. Bye!" cat "PokeHeal" pretty tellhere ; PUBLIC pokeheal : pokeown ( -- ) var source var target var tmp param @ "" stringcmp not if str "Format: " command @ " " cat "PokeOwn" pretty tellme exit then command @ "+pokemon/trade" smatch if param @ "=" explode tmp ! tmp @ 2 = not if str "Format: " command @ " =" cat "PokeOwn" pretty tellme exit then source ! target ! source @ tmp ! tmp @ pmatch source ! source @ #-1 dbcmp if tmp @ match source ! source @ #-1 dbcmp if str "Source " tmp @ " not found." cat "PokeOwn" pretty tellme exit then then source @ #-2 dbcmp if str "Target " tmp @ " matched more than once, be more specific." cat "PokeOwn" pretty tellme exit then target @ tmp ! tmp @ pmatch target ! target @ #-1 dbcmp if tmp @ match target ! target @ #-1 dbcmp if str "Target " param @ " not found." cat "PokeOwn" pretty tellme exit then then target @ #-2 dbcmp if str "Target " tmp @ " matched more than once, be more specific." cat "PokeOwn" pretty tellme exit then me @ str "p/" source @ name cat getstat not if str "Gee, you dont own " source @ "!" cat "PokeOwn" pretty tellme exit then target @ "p/" source @ name strcat source @ setstat source @ "q/" target @ name strcat target @ setstat source @ "q/" me @ name strcat 0 setstat me @ "p/" source @ name strcat 0 setstat str me @ " just traded " source @ " to " target @ "." cat "PokeOwn" pretty tellhere str "pokemon/" source @ iam "/evomethod" cat getdex tostr "Trade" smatch if str source @ " can evolve when traded! This, if you are trying to evolve this pokemon, occurs now." cat "PokeOwn" pretty tellhere then exit then param @ pmatch target ! target @ #-1 dbcmp if param @ match target ! target @ #-1 dbcmp if str "Target " param @ " not found." cat "PokeOwn" pretty tellme exit then then target @ #-2 dbcmp if str "Target " param @ " matched more than once, be more specific." cat "Pokedex" pretty tellme exit then command @ "+pokemon/owner" smatch if target @ "p/" me @ name strcat me @ setstat me @ "q/" target @ name strcat target @ setstat str target @ " now owns you." cat "PokeOwn" pretty tellme target @ str me @ " just let you own them." cat "PokeOwn" pretty ansi_notify then command @ "+pokemon/leave" smatch if target @ "p/" me @ name strcat 0 setstat me @ "q/" target @ name strcat 0 setstat str "You just left " target @ "!" cat "PokeOwn" pretty tellme target @ str me @ " just left you!" cat "PokeOwn" pretty ansi_notify then command @ "+pokemon/disown" smatch if target @ "q/" me @ name strcat 0 setstat me @ "p/" target @ name strcat 0 setstat str "You just disowned " target @ "!" cat "PokeOwn" pretty tellme target @ str me @ " just disowned you!" cat "PokeOwn" pretty ansi_notify then ; PUBLIC pokeown : main pop ; . c q