@q @program asys-stdpsiabs 1 999999 d i ( asys-stdpsiabs v1.2 Jessy@FurryMUCK 6/00 This program controls the standard psionic abilities supplied with a base installation of Argo. INSTALLATION: asys-stdpsiabs uses the standard Argo installation method. Port the program and set it Wizard. Type '+install asys-stdpsiabs' USAGE: This program is called from other programs; there are no usage notes specific to asys-stdpsiabs. asys-stdpsiabs may be freely ported. Please comment any changes. ) (2345678901234567890123456789012345678901234567890123456789012345678901) $def thisVersion "1.2" $define Tell me @ owner swap notify $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 $include $lib/argo $include $lib/reflist lvar namestr (* string: notify format with psiab name *) lvar nonamestr (* string: notify format with no psiab name *) lvar ourArg (* inital arg string, unmodified *) lvar ourAttackVal (* int: amount user made roll by *) lvar ourBoolean (* int: misc flow control var *) lvar ourCom (* string: 'official' name of command *) lvar ourCounter (* misc. counter var *) lvar ourDataObj (* dbref: object holding system-wide data *) lvar ourDefenceVal (* int: amount defender made roll by *) lvar ourPsiab (* string: psiab we're focusing *) lvar ourSubTarget (* string or dbref: carried object *) lvar ourString (* string: workspace var; prop of psiab *) lvar ourTarget (* dbref: target of psiab *) lvar scratch (* workspace var *) : 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-stdpsiabs" setprop #0 "@a/prog_list/" prog name strcat prog setprop prog "@a/version" thisVersion setprop (* set version *) RecOldActions (* create and register command; set default props *) #0 "@a/calls/focusclairsentience" prog setprop #0 "@a/calls/focusmindblast" prog setprop #0 "@a/calls/focusmindbomb" prog setprop #0 "@a/calls/focusmindfist" prog setprop #0 "@a/calls/focusmindsense" prog setprop #0 "@a/calls/focusmindstun" prog setprop #0 "@a/calls/focusmindtwiddle" prog setprop #0 "@a/calls/focusocclusion" prog setprop #0 "@a/calls/focussoulblast" prog setprop #0 "@a/calls/focussoulfist" prog setprop #0 "@a/calls/focussoultwiddle" prog setprop #0 "@a/calls/focustelekinesis" prog 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 #0 "@a/calls/focusclairsentience" remove_prop #0 "@a/calls/focusmindblast" remove_prop #0 "@a/calls/focusmindbomb" remove_prop #0 "@a/calls/focusmindfist" remove_prop #0 "@a/calls/focusmindsense" remove_prop #0 "@a/calls/focusmindstun" remove_prop #0 "@a/calls/focusmindtwiddle" remove_prop #0 "@a/calls/focusocclusion" remove_prop #0 "@a/calls/focussoulblast" remove_prop #0 "@a/calls/focussoulfist" remove_prop #0 "@a/calls/focussoultwiddle" remove_prop #0 "@a/calls/focustelekinesis" remove_prop #0 "@a/comm_list/+control" over over getprop dup string? if "" "go to " subst #0 "@a/comm_list/" rot strcat over over getprop recycle remove_prop else recycle then remove_prop #0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop ">> Uninstalled. Please edit the online manual as appropriate." Tell ; : DoTargetLoop ( -- ) (* start an event loop for target if needed *) ourTarget @ thing? not ourTarget @ player? not and if exit then ourTarget @ "@a/eloop/pid" getprop dup if ispid? not if ourTarget @ "@a/eloop/quell_tell" "yes" setprop ourTarget @ "+wait" force ourTarget @ "@a/eloop/quell_tell" remove_prop then else ourTarget @ "@a/eloop/quell_tell" "yes" setprop ourTarget @ "+wait" force ourTarget @ "@a/eloop/quell_tell" remove_prop pop then ; : DoChecks ( -- i ) (* verify target can be healed *) me @ "@a/eloop/target" getprop not if (* make sure target is ok *) ">> You don't have a valid target." VerTell me @ "@a/eloop/target" remove_prop 0 exit then me @ "@a/eloop/target" getprop ok? not if ">> You don't have a valid target." VerTell me @ "@a/eloop/target" remove_prop 0 exit then ourDataObj @ "@a/psiabs/$psiab/nonlocal" ourPsiab @ "" "@a/psiabs/" subst "$psiab" subst getpropstr not if me @ "@a/eloop/target" getprop room? not if me @ "@a/eloop/target" getprop location me @ location dbcmp not me @ "@a/eloop/target" getprop location me @ dbcmp not and if ">> You don't have a valid target." VerTell me @ "@a/eloop/target" remove_prop 0 exit then then then me @ "@a/eloop/target" getprop ourTarget ! (* make sure psiab is ok *) me @ "@a/eloop/psiab" getpropstr dup if ourPsiab ! "@a/psiabs/$psiab" ourPsiab @ "$psiab" subst ourString ! else ">> You do not have a psiab selected." VerTell 0 exit then 1 ; : DoCheckGuard ( -- i ) (* return true if ourTarget is guarded *) #0 "@a/calls/checkguard" getprop dup if ourTarget @ "#checkguard" rot call dup if (* asys-guard decides *) ">> $target is being guarded by $guard." ourTarget @ name ourTarget @ exit? if dup ";" instr if dup ";" instr 1 - strcut pop strip then then "$target" subst swap name "$guard" subst Tell 1 else pop 0 then else pop 0 then ; : DoPresenceChecks ( -- i ) (* see if we need to made presence roll *) (* return false if concentration broken by attack or injury *) me @ "@a/eloop/attacked" getpropstr if PresenceRoll not if ">> $me's psiab fails." me @ name "$me" subst PsiabTell SetWait NukeStack 0 exit then then me @ "@a/eloop/injured" getpropstr if PresenceRoll if 1 else ">> $me's psiab fails." me @ name "$me" subst PsiabTell SetWait NukeStack 0 exit then else 1 then ; : DoFocusRoll ( -- i ) (* roll for user *) -999 ourAttackVal ! (* apply fatigue *) me @ "@a/stats/fat" over over getpropstr atoi ourDataObj @ "@a/psiabs/$psiab/fat" ourPsiab @ "$psiab" subst getpropstr atoi + intostr setprop (* get ability *) me @ "@a/psiabs/$psiab" ourPsiab @ "$psiab" subst GetModAbility me @ "@a/stats/" "psiabs/$psiab" ourPsiab @ "$psiab" subst GetBase strcat GetModAbility + ourTarget @ GetPsiResAdv - me @ "@a/eloop/genmod" getpropstr atoi + me @ "@a/psiabs/$psiab" ourPsiab @ "$psiab" subst GetModAbility if 3 else 4 then 6 0 Dice over over - ourAttackVal ! dup 4 <= if me @ RollXPs then dup 4 <= if pop pop "critsucc" exit then dup 17 >= if pop pop "critfail" exit then >= if "normsucc" else "normfail" then ; : DoDefenceRoll ( -- i ) (* roll for target *) -998 ourDefenceVal ! ourDataObj @ "@a/psiabs/$psiab/def" ourPsiab @ "$psiab" subst getpropstr dup if scratch ! else pop "normfail" exit then (* get ability *) ourTarget @ scratch @ GetModAbility ourTarget @ "@a/skills/mental discipline" GetModAbility + ourTarget @ "@a/skills/mental resistance" GetModAbility + dup if 3 else 4 then 6 0 Dice over over - ourDefenceVal ! dup 4 <= if ourTarget @ RollXPs then dup 4 <= if pop pop "critsucc" exit then dup 17 >= if pop pop "critfail" exit then >= if "normsucc" else "normfail" then ; : DoDistanceListen ( -- ) (* relay noise from clairsentience target *) NukeStack ">> " ourArg @ strcat ourArg ! ourArg @ if me @ "@a/eloop/listening" REF-allrefs ourCounter ! begin depth while ourArg @ over "@a/store/veron" getpropstr if over "@a/store/verstring" getpropstr strcat then notify repeat then ; : DoDropSomething ( -- ) (* ourTarget drops an argo object *) NukeStack ourTarget @ contents begin dup while dup thing? if dup "@a/version" getpropstr if dup then then next repeat pop random depth 1 - % 1 + pick ourTarget @ location moveto NukeStack ; : DoMindBlastCritSucc ( -- ) ourTarget @ "@a/stats/int_mod" ourTarget @ "@a/stats/int" GetModAbility -1 * -16 + intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoMindBlastCritFail ( -- ) me @ "@a/stats/int_mod" me @ "@a/stats/int" GetModAbility -1 * -8 + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoMindBlastNormSucc ( -- ) ourTarget @ "@a/stats/int_mod" ourTarget @ "@a/stats/int" GetModAbility -1 * -8 + intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoMindBlastNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoMindBlast ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoMindBlastCritSucc else dup "critfail" smatch if DoMindBlastCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoMindBlastNormFail else "critfail" smatch if DoMindBlastNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoMindBlastNormSucc else DoMindBlastNormFail then then then else DoMindBlastNormFail then then then SetWait NukeStack ; : DoMindBombCritSucc ( -- ) me @ location contents begin dup while dup me @ dbcmp not if dup "@a/version" getpropstr if dup player? over thing? or if dup "@a/combat" getpropstr if dup CheckIdle not if dup ourTarget ! dup "@a/stats/stun" over over getpropstr atoi random me @ "@a/psiabs/mindbomb" GetModAbility % 1 + 2 * + intostr setprop ourTarget @ ">> You are stunned!" ourTarget @ "@a/store/veron" getpropstr if ourTarget @ "@a/store/verstring" getpropstr strcat then notify DoTargetLoop then then then then then next repeat pop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoMindBombCritFail ( -- ) me @ "@a/stats/stun" over over getpropstr atoi random 4 % 3 2 * + + intostr setprop ">> $me's attempt to focus $psiab fails. [CRITICAL FAILURE]" PsiabTell ; : DoMindBombNormSucc ( -- ) me @ location contents begin dup while dup me @ dbcmp not if dup "@a/version" getpropstr if dup player? over thing? or if dup "@a/combat" getpropstr if dup CheckIdle not if dup ourTarget ! dup "@a/stats/stun" over over getpropstr atoi random me @ "@a/psiabs/mindbomb" GetModAbility % 1 + + intostr setprop ourTarget @ ">> You are stunned!" ourTarget @ "@a/store/veron" getpropstr if ourTarget @ "@a/store/verstring" getpropstr strcat then notify DoTargetLoop then then then then then next repeat pop ">> $me focuses $psiab." PsiabTell DoTargetLoop ; : DoMindBombNormFail ( -- ) ">> $me's attempt to focus $psiab fails." PsiabTell ; : DoMindBomb ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoMindBombCritSucc else dup "critfail" smatch if DoMindBombCritFail else "normsucc" smatch if DoMindBombNormSucc else DoMindBombNormFail then then then SetWait NukeStack ; : DoMindFistCritSucc ( -- ) ourTarget @ "@a/stats/int_mod" ourTarget @ "@a/stats/int" GetModAbility -1 * -8 + intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoMindFistCritFail ( -- ) me @ "@a/stats/int_mod" me @ "@a/stats/int" GetModAbility -1 * -8 + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoMindFistNormSucc ( -- ) ourTarget @ "@a/stats/int_mod" ourTarget @ "@a/stats/int" GetModAbility -1 * intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoMindFistNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoMindFist ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoMindFistCritSucc else dup "critfail" smatch if DoMindFistCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoMindFistNormFail else "critfail" smatch if DoMindFistNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoMindFistNormSucc else DoMindFistNormFail then then then else DoMindFistNormFail then then then SetWait NukeStack ; : DoMindSenseCritSucc ( -- i ) ">> You focus MindSense on $target. [CRITICAL SUCCESS]" ourTarget @ name "$target" subst VerTell DoTargetLoop ">> $player's location is $location." ourTarget @ name "$player" subst ourTarget @ location name "$location" subst VerTell 1 ; : DoMindSenseCritFail ( -- i ) me @ "@a/stats/stun" over over getpropstr atoi random 4 % 3 + + intostr setprop ">> $me's attempt to focus $psiab fails. [CRITICAL FAILURE]" PsiabTell 0 ; : DoMindSenseNormSucc ( -- i ) ">> $me focuses $psiab." PsiabTell DoTargetLoop ">> $player's location is $location." ourTarget @ name "$player" subst ourTarget @ location name "$location" subst VerTell 1 ; : DoMindSenseNormFail ( -- i ) ">> $me's attempt to focus $psiab fails." PsiabTell 0 ; : DoMindSense ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoMindSenseCritSucc else dup "critfail" smatch if DoMindSenseCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoMindSenseNormFail else "critfail" smatch if DoMindSenseNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoMindSenseNormSucc else DoMindSenseNormFail then then then else DoMindSenseNormFail then then then me @ "@a/eloop/target" remove_prop me @ "@a/eloop/act" "wait" setprop me @ "@a/eloop/acting" "waiting" setprop ; : DoClairsentienceCritSucc ( -- ) me @ "@a/eloop/stop_listen" ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi random me @ "@a/skills/mental discipline" GetModAbility me @ "@a/psiabs/clairsentience" GetModAbility + % 1 + * 2 * systime + setprop #0 "@a/stop_listen" me @ REF-add me @ "@a/eloop/listening_to" ourTarget @ setprop ourTarget @ "@a/eloop/listening" me @ REF-add ourTarget @ "_listen/asys-stdpsiabs" prog setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoClairsentienceCritFail ( -- ) me @ "@a/stats/stun" over over getpropstr atoi random 4 % 3 + + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoClairsentienceNormSucc ( -- ) me @ "@a/eloop/stop_listen" ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi random me @ "@a/skills/mental discipline" GetModAbility me @ "@a/psiabs/clairsentience" GetModAbility + % 1 + * systime + setprop #0 "@a/stop_listen" me @ REF-add me @ "@a/eloop/listening_to" ourTarget @ setprop ourTarget @ "@a/eloop/listening" me @ REF-add ourTarget @ "_listen/asys-stdpsiabs" prog setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoClairsentienceNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoClairsentience ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoMindSense not if exit then DoFocusRoll dup "critsucc" smatch if DoClairsentienceCritSucc else dup "critfail" smatch if DoClairsentienceCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoClairsentienceNormFail else "critfail" smatch if DoClairsentienceNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoClairsentienceNormSucc else DoClairsentienceNormFail then then then else DoClairsentienceNormFail then then then SetWait NukeStack ; : DoMindStunCritSucc ( -- ) ourTarget @ "@a/stats/stun" over over getpropstr atoi random me @ "@a/psiabs/mindstun" GetModAbility % 1 + 2 * + intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ourTarget @ ">> You are stunned!" ourTarget @ "@a/store/veron" getpropstr if ourTarget @ "@a/store/verstring" getpropstr strcat then notify ; : DoMindStunCritFail ( -- ) me @ "@a/stats/stun" over over getpropstr atoi random 4 % 3 + + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoMindStunNormSucc ( -- ) ourTarget @ "@a/stats/stun" over over getpropstr atoi random me @ "@a/psiabs/mindstun" GetModAbility % 1 + + intostr setprop ourTarget @ ">> You are stunned!" ourTarget @ "@a/store/veron" getpropstr if ourTarget @ "@a/store/verstring" getpropstr strcat then notify ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoMindStunNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoMindStun ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoMindStunCritSucc else dup "critfail" smatch if DoMindStunCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoMindStunNormFail else "critfail" smatch if DoMindStunNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoMindStunNormSucc else DoMindStunNormFail then then then else DoMindStunNormFail then then then SetWait NukeStack ; : DoMindTwiddleCritSucc ( -- ) ourTarget @ "@a/stats/int_mod" over over getpropstr atoi me @ "@a/psiabs/mindtwiddle" GetModAbility me @ "@a/skills/mental discipline" GetModAbility 1 + + 1 swap 0 Dice 2 * - intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoMindTwiddleCritFail ( -- ) me @ "@a/stats/int_mod" over over getpropstr atoi me @ "@a/skills/mindtwiddle" GetModAbility me @ "@a/psiabs/mental discipline" GetModAbility 1 + + 1 swap 0 Dice + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoMindTwiddleNormSucc ( -- ) ourTarget @ "@a/stats/int_mod" over over getpropstr atoi me @ "@a/psiabs/mindtwiddle" GetModAbility me @ "@a/skills/mental discipline" GetModAbility 1 + + 1 swap 0 Dice - intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoMindTwiddleNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoMindTwiddle ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoMindTwiddleCritSucc else dup "critfail" smatch if DoMindTwiddleCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoMindTwiddleNormFail else "critfail" smatch if DoMindTwiddleNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoMindTwiddleNormSucc else DoMindTwiddleNormFail then then then else DoMindTwiddleNormFail then then then SetWait NukeStack ; : DoOcclusionCritSucc ( -- ) ourTarget @ "@a/reveal_at" ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi random me @ "@a/skills/mental discipline" GetModAbility me @ "@a/psiabs/occlusion" GetModAbility + % 1 + 2 * 2 * * systime + setprop #0 "@a/reveal" ourTarget @ REF-add ourDataObj @ "@a/sysparms/use_dark" getpropstr "yes" smatch if ourTarget @ "D" set then ourTarget @ "@a/invisible" ourAttackVal @ intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoOcclusionCritFail ( -- ) me @ "@a/stats/stun" over over getpropstr atoi random 4 % 3 + + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoOcclusionNormSucc ( -- ) ourTarget @ "@a/reveal_at" ourDataObj @ "@a/sysparms/turn_length" getpropstr atoi random me @ "@a/skills/mental discipline" GetModAbility me @ "@a/psiabs/occlusion" GetModAbility + % 1 + 2 * * systime + setprop #0 "@a/reveal" ourTarget @ REF-add ourDataObj @ "@a/sysparms/use_dark" getpropstr "yes" smatch if ourTarget @ "D" set then ourTarget @ "@a/invisible" ourAttackVal @ intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoOcclusionNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoOcclusion ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoOcclusionCritSucc else dup "critfail" smatch if DoOcclusionCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoOcclusionNormFail else "critfail" smatch if DoOcclusionNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoOcclusionNormSucc else DoOcclusionNormFail then then then else DoOcclusionNormFail then then then SetWait NukeStack ; : DoSoulBlastCritSucc ( -- ) ourTarget @ "@a/stats/pre_mod" ourTarget @ "@a/stats/pre" GetModAbility -1 * -16 + intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoSoulBlastCritFail ( -- ) me @ "@a/stats/pre_mod" me @ "@a/stats/pre" GetModAbility -1 * -8 + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoSoulBlastNormSucc ( -- ) ourTarget @ "@a/stats/pre_mod" ourTarget @ "@a/stats/pre" GetModAbility -1 * -8 + intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoSoulBlastNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoSoulBlast ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoSoulBlastCritSucc else dup "critfail" smatch if DoSoulBlastCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoSoulBlastNormFail else "critfail" smatch if DoSoulBlastNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoSoulBlastNormSucc else DoSoulBlastNormFail then then then else DoSoulBlastNormFail then then then SetWait NukeStack ; : DoSoulFistCritSucc ( -- ) ourTarget @ "@a/stats/pre_mod" ourTarget @ "@a/stats/pre" GetModAbility -1 * -8 + intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoSoulFistCritFail ( -- ) me @ "@a/stats/pre_mod" me @ "@a/stats/pre" GetModAbility -1 * -8 + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoSoulFistNormSucc ( -- ) ourTarget @ "@a/stats/pre_mod" ourTarget @ "@a/stats/pre" GetModAbility -1 * intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoSoulFistNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoSoulFist ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoSoulFistCritSucc else dup "critfail" smatch if DoSoulFistCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoSoulFistNormFail else "critfail" smatch if DoSoulFistNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoSoulFistNormSucc else DoSoulFistNormFail then then then else DoSoulFistNormFail then then then SetWait NukeStack ; : DoSoulTwiddleCritSucc ( -- ) ourTarget @ "@a/stats/pre_mod" over over getpropstr atoi me @ "@a/psiabs/soultwiddle" GetModAbility me @ "@a/skills/mental discipline" GetModAbility 1 + + 1 swap 0 Dice 2 * - intostr setprop ">> $me focuses $psiab $target. [CRITICAL SUCCESS]" PsiabTell DoTargetLoop ; : DoSoulTwiddleCritFail ( -- ) me @ "@a/stats/pre_mod" over over getpropstr atoi me @ "@a/skills/soultwiddle" GetModAbility me @ "@a/psiabs/mental discipline" GetModAbility 1 + + 1 swap 0 Dice + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoSoulTwiddleNormSucc ( -- ) ourTarget @ "@a/stats/pre_mod" over over getpropstr atoi me @ "@a/psiabs/soultwiddle" GetModAbility me @ "@a/skills/mental discipline" GetModAbility 1 + + 1 swap 0 Dice - intostr setprop ">> $me focuses $psiab $target." PsiabTell DoTargetLoop ; : DoSoulTwiddleNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoSoulTwiddle ( -- ) VerifyEvent DoChecks not if TellWait exit then DoPresenceChecks not if exit then DoFocusRoll dup "critsucc" smatch if DoSoulTwiddleCritSucc else dup "critfail" smatch if DoSoulTwiddleCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoSoulTwiddleNormFail else "critfail" smatch if DoSoulTwiddleNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoSoulTwiddleNormSucc else DoSoulTwiddleNormFail then then then else DoSoulTwiddleNormFail then then then SetWait NukeStack ; : DoTelekinesisCritSucc ( -- ) ourSubTarget @ if ourSubTarget @ location room? not if ourSubTarget @ me @ moveto then ">> $me focuses $psiab $target's $subtarget." ourSubTarget @ name "$subtarget" subst PsiabTell DoTargetLoop else ourTarget @ "@a/eloop/target" remove_prop ourTarget @ "@a/eloop/act" remove_prop ourTarget @ "@a/eloop/acting" remove_prop ourTarget @ "@a/eloop/weapon" getprop if ourTarget @ "@a/eloop/weapon" over over getprop ourTarget @ location moveto remove_prop DoDropSomething else DoDropSomething DoDropSomething then ">> $me focuses $psiab $target." ourSubTarget @ name "$subtarget" subst PsiabTell DoTargetLoop then ; : DoTelekinesisCritFail ( -- ) me @ "@a/stats/stun" over over getpropstr atoi random 4 % 3 + + intostr setprop ">> $me's attempt to focus $psiab $targetfails. [CRITICAL FAILURE]" PsiabTell ; : DoTelekinesisNormSucc ( -- ) ourSubTarget @ if ourSubTarget @ location room? not if ourAttackVal @ ourDefenceVal @ - 4 <= if ourSubTarget @ ourTarget @ location moveto else ourSubTarget @ me @ moveto then else ourSubTarget @ me @ moveto then ">> $me focuses $psiab $target's $subtarget." ourSubTarget @ name "$subtarget" subst PsiabTell DoTargetLoop else ourTarget @ "@a/eloop/target" remove_prop ourTarget @ "@a/eloop/act" remove_prop ourTarget @ "@a/eloop/acting" remove_prop ourAttackVal @ ourDefenceVal @ - 4 > if DoDropSomething then ">> $me focuses $psiab $target." PsiabTell DoTargetLoop then ; : DoTelekinesisNormFail ( -- ) ">> $me's attempt to focus $psiab $targetfails." PsiabTell ; : DoTelekinesis ( -- ) VerifyEvent "Telekinesis" ourPsiab ! DoChecks not if TellWait exit then DoPresenceChecks not if exit then #-1 ourSubTarget ! me @ "@a/eloop/subtarget" getprop if me @ "@a/eloop/subtarget" getpropstr scratch ! ourTarget @ contents begin dup while dup name scratch @ stringpfx if dup ourSubTarget ! break then next repeat pop ourSubTarget @ not if ">> I don't see $target carring that." ourTarget @ name "$target" subst VerTell SetWait NukeStack exit then ourSubTarget @ "@a/class/armor" getpropstr if ">> Sorry, this Psiab can't be used against armor." VerTell SetWait NukeStack exit then me @ "@a/eloop/genmod" ourSubTarget @ GetMagResAdv -1 * intostr setprop then DoFocusRoll dup "critsucc" smatch if DoTelekinesisCritSucc else dup "critfail" smatch if DoTelekinesisCritFail else "normsucc" smatch if DoDefenceRoll dup "critsucc" smatch if DoTelekinesisNormFail else "critfail" smatch if DoTelekinesisNormSucc else ourAttackVal @ ourDefenceVal @ >= if DoTelekinesisNormSucc else DoTelekinesisNormFail then then then else DoTelekinesisNormFail then then then me @ "@a/eloop/genmod" remove_prop SetWait NukeStack ; : main "me" match me ! (* initialize *) GetDataObj ourDataObj ! strip ourArg ! trig "@a/name" getpropstr ourCom ! Update trig exit? not command @ "(_Listen)" smatch and if DoDistanceListen exit then Disabled? me @ ArgoPermCheck ourArg @ if ourArg @ "#" stringpfx if "#focusclairsentience" ourArg @ smatch if DoClairsentience else "#focusmindblast" ourArg @ smatch if DoMindBlast else "#focusmindbomb" ourArg @ smatch if DoMindBomb else "#focusmindfist" ourArg @ smatch if DoMindFist else "#focusmindsense" ourArg @ smatch if DoMindSense else "#focusmindstun" ourArg @ smatch if DoMindStun else "#focusmindtwiddle" ourArg @ smatch if DoMindTwiddle else "#focusocclusion" ourArg @ smatch if DoOcclusion else "#focussoulblast" ourArg @ smatch if DoSoulBlast else "#focussoulfist" ourArg @ smatch if DoSoulFist else "#focussoultwiddle" ourArg @ smatch if DoSoulTwiddle else "#focustelekinesis" ourArg @ smatch if DoTelekinesis else "#install" ourArg @ stringpfx if DoInstall else "#uninstall" ourArg @ stringpfx if DoUninstall else ">> #Argument not understood." Tell then then then then then then then then then then then then then then exit then then ; . c q @set asys-stdpsiabs=W