@create Elementals @desc Elementals=A game. Type 'ehelp' for more information. @listen Elementals=Self trigger : * @aahear Elementals=@trigger [extract(%0,1,1)]ahear,[extract(%0,2,200)] &elemahear Elementals=&elemgame[setq(0,extract(%0,2,1))]%q0bidstatus me=u(elemgame%q0bidstatus)X;@switch u(elemgame%q0bidstatus)=XX,{@trigger elemextend_endround,%q0} &elemvalidflags Elementals=B W U V &elemflagnameB=bids &elemflagnameW=people looking &elemflagnameU=unchangeables &elemflagnameV=who is watching &elemextend_endround Elementals=[setq(1,u(elemfn_wintext,setq(0,u(elemfn_winner,%0))%q0,%0))]&elemgame%0scores me=[extract(setq(2,u(elemgame%0scores))%q2,1,sub(u(elemgame%0bid%q0),1))] [add(extract(%q2,u(elemgame%0bid%q0),1),switch(%q0,0,0,1,-1,2,1))] [extract(%q2,add(u(elemgame%0bid%q0),1),30)]; {@dolist [u(elemfn_interested,%0)]=@pemit ##=%q1%r[u(elemfn_display,%0,##)]}; @switch [member(u(elemgame%0scores),[switch(%q0,1,-)][u(elemgame%0width)])]=0,,{@trigger elemextend_endgame,%0,%q0} &elemextend_endgame Elementals=@trigger elemextend_destroygame,%0,[u(elemname)] game %0 is finished. [name(u(elemfn_playerdbref,%0,%1))] is the winner. &elemextend_destroygame Elementals=&elemgames me=setdiff(u(elemgames),%0);{@dolist [u(elemfn_interested,%0)]=@pemit ##=%1} &elemextend_setup Elementals=@switch [switch(gt(add(1,setq(0,member(%1,2,1,=))%q0),1),1,[switch(setq(1,upcase(member(%1,1,1,=))%q1,WIDTH,1,HEIGHT,[gte(%q0,3)],RANGE,[lte(%q0,div(u(elemgame%0height),2)],0)]))]=1,{&elemgame%0%q1 me=%q0;&elemgame%0scores me=repeat(0%b,u(elemgame%0height));@dolist u(elemfn_interested,%0)=@pemit ##=[u(elemname)] game %0 %q1 changed to %q0.},@pemit %2=Setup option invalid : '%1'. &elemcommand_ehelp Elementals=$ehelp*:@pemit %#=[u(fn_help,elem,%0)] &elemcommand_ewatch Elementals=$ewatch* *:@switch u(elemfn_gameexists,%1)=0,@pemit %#=[u(elemname)] game %1 is not in play.,{@pemit %#=Now [switch(upcase(%0),OFF,ignoring,watching)] [u(elemname)] game %1;&elemgame%1watch me=[switch(upcase(%0),OFF,setdiff(u(elemgame%1watch),%#),setunion(u(elemgame%1watch),%#));@dolist u(elemfn_interested,%1,W,%#)=@pemit ##=%n [switch(upcase(%0),OFF,stops,starts)] watching [u(elemname)] game %1.} &elemcommand_ekill Elementals=$ekill *:@switch or(u(elemfn_playernum,%#,%0),eq(%#,owner(me)))=0,@pemit %#=You must be part of a game to be allowed to destroy it.,{@trigger elemextend_destroygame,%0,[u(elemname)] game %0 destroyed by %n.} &elemcommand_elist Elementals=$elist:@pemit %#=[u(fn_centreline,40,u(elemname) games in progress)]%r[iter(u(elemgames),## - [name(u(elemfn_playerdbref,##,1))][switch(u(elemgame##bid1),,,*)] vs [name(u(elemfn_playerdbref,##,2))][switch(u(elemgame##bid2),,,*)], round [u(elemgame##round)].%r)][repeat(-,40)] &elemcommand_eview Elementals=$eview *:@pemit %#=switch(u(elemfn_gameexists,%0),0,[u(elemname)] game 0 does not exist.,[u(elemfn_display,%0)]); &elemcommand_enew Elementals=$enew *:@switch setq(0,u(fn_findplayer,%0))=,@pemit %#=Cannot find opponent '%0'.,@emit [u(elemname)] game [setq(1,u(elemfn_findfree))]%q1 started twixt %n and [name(%q0)].;&elemgames me=setunion(u(elemgames),%q1);&elemgame%q1players me=%# %q0;&elemgame%q1height me=5;&elemgame%q1width me=3;&elemgame%q1score me=0 0 0 0 0;&elemgame%q1range me=2;&elemgame%q1watch me=;&elemgame%q1round me=0;&elemgame%q1bid1=;&elemgame%q1bid2=;&elemgame%q1bid0=1;&elemgame%10bidstatus= &elemcommand_ebid Elementals=$ebid *=*:@switch [setq(0,u(elemfn_playernum,%#,%0))][setq(1,u(elemfn_bidproblems,%0,%1,%q0))]%q1=,{&elemgame%0bid%q0 me=%1;@pemit me=Self trigger : elem game %0 bid placed.;@pemit %#=Bid placed in [u(elemname)] game %0;@dolist [u(elemfn_interested,%0,B,%#)]=@pemit ##=%n places %p bid in [u(elemname)] game %0.},@pemit %#=%q1 &elemcommand_esetup Elementals=$esetup *=*:@switch [setq(0,u(elemfn_setupproblems,%0,%#))]%q0=,{@dolist %1=@trigger elemextend_setup,%0,##,%#},@pemit %#=%q0 &elemcommand_eignore Elementals=$eignore * *:@switch member(u(elemvalidflags),%0)=0,@pemit %#=%0 is not a valid flag.,{@pemit %#=Now [switch(upcase(%1),OFF,watching,ignoring)] [u(elemflagname%0)].;&eleminterestflag%0 me=[switch(upcase(%1),OFF,setdiff(u(eleminterestflag%0),%#),setunion(u(eleminterestflag%0),%#))]} &elemfn_winner Elementals=[setq(0,u(elemgame%0bid1))][setq(1,u(elemgame%0bid2))][switch([lte(setq(2,mod(add(sub(%q0,%q1),mul(2,u(elemgame%0height))),u(elemgame%0height)))%q2,u(elemgame%0range))][lte(sub(u(elemgame%0height),%q2),u(elemgame%0range))][eq(%q0,%q1)],100,1,010,2,0)] &elemfn_wintext Elementals=The bids are : [name(u(elemfn_playerdbref,%1,1))] [u(elemgame%1bid1)], [name(u(elemfn_playerdbref,%1,2))] [u(elemgame%1bid2)]%r[switch(%0,0,The round is drawn.,[name(u(elemfn_playerdbref,%1,%0))] wins one of element [u(elemgame%1bid%0)] from [name(u(elemfn_playerdbref,%1,sub(2,%0)))].)] &elemfn_setupproblems Elementals=[switch(u(elemfn_playernum,%1,%0),0,You're not playing in game %0.%b)][switch(u(elemgame%0round),0,,Game %0 has already begun.)] &elemfn_bidproblems Elementals=[switch([or(lt(%1,0),gt(%1,u(elemgame%0height)),1,Bid out of range.%b)][switch(%2,0,You aren't playing in game %0.%b)][switch(u(elemgame%0bid%2),,,Your bid is already placed.)] &elemfn_findfree Elementals=[extract(setdiff(lnum(100),u(elemgames),1,1)] &elemfn_gameexists Elementals=[and(1,member(u(elemgames),%0))] &elemfn_display Elementals=[u(fn_centreline,40,[u(elemname)] game %0 round [u(elemgame%0round)])]%r[ljust([switch(u(elemgame%0bid1),,,*)][name(u(elemfn_playerdbref,%0,1))],11)] %b [rjust([name(u(elemfnplayerdbref,%0,2))][switch(u(elemgame%0bid2),,,*)],11)][iter(lnum(u(elemgame%0height)),%r[repeat(%b,sub(12,u(elemgame%0width)))][repeat(-,add(u(elemgame%0width),extract(u(elemgame%0score),add(##,1),1)))][add(1,##)][repeat(-,sub(u(elemgame%0width),extract(u(elemgame%0score),add(##,1),1)))])]%r @edit Elementals/elemfn_diplay=$,{[switch(member(u(eleminterestflagU),%1),0,Elementals have a range of [u(elemgame%0range)].%r)][switch(member(u(eleminterestflagV),%1),0,u(elemfn_watchingnames,%0).%r)][repeat(-,40)]} &elemfn_watchingnames Elementals=[switch(u(elemgame%0watch),,There is nobody watching except the players,Watching the game are : iter(u(elemgame%0watch),name(##)))] &elemfn_playernum Elementals=[member(u(elemgame%1players),%0)] &elemfn_playerdbref Elementals=[extract(u(elemgame%0players),%1,1)] &elemfn_interested Elementals=[setdiff(setdiff(setunion(u(elemgame%0watch),u(elemgame%0players)),u(eleminterestflag%1)),%2)] &fn_centreline Elementals=[setq(0,repeat(-,sub(%0,strlen(%1))))][ljust(%q0%1%q0,%0)] &fn_help Elementals=[switch(setq(0,u(help%0%1))%q0,,{Sorry, no %0help found on '%1'.},%q0)] &fn_findplayer Elementals=[switch(num(%0),#-1,,num(%0))] &helpelem Elementals=[u(elemname)] is a psychological game, bearing a vague resemblance to scissors-stone-paper, only with a far greater element of psychology and a bit more complexity.%rFor further information, try these topics (EHELP ):%rSTORY, PLAY, COMMANDS.%rElementals was written by RavenBlack.%rraven@ravenblack.net%rhttp://www.ravenblack.net/ &helpelemstory Elementals=A ravaged world, two wizards more powerful by far than any other, with a conflict of interest - they both want everything.%rOf like mind, they summon creatures of the elements of their world and bid them destroy the other.%rAs the elements collide, the wizards get closer to destroying the other. With powers matching, their hopes lie in defeating their adversary by mind.%rWater flows over fire, soil absorbs water, Purple (an element not found on earth) dries and cracks the soil... &helpelemplay Elementals=How to play [u(elemname)]:%rTo begin a game, use the command 'ENEW (opponent)'.%rA game's SETTINGS can be adjusted with the command 'ESETUP' once the game is created.%rEach round, both players choose an element, by number, with the command 'EBID (game)=(element)'.%rOnce both players have chosen, the elements battle. The winning element gains a power of that element for its owner. In the event of neither element winning, neither player gains or loses.%r @edit elementals/helpelemplay=$,{An element wins if it is 'higher' than the opponent's. In the case of a game with seven elements and a range of two, the results are as follows...%rMatching elements always draw.%r %b %b|Loses to|Draws with|Beats%r %b1 | 2 , 3 %b| 4 , 5 %b %b| 6 , 7%r %b2 | 3 , 4 %b| 5 , 6 %b %b| 7 , 1%r %b3 | 4 , 5 %b| 6 , 7 %b %b| 1 , 2%rWell, you get the idea.%rThe number of elements in a game is known as the game's HEIGHT.%rThe number of powers more than your opponent you need is th} @edit elementals/helpelemplay=$,{e WIDTH. The range at which elements win is the RANGE. (a range of 1 would mean 3 would beat 2, lose to 4, and draw otherwise). The first player to have enough power of one element is the winner. The default settings are WIDTH=3, HEIGHT=5, RANGE=2.%rFor an example, see EVIEW.%rSee also : COMMANDS.} &helpelemcommands Elementals=The commands for [u(elemname)] are:%rEHELP (topic) - display help on (topic), if available%rENEW (opponent) - start a new game against (opponent)%rESETUP (game)=(settings) %rEBID (game)=(element) - casts an (element) spell in game number (game)%rEKILL (game) - destroys game number (game).%rEWATCH (game) - lets you watch the proceedings in a game you're not playing.%rEWATCHOFF (game) - stops the watching spam.%rELIST - lists all games in play.%r @edit elementals/helpelemcommands=$,{EVIEW (game) - displays the current power levels etc. of game number (game).%rEIGNORE (flag) (on/off) - Ignores certain parts of game update. %rAny of the commands can be seen in further detail with 'EHELP (command)'} &helpelemehelp Elementals=Hey, c'mon, you obviously know how to work EHELP, you're using it! &helpelemenew Elementals=ENEW (opponent)%rBegins a new game between yourself and (opponent). Everyone in the room will be informed of the new game and its number. If you wish to change the default settings, do so immediately after ENEW.%rRelated commands : ESETUP, EKILL, COMMANDS. &helpelemesetup Elementals=ESETUP (game)=(settings)%rThis can only be done after a game has been created with ENEW, and before it has been started. Changing the settings without the opponent's agreement is frowned upon. The available settings are WIDTH, HEIGHT and RANGE.%rEg. ESETUP 2 = WIDTH=4, HEIGHT=7, RANGE=3%r %b %bESETUP 0 = HEIGHT=7%rIt is possible to set up stupid games, for example with a range greater than its height, resulting only in draws. If a game is started like this, it must be EKILL'ed.%r @edit elementals/helpelemsetup=$,{The WIDTH of a game indicates how many of a particular element you have to have more than your opponent to win.%rThe HEIGHT of a game is how many different elements there are.%rThe RANGE of a game is how many elements each element can beat. (eg. A range of 3 means that element 4 would beat 1 2 or 3. A range of 1 means it could only beat 3.)} &helpelemebid Elementals=EBID (game)=(element)%rChooses your element for the current round. This cannot be changed later.%rYou must be one of the players of game number (game) to EBID in the game.%rSee also : ENEW, EKILL, COMMANDS. &helpelemekill Elementals=EKILL (game)%rDestroys game number (game). You must be one of the players to do this.%rDestroying a game just because the opponent is winning is frowned upon.%rSee also : ENEW, COMMANDS. &helpelemewatch Elementals=EWATCH (game) and EWATCHOFF (game)%rFor people not playing in a game, this command lets them see when players choose their spells, what the results of a round are, who else is watching, and other updates. %rSee also : EIGNORE, COMMANDS. &helpelemewatchoff Elementals=[u(helpelemewatch)] &helpelemelist Elementals=ELIST%rLists all games in progress, their players (indicating with a * those players who have already made their choice of spell for the round) and the round number. &helpelemeview Elementals=EVIEW (game)%rGives a full status report of game number (game) as it currently stands.%rAn example display for a small game looks like this...%r[u(fn_centreline,40,u(elemname) game 3 round 2)]%rBob %b %b %b %b %b RavenBlack*%r %b %b %b %b ---1---%r %b %b %b %b --2----%r %b %b %b %b -----3-%rElementals have a range of 1.%rWatching this game are : Tim Zebedee Florence.%r[repeat(-,40)]%rThis is an example of a HEIGHT 3, WIDTH 3, RANGE 1 game.%r @edit Elementals/helpelemeview=$,{In this example, Bob is winning by one of element 2, but losing by two of element 3. If RavenBlack wins one more of element 3, he wins the game.%rSee also : EWATCH, ELIST, COMMANDS. &helpelemeignore Elementals=EIGNORE (flag) (ON/OFF)%rThe valid flags are:[iter(u(elemvalidflags),%r## - [u(elemflagname##)])]%rTurning a flag ON means you won't see the updates that flag controls.%rThe command EVIEW ignores these flags, giving a full update.%rSee also : EWATCH, EVIEW, COMMANDS.