@q @program asys-combat 1 99999 d i ( Asys-combat v1.2 Jessy@FurryMUCK 6/00 This program handles combat-related commands and events. INSTALLATION: Asys-combat uses the standard Argo installation method. Port the program and set it Wizard. Type '+install asys-combat' USAGE: +aim ............... Aim at +attack ............ Attack +block ...................... Set your defence mode to 'block' +combat #yes ................ Set yourself 'combat ok' +combat #no ................. Set yourself *not* 'combat ok' +dodge ...................... Set your defence mode to 'dodge' +feint ............. Attack , using feints +fire .............. Fire readied ranged weapon at +nodef ...................... Set your defence mode to 'none' +parry ...................... Set your defence mode to 'parry' +put on ............. Don +ready ...... Ready +rest ....................... Set your action to 'rest' +take off ........... Take off +target ............ Set as your target +throw ............. Throw weapon at +unready .................... Unready any readied weapons or shields +unwait ..................... Stop waiting; resume previous action +wait ....................... Set your action to 'wait' Asys-combat may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $enddef $define PauseCheck me @ location "@a/eloop/pause" getpropstr if exit then $enddef $define VerifyEvent caller #0 "@a/calls/eventloop" getprop dbcmp not if ">> This routine must be called from asys-eventmgr." me @ swap notify 0 exit then $enddef $define ClearSkipDef me @ "@a/eloop/skipdef" remove_prop $enddef $include $lib/argo lvar scratch (* workspace var *) lvar ourArg (* inital arg string, unmodified *) lvar ourAttackVal (* int: amount by which attack made roll *) lvar ourBoolean (* int: misc flow control var *) lvar ourCom (* string: 'official' name of command *) lvar ourCounter (* misc. counter var *) lvar ourCrit (* int: true if last attack was crit succ or crit fail *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourDefendVal (* int: amount by which defender made roll *) lvar ourPlayer (* dbref: dbref of a player we're working with *) lvar ourTarget (* dbref: dbref of player/obj we're targetting *) lvar ourWeapon (* dbref: dbref of a weapon we're working with *) : DoInstall ( -- ) (* install program into Argo system *) caller program? not if (* confirm installation method *) ">> Programs must be installed via the " "+install" GetCommandName strcat " command." strcat Tell exit then prog "@a/version" getpropstr if ">> Reinstalling..." Tell else ">> Installing..." Tell then (* record 'official' name of prog; remove old links *) prog "@a/name" "asys-attack" setprop RecOldActions (* add combat advantages and skills *) ourDataObj @ "@a/dis-ad/Endurance I" "1" setprop ourDataObj @ "@a/dis-ad/Endurance II" "2" setprop ourDataObj @ "@a/dis-ad/Endurance III" "3" setprop ourDataObj @ "@a/dis-ad/Toughness I" "1" setprop ourDataObj @ "@a/dis-ad/Toughness II" "2" setprop ourDataObj @ "@a/dis-ad/Toughness III" "3" setprop ourDataObj @ "@a/skills/Brawling" "phy,5,0" setprop ourDataObj @ "@a/skills/Martial Arts" "phy,8,0" setprop ourDataObj @ "@a/skills/Martial Arts/preqs#" "1" setprop ourDataObj @ "@a/skills/Martial Arts/preqs#/1" "stats,pre,9" setprop ourDataObj @ "@a/skills/Martial Arts/nodef" "yes" setprop (* create and register commands; set default props *) #0 "+combat" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+combat" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+combat" setprop #0 "+dodge" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+dodge" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+dodge" setprop #0 "+block" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+block" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+block" setprop #0 "+parry" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+parry" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+parry" setprop #0 "+nodef" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+nodef" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+nodef" setprop #0 "+ready" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+ready" scratch @ setprop #0 "@a/calls/readyweapon" prog setprop #0 "@a/calls/readyshield" prog setprop #0 "@a/calls/removearmor" prog setprop scratch @ "@a/name" "+ready" setprop #0 "+unready" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+unready" scratch @ setprop #0 "@a/calls/unready" prog setprop scratch @ "@a/name" "+unready" setprop #0 "+put on;+don" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+put on" scratch @ setprop #0 "@a/calls/readyarmor" prog setprop scratch @ "@a/name" "+put on" setprop #0 "+take off" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+take off" scratch @ setprop #0 "@a/calls/unreadyarmor" prog setprop scratch @ "@a/name" "+take off" setprop #0 "+attack" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+attack" scratch @ setprop #0 "@a/calls/attack" prog setprop scratch @ "@a/name" "+attack" setprop #0 "+feint" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+feint" scratch @ setprop #0 "@a/calls/feint" prog setprop scratch @ "@a/name" "+feint" setprop #0 "+aim" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+aim" scratch @ setprop #0 "@a/calls/aim" prog setprop scratch @ "@a/name" "+aim" setprop #0 "+fire" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+fire" scratch @ setprop #0 "@a/calls/fire" prog setprop scratch @ "@a/name" "+fire" setprop #0 "+throw" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+throw" scratch @ setprop #0 "@a/calls/throw" prog setprop scratch @ "@a/name" "+throw" setprop #0 "+target" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+target" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+target" setprop #0 "+rest" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+rest" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+rest" setprop #0 "+wait" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+wait" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+wait" setprop #0 "+unwait" newexit dup scratch ! prog setlink prog "@a/version" thisVersion setprop scratch @ "@a/version" thisVersion setprop #0 "@a/comm_list/+unwait" scratch @ setprop #0 "@a/prog_list/" prog name strcat prog setprop scratch @ "@a/name" "+unwait" setprop #0 "@a/prog_list/" prog name strcat prog setprop prog "@a/name" "asys-combat" setprop ">> Installed." Tell ; : DoUninstall (* uninstall program from Argo *) prog "@a/name" getpropstr if #0 "@a/prog_list/" prog "@a/name" getpropstr strcat getprop not if ">> " prog name strcat " is not currently installed." strcat Tell pid kill then else ">> " prog name strcat " is not currently installed." strcat Tell pid kill then ">> Please confirm: You wish to uninstall " prog name strcat "?" strcat Tell ReadYesNo not if ">> Aborted." Tell pid kill Then (* remove commands and their supporting props *) #0 "@a/calls/readyweapon" remove_prop #0 "@a/calls/readyshield" remove_prop #0 "@a/calls/removearmor" remove_prop #0 "@a/calls/unready" remove_prop #0 "@a/calls/readyarmor" remove_prop #0 "@a/calls/unreadyarmor" remove_prop #0 "@a/calls/attack" remove_prop #0 "@a/calls/feint" remove_prop #0 "@a/calls/aim" remove_prop #0 "@a/calls/fire" remove_prop #0 "@a/calls/throw" remove_prop "@a/comm_list/+aim" RemoveCommand "@a/comm_list/+attack" RemoveCommand "@a/comm_list/+block" RemoveCommand "@a/comm_list/+combat" RemoveCommand "@a/comm_list/+dodge" RemoveCommand "@a/comm_list/+feint" RemoveCommand "@a/comm_list/+fire" RemoveCommand "@a/comm_list/+nodef" RemoveCommand "@a/comm_list/+parry" RemoveCommand "@a/comm_list/+put on" RemoveCommand "@a/comm_list/+ready" RemoveCommand "@a/comm_list/+rest" RemoveCommand "@a/comm_list/+take off" RemoveCommand "@a/comm_list/+target" RemoveCommand "@a/comm_list/+throw" RemoveCommand "@a/comm_list/+unready" RemoveCommand "@a/comm_list/+unwait" RemoveCommand "@a/comm_list/+wait" RemoveCommand background #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop RecOldActions ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoAimHelp ( -- ) (* show help for +aim *) "The $com command aims a readied missle weapon at . Aiming for " "1 turn is necessary to fire at normal levels (rolls for firing " "without aiming are at -3). Additional turns spent aiming increase " "your chance to hit by 1 for each turn spent aiming, up to +5. " "(see also '+fire' and 'combat') " strcat strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com [at] " command @ "$com" subst Tell " " Tell "If you already have a target, may be omitted." Tell ; : DoAttackHelp ( -- ) (* show help for +attack *) "The $com command initiates an attack sequence against a " "designated target. If you already have a designated target, you can " "type '$com' without arguments. If you have a readied weapon, the " "attack will be resolved using your skill level for that weapon and its " "damage values. If you don't have a readied weapon, the attack will " "be resolved as unarmed combat." strcat strcat strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com " command @ "$com" subst Tell " " Tell ; : DoBlockHelp ( -- ) (* show help for +block *) "The $com command sets your defense mode to 'block': you attempt to " "avoid attacks by warding them off with your shield. You must have " "a readied shield in order to block. Your Block skill is equal to " "your current DEX plus your Shield skill minus 2. " strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoCombatHelp ( -- ) (* show help for +combat *) "The $command command is used to display or change your combat " "status. If you are 'combat ok', you may use combat-related commands, " "and they may be used against you. If you are not 'combat ok', then " "you may not use the commands and they may not be used against you." strcat strcat strcat command @ "$command" subst Tell " " Tell "Syntax:" Tell " " Tell " $com ........................ Show your combat status" command @ "$com" subst Tell " $com #yes ................... Set yourself 'combat ok'" command @ "$com" subst Tell " $com #no .................... Set yourself *not* 'combat ok'" command @ "$com" subst Tell " " Tell "By default, players are *not* 'combat ok'." Tell ; : DoDodgeHelp ( -- ) (* show help for +dodge *) "The $com command sets your defense mode to 'dodge': you attempt to " "avoid attacks by moving out of their way. Your Dodge skill is equal " "to your current CON + current DEX divided by 3 plus 1. You may " "declare +dodge at any time. Dodging is the only defense mode " "available if you have no shield or weapon that can parry. It may " "also be your best choice if you are unskilled with your weapon or " "shield." strcat strcat strcat strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoFeintHelp ( -- ) (* show help for +feint *) "The $com command changes your attack mode to feinting. Feinting " "is a tactical manuever that can increase your chance to hit a " "well-defended opponent. Instead of attacking, you fake an attack " "in attempt to draw your oppenent off guard. If the feint succeeds " "(rolled as an attack against your opponent), the amount by which " "you made your feint is applied as a modifier to your next attack " "roll. Upon executing a successful feint, your attack mode " "automatically switches to attack. Your next attack is made with " "the feint modifier, and then your attack mode automatically " "switches back to feint." strcat strcat strcat strcat strcat strcat strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com " command @ "$com" subst Tell " " Tell "If you already have a target, may be omitted." Tell ; : DoThrowHelp ( -- ) (* show help for +throw *) "The $com command throws a readied throwing weapon at a designated " "target. After you throw a weapon, it will be in the room you are in, " "rather than your inventory, and your combat action will be set to " "'wait'." strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com [at] " command @ "$com" subst Tell " " Tell "If you already have a target, may be omitted." Tell ; : DoFireHelp ( -- ) (* show help for +fire *) "The $com command fires a readied missle weapon at a designated " "target. If you are currently aiming, you can type '+fire' with no " "arguments. Rolls for firing without aiming are made at -3. " strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com [at] " command @ "$com" subst Tell " " Tell "If you already have a designated target, may be omitted." Tell ; : DoNoDefHelp ( -- ) (* show help for +nodef *) "The $com command `turns off' your defenses: you have no Defense " "Mode set. When you have no defense mode, you are concentrating " "entirely on your attack: rolls to hit are made at +2." strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoParryHelp ( -- ) (* show help for +parry *) "The $com command sets your defense mode to 'parry': you attempt to " "avoid attacks by deflecting them with your weapon. You must have a " "readied weapon in order to parry. Your Parry skill is equal to " "your current DEX plus your weapon skill minus 4. Not all weapons " "may be used to parry." strcat strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoPutOnHelp ( -- ) (* show help for +put on *) "The $com command begins the process of donning armor, a spacesuit, " "or similar equipment. The time required to don a suit of armor is " "proportionate to its defense value, usually 2 turns per level of " "Damage Reduction." strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com " command @ "$com" subst Tell " " Tell ; : DoReadyHelp ( -- ) (* show help for +ready *) "The $com command readies for use in combat. You must be " "holding the object. You cannot have more than one weapon ready, but " "you may have one weapon and one shield." strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com " command @ "$com" subst Tell " " Tell ; : DoRestHelp ( -- ) (* show help for +rest *) "The $com command sets your combat action to 'rest'. When resting, " "you take no offensive or defensive actions, and recover fatigue at " "an accelerated rate." strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoTakeOffHelp ( -- ) (* show help for +take off *) "The $com command begins the process of removing armor, a " "spacesuit, or similar equipment. The time required to remove a " "suit of armor is proportionate to its defense value, usually 1 " "turn per level of Damage Reduction. " strcat strcat strcat command "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoTargetHelp ( -- ) (* show help for +target *) "$com is a readiness command, initiating a combat process, with " " as your designated target and 'wait' as your current " "action. It may also be used to change your target in the middle " "of combat." strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax:" Tell " " Tell " $com .............. Set as your target" command @ "$com" subst Tell " $com #none ................. Set your target to 'none'" command @ "$com" subst Tell " " Tell ; : DoUnreadyHelp ( -- ) (* show help for +unready *) "The $com command unreadies your current weapon and chield. Use " "the +unready command to put away a weapon once combat is concluded " "and it is no longer appropriate to be weilding it." strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoWaitHelp ( -- ) (* show help for +wait *) "The $com command is a readiness command, initiating a combat " "process with no designated target and 'wait' as your current " "action. If you have a current action when you do +wait, it will be " "saved, and restored with the +unwait command." strcat strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command @ "$com" subst Tell " " Tell ; : DoUnWaitHelp ( -- ) (* show help for +unwait *) "The $com command is a readiness command, restoring your combat " "action to whatever you were doing before you issued a +wait command. " "If you do not have a stored action, your action remains 'wait'." strcat strcat command @ "$com" subst Tell " " Tell "Syntax: $com" command "$com" subst Tell " " Tell ; : DoHelp ( -- ) (* display help screen *) " " Tell prog name " (#" strcat prog intostr strcat ")" strcat Tell " " Tell ourCom @ "+aim" smatch if DoAimHelp exit then ourCom @ "+attack" smatch if DoAttackHelp exit then ourCom @ "+block" smatch if DoBlockHelp exit then ourCom @ "+combat" smatch if DoCombatHelp exit then ourCom @ "+dodge" smatch if DoDodgeHelp exit then ourCom @ "+feint" smatch if DoFeintHelp exit then ourCom @ "+fire" smatch if DoFireHelp exit then ourCom @ "+nodef" smatch if DoNoDefHelp exit then ourCom @ "+parry" smatch if DoParryHelp exit then ourCom @ "+put on" smatch if DoPutOnHelp exit then ourCom @ "+ready" smatch if DoReadyHelp exit then ourCom @ "+rest" smatch if DoRestHelp exit then ourCom @ "+take off" smatch if DoTakeOffHelp exit then ourCom @ "+target" smatch if DoTargetHelp exit then ourCom @ "+throw" smatch if DoThrowHelp exit then ourCom @ "+unready" smatch if DoUnreadyHelp exit then ourCom @ "+unwait" smatch if DoUnWaitHelp exit then ourCom @ "+wait" smatch if DoWaitHelp exit then ; (******************* Begin combat support functions *******************) : DoVerString ( s -- s' ) (* append verification string to s *) me @ "@a/store/veron" getpropstr if me @ "@a/store/verstring" getpropstr strcat then ; : DoCheckTarget ( -- i ) (* go to wait if target is invalid *) (* return true if target is ok *) me @ "@a/eloop/target" getprop VerifyTarget not if ">> You do not have a valid target." DoVerString Tell ">> Your current action is 'wait'." DoVerString Tell me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop 0 else me @ "@a/eloop/target" getprop ourTarget ! 1 then ; : DoRanged? ( -- i ) (* return true if user's weapon is ranged *) me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/ranged" rot "@a/name" getpropstr "$name" subst getprop if 1 else 0 then else pop 0 then ; : DoThrown? ( -- i ) (* return true if user's weapon can be thrown *) me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/thrown" rot "@a/name" getpropstr "$name" subst getprop if 1 else 0 then else pop 0 then ; : DoDodge? ( -- i ) (* return true if user's weapon can be dodged *) me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/dable" rot "@a/name" getpropstr "$name" subst getprop if 1 else 0 then else pop 0 then ; : DoBlock? ( -- i ) (* return true if user's weapon can be blocked *) me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/bable" rot "@a/name" getpropstr "$name" subst getprop if 1 else 0 then else pop 0 then ; : DoParry? ( -- i ) (* return true if user's weapon can be parried *) me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/pable" rot "@a/name" getpropstr "$name" subst getprop if 1 else 0 then else pop 0 then ; : DoNoWeapon ( -- ) (* weapon invalid: notify and reset *) me @ "@a/eloop/weapon" remove_prop me @ "@a/eloop/defmode" getpropstr dup if dup "parry" smatch if me @ "@a/eloop/defmode" "dodge" setprop then else pop then ">> You no longer have a readied weapon." DoVerString Tell ; : DoNoShield ( -- ) (* shield invalid: notify and reset *) me @ "@a/eloop/shield" remove_prop me @ "@a/eloop/defmode" getpropstr dup if dup "block" smatch if me @ "@a/eloop/defmode" "dodge" setprop then else pop then ">> You no longer have a readied shield." DoVerString Tell ; : DoNoArmor ( -- ) (* armor invalid: notify and reset *) me @ "@a/eloop/armor" remove_prop ">> You now longer are wearing armor." DoVerString Tell ; : DoVerifyEquipment ( -- ) (* make sure equipment is still valid *) me @ "@a/eloop/weapon" getprop dup if dup scratch ! ourWeapon ! begin scratch @ ok? not if DoNoWeapon break then scratch @ "@a/version" getprop not if DoNoWeapon break then scratch @ location me @ dbcmp not if DoNoWeapon break then scratch @ "@a/broken" getprop if DoNoWeapon break then break repeat else pop then me @ "@a/eloop/shield" getprop dup if scratch ! begin me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/hands" rot "@a/name" getpropstr "$name" subst getpropstr dup if "2" smatch if ">> You cannot use a shield with a two handed weapon." DoVerString Tell DoNoShield break then else pop then else pop then scratch @ ok? not if DoNoShield break then scratch @ "@a/version" getprop not if DoNoShield break then scratch @ location me @ dbcmp not if DoNoShield break then scratch @ "@a/broken" getprop if DoNoShield break then break repeat else pop then me @ "@a/eloop/armor" getprop dup if scratch ! begin scratch @ ok? not if DoNoArmor break then scratch @ "@a/version" getprop not if DoNoArmor break then scratch @ location me @ dbcmp not if DoNoArmor break then scratch @ "@a/broken" getprop if DoNoArmor break then break repeat else pop then ; : DoGetWeaponType ( d -- s ) (* return type of d's weapon *) (* s will be "hands" if d has no weapon *) "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/type" rot "@a/name" getpropstr "$name" subst getpropstr dup not if pop "hands" then else pop "hands" then ; : DoGetPhysSkill ( d -- i ) (* get phys skill in combat context *) dup "@a/stats/str" GetModAbility over "@a/stats/con" GetModAbility + over "@a/stats/dex" GetModAbility + over "@a/eloop/shield" getprop dup if ourDataObj @ "@a/objects/$name/armor/dexred" rot "@a/name" getpropstr "$name" subst getpropstr atoi - else pop then swap "@a/eloop/armor" getprop dup if ourDataObj @ "@a/objects/$name/armor/dexred" rot "@a/name" getpropstr "$name" subst getpropstr atoi - else pop then 3 / ; : DoGetWeaponAbility ( d -- s i ) (* return d's best skill for current weapon and its level *) ourPlayer ! 0 ourCounter ! ourDataObj @ "@a/objects/$name/combat/skills/" ourPlayer @ "@a/eloop/weapon" getprop "@a/name" getpropstr "$name" subst nextprop begin dup while ourDataObj @ over getpropstr if dup dup "/" rinstr strcut swap pop "@a/skills/" swap strcat scratch ! ourPlayer @ scratch @ GetModAbility dup ourCounter @ > if ourCounter ! else pop then then ourDataObj @ swap nextprop repeat pop scratch @ ourCounter @ ; : DoGetFatigueHitMods ( d -- i ) (* return neg mods to be applied because of fatigue *) scratch ! scratch @ "@a/stats/str" GetModAbility scratch @ "@a/stats/con" GetModAbility + scratch @ "@a/dis-ad/endurance iii" getpropstr if 9 + else scratch @ "@a/dis-ad/endurance ii" getpropstr if 6 + else scratch @ "@a/dis-ad/endurance i" getpropstr if 3 + then then then scratch @ "@a/stats/fat" GetModAbility - dup 0 > if pop 0 exit then ; : DoGetDamageHitMods ( d -- i ) (* return neg mods to be applied because of damage *) scratch ! scratch @ "@a/stats/con" GetModAbility scratch @ "@a/stats/dam" getpropstr atoi - dup 0 > if pop 0 then ; : DoGetShieldHitMods ( d -- i ) (* retun 'to hit' mods to be applied because of target's shield *) scratch ! scratch @ "@a/eloop/target" getprop dup if dup ok? if dup "@a/eloop/nodef" getprop not if "@a/eloop/shield" getprop dup dup scratch ! if ourDataObj @ "@a/objects/$name/armor/type/" rot "@a/name" getpropstr "$name" subst scratch @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/type" rot "@a/name" getpropstr "$name" subst getpropstr else pop "conventional" then strcat getpropstr if ourDataObj @ "@a/objects/$name/armor/hitred" scratch @ "@a/name" getpropstr "$name" subst getpropstr atoi else 0 then else pop 0 then else pop 0 then else pop 0 then else pop 0 then ; : DoGetArmorHitMods ( d -- i ) (* retun 'to hit' mods to be applied because of target's armor *) scratch ! scratch @ "@a/eloop/target" getprop dup if dup ok? if "@a/eloop/armor" getprop dup dup scratch ! if ourDataObj @ "@a/objects/$name/armor/" rot "@a/name" getpropstr "$name" subst scratch @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/type" rot "@a/name" getpropstr "$name" subst getpropstr else pop "conventional" then strcat getpropstr if ourDataObj @ "@a/objects/$name/armor/hitred" scratch @ "@a/name" getpropstr "$name" subst getpropstr atoi else 0 then else pop 0 then else pop 0 then else pop 0 then ; : DoCritAttackSucc ( -- ) (* run a random crit succ; notify room *) 2 6 0 Dice dup 2 = if pop ourTarget @ dup if dup "@a/eloop/weapon" getprop dup if "@a/broken" "yes" setprop ">> $name's weapon breaks!" swap name "$name" subst TellRoom else pop dup "@a/stats/dam" over over getpropstr atoi 1 6 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" swap name "$name" subst TellRoom ourTarget @ CheckDeath then else pop then else dup 3 = if pop ourTarget @ dup if dup "@a/eloop/weapon" getprop dup if over location moveto dup "@a/eloop/weapon" remove_prop dup ">> $name drops %p weapon! [CRITICAL SUCCESS]" pronoun_sub swap name "$name" subst TellRoom else pop dup "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" swap name "$name" subst TellRoom ourTarget @ CheckDeath then else pop then else dup 4 = if pop ourTarget @ dup if dup "@a/eloop/shield" getprop dup if over location moveto dup "@a/eloop/shield" remove_prop dup ">> $name drops %p shield! [CRITICAL SUCCESS]" pronoun_sub TellRoom else pop then ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 8 2 Dice + intostr setprop else pop then else dup 5 = if pop ourTarget @ dup if ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 6 1 Dice + intostr setprop else pop then else dup 6 = if pop ourTarget @ dup if ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 4 0 Dice + intostr setprop else pop then else dup 7 = if pop ourTarget @ dup if dup "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 4 0 Dice + intostr setprop ourTarget @ CheckDeath else pop then else dup 8 = if pop ourTarget @ dup if dup "@a/stats/dam" over over getpropstr atoi 1 5 1 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 5 1 Dice + intostr setprop ourTarget @ CheckDeath else pop then else dup 9 = if pop ourTarget @ dup if dup "@a/stats/dam" over over getpropstr atoi 1 4 0 dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" swap name "$name" subst TellRoom ourTarget @ CheckDeath else pop then else dup 10 = if pop ourTarget @ dup if dup "@a/stats/dam" over over getpropstr atoi 1 4 0 dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" swap name "$name" subst TellRoom ourTarget @ CheckDeath else pop then else dup 11 = if pop ourTarget @ dup if dup "@a/stats/dam" over over getpropstr atoi 1 4 2 dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" swap name "$name" subst TellRoom ourTarget @ CheckDeath else pop then else dup 12 = if pop ourTarget @ dup if dup "@a/eloop/weapon" getprop dup if over location moveto dup "@a/eloop/weapon" remove_prop dup ">> $name drops %p weapon! [CRITICAL SUCCESS]" pronoun_sub over name "$name" subst TellRoom dup "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 4 0 Dice + intostr setprop ourTarget @ CheckDeath else pop dup "@a/stats/dam" over over getpropstr atoi 1 6 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL SUCCESS]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL SUCCESS]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 6 0 Dice + intostr setprop ourTarget @ CheckDeath then else pop then else pop then then then then then then then then then then then ; : DoCritAttackFail ( -- ) (* run a random crit fail; notify room *) 2 6 0 Dice dup 2 = if pop me @ dup "@a/eloop/weapon" getprop dup if "@a/broken" "yes" setprop ">> $name's weapon breaks! [CRITICAL FAILURE]" swap name "$name" subst TellRoom else pop dup "@a/stats/dam" over over getpropstr atoi 1 6 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" swap name "$name" subst TellRoom me @ CheckDeath then else dup 3 = if pop me @ dup "@a/eloop/weapon" getprop dup if over location moveto dup "@a/eloop/weapon" remove_prop dup ">> $name drops %p weapon! [CRITICAL FAILURE]" pronoun_sub swap name "$name" subst TellRoom else pop dup "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" swap name "$name" subst TellRoom me @ CheckDeath then else dup 4 = if pop me @ dup ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 8 2 Dice + intostr setprop else dup 5 = if pop me @ dup ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 6 1 Dice + intostr setprop else dup 6 = if pop me @ dup ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 4 0 Dice + intostr setprop else dup 7 = if pop me @ dup dup "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 4 0 Dice + intostr setprop me @ CheckDeath else dup 8 = if pop me @ dup dup "@a/stats/dam" over over getpropstr atoi 1 5 1 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 5 1 Dice + intostr setprop me @ CheckDeath else dup 9 = if pop me @ dup dup "@a/stats/dam" over over getpropstr atoi 1 4 0 dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" swap name "$name" subst TellRoom me @ CheckDeath else dup 10 = if pop me @ dup dup "@a/stats/dam" over over getpropstr atoi 1 4 0 dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" swap name "$name" subst TellRoom me @ CheckDeath else dup 11 = if pop me @ dup dup "@a/stats/dam" over over getpropstr atoi 1 4 2 dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" swap name "$name" subst TellRoom me @ CheckDeath else dup 12 = if pop me @ dup dup "@a/eloop/weapon" getprop dup if over location moveto dup "@a/eloop/weapon" remove_prop dup ">> $name drops %p weapon! [CRITICAL FAILURE]" pronoun_sub over name "$name" subst TellRoom dup "@a/stats/dam" over over getpropstr atoi 1 4 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 4 0 Dice + intostr setprop me @ CheckDeath else pop dup "@a/stats/dam" over over getpropstr atoi 1 6 0 Dice + intostr setprop ">> $name takes extra damage! [CRITICAL FAILURE]" over name "$name" subst TellRoom ">> $name is stunned! [CRITICAL FAILURE]" over name "$name" subst TellRoom "@a/stats/stun" over over getpropstr atoi 1 6 0 Dice + intostr setprop me @ CheckDeath then else pop then then then then then then then then then then then ; : DoNormAttackFail ( -- ) (* notify room: attack failed *) ">> $me misses $you..." me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ; : DoNormDefSucc ( -- ) (* notify room: defence succeeded *) ">> $you $mode $me's attack!" me @ name "$me" subst ourTarget @ name "$you" subst ourTarget @ "@a/eloop/defmode" getpropstr dup "dodge" smatch if pop "dodges" else dup "block" smatch if pop "blocks" else dup "parry" smatch if pop "parries" else pop "avoids" then then then "$mode" subst TellRoom ; : DoNormAttackSucc (* notify room: attack succeeded *) me @ "@a/eloop/act" getpropstr "fire" smatch if ">> $me's shot hits $you!" else ">> $me strikes $you!" then me @ name "$me" subst ourTarget @ name "$you" subst TellRoom ourTarget @ "@a/eloop/armor" getprop dup if CountUse else pop then ; : DoCalcDodge ( i1 -- i2 (* figure dodge defense for ourTarget *) (* i1 is roll modifier; i2 is true|false *) DoDodge? not if pop 0 exit then ourTarget @ "@a/stats/dex" GetModAbility (* get effective ability *) ourTarget @ "@a/stats/str" GetModAbility + 2 / 2 + ourTarget @ DoGetFatigueHitMods + ourTarget @ DoGetDamageHitMods + + ourTarget @ "@a/eloop/defmod" getpropstr atoi + ourTarget @ "@a/eloop/defmod" remove_prop 3 6 0 Dice over over - ourDefendVal ! >= if (* roll it! *) 1 else 0 then ourTarget @ ApplyCombatFatigue ; : DoCalcBlock ( i1 -- i2 ) (* figure block defense for ourTarget *) (* i1 is roll modifier; i2 is true|false *) DoBlock? not if pop 0 exit then ourTarget @ "@a/eloop/shield" getprop not if pop 0 exit then ourTarget @ "@a/skills/shield" GetModAbility (* get ability *) ourTarget @ GetPhysSkill atoi + ourTarget @ DoGetFatigueHitMods + ourTarget @ DoGetDamageHitMods + + ourTarget @ "@a/eloop/defmod" getpropstr atoi + ourTarget @ "@a/eloop/defmod" remove_prop dup 0 <= if pop 0 else 3 6 0 Dice over over - ourDefendVal ! >= if (* roll it! *) 1 else 0 then then ourTarget @ "@a/eloop/shield" getprop CountUse ourTarget @ ApplyCombatFatigue ; : DoCalcParry ( i1 -- i2 ) (* figure parry defense for ourTarget *) (* i1 is roll modifier; i2 is true|false *) DoParry? not if pop 0 exit then ourTarget @ "@a/eloop/weapon" getprop dup if (* get ability *) ourDataObj @ "@a/objects/$name/combat/parry" 3 pick "@a/name" getpropstr "$name" subst getprop if ourWeapon ! 0 ourCounter ! "" scratch ! ourDataObj @ "@a/objects/$name/combat/skills/" ourWeapon @ "@a/name" getpropstr "$name" subst nextprop begin dup while ourDataObj @ over getpropstr if dup dup "/" rinstr strcut swap pop "@a/skills/" swap strcat scratch ! ourTarget @ scratch @ GetModAbility dup ourCounter @ > if ourCounter ! else pop then then ourDataObj @ swap nextprop repeat pop scratch @ if ourTarget @ scratch @ GetModAbility else pop then ourTarget @ GetPhysSkill atoi + 1 - ourTarget @ DoGetFatigueHitMods + ourTarget @ DoGetDamageHitMods + + ourTarget @ "@a/eloop/defmod" getpropstr atoi + ourTarget @ "@a/eloop/defmod" remove_prop ourDataObj @ "@a/objects/$name/class/fencing weapons" ourTarget @ "@a/eloop/weapon" getprop "@a/name" getpropstr "$name" subst getpropstr if ourTarget @ "@a/skills/fencing" GetModAbility + then 3 6 0 Dice over over - ourDefendVal ! >= if (* roll it *) 1 else 0 then else pop 0 then ourTarget @ "@a/eloop/weapon" getprop CountUse else pop 0 then ourTarget @ ApplyCombatFatigue ; : DoCalcDefense ( i1 -- i2 ) (* return true if defenses succeed *) (* i1 is roll modifier; i2 is true|false *) (* check for program call to handle defence *) ourWeapon @ not if #0 "@a/calls/calcbaredefence" getprop dup if "#calcbaredefence" swap call exit else pop then then me @ "@a/eloop/weapon" getprop dup if #0 "@a/calls/calc$typedefence" ourDataObj @ "@a/objects/$weapon/combat/type" 4 rotate "@a/name" getpropstr "$weapon" subst getpropstr "$type" subst getprop dup if "#calcweapondefence" swap call exit else pop then else pop then ourTarget @ "@a/stats/stun" getpropstr if pop 0 exit then ourTarget @ "@a/eloop/skipdef" getprop if 0 exit then ourTarget @ "@a/eloop/defmode" getpropstr dup if dup "dodge" smatch if pop DoCalcDodge exit then dup "block" smatch if pop DoCalcBlock exit then dup "parry" smatch if pop DoCalcParry exit then else pop 0 then ; : DoApplyBareDamage ( -- ) (* apply dam for an unarmed attack *) me @ "@a/stats/str" GetModAbility (* get base dam range *) dup 4 <= if pop 1 2 -1 else dup 6 <= if pop 1 3 -1 else dup 8 <= if pop 1 4 -1 else dup 10 <= if pop 1 5 -1 else dup 12 <= if pop 1 6 -1 else dup 14 <= if pop 1 7 -1 else pop 1 8 -1 then then then then then then Dice (* roll extra damage for unarmed combat skills *) me @ "@a/skills/martial arts" GetModAbility dup if 1 swap 0 Dice else me @ "@a/skills/brawling" GetModAbility dup if 1 swap 0 Dice then then + (* calc martial arts dam reduction *) ourTarget @ "@a/eloop/weapon" getprop not ourTarget @ "@a/eloop/armor" getprop not and ourTarget @ "@a/skills/martial arts" getpropstr and if ourTarget @ GetPhysSkill atoi ourTarget @ "@a/skills/martial arts" GetModAbility + 3 6 0 Dice >= if 1 ourTarget @ "@a/skills/martial arts" GetModAbility 0 Dice - then then (* apply mods for armor and shields *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 4 pick me @ DoGetArmorHitMods if ourTarget @ "@a/eloop/armor" getprop dup if ourDataObj @ "@a/objects/$name/armor/damred" rot "@a/name" getpropstr "$name" subst getpropstr atoi - else pop then then me @ DoGetShieldHitMods if ourTarget @ "@a/eloop/shield" getprop dup if ourDataObj @ "@a/objects/$name/armor/damred" rot "@a/name" getpropstr "$name" subst getpropstr atoi - else pop then then dup 0 < if pop 0 then dup if ourTarget @ "@a/eloop/injured" "yes" setprop then 0 ourBoolean ! dup if 1 ourBoolean ! then begin dup int? not while pop repeat + intostr setprop ourBoolean @ if ourTarget @ "@a/eloop/check" getpropstr if ourTarget @ CheckCombatInfo then then (* apply death or wimpout if needed *) ourTarget @ CheckDeath if exit then ourTarget @ CheckWimpOut ; : DoApplyWeaponDamage ( -- ) (* apply damage for an armed attack *) (* roll base damage *) ourDataObj @ "@a/objects/$name/combat/dam" ourWeapon @ "@a/name" getpropstr "$name" subst getpropstr dup if "d" explode pop atoi swap dup "+" instr if "+" explode pop strip atoi swap strip atoi else dup "-" instr if "-" explode pop strip atoi swap strip atoi else atoi 0 then then Dice else ">> ERROR: Weapon type not found." VerTell NukeStack me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop exit then (* apply str mod for melee weapons *) DoRanged? not if me @ "@a/stats/str" GetModAbility dup 16 >= if pop 4 else dup 13 >= if pop 3 else dup 10 >= if pop 2 else pop 0 then then then dup if 1 swap 0 Dice + else pop then then (* calc martial arts dam reduction *) ourTarget @ "@a/eloop/weapon" getprop not ourTarget @ "@a/eloop/armor" getprop not and ourTarget @ "@a/skills/martial arts" getpropstr and if ourTarget @ GetPhysSkill atoi ourTarget @ "@a/skills/martial arts" GetModAbility + 3 6 0 Dice >= if 1 ourTarget @ "@a/skills/martial arts" GetModAbility 0 Dice - then then (* apply mods for toughness advantage *) ourTarget @ "@a/dis-ad/toughness iii" getpropstr if 6 - else ourTarget @ "@a/dis-ad/toughness ii" getpropstr if 4 - else ourTarget @ "@a/dis-ad/toughness i" getpropstr if 2 - then then then (* apply mods for armor and shields *) ourTarget @ "@a/stats/dam" over over getpropstr atoi 4 pick me @ DoGetArmorHitMods if ourTarget @ "@a/eloop/armor" getprop dup if ourDataObj @ "@a/objects/$name/armor/damred" rot "@a/name" getpropstr "$name" subst getpropstr atoi - else pop then then me @ DoGetShieldHitMods if ourTarget @ "@a/eloop/shield" getprop dup if ourDataObj @ "@a/objects/$name/armor/damred" rot "@a/name" getpropstr "$name" subst getpropstr atoi - else pop then then dup 0 < if pop 0 then dup if ourTarget @ "@a/eloop/injured" "yes" setprop then 0 ourBoolean ! dup if 1 ourBoolean ! then + intostr setprop ourBoolean @ if ourTarget @ "@a/eloop/check" getpropstr if ourTarget @ CheckCombatInfo then then (* apply death or wimpout if needed *) ourTarget @ CheckDeath if exit then ourTarget @ CheckWimpOut ; : DoApplyDamage ( -- ) (* route to appropriate damage function *) DoVerifyEquipment me @ "@a/eloop/weapon" getprop if DoApplyWeaponDamage else DoApplyBareDamage then ; : DoCalcBareAttack ( -- i ) (* calculate bare hand attack *) (* return true if successful *) (* check for program call to handle attack *) #0 "@a/calls/calc$skillattack" me @ "@a/eloop/skill" getpropstr "$skill" subst getpropstr dup if "#calcbareattack" swap call exit else pop then me @ DoGetPhysSkill + (* get effective ability level *) me @ DoGetFatigueHitMods + me @ DoGetDamageHitMods + me @ DoGetArmorHitMods - me @ DoGetShieldHitMods - me @ "@a/eloop/defmode" getpropstr not if 2 + then me @ "@a/eloop/armor" getprop not if me @ "@a/skills/martial arts" GetModAbility + then ourTarget @ "@a/invisible" getpropstr if 8 - then 3 6 0 Dice (* roll attack *) over over - ourAttackVal ! 0 ourCrit ! dup 4 <= if 1 ourCrit ! then dup 17 >= if 1 ourCrit ! then (* record roll diff if we're feinting *) me @ "@a/eloop/act" getpropstr "feint" smatch if ourTarget @ "@a/eloop/defmod" ourAttackVal @ -1 * intostr setprop then >= if 1 else 0 then ; : DoCalcWeaponAttack ( -- i ) (* calculate weapon attack *) (* return true if successful *) DoVerifyEquipment (* make sure we still have weapon *) (* check for program call to handle attack *) #0 "@a/calls/calc$typeattack" ourDataObj @ "@a/objects/$weapon/combat/type" me @ "@a/eloop/weapon" getprop "@a/name" getpropstr "$weapon" subst getpropstr "$type" subst getprop dup if "#calcweaponattack" swap call exit else pop then (* go to unarmed attack if weapon got lost *) me @ "@a/eloop/weapon" getprop not if DoCalcBareAttack exit then #0 "@a/calls/calc$typedef" ourDataObj @ "@a/objects/$weapon/combat/type" me @ "@a/eloop/weapon" getprop "@a/name" getpropstr "$weapon" subst getpropstr "$type" subst getprop dup if "#calcweaponattack" swap call exit else pop then 0 ourBoolean ! (* get effective ability level *) me @ "@a/eloop/act" getpropstr "throw" smatch if me @ "@a/skills/thrown weapons" GetModAbility else me @ DoGetWeaponAbility swap pop then dup if 1 ourBoolean ! then + me @ DoGetFatigueHitMods + me @ DoGetDamageHitMods + me @ DoGetArmorHitMods - me @ DoGetShieldHitMods - ME @ DoGetPhysSkill + me @ "@a/eloop/defmode" getpropstr not if 2 + then me @ "@a/eloop/act" getpropstr "fire" smatch DoRanged? and me @ "@a/eloop/genmod" getpropstr not and if 3 - then ourTarget @ "@a/invisible" getpropstr if 8 - then (* ourBoolean is true if user has an applicable skill *) ourBoolean @ if 3 else 4 then 6 0 Dice (* roll attack *) over over - ourAttackVal ! 0 ourCrit ! dup 4 <= if 1 ourCrit ! then (* record if we got a crit *) dup 17 >= if 1 ourCrit ! then me @ "@a/eloop/act" getpropstr "feint" smatch if ourTarget @ "@a/eloop/defmod" ourAttackVal @ -1 * intostr setprop then >= if 1 (* return true for a successful attack *) else 0 then ourWeapon @ CountUse ; : DoCalcAttack ( -- i ) (* go to appropriate attack calc routine *) me @ "@a/eloop/genmod" getpropstr atoi me @ "@a/eloop/weapon" getprop dup if ourWeapon ! DoCalcWeaponAttack else pop DoCalcBareAttack then me @ "@a/eloop/genmod" remove_prop me @ ApplyCombatFatigue ourTarget @ "@a/eloop/attacked" "yes" setprop ; (********************* Begin wait & rest functions ********************) : DoTarget ( -- ) (* set a target and start an action loop *) ourArg @ if (* check: user wants to clear target? *) "#none" ourArg @ stringpfx if me @ "@a/eloop/target" remove_prop ">> Target cleared." Tell exit then (* find and verify target *) ourArg @ match dup not if ">> Target not found." Tell pop exit then dup #-2 dbcmp if ">> Ambiguous. I don't know which one you mean!" Tell pop exit then dup "@a/version" getprop not if ">> $name is not Argo-enabled." swap name "$name" subst Tell exit then dup awake? not if ">> $name is not online." swap name "$name" subst Tell exit then dup location me @ location dbcmp not if ">> $name is not here." swap name "$name" subst Tell exit then ">> $name is now your target." over name "$name" subst Tell me @ "@a/eloop/target" rot setprop me @ "@a/eloop/pid" getprop not me @ "@a/eloop/act" getprop not or if me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop EventLoop then else ">> Syntax: $command " command @ "$command" subst Tell then ; : DoWait ( -- ) (* store current action; pause loop *) ClearSkipDef me @ "@a/eloop/quell_tell" getpropstr not if ">> Waiting..." Tell then me @ "@a/eloop/oact" me @ "@a/eloop/act" getprop setprop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop EventLoop ; : DoUnwait ( -- ) (* restore previous action; resume loop *) ClearSkipDef me @ "@a/eloop/oact" getprop dup if me @ "@a/eloop/act" 3 pick setprop ">> Action now set to '$act'." swap "$act" subst Tell else ">> No previous action found..." Tell ">> Action set to 'wait'." Tell pop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop then me @ "@a/eloop/oact" remove_prop ; : DoRest ( -- ) (* set current action to 'rest' *) me @ "@a/eloop/act" "rest" setprop me @ "@a/eloop/acting" "resting" setprop me @ "@a/eloop/skipdef" "yes" setprop ">> You are now resting." Tell EventLoop ; (*********************** Begin attack functions ***********************) : DoRunAttack ( -- ) (* execute an attack event *) PauseCheck VerifyEvent DoVerifyEquipment ClearSkipDef (* clean up and check *) DoCheckTarget not if exit then (* calc attack; calc def if needed; check for crits; apply results *) DoCalcAttack if ourCrit @ if DoNormAttackSucc DoApplyDamage DoCritAttackSucc ourTarget @ CheckWimpOut else 0 DoCalcDefense if ourDefendVal @ ourAttackVal @ >= if DoNormDefSucc else DoNormAttackSucc DoApplyDamage then else DoNormAttackSucc DoApplyDamage then then else DoNormAttackFail ourCrit @ if DoCritAttackFail me @ CheckWimpOut then then ; : DoRunFeint ( -- ) (* execute a feint event *) PauseCheck VerifyEvent DoVerifyEquipment ClearSkipDef (* clean up and check *) DoCheckTarget not if exit then (* we sleep in this routine; see if user got stunned *) me @ "@a/stats/stunned" getpropstr atoi if exit then random 4 % (* get a random feint direction; notify room *) dup 0 = if pop "high" else dup 1 = if pop "low" else dup 2 = if pop "left" else dup 3 = if pop "right" else pop "" then then then then ">> $me feints $dir..." me @ name "$me" subst swap "$dir" subst TellRoom (* run a feint attack; go do real one if feint succeeds *) DoCalcAttack if me @ GetTurnLength sleep PauseCheck me @ "@a/eloop/act" "attack" setprop DoRunAttack me @ "@a/eloop/act" "feint" setprop then ; : DoRunFire ( -- ) (* execute a fire event *) PauseCheck VerifyEvent DoVerifyEquipment ClearSkipDef (* clean up and check *) DoCheckTarget not if exit then (* see if user got stunned while aiming *) me @ "@a/stats/stunned" getpropstr atoi if exit then (* verify ranged weapon *) ourWeapon @ if DoRanged? not if ">> You do not have a ready ranged weapon." DoVerString Tell ">> Cannot fire." DoVerString Tell ">> Your current action is 'wait'." DoVerString Tell me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop else (* calc attack; calc def if needed; check for crits; apply results *) me @ "@a/eloop/genmod" getpropstr atoi DoCalcWeaponAttack if ourCrit @ if DoNormAttackSucc DoApplyDamage DoCritAttackSucc ourTarget @ CheckWimpOut NukeStack exit then DoRanged? if 0 DoCalcDefense else 0 then if DoNormDefSucc else DoNormAttackSucc DoApplyWeaponDamage then else ourCrit @ if DoCritAttackFail me @ CheckWimpOut then DoNormAttackFail then then else ">> You do not have a ready missle weapon." DoVerString Tell ">> Cannot fire." DoVerString Tell ">> Your current action is 'wait'." DoVerString Tell then NukeStack ; : DoRunThrow ( -- ) (* execute a thrown weapon attack *) PauseCheck VerifyEvent DoVerifyEquipment ClearSkipDef (* clean up and check *) DoCheckTarget not if exit then (* verify thrown weapon *) ourWeapon @ if DoThrown? if ">> $me throws a weapon at $you..." me @ name "$me" subst ourTarget @ name "$you" subst DoVerString TellRoom (* calc attack; calc def if needed; check for crits; apply results *) me @ "@a/eloop/genmod" getpropstr atoi DoCalcWeaponAttack if ourCrit @ if DoNormAttackSucc DoApplyDamage DoCritAttackSucc ourTarget @ CheckWimpOut NukeStack exit then DoThrown? if 0 DoCalcDefense else 0 then if DoNormDefSucc else DoNormAttackSucc DoApplyWeaponDamage then else ourCrit @ if DoCritAttackFail me @ CheckWimpOut then DoNormAttackFail then then me @ "@a/eloop/weapon" getprop me @ location moveto me @ "@a/eloop/weapon" remove_prop else ">> You do not have a ready throwing weapon." DoVerString Tell ">> Cannot throw." DoVerString Tell ">> Your current action is 'wait'." DoVerString Tell then me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop NukeStack ; : DoRunAim ( -- ) (* execute an aim event *) PauseCheck VerifyEvent DoVerifyEquipment ClearSkipDef (* clean up and check *) DoCheckTarget not if exit then begin me @ GetTurnLength sleep PauseCheck (* see if user got stunned while function slept *) me @ "@a/stats/stunned" getpropstr atoi if exit then (* see if target or weapon status changed *) ourTarget @ VerifyTarget not if ">> You do not have a valid target." DoVerString Tell ">> Cannot aim." DoVerString Tell ">> Your current action is now 'wait'." DoVerString Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then ourWeapon @ not if ">> You do not have a readied ranged weapon." DoVerString Tell ">> Cannot aim." DoVerString Tell ">> Your current action is now 'wait'." DoVerString Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then DoRanged? not if ">> You do not have a readied ranged weapon." DoVerString Tell ">> Cannot aim." DoVerString Tell ">> Your current action is now 'wait'." DoVerString Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then (* go fire if indicated *) me @ "@a/eloop/act" getpropstr dup if "fire" smatch if DoRunFire NukeStack continue then else pop exit then (* increment general mod *) me @ "@a/eloop/act" getpropstr dup if "aim" smatch not if me @ "@a/eloop/genmod" remove_prop exit then else pop exit then me @ "@a/eloop/genmod" over over getpropstr atoi 1 + intostr setprop me @ "@a/eloop/genmod" getpropstr atoi 5 > if me @ "@a/eloop/genmod" "5" setprop then ">> Aiming... (+$num)" me @ "@a/eloop/genmod" getpropstr "$num" subst DoVerString Tell NukeStack repeat ; : DoCheckGuard ( -- i ) (* return true if ourTarget is guarded *) #0 "@a/calls/checkguard" getprop dup if ourTarget @ "#checkguard" rot call dup if ">> $target is being guarded by $guard." ourTarget @ name "$target" subst swap name "$guard" subst Tell 1 else pop 0 then else pop 0 then ; : DoAttackInfo ( -- ) (* get target for an attack *) ourArg @ not me @ "@a/eloop/target" getprop not and if ">> You do not have a target." Tell ">> Try '$command '." command @ "$command" subst Tell 0 exit then ourArg @ if ourArg @ "" "at " subst strip ourArg ! ourArg @ match dup #-1 dbcmp if ">> Target not found." Tell pop 0 exit then dup #-2 dbcmp if ">> Ambiguous. I don't know who you want to attack!" Tell pop 0 exit then dup me @ dbcmp if ">> That would be silly!" Tell pop 0 exit then dup VerifyTarget not if ">> $name is not a valid target." swap name "$name" subst Tell 0 exit then dup ourTarget ! me @ "@a/eloop/target" rot setprop then 1 ; : DoAttack ( -- ) (* go to 'attack'; start loop if needed *) ClearSkipDef DoVerifyEquipment DoRanged? if ">> You are using a ranged weapon." Tell ">> Use the $aim and $fire commands to initiate attacks." "+aim" GetCommandName "$aim" subst "+fire" GetCommandName "$fire" subst Tell exit then DoAttackInfo not if exit then DoCheckGuard if exit then me @ "@a/eloop/act" "attack" setprop me @ "@a/eloop/acting" "attacking" setprop ">> $me moves to attack $you..." me @ name "$me" subst me @ "@a/eloop/target" getprop name "$you" subst TellRoom EventLoop ; : DoFeint ( -- ) (* go to 'feint'; start loop if needed *) ClearSkipDef DoVerifyEquipment DoRanged? if ">> You are using a ranged weapon." Tell ">> Use the $aim and $fire commands to initiate attacks." "+aim" GetCommandName "$aim" subst "+fire" GetCommandName "$fire" subst Tell exit then DoAttackInfo not if exit then me @ "@a/eloop/act" "feint" setprop me @ "@a/eloop/acting" "feinting" setprop ">> $me moves toward $you..." me @ name "$me" subst me @ "@a/eloop/target" getprop name "$you" subst TellRoom EventLoop ; : DoThrow ( -- ) (* go to 'throw'; start loop if needed *) ClearSkipDef DoVerifyEquipment DoAttackInfo not if exit then ourTarget @ VerifyTarget not if ">> You do not have a valid target." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then ourWeapon @ not if ">> You do not have a readied throwing weapon." Tell ">> Cannot throw." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then DoThrown? not if ">> You do not have a readied throwing weapon." Tell ">> Cannot throw." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then ">> Preparing to throw..." Tell me @ "@a/eloop/act" "throw" setprop me @ "@a/eloop/acting" "preparing to throw a weapon" setprop EventLoop ; : DoAim ( -- ) (* go to 'aim'; start loop if needed *) ClearSkipDef DoVerifyEquipment DoAttackInfo not if exit then ourTarget @ VerifyTarget not if ">> You do not have a valid target." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then ourWeapon @ not if ">> You do not have a readied ranged weapon." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then DoRanged? not if ">> You do not have a readied ranged weapon." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then me @ "@a/eloop/act" "aim" setprop me @ "@a/eloop/acting" "aiming" setprop ">> $me aims at $you..." me @ name "$me" subst me @ "@a/eloop/target" getprop name "$you" subst TellRoom EventLoop ; : DoFire ( -- ) (* go to 'fire'; start loop if needed *) ClearSkipDef DoVerifyEquipment DoAttackInfo not if exit then ourTarget @ VerifyTarget not if ">> You do not have a valid target." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then ourWeapon @ not if ">> You do not have a readied ranged weapon." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then DoRanged? not if ">> You do not have a readied ranged weapon." Tell ">> Cannot aim." Tell ">> Your current action is now 'wait'." Tell me @ "@a/eloop/act" "wait" setprop exit me @ "@a/eloop/acting" "waiting" setprop exit then me @ "@a/eloop/act" "fire" setprop me @ "@a/eloop/acting" "firing" setprop ">> $me is firing at $you..." me @ name "$me" subst me @ "@a/eloop/target" getprop name "$you" subst TellRoom EventLoop ; (********************** Begin readying functions **********************) : DoReadyingArmor ( d -- ) (* begin readying armor obj d *) me @ "@a/eloop/armor" getprop dup if dup ok? if over dbcmp if ">> You're already wearing that!" Tell pop pid kill then else pop then else pop then ">> Donning $name..." over name "$name" subst Tell me @ "@a/eloop/act" "readyarmor" setprop me @ "@a/eloop/acting" "donning armor" setprop me @ "@a/eloop/toready" rot setprop EventLoop ; : DoRunReadyShield ( -- ) (* ready a shield *) PauseCheck VerifyEvent me @ "@a/eloop/toready" getprop dup if dup ok? if dup location me @ dbcmp if dup me @ "@a/eloop/shield" rot setprop ">> $name ready!" swap name "$name" subst DoVerString Tell me @ location me @ ">> $name readies a shield." me @ name "$name" subst notify_except else ">> Shield to ready no longer available." DoVerString Tell pop then else ">> Shield to ready no longer available." DoVerString Tell pop then else pop then me @ "@a/eloop/toready" remove_prop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop NukeStack ; : DoReadyingShield ( d -- ) (* begin readying shield obj d *) me @ "@a/eloop/shield" getprop dup if dup ok? if over dbcmp if ">> That's already your ready shield!" Tell pop pid kill then else pop then else pop then ">> Readying $name..." over name "$name" subst Tell me @ "@a/eloop/act" "readyshield" setprop me @ "@a/eloop/acting" "readying a shield" setprop me @ "@a/eloop/toready" rot setprop EventLoop ; : DoRunReadyWeapon ( -- ) (* ready a weapon *) PauseCheck VerifyEvent me @ "@a/eloop/toready" getprop dup if dup ok? if dup location me @ dbcmp if dup me @ "@a/eloop/weapon" rot setprop ">> $name ready!" swap name "$name" subst DoVerString Tell me @ location me @ ">> $name readies a $type." ourDataObj @ "@a/objects/$object/combat/" me @ "@a/eloop/weapon" getprop "@a/name" getpropstr "$object" subst nextprop if "weapon" else "tool" then "$type" subst me @ name "$name" subst notify_except else ">> Weapon to ready no longer available." DoVerString Tell pop then else ">> Weapon to ready no longer available." DoVerString Tell pop then else pop then me @ "@a/eloop/toready" remove_prop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop NukeStack ; : DoReadyingWeapon ( d -- ) (* begin readying weapon obj d *) me @ "@a/eloop/weapon" getprop dup if dup ok? if over dbcmp if ">> That's already your ready weapon!" Tell pop pid kill then else pop then else pop then ourDataObj @ "@a/objects/$name/combat/minstr" 3 pick "@a/name" getpropstr "$name" subst getpropstr dup if atoi me @ "@a/stats/str" GetModAbility > if ">> Sorry, you're not strong enough to use that weapon." Tell pop exit then else pop then ">> Readying $name..." over name "$name" subst Tell me @ "@a/eloop/act" "readyweapon" setprop me @ "@a/eloop/acting" "readying a weapon" setprop me @ "@a/eloop/toready" rot setprop EventLoop ; : DoReady ( -- ) (* find an object to ready; go to function *) ourArg @ not if ">> Syntax: $command " command @ "$command" subst Tell exit then me @ ComCheck not if ">> You must be set 'combat ok' to use this command." Tell #0 "@a/comm_list/+combat" getprop dup if name dup ";" instr if dup ";" instr 1 - strcut pop then else exit then ">> Use the $command command to make this setting." swap "$command" subst Tell exit then me @ contents begin dup while dup name ourArg @ stringpfx if dup "@a/class/weapons" getpropstr if DoReadyingWeapon exit then then next repeat pop me @ contents begin dup while dup name ourArg @ stringpfx if dup "@a/name" getpropstr dup if ourDataObj @ "@a/objects/$name/class/shields" rot "$name" subst getprop if me @ "@a/eloop/weapon" getprop dup if ourDataObj @ "@a/objects/$name/combat/hands" rot "@a/name" getpropstr "$name" subst getpropstr dup if "2" smatch if ">> Sorry, you can't use a shield with a two-handed " "weapon." strcat Tell NukeStack exit then else pop then else pop then DoReadyingShield exit then else pop then then next repeat pop ">> Weapon or shield '$name' not found in your inventory." ourArg @ "$name" subst Tell ; : DoUnReady ( -- ) (* unready current weapon and shield *) me @ "@a/eloop/weapon" getprop dup if dup ok? if ">> You unready $name." swap name "$name" subst Tell else ">> You unready your weapon." Tell then me @ "@a/eloop/weapon" remove_prop 1 ourBoolean ! then me @ "@a/eloop/shield" getprop dup if dup ok? if ">> You unready $name." swap name "$name" subst Tell else ">> You unready your sheild." Tell then me @ "@a/eloop/shield" remove_prop 1 ourBoolean ! then ourBoolean @ not if ">> Unreadied." Tell then NukeStack ; : DoRunReadyArmor ( -- ) (* ready a suite of armor *) PauseCheck VerifyEvent ourDataObj @ "@a/objects/$name/armor/damred" me @ "@a/eloop/toready" getprop "@a/name" getprop "$name" subst getpropstr atoi ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi 2 * * sleep PauseCheck me @ "@a/stats/stunned" getpropstr atoi if exit then me @ "@a/eloop/toready" getprop dup if dup ok? if dup location me @ dbcmp if dup me @ "@a/eloop/armor" rot setprop ">> $name donned!" swap name "$name" subst DoVerString Tell me @ location me @ ">> $name dons armor." me @ name "$name" subst notify_except else ">> Armor to don no longer available." DoVerString Tell pop then else ">> Armor to don no longer available." DoVerString Tell pop then else pop then me @ "@a/eloop/toready" remove_prop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop NukeStack ; : DoPutOn ( -- ) (* find armor; begin readying it *) ourArg @ not if ">> Syntax: $command " command @ "$command" subst Tell exit then me @ contents begin dup while dup name ourArg @ stringpfx if dup "@a/name" getpropstr dup if ourDataObj @ "@a/objects/$name/class/armor" rot "$name" subst getprop if DoReadyingArmor exit then else pop then then next repeat ">> Armor '$name' not found in your inventory." ourArg @ "$name" subst Tell NukeStack ; : DoRunUnreadyArmor ( -- ) (* unready current armor *) VerifyEvent ourDataObj @ "@a/objects/$name/armor/damred" me @ "@a/eloop/armor" getprop "@a/name" getprop "$name" subst getpropstr atoi ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi * sleep PauseCheck me @ "@a/stats/stunned" getpropstr atoi if exit then me @ "@a/eloop/armor" remove_prop me @ "@a/eloop/toready" remove_prop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop ">> Armor removed." Tell NukeStack ; : DoTakeOff ( -- ) (* begin unreadying current armor *) me @ "@a/eloop/armor" getprop if ">> Removing armor..." Tell me @ "@a/eloop/act" "removearmor" setprop me @ "@a/eloop/acting" "removing armor" setprop EventLoop else ">> You're not wearing armor." Tell then ; (*********************** Begin defmode functions ***********************) : DoSetDodge ( -- ) (* set def mode to 'dodge' *) me @ "@a/eloop/defmode" "dodge" setprop ">> Your defense mode is now 'dodge'." Tell ; : DoSayNoBlock ( -- ) (* notify: can't use 'block' *) NukeStack ">> You do not have a readied shield." Tell ">> Cannot block." Tell ; : DoSayNoParry ( -- ) (* notify: can't use 'parry' *) NukeStack ">> You do not have a readied parry weapon." Tell ">> Cannot parry." Tell ; : DoSetBlock ( -- ) (* verify shield and set def mode to 'block *) me @ "@a/eloop/shield" getprop dup if dup ok? if dup "@a/version" getprop if ourDataObj @ "@a/objects/$name/armor/" 3 pick "@a/name" getpropstr "$name" subst nextprop if dup "@a/broken" getprop not if dup location me @ dbcmp if me @ "@a/eloop/defmode" "block" setprop ">> Your defense mode is now 'block'." Tell else DoSayNoBlock then else DoSayNoBlock then else DoSayNoBlock then else DoSayNoBlock then else DoSayNoBlock then else DoSayNoBlock then ; : DoSetParry ( -- ) (* verify weapon and set def mode to 'parry' *) me @ "@a/eloop/weapon" getprop dup if dup ok? if dup "@a/version" getprop if ourDataObj @ "@a/objects/$name/combat/parry" 3 pick "@a/name" getpropstr "$name" subst getprop if dup "@a/broken" getprop not if dup location me @ dbcmp if me @ "@a/eloop/defmode" "parry" setprop ">> Your defense mode is now 'parry'." Tell else DoSayNoParry then else DoSayNoParry then else DoSayNoParry then else DoSayNoParry then else DoSayNoParry then else DoSayNoParry then ; : DoSetNoDef ( -- ) (* set def mode to 'none' *) me @ "@a/eloop/defmode" remove_prop ">> Your defense mode is now set to 'none'." Tell NukeStack ; (*********************** Begin status functions ***********************) : DoCombatYes ( -- ) (* set user combat-ok *) me @ "@a/combat" "yes" setprop ">> You are now set 'combat ok'." Tell ; : DoCombatNo ( -- ) (* set user !combat-ok *) me @ "@a/combat" remove_prop ">> You are now *not* set 'combat ok'." Tell ; : DoShowCombatStatus ( -- ) (* show user's combat status *) me @ "@a/combat" getprop if ">> You are currently set 'combat ok'." Tell else ">> You are currently *not* set 'combat ok'." Tell then ; : DoCombatStatus ( -- ) (* route to combat status function *) ourArg @ if "#help" ourArg @ stringpfx if DoHelp exit then "#yes" ourArg @ stringpfx if DoCombatYes exit then "#no" ourArg @ stringpfx if DoCombatNo exit then "#ok" ourArg @ stringpfx if DoCombatYes exit then "#!ok" ourArg @ stringpfx if DoCombatNo exit then ">> #Option not understood." Tell else DoShowCombatStatus then ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! ourCom @ if ourCom @ "+combat" smatch if DoCombatStatus exit then then ourArg @ if ourArg @ "#" stringpfx if "#readyweapon" ourArg @ smatch if DoRunReadyWeapon else "#readyshield" ourArg @ smatch if DoRunReadyShield else "#readyarmor" ourArg @ smatch if DoRunReadyArmor else "#removearmor" ourArg @ smatch if DoRunUnreadyArmor else "#attack" ourArg @ smatch if DoRunAttack else "#feint" ourArg @ smatch if DoRunFeint else "#aim" ourArg @ smatch if DoRunAim else "#fire" ourArg @ smatch if DoRunFire else "#throw" ourArg @ smatch if DoRunThrow else "#help" ourArg @ stringpfx if DoHelp else "#enable" ourArg @ stringpfx if DoEnable else "#disable" ourArg @ stringpfx if DoDisable else "#version" ourArg @ stringpfx if DoVersion else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Option not understood." Tell then then then then then then then then then then then then then then then exit then then me @ ArgoPermCheck Disabled? ActionCheck Approved? VerifyCombat ourCom @ "+wait" smatch if DoWait exit then Update ourCom @ "+dodge" smatch if DoSetDodge exit then ourCom @ "+block" smatch if DoSetBlock exit then ourCom @ "+parry" smatch if DoSetParry exit then ourCom @ "+nodef" smatch if DoSetNoDef exit then ourCom @ "+ready" smatch if DoReady exit then ourCom @ "+unready" smatch if DoUnReady exit then ourCom @ "+put on" smatch if DoPutOn exit then ourCom @ "+take off" smatch if DoTakeOff exit then ourCom @ "+attack" smatch if DoAttack exit then ourCom @ "+feint" smatch if DoFeint exit then ourCom @ "+aim" smatch if DoAim exit then ourCom @ "+fire" smatch if DoFire exit then ourCom @ "+throw" smatch if DoThrow exit then ourCom @ "+target" smatch if DoTarget exit then ourCom @ "+rest" smatch if DoRest exit then ourCom @ "+unwait" smatch if DoUnwait exit then ">> ERROR: Command not found." Tell ; . c q @set asys-combat=W