MPI Laser Tag

From Redwall MUCK Wiki


This is a dump from a file, but perhaps someone will find it to be of interest. It is the code for the laser tag game located at #184880 on the MUCK. This code is not exactly the paragon of good design, but I have two reasonable excuses: 1) MPI limits are suffocatingly low in places (to wit, beyond 26 levels of nested functions--including macros--the interpreter stops evaluating your code); and 2) I had basically not used MPI for four years.

Some game features (and some gratuitous exclamation points to boot):

  • Fire at players from neighboring rooms!
  • Recharge stations!
  • Health packs!
  • Detailed scores!
  • Missiles and mines!
  • Spycams and a turret!

The HUD looks like this:

+----+----+----+----+----+

| * | | | | |

| | | | | |

+----+----+----+----+----+----+----+----+

| |::::| |::::| |::::|::::| |

| |::::|R |::::| |::::|::::| |

+----+----+----+----+----+----+----+----+

| | | |::::| | | | |

| | | |::::| | | |R |

+----+----+----+----+----+----+----+----+

| | |::::|::::| | | |

| | |::::|::::| | | |

+----+----+----+----+----+----+----+

| | | | | |

| | | | | |


[ Move: 110 ]-----

Energy: |#####[50%]#######| | | | | | | | |

Life: |#####[27%] | | | | | | | | | | | |

lsedit $laser=func/repeat

.del ^ $

{func:repeat,str,times,

{left:,{mult:{&times},{strlen:{&str}}},{&str}}}

.end

lsedit $laser=showmap

.del ^ $

{lexec:func/repeat}

{with:i,0,

{null:

{foreach:y,{lsort:{subst:{listprops:_reg/room/1,$laser},_reg/room/1/,}},

{with:pw,{&i},

{set:i,1}

{with:line1,,

{with:line2,,

{with:line3,,

{foreach:x,{lsort:{subst:{listprops:_reg/room/1/{&y},$laser},_reg/room/1/{&y}/,}},

{with:_r,{prop:_reg/room/1/{&y}/{&x},$laser},

{if:{gt:{&x},{&i}},

{set:line1,{&line1}{repeat:+----,{subt:{&x},{&i}}}}

{set:line2,{&line2}{repeat:|::::,{subt:{&x},{&i}}}}

{set:line3,{&line3}{repeat:|::::,{subt:{&x},{&i}}}}}

{null:{set:i,{add:{&x},1}}}

{set:line1,{&line1}+----}

{set:line2,{&line2}{if:{eq:{&_r},{loc:me}},| * ,|{center:{prop:_game/room/{&_r}/who,$laser},4}}}

{set:line3,{&line3}|

{if:{propdir:_game/pinfo/{ref:me}/marked/{&_r},$laser},

{default:{prop:_game/pinfo/{ref:me}/marked/{&_r}/1}, }

{default:{prop:_game/pinfo/{ref:me}/marked/{&_r}/2}, }

{default:{prop:_game/pinfo/{ref:me}/marked/{&_r}/3}, }

{default:{prop:_game/pinfo/{ref:me}/marked/{&_r}/4}, }, }},

\r}}

{tell:

{&line1}+{if:{gt:{&pw},{&i}},

{repeat:----+,{subt:{&pw},{&i}}}}\r

{&line2}|\r

{&line3}|\r

}}}}}}}}

.end

@set $laser=_msgmacs/laserhud:{lexec:showmap}{right:[ Move: {curmove:me} ],45,-}-----\r{showenergy:me}\r{showlife:me}\r{showcontents:this}

@set $laser=_msgmacs/exitdesc:{if:{&room},{lexec:exitdesc},You see a wall.}

lsedit $laser=exitdesc

.del ^ $

{left:,50,-}\r

In the neighboring room you see:\r

{with:con,

{contents:{&room}},

{if:{count:{&con}},

{parse:c,{&con},

- {name:{&c}}},

- Nothing special.}}

\r{left:,50,-}

.end

@set $laser=_depart/lastloc:,{null:{store:{x},_game/pinfo/{ref:me}/lastx},{store:{y},_game/pinfo/{ref:me}/lasty}}}

@set $laser=_depart/updatemaps:,{lexec:updatemaps}}

@set $laser=_arrive/updatemaps:,{lexec:updatemaps}}

lsedit $laser=updatemaps

.del ^ $

{null:

   {with:con,
       {contents:here,player},
       {if:{eq:{&cmd},Depart},
           {set:con,{lremove:{&con},*{name:me}}}},
   {store:
       {parse:p,{&con},
           {tolower:{midstr:{name:{&p}},1}},\r,},
       _game/room/{ref:here}/who,
       $laser}}}

.end

@set $laser=_msgmacs/findcams:{filter:c,{lcommon:{contents:{default:{:1},here}},{subst:{prop!:_game/spycams,$laser},-,\r}},{objlife:{&c}}}

@set $lasertop=_msgmacs/objlife:{prop:_game/object/{ref:{:1}}/life,$laser}

@set $lasertop=_msgmacs/energy:{prop:_game/pinfo/{ref:{:1}}/energy,$laser}

@set $lasertop=_msgmacs/life:{if:{istype:{:1},thing},{objlife:{:1}},{plife:{:1}}}

@set $lasertop=_msgmacs/plife:{prop:_game/pinfo/{ref:{:1}}/life,$laser}

@set $lasertop=_msgmacs/lssetting:{prop:_game/settings/{:1},$laser}

@set $lasertop=_msgmacs/minecount:{default:{prop:_game/pinfo/{ref:me}/mine/total,$laser},{lssetting:mines}}

@set $laser=_msgmacs/objlife:

@set $laser=_msgmacs/energy:

@set $laser=_msgmacs/life:

@set $laser=_msgmacs/plife:

@set $laser=_msgmacs/omesg:{force:$laseradmin,@tel {:2}}{force:$laseradmin,spoof << {:1} >>}{force:$laseradmin,go home}

@set $laser=_msgmacs/isplayer:{propdir:_game/pinfo/{ref:{:1}},$laser}

@set $laser=_msgmacs/x:{roomx:{if:{:1},{ploc:{:1}},{ref:here}}}

@set $laser=_msgmacs/y:{roomy:{if:{:1},{ploc:{:1}},{ref:here}}}

@set $laser=_msgmacs/roomx:{prop:_game/room/{:1}/x,$laser}

@set $laser=_msgmacs/roomy:{prop:_game/room/{:1}/y,$laser}

@set $laser=_msgmacs/gameroom:{prop:_reg/room/{default:{:3},1}/{:2}/{:1},$laser}

@set $laser=_msgmacs/bar:|{with:__bar,{left:,{div:{:1},3},#},{null:{set:__bar,{&__bar}{midstr:| | | | | | | | | | | | | | | | |,{add:{strlen:{&__bar}},1},-1}}}{midstr:{&__bar},1,5}[{:1}%]{midstr:{&__bar},{add:5,3,{strlen:{:1}}},-1}}

@set $laser=_msgmacs/objowner:{default:{prop:_game/object/{ref:{:1}}/owner,$laser},#82642}

@set $laser=_msgmacs/objname:{if:{ne:{objowner:{:1}},#82642},{name:{objowner:{:1}}}'s,Unowned} {name:{:1}}

@set $laser=_msgmacs/showenergy:Energy: {bar:{energy:{:1}}}

@set $laser=_msgmacs/showlife:Life: {bar:{life:{:1}}}

@set $laser=_msgmacs/showcontents:{with:loc,{:1},{lexec:showcontents}}

@set $laser=_msgmacs/rechargeroom:{lmember:{prop:_game/rechargerooms,$laser},{ref:{:1}}}

@set $laser=_msgmacs/curmove:{abs:{prop:_game/pinfo/{ref:{:1}}/moves,$laser}}

@set $laser=_msgmacs/opposite:{if:{smatch:{:1},north*},south,{if:{smatch:{:1},south*},north}}{if:{smatch:{:1},*east},west,{if:{smatch:{:1},*west},east}}

@set $laser=_msgmacs/dirname:{if:{gt:{:4},{:2}},south,{if:{lt:{:4},{:2}},north}}{if:{gt:{:3},{:1}},east,{if:{lt:{:3},{:1}},west}}

@set $lasertop=_msgmacs/adjustlife:{if:{istype:{:1},thing},{adjustolife:{:1},{:2}},{adjustplife:{:1},{:2}}}

@set $laser=_msgmacs/adjustlife:

@NULL OLD

@null @set $laser=_msgmacs/adjustplife:{with:p,{ref:{:1}},{null:{store:{life:{:1}},_game/pinfo/{&p}/prevlife,$laser}, {store:{max:0,{min:100,{add:{plife:{:1}},{:2}}}},_game/pinfo/{&p}/life,$laser},{if:{eq:{sign:{:2}},-1},{if:{and:{prop:_game/pinfo/{&p}/prevlife,$laser},{not:{life:{:1}}}},{if:{:3},{store: {lexec:playerdeath,$laser}}}}}

@set $lasertop=_msgmacs/adjustplife:{with:p,{ref:{:1}},{null:{store:{life:{:1}},_game/pinfo/{&p}/prevlife,$laser},{store:{max:0,{min:100,{add:{plife:{:1}},{:2}}}},_game/pinfo/{&p}/life,$laser},{if:{eq:{sign:{:2}},-1},{if:{and:{prop:_game/pinfo/{&p}/prevlife,$laser},{not:{life:{:1}}}},{lexec:playerdeath,$laser}}}}}

@set $laser=_msgmacs/adjustplife:

@set $laser=_msgmacs/adjustolife:{null:{store:{max:0,{min:100,{add:{prop:_game/object/{ref:{:1}}/life,$laser},{:2}}}},_game/object/{ref:{:1}}/life,$laser},,{with:o,{ref:{:1}},{if:{life:{:1}},{with:d,{:2},{exec:_game/hook/attackobj,$laser}},{exec:_game/hook/destroyedobj,$laser}}}}

@set $laser=_msgmacs/adjustenergy:{null:{store:{max:0,{min:100,{add:{prop:_game/pinfo/{ref:{:1}}/energy,$laser},{:2}}}},_game/pinfo/{ref:{:1}}/energy,$laser},{if:{not:{energy:{:1}}},{tell:<< You've run out of energy! Find a [recharge] spot! >>}}}

@set $laser=_msgmacs/revealoccp:{null:{store:{prop:_game/room/{:2}/occupants,$laser},_game/pinfo/{:1}/marked/{:2}/3,$laser}}

@set $laser=_msgmacs/incprop:{store:{add:{default:{:2},1},{prop:{:1},$laser}},{:1},$laser}

@set $laser=_msgmacs/incpropmax:{store:{min:{:3},{add:{default:{:2},1},{prop:{:1},$laser}}},{:1},$laser}

@set $laser=_msgmacs/stun:{null:{store:{secs},_game/pinfo/{ref:{:1}}/stun/last,$laser},{incprop:_game/pinfo/{ref:{:1}}/stun/count}}

@set $laser=_msgmacs/coords:({roomx:{:1}}\,{roomy:{:1}})

@set $laser=_msgmacs/surrounding:{filter:__l,{around:{:1}},{&__l}}

@set $laser=_msgmacs/ploc:{if:{contains:{:1},$laser},{loc:{:1}},$laser}

@set $lasertop=_msgmacs/spectatortell:{force:$speaker,spoof << {:1} >>}

@set $lasertop=_msgmacs/queuemsg:{store:{:1},_queued,$spectators}

@set $laser=_msgmacs/around:{with:__x,{roomx:{:1}},{with:__y,{roomy:{:1}},{gameroom:{set:__x,{subt:{&__x},1}},{subt:{&__y},1}}\r{gameroom:{&__x},{&__y}}\r{gameroom:{&__x},{add:{&__y},1}}\r{gameroom:{add:{&__x},1},{subt:{&__y},1}}\r{gameroom:{add:{&__x},1},{add:{&__y},1}}\r{gameroom:{set:__x,{add:{&__x},2}},{subt:{&__y},1}}\r{gameroom:{&__x},{&__y}}\r{gameroom:{&__x},{add:{&__y},1}}}}

@set $laser=_msgmacs/findwall:{sublist:nw\rw\rsw\rn\rs\rne\re\rse,{with:i,1,{with:__arnd,{around:{:1}},{null:{while:{sublist:{&__arnd},{&i}},{inc:i}}}{&i}}}}

@set $laser=_game/hook/destroyedobj:{if:{eq:{name:{&o}},Spycam},{with:cam,{&o},{lexec:destroy_spycam,$laser}}}{null:{tell:<< You've destroyed {objname:{&o}}! >>},{otell:<< {name:me} has destroyed {objname:{&o}}! >>},{store:1,_game/object/destroyed,$laser},{incprop:_game/pinfo/{ref:me}/shot/hit/objects}}

@set $laser=_game/hook/attackobj:{tell:<< {name:me} shot your {name:{&o}}! ({x}\,{y}) ({&d}) >>,{objowner:{&o}}}

lsedit $laser=playerresurrected

.del ^ $

{tell:<< You've been resurrected! >>,{&p}}

{otell:<< {name:me} has been resurrected! >>,{ploc:{&p}}}

.end

lsedit $laser=playerdeath

.del ^ $

{tell:<< You have been killed! >>,{&p}}

{queuemsg:{name:me} killed {name:{&p}}!}

{otell:<< {name:{&p}} has been killed. >>,{loc:{&p}},#-1}

{incprop:_game/pinfo/{&p}/deaths}

{if:{not:{dbeq:{&p},me}},

{incprop:_game/pinfo/{ref:me}/kills}

{if:{not:{nearby:{&p},me}},

{tell:<< You killed {name:{&p}}! >>}}}

{delay:1,\{with:p\,{&p}\,\{lexec:respawnplayer\,$laser\}\}}

.end

lsedit $laser=respawnplayer

.del ^ $

{null:

{if:

{lt:

{prop:_game/pinfo/{&p}/deaths,$laser},

{default:

{prop:_game/pinfo/{&p}/lives/total,$laser},

{lssetting:lives}}},

{tell:<< Respawning in 5 seconds...,{&p}}

{delay:5,\{with:_p\,{&p}\,\{lexec:respawn\,$laser\}\}},

{tell:<< You've run out of lives. >>,{&p}}

{delay:1,{lit:{checkendcond}}}}}

.end

lsedit $laser=respawn

.del ^ $

{if:{contains:{&_p},$laser},

{null:

{foreach:obj,

{subst:{listprops:_game/object/,$laser},_game/object/,},

{if:{dbeq:{objowner:{&obj}},{&_p}},

{store: ,_game/pinfo/{&_p}/marked/{loc:{subst:{&obj},_game/object/,}}/4,$laser}

{delprop:_game/object/{&obj}/owner,$laser}}},

{spectatortell:{name:{&_p}} has respawned.}

{adjustlife:{&_p},{prop:_game/settings/respawn_life,$laser}},

{store:{prop:_game/settings/respawn_energy,$laser},_game/pinfo/{&_p}/energy,$laser},

{otell:<< {name:{&_p}} respawns. >>,{loc:{&_p}}},

{force:$laseradmin,@tel {&_p}={randomroom}},

{otell:<< {name:{&_p}} respawns. >>,{loc:{&_p}}},

{tell:<< You've lost all your possessions.,{&_p}},

{tell:<< Respawning with {prop:_game/settings/respawn_life,$laser}% life and {prop:_game/settings/respawn_energy,$laser}% energy. >>,{&_p}}}}

.end

@set $laser=_msgmacs/checkendcond:{lexec:checkendcondition}

lsedit $laser=checkendcondition

.del ^ $

{with:players,{subst:{listprops:_game/pinfo/,$laser},_game/pinfo/,},

{with:winners,,

{if:

{fold:acc,cond,

{listprops:_game/special/conditions,$laser},

{and:{&acc},{exec:{&cond},$laser}}},

{lexec:endgame,$laser}}}}

.end

@set $laser=_game/special/conditions/lives:{ge:{count:{set:winners,{filter:pl,{&players},{ge:{prop:_game/pinfo/{&p}/deaths,$laser}}}}},{subt:{count:{&players}},1}}

lsedit $laser=endgame

.del ^ $

{null:

{foreach:prop,{listprops:_game/special/end/,$laser},{exec:{&prop},$laser}},

{store:0,_game/started,$laser},

{foreach:player,{&players},

{if:{contains:{&player},$laser},

{tell:<< The game has ended! >>,{&player}}

{force:$laseradmin,@tel {&player}=$lobby}}},

{spectatortell:The game has ended!},

{delay:2,\{with:players\,{&players}\,\{lexec:tabscores\,$laser\}\}}}

.end

lsedit $laser=tabscores

.del ^ $

{null:

{otell:<< Tabulating overall scores... >>,$lobby,#-1},

{foreach:player,{&players},

{delay:1,\{with:player\,{&player}\,\{lexec:doscore\,$laser\}\}}},

{delay:2,{lit:{lexec:showscores,$laser}}},

{delay:3,{lit:{lexec:docleanup,$laser}}}}

.end

lsedit $laser=showscores

.del ^ $

{null:

{with:dir,_game/,

{with:dirloc,{ref:$laser},

{otell:<< Type 'scores {add:1,{prop:_game/count,$laser}}' to see this again later. >>,$lobby,#-1},

{otell:{lexec:scoredisplay,$laser},$lobby,#-1}}}}

.end

lsedit $laser=docleanup

.del ^ $

{null:

{foreach:obj,

{listprops:_game/object/,$laser},

{store:100,{&obj}/life,$laser}

{store:50,{&obj}/energy,$laser}

{delprop:{&obj}/owner,$laser}

{force:$laseradmin,@tel {subst:{&obj},_game/object/,}={randomroom}}},

{foreach:room,

{listprops:_game/room/,$laser},

{delprop:{&room}/rigged,$laser}

{delprop:{&room}/treats,$laser}

{store:0,{&room}/healthpack,$laser}

{delprop:{&room}/mine,$laser}},

{with:count,{store:{add:1,{prop:_game/count,$laser}},_game/count,$laser},

{force:$laseradmin,cp #143944=_game/\,#210112=_game/{&count}}

{delprop:_game/{&count}/hook,$records}

{delprop:_game/{&count}/special,$records}

{delprop:_game/{&count}/boost,$records}}}

.end

@set $lasertop=_msgmacs/players:{subst:{listprops:_game/pinfo,$laser},_game/pinfo/,}

@act cancel=$lasertop=$laser:doclear=$nothing

@lock $laser:doclear=me|*Ajax|*Aleltai|_arenaempty?:1

@set $laser:doclear=_arenaempty?:{lt:{count:{filter:player,{players},{and:{istype:{&player},player},{contains:{&player},$laser}}}},1}

@fail $laser:doclear=You are not authorized to use this command.

@succ $laser:doclear={lexec:succ}

lsedit $laser:doclear=succ

.del ^ $

<< Canceling current game. >>

{null:

{with:players,

{players},

{foreach:player,{&players},

{if:{contains:{&player},$laser},

{tell:<< The administrators have rebooted the game. >>}

{force:$laseradmin,@tel {&player}=$lobby}}}},

{delprop:_game/started,$laser}}

{lexec:docleanup,$laser}

.end

lsedit $laser=scoredisplay

.del ^ $

{laserhead}

{with:i,0,

{parse:prop,

{lsort:

{listprops:{&dir}/scoring/final,{&dirloc}},

p1,p2,

{gt:{prop:{&p2},{&dirloc}},{prop:{&p1},{&dirloc}}}},

{if:{istype:{subst:{&prop},{&dir}/scoring/final/,},player},

\r {inc:i}.{lit: }

{left:

{prop:{subst:{&prop},/scoring/final/,/pinfo/}/name,{&dirloc}},60,. }

{prop:{&prop},{&dirloc}}},\r,}}{nl}{nl}

To view detailed score information for each player, type [scard ].{nl}

{laserfoot}

.end

@act scores=$laser:lobby=$laser:scores=$nothing

@succ $laser:scores={with:dir,,{with:dirloc,,{null:{if:{and:{&arg},{propdir:_game/{&arg},$records}},{set:dir,_game/{&arg}}{set:dirloc,{ref:$records}},{set:dir,_game}{set:dirloc,{ref:$records}}}}{lexec:scoredisplay,$laser}}}

lsedit $laser=specialscores

.del ^ $

.end

lsedit $laser=doscore

.del ^ $

{null:

{with:score,0,

{with:smod,,

{foreach:prop,{listprops:_game/scoring/individual,$laser},

{exec:{&prop},$laser}

{set:score,{add:{&score},{&smod}}}}}

{incprop:_game/scoring/final/{&player},{&score}}

{store:

{add:

{&score},

{prop:_overall/{name:{&player}},#210112}}

,_overall/{name:{&player}},#210112}}}

.end

lsedit $laser=specialscores

.del ^ $

{with:score,0,

{with:smod,,

{foreach:prop,{listprops:_game/scoring/special,$laser},

{exec:{&prop},$laser}

{set:score,{add:{&score},{&smod}}}}}

{incprop:_game/scoring/final/{&player},{&score}}}

.end

@set $laser=_disconnect/movetolobby:},{force:$laseradmin,@tel {ref:me}=$lobby}{if:{contains:me,$laser},{force:$laseradmin,+set {loc:me} sweep-to=$lobby}{force:$laseradmin,sweep {ref:me}}}}

lsedit $laser=showcontents

.del ^ $

With:\r

{default:

{parse:c,

{contents:{&loc}},

{if:

{and:{&c},{ne:{set:c,{ref:{&c}}},{ref:me}}},

{if:

{isplayer:{&c}},

{name:{&c}} (Life: {life:{&c}}%\, Energy {energy:{&c}}%),

{if:

{propdir:_game/object/{&c},$laser},

{objname:{&c}}

{if:{not:{objlife:{&c}}},

{lit: }(Destroyed),

{lit: }(Life: {objlife:{&c}}%)}}}\r,},\r,},

(Nothing)}

.end

lsedit $laser=func/reset

.del ^ $

{func:resetplayer,p,

{null:

{set:p,{ref:{&p}}}

{delprop:_game/pinfo/{&p}/,$laser},

{store:{name:{&p}},_game/pinfo/{&p}/name,$laser},

{store:100,_game/pinfo/{&p}/energy,$laser},

{store:100,_game/pinfo/{&p}/life,$laser},

{store:100,_game/pinfo/{&p}/minlife,$laser},

{store:{name:{&p}},_game/pinfo/{&p}/name,$laser},

{tell:<< You feel a wonderful sensation wash over you as your life and energy are replenished. >>,{&p}}}}

.end

@set $laser=_arrive/sawrecharge:,{if:<< You found a [recharge] station! >>{lexec:markrecharge}}

lsedit $laser=markrecharge

.del ^ $

{null:{store:R,_game/pinfo/{ref:me}/marked/{ref:here}/1,this}}

.end

@act recharge;rech=$laser=$laser:recharge=$nothing

@succ $laser:recharge={lexec:succ}

lsedit $laser:recharge=succ

.del ^ $

{if:{rechargeroom:{loc:me}},

{if:{not:{roomdestroyed:here}},

{if:{life:me},

{if:{lt:{energy:me},75},

{if:{gt:{subt:{secs},{prop:_game/pinfo/{ref:me}/recharge/stamp,$laser}},90},

{with:movedelta,

{subt:{curmove:me},{prop:_game/pinfo/{ref:me}/recharge/lastmove,$laser}},

{if:{not:{&movedelta}},

<< No camping in the recharge area! >>,

{if:{prop:_game/room/{ref:here}/rigged,$laser},

{with:dam,{subt:-5,{dice:15}},

{with:rigger,{prop:_game/room/{ref:here}/rigged,$laser},

<< ACK! This recharge station is rigged! ({&dam}) >>

{null:

{spectatortell:{name:me} got shocked by a rigged station!}

{otell:<< {name:me} receives a nasty jolt from the rigged recharge station. >>},

{if:{not:{nearby:{&rigger},me}},

{tell:<< {name:me} was shocked by your rigged recharge station! ({&dam}) >>,{&rigger}}},

{if:{le:{add:{life:me},{&dam}},0},

{incprop:_game/pinfo/{&rigger}/kills}

{if:{dbeq:me,{&rigger}},

{incprop:_game/pinfo/{&rigger}/rig/suicides},

{tell:<< Your rigged station killed {name:me}! >>,{&rigger}}}},

{incprop:_game/pinfo/{&rigger}/damagecaused,{&dam}},

{incprop:_game/pinfo/{&rigger}/rig/damagecaused,{&dam}},

{adjustlife:me,{&dam}},

{delprop:_game/room/{ref:here}/rigged,$laser}}}},

{if:{le:{&movedelta},4},

{null:

{incprop:_game/pinfo/{ref:me}/recharge/camping}}}

<< Your gun has been recharged. >>

{null:

{spectatortell:{pronouns:%n recharged %p gun.}}

{otell:{pronouns:<< %n recharges %p gun. >>}},

{adjustenergy:me,100},

{incprop:_game/pinfo/{ref:me}/recharge/count},

{incprop:_game/pinfo/{ref:me}/recharge/loc/{ref:here}},

{store:{secs},_game/pinfo/{ref:me}/recharge/stamp,$laser},

{store:{curmove:me},_game/pinfo/{ref:me}/recharge/lastmove,$laser}}}}},

<< You must wait 90 seconds between recharges. >>},

<< You cannot recharge until your energy level is below 75%. >>},

<< You're dead\, sweetheart. >>},

<< The station is offline at the moment. >>},

<< There's no recharge station here. >>}

.end

@act rig=$laser=$laser:rig=$nothing

@succ $laser:rig={lexec:succ}

lsedit $laser:rig=succ

.del ^ $

{if:

{and:

{ge:{subt:{secs},{prop:_game/pinfo/{ref:me}/rig/lastattempt,$laser}},60},

{ge:{subt:{secs},{prop:_game/pinfo/{ref:me}/rig/lastsuccess,$laser}},300}},

{if:{rechargeroom:{loc:me}},

{with:dmg,{dice:5},

{if:{gt:{life:me},5},

{if:{le:{dice:100},{add:{prop:_game/pinfo/{ref:me}/rig/boost,$laser},30}},

<< You've rigged this recharge station! You also got a bit of a shock. (-{&dmg}) >>

{null:

{spectatortell:{name:me} rigged a recharge station!},

{store:{ref:me},_game/room/{ref:here}/rigged,$laser},

{store:{secs},_game/pinfo/{ref:me}/rig/lastsuccess,$laser},

{incprop:_game/pinfo/{ref:me}/rig/count}},

<< You try to rig the station\, but all you get is a shock! (-{&dmg}) >>

{null:

{otell:{pronouns:<< %n tries to rig the station\, but all %s gets is a shock! (-{&dmg}) >>}}}},

<< You're too weak to try that now! >>}

{null:

{adjustlife:me,-{&dmg}},

{store:{secs},_game/pinfo/{ref:me}/rig/lastattempt,$laser},

{incprop:_game/pinfo/{ref:me}/rig/attempts}}},

<< There is no recharge station here. >>},

<< Your paws are still hurting from the last time. >>}

.end

lsedit $laser=changerechargerooms

.del ^ $

{with:rechargers,,

{with:newroom,,

{for:i,1,{lssetting:rechargers},1,

{set:newroom,{randomroom}}

{while:

{fold:acc,r,{&rechargers},

{or:{tell:{&acc}},{lt:{dist:{roomx:{&newroom}},{roomy:{tell:{&newroom}}},{roomx:{tell:{&r}}},{roomy:{&r}}},2}}},

{set:newroom,{randomroom}}}

{set:rechargers,{mklist:{&rechargers},{&newroom}}}}}}

.end

lsedit $laser=changerechargerooms

.del ^ $

{with:roomlist,

{subst:{listprops:_game/room/,$laser},_game/room/,},

{with:r1,{lrand:{&roomlist}},

{with:r2,,

{if:{eq:{default:{lssetting:rechargers},2},2},

{while:

{or:

{not:{&r2}},

{lt:{dist:

{roomx:{&r1}},{roomy:{&r1}},

{roomx:{&r2}},{roomy:{&r2}}},3}},

{null:{set:r2,{lrand:{&roomlist}}}}}}

{null:{store:{&r1}{if:{&r2},\r{&r2}},_game/rechargerooms,$laser}}}}}

.end

@act plant mine;mine=$laser=$laser:plantmine=$nothing

@succ $laser:plantmine={lexec:succ}

@lock $laser:plantmine=!_game/alive?:0

@set $laser:plantmine=_game/alive?:{life:me}

@fail $laser:plantmine=<< That's an interesting thing for a ghost to do. >>

lsedit $laser:plantmine=succ

.del ^ $

{if:

{lt:{default:

{prop:_game/pinfo/{ref:me}/mine/count,$laser},0},

{default:

{prop:_game/pinfo/{ref:me}/mine/total,$laser},

{lssetting:mines}}},

{if:{le:1,

{count:

{filter:p,{contents:here,player},{awake:{&p}}}}},

<< You plant a mine. >>

{null:

{spectatortell:{name:me} planted a mine.},

{store:{ref:me},_game/room/{ref:here}/mine,$laser},

{incprop:_game/pinfo/{ref:me}/mine/count}},

<< You should plant a mine when no one is looking! >>},

<< You don't have any more mines. >>}

.end

@set $laser=_arrive/1mine:,{lexec:mineboom}}

lsedit $laser=mineboom

.del ^ $

{if:{life:me},

{with:miner,

{prop:_game/room/{ref:here}/mine,$laser},

{if:{&miner},

{with:dmg,{subt:-10,{dice:-15}},

{null:

{queuemsg:{name:me} stepped on a mine!}

{otell:<< KABOOM! A mine explodes under {name:me}'s paws! >>},

{foreach:r,{surrounding:{ref:here}},

{otell:<< You hear an explosion from the {dirname:{roomx:{&r}},{roomy:{&r}},{x},{y}}. >>}},

{tell:<< {name:me} has been injured by your mine! ({&dmg}) >>,{&miner}},

{incprop:_game/pinfo/{&miner}/damagecaused,{&dmg}},

{incprop:_game/pinfo/{ref:me}/mine/damagereceived,{&dmg}},

{adjustlife:me,{&dmg}},

{tell:<< KABOOM! A mine explodes beneath you! ({&dmg}) >>}

{if:{and:{not:{life:me}},{not:{dbeq:{&miner},me}}},{incprop:_game/pinfo/{&miner}/kills}},

{store:#,_game/pinfo/{&miner}/marked/{ref:here}/2,$laser},

{delprop:_game/room/{ref:here}/mine,$laser}}}}}

{null:

{store: ,_game/pinfo/{ref:me}/marked/{ref:here}/2,$laser}}}

.end

@act findpacks=$laser=$laser:findpacks=$nothing

@succ $laser:findpacks={lexec:succ}

lsedit $laser:findpacks=succ

.del ^ $

{if:{prop:_game/pinfo/{ref:me}/healthpack/searched,$laser},

<< You can only use [findpacks] once per game! >>,

{null:

{tell:<< You raise your nose to the wind... >>{nl}{nl}},

{spectatortell:{name:me} is desperate for health!},

{foreach:r,{listprops:_game/room/,$laser},

{if:{prop:{&r}/healthpack,$laser},

{tell:

- {prop:{&r}/healthpack,$laser} healthpack{if:{ne:{prop:{&r}/healthpack,$laser},1},s} found at {coords:{subst:{&r},_game/room/,}}}}},

{otell:{pronouns:<< %n raises %p nose to the wind... >>}},

{store:{secs},_game/pinfo/{ref:me}/healthpack/searched,$laser}}}

.end

@set $laser=_msgmacs/healthpack:{prop:_game/room/{ref:{:1}}/healthpack,$laser}

@set $laser=_msgmacs/removehealth:{null:{store:{subt:{healthpack:{:1}},1},_game/room/{ref:{:1}}/healthpack,$laser}}

@set $laser=_arrive/healthpack:,<< There's a healthpack here! Type [healthpack] to use it. >>}

lsedit $laser=makehealthpack

.del ^ $

{with:prp,

{lrand:{listprops:_game/room,$laser}}/healthpack,

{store:{add:{prop:{&prp},$laser},1},{&prp},$laser}

{set:prp,{subst:{subst:{&prp},_game/room/,},/healthpack,}}

{force:$laseradmin,@tel {&prp}}

{force:$laseradmin,spoof << A healthpack appears. >>}

{force:$laseradmin,go home}}

.end

@act healthpack;hp;hpack=$laser=$laser:healthpack=$nothing

@succ $laser:healthpack={lexec:succ}

lsedit $laser=succ

.del ^ $

{if:{life:me},

{if:{healthpack:here},

<< You use the health pack. >>{nl}

{if:{eq:

{dice:

{if:{prop:_game/room/{ref:here}/hptreat,$laser},2,10}},1},

{if:{eq:{dice:4},1},

<< You got a mine! >>

{null:

{store:

{add:{default:

{prop:_game/pinfo/{ref:me}/mine/total,$laser},

{lssetting:mines}},1},

_game/pinfo/{ref:me}/mine/total,$laser}},

{boost:{lrand:rig\rshot\rtheft},me}},

{with:adj,{min:{subt:100,{life:me}},{add:9,{dice:6}}},

{removehealth:here}

{adjustlife:me,{&adj}}

<< You feel a surge of life as you recover {&adj} point{if:{ne:{&adj},1},s}. >>

{null:

{if:{prop:_game/room/{ref:here}/hptreat,$laser},

{incprop:_game/room/{ref:here}/hptreat,-1},

{lexec:makehealthpack,$laser}}

{otell:<< {name:me} uses a health pack and recovers {&adj} points. >>},

{incprop:_game/pinfo/{ref:me}/healthpack/recovered,{&adj}}}}}

{null:

{incprop:_game/stats/healthpacks},

{incprop:_game/pinfo/{ref:me}/healthpack/count}},

<< There are no health packs here. >>},

<< The healthpacks don't cure death\, sadly. >>}

.end

lsedit $laser=clearhealthpacks

.del ^ $

{null:{foreach:r,{listprops:_game/room,$laser},{store:0,{&r}/healthpack,$laser}}}

.end

@set $laser=_arrive/spycam:,{with:mesg,{name:me} appears in your spycam. ({x}\,{y}),{lexec:spycam}}}

@set $laser=_depart/spycam:,{with:mesg,{name:me} disappears from your spycam. ({x}\,{y}),{lexec:spycam}}}

lsedit $laser=spycam

.del ^ $

{with:cams,

{findcams:here},

{if:{&cams},

{foreach:c,{&cams},

{if:{contains:{objowner:{&c}},$laser},

{null:{tell:

<< {&mesg} >>,

{objowner:{&c}}}}}}}}

.end

lsedit $laser=destroy_spycam

.del ^ $

{null:

{if:{objowner:{&cam}},

{tell:

{if:{name:me},

<< {name:me} has destroyed your spy cam! ({x}\,{y}) >>,

<< Your spy cam has been destroyed! ({x}\,{y}) >>},

{objowner:{&cam}}}}}

{lexec:uninstallcam}

.end

lsedit $laser=installcam

.del ^ $

{null:{store:S,_game/pinfo/{objowner:{&cam}}/marked/{loc:{&cam}}/4,this}}

.end

lsedit $laser=uninstallcam

.del ^ $

{if:{not:{dbeq:{objowner:{&cam}},$laseradmin}},

{if:

{null:{store: ,_game/pinfo/{objowner:{&cam}}/marked/{loc:{&cam}}/4,this}}}

.end

lsedit $laser=calcodds

.del ^ $

{func:calcodds,p1,p2,

{with:x2,{x:{&p2}},

{with:y2,{y:{&p2}},

{with:x1,{x:{&p1}},

{with:y1,{y:{&p1}},

{with:odds,

{if:{eq:{loc:{&p1}},{ploc:{&p2}}},

50,

{with:dist,{dist:{&x1},{&y1},{&x2},{&y2}},

{if:{eq:{&dist},1},

{if:

{or:

{eq:{&x1},{&x2}},

{eq:{&y1},{&y2}}},

40,33},

{if:{gt:{&dist},2},0}}}},

{if:{not:{isnum:{&odds}}},

{with:dir,

{if:

{gt:

{abs:{subt:{&x2},{&x1}}},

{abs:{subt:{&y2},{&y1}}}},

x,y},

{with:xstep,

{sign:{subt:{&x2},{&x1}}},

{with:ystep,

{sign:{subt:{&y2},{&y1}}},

{with:opp,{if:{eq:{&dir},x},y,x},

{null:

{set:odds,{if:

{gameroom:

{v:{&opp}1},

{add:{v:{&dir}1},{v:{&dir}step}}},

16,

{if:{eq:{v:{&opp}1},{v:{&opp}2}},0,8}}}

{if:{&odds},

{if:{not:

{gameroom:

{add:{&x1},{&xstep}},

{add:{&y1},{&ystep}}}},

{set:odds,

{if:{eq:{&odds},8},

0,

8}}}}}}}}}}

{max:

{if:{&odds},1,0},

{add:

{&odds},

{if:{istype:{&p2},thing},15},

{if:{lt:{subt:{secs},{prop:_game/pinfo/{&p1}/shot/last,$laser}},5},-15},

{prop:_game/pinfo/{&p1}/shot/boost},

{if:{prop:_game/pinfo/{&p1}/charged},

{div:{mult:{&odds},10},20},

0},

{prop:_game/pinfo/{&p1}/armorweight}}}}}}}}}

.end

lsedit $laser=purgeplayers

.del ^ $

{null:

{foreach:p,

{subst:{listprops:_game/pinfo/,$laser},_game/pinfo/,},

{if:{not:{istype:{&p},player}},

{delprop:_game/pinfo/{&p},$laser}}}}

.end

lsedit $lasertop=func/findplayer

.del ^ $

{func:findplayer,str,no,

{with:_list,

{filter:p,

{if:{&no},

{listprops:_game/{&no}/pinfo/,$records},

{listprops:_game/pinfo/,$laser}},

{smatch:

{default:

{prop:{&p}/name,{if:{&no},$records,$laser}},

{delprop:{&p},{if:{&no},$records,$laser}}},{&str}*}},

{if:{eq:{count:{&_list}},1},

{subst:{&_list},_game/{if:{&no},{&no}/}pinfo/,},

0}}}

.end

lsedit $laser=func/dirname

.del ^ $

{func:dirname,x1,y1,x2,y2,

{if:{gt:{&y2},{&y1}},

south,

{if:{lt:{&y2},{&y1}},

north}}

{if:{gt:{&x2},{&x1}},

east,

{if:{lt:{&x2},{&x1}},west}}}

.end

@act shoot;sh;sho;shoo;shoot at=$laser=$laser:shoot=$nothing

@lock $laser:shoot=_canshoot?:1

@set $laser:shoot=_canshoot?:{lexec:canshoot}

lsedit $laser:shoot=canshoot

.del ^ $

{if:{gamestarted},

{if:{life:me},

{if:{energy:me},

{if:{gt:{subt:{secs},{prop:_game/pinfo/{ref:me}/stunned,$laser}},5},

{if:{not:{prop:_game/pinfo/{ref:me}/charging,$laser}},

{with:target,

{if:

{and:

{or:{istype:{&arg},player},

{istype:{&arg},thing}},

{nearby:{&arg},me}},

{ref:{&arg}},

#-1},

{if:{eq:{&target},#-1},

{lexec:func/findplayer,$laser}

{null:{set:target,{findplayer:{&arg}}}}}

{if:{&target},

{if:{contains:{&target},$laser},

{if:{life:{&target}},

1{null:{store:{&target},_tmp/target}},

0{null:{store:<< {name:{&target}} is dead! >>,_/fl}}},

0{null:{store:<< {name:{&target}} left the arena. >>,_/fl}}},

1{null:{delprop:_tmp/target}}}},

0{null:{store:<< Your gun is charging. >>,_/fl}}},

0

{null:

{store:<< Give your gun a couple seconds to cool off! >>,_/fl},

{otell:<< {name:me}'s gun is too hot to fire! >>}}},

0

{null:

{store:<< Your gun is out of energy! Find a [recharge] spot! >>,_/fl},

{otell:<< {pronouns:

%n points %p gun

{if:{or:{istype:{&arg},player},{istype:{&arg},thing}}, at {name:{&arg}}}

\, but %s's run out of energy!} >>}}},

0

{null:

{store:<< You're quite dead\, my friend. >>,_/fl},

{otell:<< {name:me}'s dead body appears to twitch. >>}}},

{null:{store:<< There is no game in session. >>,_/fl}}}

.end

@succ $laser:shoot={lexec:succ}

lsedit $laser:shoot=succ

.del ^ $

{with:target,

{prop!:_tmp/target},

{if:{or:{not:{&target}},{eq:{&target},{ref:me}}},

{if:{eq:{&target},{ref:me}},

You look at your reflection in the barrel of your gun.

{null:{otell:{pronouns:%n looks at %r in the barrel of %p gun.}}},

{with:p,{listprops:_game/special/shoot/,$laser,{sublist:{&arg},1,1, }*},

{if:{eq:{count:{&p}},1},

{with:nosucc,,

{exec:{&p},$laser}

{if:{not:{&nosucc}},

{null:

{adjustenergy:me,-1},

{delprop:_game/pinfo/{ref:me}/charged,$laser}}}},

{rand:notfound}}}},

{lexec:calcodds,$laser}

{with:odds,{calcodds:{ref:me},{&target}},

{if:{&odds},

<< You fire at {name:{&target}}! >>

{if:

{le:{dice:100},{&odds}},

{with:msg,,

{with:dmod,,

{nl}{lit:<< Your shot }

{if:{istype:{&target},thing},

{set:msg,

{if:{prop:_game/pinfo/{ref:me}/charged},

slams into {objname:{&target}}! ({set:dmod,{subt:-10,{dice:10}}}) >>,

hits {objname:{&target}}. ({set:dmod,{subt:-5,{dice:10}}}) >>}},

{set:msg,

{eval:

{pronouns:

{lrand:

{list:

{if:{prop:_game/pinfo/{ref:me}/charged,$laser},charged}

hitmessage}},

{&target}

}

} ({set:dmod,{add:-2,{&dmod}}}) >>}

{null:

{store:{secs},_game/pinfo/{&target}/lasthit,$laser},

{incprop:_game/pinfo/{ref:me}/shot/hit/p/{&target}}}}

{null:

{otell:<< {name:me}'s shot {&msg}},

{if:{not:{nearby:{&target},me}},

{otell:

<< {name:me} fires at {name:{&target}} from the {dirname:{x:{&target}},{y:{&target}},{x},{y}}! >>{nl}

<< {name:me}'s shot {&msg},{loc:{&target}}}},

{adjustlife:{&target},{&dmod}},

{incprop:_game/pinfo/{ref:me}/damagecaused,{&dmod}},

{incprop:_game/pinfo/{ref:me}/shot/count},

{incprop:_game/pinfo/{ref:me}/shot/hit/dist/

{dist:{x},{y},{x:{&target}},{y:{&target}}}}

{store:{secs},_game/pinfo/{ref:me}/shot/last,$laser}}}},

{nl}<< You miss {name:{&target}} >>.

{null:

{delprop:_game/pinfo/{ref:me}/noshots,$laser},

{incprop:_game/pinfo/{ref:me}/misses},

{if:{not:{nearby:{&target},me}},

{otell:

<< {name:me} fires at {name:{&target}} from the {dirname:{x:{&target}},{y:{&target}},{x},{y}}! >>{nl}

<< {name:me}'s shot misses. >>,{loc:{&target}}}},

{otell:<< {name:me} misses {name:{&target}}. >>}}}

{with:recents,

{sublist:{mklist:{secs},{prop:_game/pinfo/{ref:me}/recentshots,$laser}},1,5},

   				{null:
   				    {store:{&recents},_game/pinfo/{ref:me}/recentshots,$laser},
   					{adjustenergy:me,-1},
   					{delprop:_game/pinfo/{ref:me}/charged,$laser}
   					{incprop:_game/pinfo/{ref:me}/shot/count}
   					{incprop:_game/pinfo/{ref:me}/shot/loc/{ref:here}}}
   				{if:{and:{eq:{count:{&recents}},5},{le:{subt:{secs},{sublist:{&recents},5,5}},{lssetting:overheat}}},
   				    \r<< Your gun has overheated! >>
   				    {null:{store:{secs},_game/pinfo/{ref:me}/stunned,$laser}}}},

{null:

{if:{gt:{prop:_game/pinfo/{ref:me}/noshots,$laser},10},

{incprop:_game/pinfo/{ref:me}/cheating},

{incprop:_game/pinfo/{ref:me}/noshots}}}

You can't see {name:{&target}} from here.}}}}

.end

lsedit $laser:shoot=chargedhitmessage

.del ^ $

rockets into %n's chest!{null:{set:dmod,-6}}

sends a violent jolt through %n!{null:{set:dmod,-4}}

hammers into %n!{null:{set:dmod,-5}}

slams into %n's gun\, causing it to overheat!{null:{set:dmod,-2},{store:{secs},_game/pinfo/{&target}/stunned,$laser}}

.end

lsedit $laser:shoot=hitmessage

.del ^ $

slams into %n.{null:{set:dmod,-2}}

hits %n right on %p arm.{null:{set:dmod,-2}}

singes the fur on %n's head.{null:{set:dmod,-2}}

hits %n's foot.

strikes %n in the back.

combs %n's hair into a neat part.

bounces off the floor and into %n's leg.

knocks %n in the head.

hits %n's gun\, causing it to get red hot!{null:{store:{secs},_game/pinfo/{&target}/stunned,$laser}}

hits %n in the shin.

looks like a miss\, but then it curves right into %n's {lrand:shoulder\rankle\relbow\rbuttock}.

.end

lsedit $laser:shoot=missmessage

Your shot meanders like a restless wind inside a letter box.{null:{set:ind,1}}

.end

@set $laser=_msgmacs/roomdestroyed:{if:{gt:{subt:{secs},{prop:_game/room/{ref:{:1}}/destroyed,$laser}},90},{null:{delprop:_game/room/{ref:{:1}}/destroyed,$laser}}0,1}

@set $laser=_msgmacs/destroyroom:{store:{secs},_game/room/{ref:{:1}}/destroyed,$laser}{if:{:2},{incprop:_game/pinfo/{ref:{:2}}/shot/hit/rooms}}

@set $laser=_game/special/shoot/station:{if:{rechargeroom:here},{if:{roomdestroyed:here},<< The station is already destroyed. >>,{null:{tell:<< You fire at the recharge station! >>},{otell:<< {name:me} fires at the recharge station! >>},{if:{eq:{dice:5},1},{otell:<< The recharge station goes offline for 90 seconds. >>,here,#-1}{spectatortell:{name:me} took a recharge station offline!}{destroyroom:here,me},{otell:<< The shot glances harmlessly off the station. >>,here,#-1}}}},<< There is no recharge station here. >>}

@set $laser=_game/special/shoot/recharge:{exec!:_game/special/shoot/station}

@set $laser=_game/special/shoot/healthpack:{if:{healthpack:here},{null:{tell:<< You fire at a healthpack! >>},{otell:<< {name:me} fires at a healthpack! >>}{if:{eq:{dice:5},1},{with:dmg,{subt:1,{dice:7},1},{otell:<< The healthpack explodes!{if:{&dmg}, ({&dmg})} >>,here,#-1}{if:{&dmg},{adjustlife:me,{&dmg}}}}{incprop:_game/room/{loc:me}/healthpack,-1}{incprop:_game/pinfo/{ref:me}/healthpack/destroyed}{spectatortell:{name:me} destroyed a healthpack!}}},<< There is no healthpack here. >>}

@set $laser=_game/special/shoot/wall:{null:{tell:<< You fire at the wall! >>},{otell:<< {name:me} fires at the wall! >>}{if:{lssetting:treats},{if:{prop:_game/room/{ref:here}/treats},{otell:<< A [healthpack] pops out of the wall! >>,here,#-1}{incprop:_game/room/{ref:here}/healthpack}{incprop:_game/room/{ref:here}/treats,-1}{incprop:_game/room/{ref:here}/hptreat}{incprop:_game/pinfo/{ref:me}/treasure}{spectatortell:{name:me} found treasure!}}}}

@set $laser=_game/special/shoot/ceiling:{null:{tell:<< You fire at the ceiling! >>},{otell:<< {name:me} fires at the ceiling! >>},{if:{eq:{dice:2},1},{with:dmg,{subt:-1,{dice:4}},{otell:<< A chunk of rubble falls on {commas:{contents:here,player}, and ,p,{name:{&p}}}! ({&dmg}) >>,here,#-1}{foreach:pl,{contents:here,player},{adjustlife:{&pl},{&dmg},me}}}}}

@set $laser=_game/special/shoot/lights:{null:{tell:<< You fire at the lights! >>},{otell:<< {name:me} fires at the lights! >>}}

@set $laser=_game/special/shoot/foot:{null:{tell:<< You shoot yourself in the foot! (-2) >>},{otell:<< {pronouns:%n shoots %r in the foot!} (-3) >>},{adjustlife:me,-2,me},{spectatortell:{pronouns:%n shot %r in the foot!}}}

@set $laser=_game/special/shoot/head:{null:{tell:<< You shoot yourself in the head! (-20) >>},{otell:<< {pronouns:%n shoots %r in the head!} (-20) >>},{adjustlife:me,-20,me},{spectatortell:{pronouns:%n shot %r in the head!}}}

@set $laser=_game/special/shoot/god:{null:{tell:<< This is no place for a crisis of faith! >>},{otell:<< {pronouns:%n tries to take %p problems out on %p god.} >>},{set:nosucc,1}}

@set $laser=_game/special/shoot/craps:{null:{with:d1,{dice:6},{with:d2,{dice:6},{tell:<< You roll some dice. You get a {&d1} and a {&d2}. >>},{otell:<< {pronouns: %n rolls some dice. %S gets a {&d1} and a {&d2}.} >>}}}}

@mpi {with:r,,{foreach:c,1-1 1-2 1-4 1-5 2-1 2-5 3-5 4-5 7-4 8-2 8-3,{set:r,{gameroom:{sublist:{&c},1,1,-},{sublist:{&c},2,2,-}}}{store:1,_game/room/{&r}/destructible,$laser}, }}

@set $laser=_game/special/shoot/missile:{lexec:shootmissile}

lsedit $laser=shootmissile

.del ^ $

{null:

{if:

{lt:

{prop:_game/pinfo/{ref:me}/shot/missile/count,$laser},

{default:

{prop:_game/pinfo/{ref:me}/missile/total,$laser},

{lssetting:missiles}}},

{if:{prop:_game/pinfo/{ref:me}/charged,$laser},

{with:player,

{lexec:func/findplayer}

{findplayer:{sublist:{&arg},2,2, }},

{if:{&player},

{tell:<< You launch a MISSILE at {name:{&player}}! (self: -5) >>}

{otell:<< {name:me} launches a MISSILE at {name:{&player}}! (self: -5) >>}

{incprop:_game/pinfo/{ref:me}/shot/missile/count}

{adjustlife:me,-5}


{delay:1,

\{with:player\,{&player}\,

{lit:

{null:

{if:{life:{&player}},

{if:{ne:{dice:{lssetting:backfire}},1},

{with:dmg,{subt:-10,{dice:20}},

{incprop:_game/pinfo/{ref:me}/shot/missile/hits}

{incprop:_game/pinfo/{ref:me}/shot/hit/p/{&player}}

{spectatortell:{name:me} shot a missile that hit {name:{&player}}}

{otell:<< The missile slams into {name:{&player}}! ({&dmg}) >>,here,#-1}

{if:{not:{nearby:{&player},me}},

{otell:<< {name:me}'s missile slams into {name:{&player}}! ({&dmg}) >>,{if:{contains:{&player},$laser},{loc:{&player}},{loc:$laseradmin}},#-1}}

{adjustlife:{&player},{&dmg}}},

{with:dmg,{subt:-5,{dice:10}},

{incprop:_game/pinfo/{ref:me}/shot/missile/misses}

{spectatortell:{name:me} shot a missile that backfired!}

{otell:<< {pronouns:%n's missile backfires and injures %o instead!} ({&dmg}),here,#-1}

{adjustlife:me,{&dmg}}}},

{tell:<< Your missile passes through {name:{&player}}'s ghostly form! >>}

{otell:<< A missile passes right through {name:{&player}}!,{loc:{&player}},#-1}}}}\}},

{set:nosucc,1}

{tell:<< There is no such player. >>}}},

{set:nosucc,1}

{tell:<< You must [charge] your gun to launch a missile. >>}},

{set:nosucc,1}

{tell:<< You've used up your missiles. >>}}}

.end

lsedit $laser:shoot=notfound

.del ^ $

You strike a pose and think about "{&arg}".

If only I knew what "{&arg}" was...

You fire your gun randomly!{null:{adjustenergy:me,-1},{otell:<< {name:me} fires {pronouns:%p} gun at something invisible. >>}}

.end

@act odds=$laser=$laser:odds=$nothing

@succ $laser:odds={with:p1,{sublist:{&arg},1,1, },{with:p2,{sublist:{&arg},2,2, },{lexec:calcodds,{loc:this}}}}

@act n;no;nor;nort;north;e;ea;eas;east;s;so;sou;sout;south;w;we;wes;west;ne;neast;northeast;se;seast;southeast;sw;swest;southwest;nw;nwest;northwest=$laser=$laser:nav=$nothing

@succ $laser:nav={lexec:succ}

@desc $laser:nav={lexec:desc}

@lock $laser:nav=_isplayer?:1

@set $laser:nav=_isplayer?:{istype:me,player}

@fail $laser:nav=<< Only players may use this command. >>

lsedit $laser:nav=roomdest

.del ^ $

{with:dx,,

{with:dy,,

{with:dir,,

{null:

{if:{smatch:{&cmd},n*},

{set:dy,-1}

{set:dir,north},

{if:{smatch:{&cmd},s*},

{set:dy,1}

{set:dir,south}}}

{if:{smatch:{&cmd},*e*},

{set:dx,1}

{set:dir,{&dir}east},

{if:{smatch:{&cmd},*w*},

{set:dir,{&dir}west}

{set:dx,-1}}}

{store:{&dir},_dir}}

{gameroom:{add:{x},{&dx}},{add:{y},{&dy}}}}}}

.end

lsedit $laser:nav=succ

.del ^ $

{with:room,

{lexec:roomdest},

{if:{&room},

{null:

{otell:<< {name:me}{if:{not:{life:me}}, (dead)} heads {prop:_dir}. >>},

{tell:<< You head {prop:_dir}. >>}

{force:$laseradmin,@tel {ref:me}={&room}},

{otell:<< {name:me}{if:{not:{life:me}}, (dead)} arrives from the {opposite:{prop:_dir}}. >>}},

{null:

{incprop:_game/pinfo/{ref:me}/klutz},

{tell:<< There's a wall in that direction! >>},

{otell:<< {name:me} walks into a wall for some reason. >>}}}}

.end

lsedit $laser:nav=desc

.del ^ $

{null:{set:cmd,{&arg}}}

{with:room,

{lexec:roomdest},

{exitdesc}}

.end

@create Laser Administrator=$laser=$laser:admin

+reg $laser:laseradmin=$laser:admin

@set $laser:admin=xforcible

@flock $laser:admin=me

@@ $laseradmin

@dig Weapon Room=$laser=$laser:weapons

lsedit $laser=getobject

.del ^ $

{if:{gamestarted},

{if:{life:me},

{if:

{dbeq:me,{objowner:{&_object}}},

1,

{if:

{or:

{dbeq:{objowner:{&_object}},$laseradmin},

{and:

{gt:{subt:{secs},{prop:_game/pinfo/{ref:me}/theft/lastattempt,$laser}},15},

{store:{secs},_game/pinfo/{ref:me}/theft/lastattempt,$laser},

1{incprop:_game/pinfo/{ref:me}/theft/attempts},

{le:

{dice:100},

{add:

{prop:_game/pinfo/{ref:me}/theft/boost,$laser},

{prop:_game/pinfo/{ref:me}/theft/count,$laser},

10}}}},

1,

0{null:

{store:<< You try to steal {objname:{&_object}}. It shocks your paw quite painfully. (-1) >>,_/fl,{&_object}},

{store:{pronouns:tries to steal {objname:{&_object}}. It shocks %p paw quite badly.} (-1),_/ofl,{&_object}},

{adjustlife:me,-1}}}},

0{null:{store:<< The dead have have no use for material goods. >>,_/fl,{&_object}}}},

0{null:{store:<< There is no game in session. >>,_/fl,{&_object}}}}

.end

lsedit $laser=stealobj

.del ^ $

{null:

{tell:<< You successfully steal {objname:{&obj}}! >>},

{tell:<< {name:me} has stolen your {name:{&obj}}! >>,{objowner:{&obj}}},

{spectatortell:{name:me} stole {objname:{&obj}}!},

{otell:<< {name:me} steals a {name:{&obj}}. >>,{loc:{&thief}},{&thief}},

{if:{not:{dbeq:#82642,{objowner:{&obj}}}},

{incprop:_game/pinfo/{&thief}/theft/count},

{incprop:_game/pinfo/{objowner:{&obj}}/theft/losses}},

{exec!:_game/hook/steal/{tolower:{name:{&obj}}},$laser},

{store:{&thief},_game/object/{&obj}/owner,$laser}}

.end

@set $laser=_game/hook/steal/spycam:{with:cam,{&obj},{lexec:uninstallcam}}

@set $laser=_msgmacs/getcam:{if:{dbeq:{objowner:this},me},You uninstall your spycam.{null:{with:cam,{ref:this},{lexec:uninstallcam, $laser}}},{null:{with:obj,{ref:this},{with:thief,{ref:me},{lexec:stealobj,$laser}}}}}

@act spy=$laser=$laser:spy=$nothing

@succ $laser:spy={lexec:succ}

lsedit $laser:spy=succ

.del ^ $

{with:mycams,

{filter:c,

{prop:_game/spycams,$laser},

{and:

{dbeq:{objowner:{&c}},me},

{objlife:{&c}}},-,\r},

{if:{not:{&mycams}},

<< You have no active spycams. >>,

{null:

{foreach:c,

{&mycams},

{tell:

<< Spycam ({x:{&c}}\,{y:{&c}}) sees:{lit: }

{default:

{commas:

{contents:{loc:{&c}},player},

\, and ,

pl,

{name:{&pl}} (Life: {life:{&pl}}%\, Energy: {energy:{&pl}}%)},

Nothing} >>}}}}}

.end

@set $laser=_msgmacs/objectlock:{with:_object,{ref:this},{lexec:getobject,$laser}}

@set $laser=_msgmacs/camdesc:A strategically placed spycam that silently observes the room.

@create Spycam=$laser:weapons=$laser:spycam1

@lock $laser:spycam1=_game/checkowner:1

@set $laser:spycam1=_game/checkowner:{objectlock}

@desc $laser:spycam1={camdesc}

@odrop $laser:spycam1=installs a spycam.

@drop $laser:spycam1=You install a spycam.{null:{with:cam,{ref:this},{lexec:installcam,$laser}}}

@succ $laser:spycam1={getcam}

@create Spycam=$laser:weapons=$laser:spycam2

@lock $laser:spycam2=_game/checkowner:1

@set $laser:spycam2=_game/checkowner:{objectlock}

@fail $laser:spycam2=

@ofail $laser:spycam2=

@desc $laser:spycam2={camdesc}

@odrop $laser:spycam2=installs a spycam.

@drop $laser:spycam2=You install a spycam.{null:{with:cam,{ref:this},{lexec:installcam,$laser}}}

@succ $laser:spycam2={getcam}

@osucc $laser:spycam2=

@create Spycam=$laser:weapons=$laser:spycam2

@lock $laser:spycam3=_game/checkowner:1

@set $laser:spycam3=_game/checkowner:{objectlock}

@fail $laser:spycam3=

@ofail $laser:spycam3=

@desc $laser:spycam3={camdesc}

@odrop $laser:spycam3=installs a spycam.

@drop $laser:spycam3=You install a spycam.{null:{with:cam,{ref:this},{lexec:installcam,$laser}}}

@succ $laser:spycam3={getcam}

@osucc $laser:spycam3=

@mpi {force:me,@set $laser=_game/spycams:{ref:$spycam1}-{ref:$spycam2}-{ref:$spycam3}}

@@ Turrets

@set $laser=_msgmacs/turretdesc:A terrifying turret.

@lock $laser=_game/checkowner:1

@create Turret=$laser:weapons=$laser:turret1

@desc $laser:turret1={turretdesc}

@lock $laser:turret1=_game/checkowner:1

@set $laser:turret1=_game/checkowner:{objectlock}

@drop $laser:turret1=You install a turret.

@odrop $laser:turret1=installs a turret.

@succ $laser:turret1={if:{dbeq:{objowner:this},me},You uninstall your turret.,{null:{with:obj,{ref:this},{with:thief,{ref:me},{lexec:stealobj,$laser}}}}}

@mpi {store:{ref:$turret1},_game/turrets,$laser}

@set $laser=_arrive/turret:,{prop:_game/turret/lastrun,$laser}},11},{null:{lexec:turret/dorun,$laser}}}

lsedit $laser=turret/dorun

.del ^ $

{foreach:turret,

{prop:_game/turrets,$laser},

{if:{objlife:{&turret}},

{with:player,

{filter:p,

{contents:{loc:{&turret}},player},

{and:

{not:{dbeq:{&p},{objowner:{&turret}}}},

{awake:{&p}},

{life:{&p}}}},

{if:{&player},

{null:

{set:player,{ref:{lrand:{&player}}}},

{otell:<< {objname:{&turret}} fires a shot at {name:{&player}}! (-5) >>,{loc:{&turret}},#-1},

{adjustlife:{&player},-5},

{if:{and:{not:{life:{&player}}},{not:{dbeq:{objowner:{&turret}},#82642}}},

{incprop:_game/pinfo/{objowner:{&turret}}/kills}

{tell:<< Your turret killed {name:{&player}}! >>,{objowner:{&turret}}}}

{incprop:_game/pinfo/{&player}/turret/hitby}

{incprop:_game/pinfo/{objowner:{&turret}}/turret/damagecaused,-5}

{incprop:_game/pinfo/{objowner:{&turret}}/damagecaused,-5},

{if:{not:{prop:_game/object/{&turret}/energy}},

{tell:<< Your turret has run out of energy. {coords:{loc:{&turret}}} >>,{objowner:{&turret}}}}}}}}}

{null:

{store:{secs},_game/turret/lastrun,$laser},

{store:

{delay:{add:4,{dice:3}},{lit:{lexec:turret/dorun,$laser}}},

_game/turret/pid,$laser}}

.end

@set $laser=_game/turret/stop:{kill:{prop:_game/turret/pid,$laser}}

@set $laser=_game/special/end/stopturret:{exec:_game/turret/stop}

@set $laser=_arrive/peopletrack:,{null:{store:{add:{prop:_game/occupants,here},1},_game/occupants,here}}}

@set $laser=_depart/peopletrack:,{null:{store:{max:0,{subt:{prop:_game/occupants,here},1}},_game/occupants,here}}}

@set $laser=_depart/leavegame:,{null:{delay:1,{lit:{if:{not:{contains:me,$laser}},{lexec:leavegame}}}}}}

lsedit $laser=leavegame

.del ^ $

<< You leave the game of laser tag and lose all of your possessions. >>

{null:

{foreach:player,

{players},

{if:{contains:{&player},#143944},

{tell:<< {name:me} has left the arena. >>,{&player}}}},

{foreach:object,

{listprops:_game/object,#143944},

{if:{prop:{&object}/owner,#143944},

{if:{dbeq:{prop:{&object}/owner,#143944},me},

{store: ,_game/pinfo/{ref:me}/marked/{loc:{subst:{&object},_game/object/,}}/4,#143944}

{delprop:{&object}/owner,#143944}}}}}

.end

@set $laser=_depart/trackmoves:,{null:{store:{add:{prop:_game/pinfo/{ref:me}/moves,this},1},_game/pinfo/{ref:me}/moves,this},{store:{add:{prop:_game/pinfo/{ref:me}/visits/{loc:me},this},1},_game/pinfo/{ref:me}/visits/{loc:me},this}}}

@set $laser=_arrive/movestamp:,{null:{store:{secs},_game/pinfo/{ref:me}/lastmove,this}}}

@set $laser=_arrive/movehook:,{exec:_game/pinfo/{ref:me}/movehook/{curmove:me},$laser}}

@act lifetime=$lasertop=$laser:lifetime=$nothing

@succ $laser:lifetime={lexec:succ}

lsedit $laser:lifetime=succ

.del ^ $

{laserhead}\r

{parse:player,

{listprops:_overall/,$records},

{left: {subst:{&player},_overall/,},60,. }{prop:{&player},$records}}\r

{laserfoot}

.end

lsedit $laser=help

.del ^ $

{laserhead}{nl}

SHOOTING:{nl}{nl}

Firing your gun is a simple matter of typing SHOOT , where is the name of another player in the game, a nearby object, or certain special targets. Firing consumes 1% of your energy. Your accuracy is primarily based on distance (you can shoot from up to two squares away), walls (shooting around a corner halves your accuracy), and other factors.{nl}

Using the CHARGE command will consume 4% of your energy and take 10 seconds to complete, but it boosts your accuracy and damage significantly. It also permits you to fire missiles (if you've allowed missiles in your game). To do this, type SHOOT MISSILE . Missiles can be fired even at players who are on the other side of the grid, and, when they hit (50% of the time), they deal considerable damage. They can also backfire, however, and injure the shooter rather badly.{nl}{nl}

OBJECTS:{nl}

There are four special objects currently on the grid: three spycams and one turret. All are destructible (simply SHOOT the object), but you can also steal them and then place them on the grid yourself. To do this, simply try to grab the object (GET ). When the game begins, the objects are unowned, so "stealing" them is easy. Once they are owned, theft becomes considerably more difficult, so find the items early!{nl}

- The Spycams let you observe a particular square for passing players.  You may also type SPY to scan your cameras.  The spycams you own are marked with an S on the grid.{nl}
- The Turret will fire continuously at any enemies in its square.{nl}{nl}

RECHARGE STATIONS:{nl}

Recharge stations permit you to fully RECHARGE your weapon once its energy has dropped below 75%. You can also attempt to RIG the station so that the next player receives a nasty shock when s/he goes to recharge. Shooting at the station will sometimes take it offline for 90 seconds.{nl}{nl}

HEALTH PACKS:{nl}

The number of health packs in a game depends on the initial settings. You will find these items strewn around the grid. To use one when you find it, type HP or HEALTHPACK. Doing so will usually result in a boost to your life, but sometimes the packs will improve your accuracy, your ability to rig recharge stations, or your aptitude at theft. They may also give you an additional mine or missile.{nl}

When a health pack is used, another one appears elsewhere on the map. Shooting a health pack may destroy it completely (i.e., it will not reappear elsewhere), but destroying all the health packs eliminates the only way (other than respawning) of regaining life. Be careful!{nl}{nl}

MINES:{nl}

Planting a mine in a room (PLANT MINE) is the only surefire way of inflicting a great deal of damage (up to 30%) on another player, assuming you don't step on the thing yourself. The number of mines that every player receives is customizable at the start of the match.{nl}

{laserfoot}

.end

@act laserhelp;lhelp=$lasertop=$laser:help=$nothing

@succ $laser:help={lexec:help,$laser}

@@@

@@@

@@@ You can steal game objects belonging to other players simply by using 'get' to try picking them up. Repeated, back to back attempts will

@@@

@@@

@set $laser=_msgmacs/boostattr:{with:__amt,{if:{:3},{:3},{add:{dice:5},5}},{null:{incpropmax:_game/pinfo/{ref:{:2}}/{:1},{&__amt},25}}{&__amt}}

@set $laser=_game/boost/shot:You suddenly feel your mind sharpen. (Accuracy +{&increase}%)

@set $laser=_game/boost/theft:You suddenly feel mischievous. (Thievery +{&increase}%)

@set $laser=_game/boost/rig:<< You feel really smart. >> (Rigging +{&increase})

@set $laser=_msgmacs/boost:{with:increase,{boostattr:{:1}/boost,{:2}},{null:{tell:<< {exec:_game/boost/{:1},$laser} >>,{:2}}}}

@act charge;ch;chr=$laser=$laser:charge=$nothing

@succ $laser:charge={lexec:succ}

@lock $laser:charge=_gamestarted?:1

@set $laser:charge=_gamestarted?:{ne:{gamestarted},0}

@fail $laser:charge=<< There is no game in session. >>

lsedit $laser:charge=succ

.del ^ $

{if:{life:me},

{if:{prop:_game/pinfo/{ref:me}/charged,$laser},

<< Your gun is already charged. >>,

{if:{prop:_game/pinfo/{ref:me}/charging,$laser},

<< Your gun is already charging. {with:l,

{subt:10,

{subt:{secs},{prop:_game/pinfo/{ref:me}/charging,$laser}}},

{&l} more second{if:{ne:{&l},1},s} to go.} >>,

{if:{lt:{energy:me},5},

<< You need at least 5% energy to charge your gun. Please visit a recharge station. >>,

<< You begin charging your gun... >>

{null:

{otell:<< {pronouns:%n begins charging %p gun...} >>},

{spectatortell:{name:me} is charging up.},

{adjustenergy:me,-4},

{store:{secs},_game/pinfo/{ref:me}/charging,$laser},

{delay:10,

{lit:{null:

{if:{gamestarted},

{tell:<< Your gun has finished charging. >>}

{store:{secs},_game/pinfo/{ref:me}/charged,$laser}

{store:

{add:1,

{prop:_game/pinfo/{ref:me}/charge/count,$laser}}

,_game/pinfo/{ref:me}/charge/count,$laser}},

{delprop:_game/pinfo/{ref:me}/charging,$laser}}}}}}}},

<< You think fondly on your days among the living. >>}

.end

@act scorecard;scard=$lasertop=$laser:scorecard=$nothing

@succ $laser:scorecard={lexec:succ}

lsedit $laser:scorecard=succ

.del ^ $

{laserhead}{nl}

{with:no,{if:{gt:{count:{&arg},=},1},{sublist:{&arg},1,1,=}{null:{set:arg,{sublist:{&arg},2,2,=}}}},

{with:player,{if:{&arg},{lexec:func/findplayer}{findplayer:{&arg},{&no}}},

{with:score,0,

{with:smod,,

{with:cur,,

{with:i,1,

{null:{if:{or:{not:{&player}},{eq:{&player},#-1}},{set:player,{ref:me}}}}

{center: {name:{&player}} ,70}{nl}

{center:o,70,-}{nl}

{parse:sc,

{listprops:_game/scoring/individual/,$laser},

{null:{set:cur,{exec:{&sc},$laser}}}

{if:{&smod},

{left: {&cur},32}{if:{not:{mod:{&i},2}},{nl}}

{null:

{inc:i},

{set:score,{add:{&score},{&smod}}}}},\r,}

{nl}{right:Total Score: {&score},65}}}}}}}

{nl}

{laserfoot}

.end

@set $laser=_game/scoring/special/explorer:{with:_l,{lsort:{&players},p1,p2,{gt:{count:{listprops:_game/pinfo/{&p2}/visits/,$laser}},{count:{listprops:_game/pinfo/{&p1}/visits/,$laser}}}},Explorer:{sublist:{&_l},1}:250\rHomebody:{sublist:{&_l},-1}:-250}

@set $laser=_game/scoring/special/mobile:

@set $laser=_game/scoring/special/dopefiend:{with:_l,{lsort:{&players},p1,p2,{gt:{prop:_game/pinfo/{&p2}/healthpack/count,$laser},{prop:_game/pinfo/{&p1}/healthpack/count,$laser}}},{if:{prop:_game/pinfo/{set:_l,{sublist:{&_l},1}}/healthpack/count,$laser},Dope Fiend:{&_l}:100}}

@set $laser=_game/scoring/individual/vandal:{scoreitem:Vandal,{add:{prop:<>/shot/hit/objects,<>},{prop:<>/{&player}/shot/hit/rooms,<>}},50}

@set $laser=_game/scoring/individual/thief:{scoreitem:Thefts,theft/count,60}

@set $laser=_game/scoring/individual/deaths:{scoreitem:Deaths,deaths,-500}

@set $laser=_game/scoring/individual/kills:{scoreitem:Kills,kills,400}

@set $laser=_game/scoring/individual/sniper:{scoreitem:Sniper,shot/hit/dist/2,25}

@set $laser=_game/scoring/individual/neighbor:{scoreitem:Lousy Neighbor,shot/hit/dist/1,1}

@set $laser=_game/scoring/individual/variety:{scoreitem:{with:_c,{subt:{count:{filter:_l,{listprops:_game/pinfo/{&player}/shot/loc,$laser},{gt:{prop:{&_l},$laser},5}}},4},Variety: ({set:smod,{mult:50,{&_c}}})}

@null @set $laser=_game/scoring/individual/bully:{with:_c,{parse:_l,{listprops:_game/pinfo/{&player}/shot/hit/p/,$laser}

@set $laser=_game/scoring/individual/life:{scoreitem:Life,life,5}

@set $laser=_game/scoring/individual/mobility:{scoreitem:Mobility,{min:500,{div:{prop:_game/pinfo/{&player}/moves,$laser},3}},1}

@set $laser=_game/scoring/individual/damage:{scoreitem:Damage Dealt,damagecaused,-2}

@set $laser=_game/scoring/individual/healthrecovered:{scoreitem:Health Recovered,healthpack/recovered,1}

@set $laser=_game/scoring/individual/rigging:{scoreitem:Stations Rigged,rig/count,5}

@set $laser=_game/scoring/individual/misses:{scoreitem:Misses,misses,-2}

@set $laser=_game/scoring/individual/missiles:{scoreitem:Missiles Fired,shot/missiles/count,2}

@set $laser=_game/scoring/individual/mines:{scoreitem:Mines Planted,mine/count,5}

@set $laser=_game/scoring/individual/late:{scoreitem:Late Joiner,{div:{prop:_game/pinfo/{&player}/latejoiner,$laser},5},-1}

@set $laser=_game/scoring/individual/christsci:{scoreitem:Christian Scientist,healthpack/destroyed,5}

@set $laser=_game/scoring/individual/treasure:{scoreitem:Treasure Hunter,treasure,5}

@set $laser=_game/scoring/individual/cheating:{scoreitem:Squatting,cheating,-2}

@set $laser=_game/scoring/individual/klutz:{scoreitem:Klutz,klutz,-1}

@set $laser=_msgmacs/scoreitem:{with:_c,{if:{isnum:{:2}},{:2},{prop:_game/pinfo/{&player}/{:2},$laser}},{:1}: {default:{abs:{&_c}},-none-} ({if:{gt:{set:smod,{mult:{:3},{&_c}}},0},+}{&smod})}

@set $laser=_game/scoring/rankings/places:{with:places,{sublist:{lsort:{listprops:_game/pinfo/{&player}/visits/,$laser},l1,l2,{gt:{prop:{&l2},$laser},{prop:{&l1},$laser}}},1,5},{with:i,1,{parse:pl,{&places},{&i}. {coords:{subst:{&pl},_game/pinfo/{&player}/visits/,}} - {prop:{&pl},$laser} visits{null:{inc:i}}}}}

@set $laser=_game/scoring/rankings/targets:{with:hits,{subst:{sublist:{lsort:{listprops:_game/pinfo/{&player}/shot/hit/p/,$laser},p1,p2,{gt:{prop:{&p2},$laser},{prop:{&p1},$laser}}},1,5},_game/pinfo/{&player}/shot/hit/p/,},{with:i,0,{parse:p,{&hits},{inc:i}. {name:{&p}} ({with:s,{prop:_game/pinfo/{&player}/shot/hit/p/{&p},$laser},{&s} hit{if:{ne:{&s},1},s}})}}}

@set $laser=_game/scoring/rankings/stakeouts:{with:so,{sublist:{lsort:{listprops:_game/pinfo/{&player}/shot/loc/,$laser},l1,l2,{gt:{prop:{&l2},$laser},{prop:{&l1},$laser}}},1,5},{with:i,0,{parse:p,{&so},{inc:i}. {coords:{subst:{&p},_game/pinfo/{&player}/shot/loc/,}} - {prop:{&p},$laser} shots}}}

@act ranking=$lasertop=$laser:ranking=$nothing

@succ $laser:ranking={lexec:succ}

lsedit $laser:ranking=succ

.del ^ $

{if:{&arg},

{with:player,{ref:me},

{if:{gt:{count:{&arg}, },1},

{null:

{lexec:func/findplayer,$laser},

{set:player,{findplayer:{sublist:{&arg},1,1, }}},

{set:arg,{sublist:{&arg},2,2, }}}}

{if:{prop:_game/scoring/rankings/{&arg},$laser},

{if:{propdir:_game/pinfo/{&player},$laser},

{if:{dbeq:me,{&player}},Your,{name:{&player}}'s} Favorite {&arg}:{nl}

{exec:_game/scoring/rankings/{&arg},$laser},

<< {name:{&player}} has no stats for this game. >>},

No such ranking available.}},

Syntax: ranking {nl} ranking {nl}

Available rankings are: {commas:{listprops:_game/scoring/rankings,$laser}, and ,r,{subst:{&r},_game/scoring/rankings/,}}}

.end

@act otherstuff=$lasertop=$laser:otherstuff=$nothing

@succ $laser:otherstuff={lexec:succ}

lsedit $laser:otherstuff=succ

.del ^ $

{with:player,{ref:me},

   {if:{&arg},
       {null:
   		{lexec:func/findplayer,$laser},
   		{set:player,{findplayer:{sublist:{&arg},1,1, }}}}},

Other stuff for {prop:_game/pinfo/{&player}/name,$laser}\r

Objects Hit: {prop:_game/pinfo/{&player}/shot/hit/objects,$laser}\r

Rooms Hit: {prop:_game/pinfo/{&player}/shot/hit/rooms,$laser}\r

Healthpacks Used: {prop:_game/pinfo/{&player}/healthpack/count,$laser}\r

Average HP/pack: {div:{prop:_game/pinfo/{&player}/healthpack/recovered,$laser},{prop:_game/pinfo/{&player}/healthpack/count,$laser}}\r

Final Coordinates: ({prop:_game/pinfo/{&player}/lastx,$laser}\, {prop:_game/pinfo/{&player}/lasty,$laser})\r

Hit by Turret: {prop:_game/pinfo/{&player}/turret/hitby,$laser}\r

Damage Received from Mines: {abs:{prop:_game/pinfo/{&player}/mine/damagereceived,$laser}}\r

Charged Weapon: {prop:_game/pinfo/{&player}/charge/count,$laser}\r

Rigging Attempts: {prop:_game/pinfo/{&player}/rig/attempts,$laser}; {prop:_game/pinfo/{&player}/rig/count,$laser} successful\r

Recharge Stations:

}

.end

@set $laser=_game/scoring/individual/rechargevariety:

lsedit $laser=resetsettings

.del ^ $

{null:

{store:1,_game/settings/mines,$laser},

{store:3,_game/settings/lives,$laser},

{store:2,_game/settings/rechargers,$laser},

{store:3,_game/settings/backfire,$laser},

{store:2,_game/settings/healthpacks,$laser},

{store:0,_game/settings/treats,$laser},

{store:1,_game/settings/missiles,$laser}

{store:2,_game/settings/overheat,$laser}}

.end

@set $laser=_game/settings/mines/info:The number of mines every player initially gets.

@set $laser=_game/settings/lives/info:The number of times that a player respawns.

@set $laser=_game/settings/healthpacks/info:The number of healthpacks on the initial grid.

@set $laser=_game/settings/missiles/info:The number of missiles every player initially gets.

@set $laser=_game/settings/rechargers/info:The number of recharge stations on the grid.

@set $laser=_game/settings/latejoiners/info:Allow players to join the game late. (1=on, 0=off)

@set $laser=_game/settings/backfire/info:Missiles backfire 1/x times.

@set $laser=_game/settings/treats/info:Shoot walls to find hidden treats! (1=on, 0=off)

@set $laser=_game/settings/overheat/info:Player can fire 5 times/x seconds. (0 permits rapid fire)

@set $laser=_game/settings/respawn_life/info:Life% after respawn

@set $laser=_game/settings/respawn_energy/info:Energy% after respawn

@set $laser=_game/settings/radar/info:Show other players on the map (1=true)

@set $laser=_game/settings/rooting/info:Spectators can root from the booth (1=true)

@set $laser=_game/settings/mines/default:1

@set $laser=_game/settings/lives/default:3

@set $laser=_game/settings/healthpacks/default:2

@set $laser=_game/settings/missiles/default:1

@set $laser=_game/settings/rechargers/default:2

@set $laser=_game/settings/latejoiners/default:1

@set $laser=_game/settings/backfire/default:3

@set $laser=_game/settings/treats/default:0

@set $laser=_game/settings/overheat/default:5

@set $laser=_game/settings/respawn_life/default:50

@set $laser=_game/settings/respawn_energy/default:50

@set $laser=_game/settings/radar/default:0

@set $laser=_game/settings/rooting/default:1

@set $laser=_game/settings/lives/max:100

@set $laser=_game/settings/healthpacks/max:15

@set $laser=_game/settings/rechargers/max:2

@set $laser=_game/settings/latejoiners/max:1

@set $laser=_game/settings/backfire/max:100

@set $laser=_game/settings/treats/max:1

@set $laser=_game/settings/overheat/max:20

@set $laser=_game/settings/respawn_life/max:100

@set $laser=_game/settings/respawn_energy/max:100

@set $laser=_game/settings/radar/max:1

@set $laser=_game/settings/rooting/max:1

@desc $laser:lobby={lexec:desc}

lsedit $laser:lobby=desc

.del ^ $

{laserhead}{nl}

{if:{gamestarted},

GAME IN PROGRESS:{nl}

{with:players,

{subst:{listprops:_game/pinfo,$laser},_game/pinfo/,},

{commas:{&players}, and ,p,{name:{&p}}} {if:{ne:{count:{&players}},1},are,is} playing.{nl}To view a player's scorecard\, type [scorecard ]. You can also use the [ranking] command to view individuals' rankings for particular stats.

{if:{lexec:cancancelgame},

{lit: }No one appears to be in the arena at the moment\, so you can [cancel] the game prematurely.}},

GAME ENDED.{nl}To view the overall scores for the previous round (#{prop:_game/count,$laser})\, type [scores {prop:_game/count,$laser}]. To view stats for an individual player\, type [scard ] or see the [ranking] command.\rTo start a new game:\r 1. Use [settings] and [set] to set the parameters.\r 2. Have each player [join] the match. Make sure everyone checks out [laserhelp] for details on how to play.\r 3. Once you have at least 2 players\, type [start] to enter the arena.}{nl}

{if:{prop:_game/joiners,$laser},{nl}NEXT GAME'S PARTICIPANTS: {commas:{prop:_game/joiners,$laser}, and ,p,{name:{&p}}}{nl}

{if:{lmember:{prop:_game/joiners,$laser},{ref:me}},To take your name off the list\, type [quit].{nl}}}{nl}

Special thanks to Naco for the original inspiration; to Ajax, Aleltai, and Jessy for feature ideas and debugging help.{nl}

{laserfoot}

.end

@act join=$laser:lobby=$laser:join=$nothing

@succ $laser:join={lexec:succ}

lsedit $laser:join=succ

.del ^ $

{if:{not:{gamestarted}},

{null:

{store:{lunique:{mklist:{prop:_game/joiners,$laser},{ref:me}}},_game/joiners,$laser},

{otell:<< {name:me} signs up for the next game. >>},

{spectatortell:{name:me} signs up for the game.}}

<< You sign up for the next game. >>,

{if:{propdir:_game/pinfo/{ref:me},$laser},

<< You step back into the game. >>

{null:

{force:$laseradmin,

@tel {ref:me}={randomroom}}},

{if:{lssetting:latejoiners},

<< You step into the game. >>

{null:

{lexec:func/reset,$laser}{resetplayer:me},

{force:$laseradmin,

@tel {ref:me}={randomroom}},

{store:{subt:{secs},{prop:_game/started,$laser}},_game/pinfo/{ref:me}/latejoiner,$laser}},

<< The ongoing game does not permit late joiners! >>}}}

.end

@set $lasertop=_msgmacs/randomroom:{prop:{lrand:{listprops:{lrand:{listprops:_reg/room/1,$laser}},$laser}},$laser}

@act quit=$lasertop=$laser:quit=$nothing

@succ $laser:quit={lexec:succ}

lsedit $laser:quit=succ

.del ^ $

{if:{gamestarted},

{if:{propdir:_game/pinfo/{ref:me},$laser},

{if:{contains:me,$laser},

<< You exit the game. >>

{null:{force:$laseradmin,@tel {ref:me}=$lobby}},

<< You're not in the game! >>},

<< You're not in the game! >>},

{if:{lmember:{prop:_game/joiners,$laser},{ref:me}},

<< You take your name off the list. >>

{null:

{store:{lremove:{prop:_game/joiners,$laser},{ref:me}},_game/joiners,$laser},

{otell:<< {pronouns:%n takes %p name off the list.} >>},

{spectatortell:{name:me} quits the game.}},

<< You're not signed up. >>}}

.end

@set $laser:lobby=_depart/doquit:,{ref:me}},<< You take your name off the list as you leave. >>{null:{store:{lremove:{prop:_game/joiners,$laser},{ref:me}},_game/joiners,$laser},{otell:<< {pronouns:%n takes %p name off the list as %s leaves.} >>}}}

lsedit $lasertop=cancancelgame

.del ^ $

{if:{count:{filter:player,{&players},{contains:{&player},$laser}}},0,1}

.end

@act cancel;cancelgame;cancel game=$laser:lobby=$laser:cancelgame=$nothing

@succ $laser:cancelgame={lexec:succ}

lsedit $laser:cancelgame=succ

.del ^ $

{with:players,

{subst:{listprops:_game/pinfo,$laser},_game/pinfo/,},

{if:{lexec:cancancelgame},

<< You cancel the ongoing game. >>


.end

@act start;startgame;start game;star=$laser:lobby=$laser:startgame=$nothing

@succ $laser:startgame={lexec:succ}

lsedit $laser:startgame=succ

.del ^ $

{if:{not:{gamestarted}},

{with:players,{prop:_game/joiners,$laser},

{if:{ge:{count:{set:players,{prop:_game/joiners,$laser}}},2},

<< You start the match. >>

{null:

{spectatortell:The game has begun.}

{lexec:func/reset,$laser},

{delprop:_game/scoring/final,$laser},

{delprop:_game/pinfo,$laser}

{delprop:_game/stats,$laser}

{delprop:_game/joiners,$laser},

{lexec:changerechargerooms,$laser},

{lexec:clearhealthpacks,$laser}

{for:i,1,{lssetting:healthpacks},1,{lexec:makehealthpack,$laser}},

{if:{lssetting:treats},

{for:i,1,{add:3,{dice:3}},1,{store:1,{lrand:{listprops:_game/room/,$laser}}/treats,$laser}}}

{store:{secs},_game/started,$laser},

{foreach:player,{&players},

{resetplayer:{&player}}

{force:$laseradmin,@tel {&player}={randomroom}}}},

<< Not enough players have joined the game. >>}},

<< A game is already in progress. >>}

.end

@act settings;set=$laser:lobby=$laser:setup=$nothing

@succ $laser:setup={lexec:{&cmd}}

lsedit $laser:setup=settings

.del ^ $

{laserhead}{nl}

[ SETUP OPTIONS ]{nl}

{parse:p,

{listprops:_game/settings/,$laser},

- {titlecase:{subst:{&p},_game/settings/,}}: {prop:{&p},$laser}

{nl} {prop:{&p}/info,$laser}}{nl}{nl}

To change a setting, type SET =.{nl}

If you omit a value, the default will be used.{nl}

{laserfoot}

.end

@lock $laser:setup=_canset?:1

@set $laser:setup=_canset?:{or:{ne:{&cmd},set},{not:{gamestarted}}}

@fail $laser:setup=<< You cannot change the settings while a game is in progress. >>

lsedit $laser:setup=set

.del ^ $

{with:setting,{sublist:{&arg},1,1,=},

{with:value,{sublist:{&arg},2,2,=},

{with:prop,,

{if:{&setting},

{if:{set:prop,

{sublist:

{listprops:_game/settings/,$laser,{&setting}*},1}},

{if:{isnum:{&value}},

{if:

{and:

{ge:{&value},0},

{or:

{not:{prop:{&prop}/max,$laser}},

{le:{&value},{prop:{&prop}/max,$laser}}}},

<< Setting stored. >>

{null:

{store:{&value},{&prop},$laser},

{otell:<< {name:me} sets '{&setting}' to '{&value}'.}},

<< Invalid setting. (min: 0; max: {prop:{&prop}/max,$laser}) >>},

<< Default setting restored. >>

{null:{store:{prop:{&prop}/default,$laser},{&prop},$laser}}},

<< Invalid setting. Type [settings] to see a list. >>},

<< Syntax: set = >>}}}}

.end

@set $lasertop=_msgmacs/laserhead:{center:====== Laser Tag ======,70,-}

@set $lasertop=_msgmacs/laserfoot:{center:==========oOo==========,70,-}

@set $lasertop=_msgmacs/titlecase:{toupper:{midstr:{:1},1}}{if:{gt:{strlen:{:1}},1},{midstr:{:1},2,-1}}

@set $lasertop=_msgmacs/gamestarted:{prop:_game/started,$laser}

@set $spectators=_scoresloop:{null:{lexec:showscores}{delay:1,{lit:{exec:_scoresloop}}}}

lsedit $spectators=showscores

.del ^ $

{if:

   {gamestarted},
       {foreach:
           player,
           {subst:{listprops:_game/pinfo,$laser},_game/pinfo/,},
               {if:{prop!:_queued},{spectatortell:{prop!:_queued}}{delprop:_queued}}
               {with:ll,{prop!:_last/{&player}/life},
               {with:le,{prop!:_last/{&player}/energy},
               {with:l,{store:{life:{&player}},,_last/{&player}/life},
               {with:e,{store:{energy:{&player}},_last/{&player}/energy},
                   {if:
                       {or:
                           {ne:{&le},{&e}},
                           {ne:{&ll},{&l}}},
                       {spectatortell:{escape}[4m{name:{&player}}{escape}[0m{if:{prop:_game/pinfo/{&player}/stunned}, *} - Life: {if:{gt:{&l},{&ll}},{escape}[32m{&l}{escape}[0m ^,{if:{eq:{&l},{&ll}},{&l} =,{escape}[31m{&l}{escape}[0m v}}  Energy: {if:{gt:{&e},{&le}},{escape}[32m{&e}{escape}[0m ^,{if:{eq:{&e},{&le}},{&e} =,{escape}[31m{&e}{escape}[0m v}}}
                   }}}}}}

.end

@act root=$spectators=$lasertop:root=$nothing

@succ $lasertop:root={lexec:succ}

lsedit $lasertop:root=succ

.del ^ $

{if:{gamestarted},

   {if:
       {lssetting:rooting},
       {if:
           {ge:
               {subt:{secs},{prop:_lastroot/{ref:me}}},
               30},
           {lexec:func/findplayer}
           {with:rootfor,
               {findplayer:{&arg}},
               {if:{&rootfor},
                   {with:boost,{add:{dice:8},3},
                       You root for {name:{&rootfor}}! (+{&boost})
                       {null:
                           {store:{secs},_lastroot/{ref:me}},
                           {otell:{name:me} roots for {name:{&rootfor}} (+{&boost})},
                           {if:
                               {contains:{&rootfor},$laser},
                               {tell:>> A spectator is rooting for you! (+{&boost}),{&rootfor}}},
                           {adjustlife:{&rootfor},{&boost}}}},
                   No such player.}}
           ,You have to wait a bit before rooting again!},
       Rooting is not permitted in this game.},
   There is no game in session.}

.end

@desc $spectators={if:{gamestarted},{lexec:showmap,$laser}--------\rIf this game allows rooting\, you can [root ] on!\rParticipants: {commas:{filter:p,{subst:{listprops:_game/pinfo/,$laser},_game/pinfo/,},{isplayer:{&p}}}, and ,p,{name:{&p}}},There is no game in progress.}