This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| crpl:docs:setdigitalis [2013/01/14 19:03] – created chani | crpl:docs:setdigitalis [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | TODO | + | <- [[crpl: |
| + | ===== SetDigitalis | ||
| + | |||
| + | ^Arguments^Result^Notation^ | ||
| + | |X, Y, Amt| |'' | ||
| + | |||
| + | |||
| + | === Description === | ||
| + | Sets Amt of Digitalis at coordinates. | ||
| + | An Amt of 1 means full health Digitalis, -1 means killed or not-yet-grown, | ||
| + | |||
| + | === Zero quirk === | ||
| + | FIXME This is based on experiment and observation, | ||
| + | |||
| + | Using this command to set the Digitalis level to zero results in never-regrowing Digitalis, even if there is Digitalis " | ||
| + | |||
| + | === Examples === | ||
| + | |||
| + | ^Weapon^Radius^Amount^ | ||
| + | |Blaster|1|.52| | ||
| + | |Mortar|3|.52| | ||
| + | |Strafer|2|.35| | ||
| + | |Bertha|10|.7| | ||
| + | |||
| + | * ** Emulating the in game weapons **\\ %% %% \\ // | ||
| + | |||
| + | Note: blasters will not injure digitalis that is uphill ever. //\\ %% %%\\ < | ||
| + | #This function takes four arguments, a centre, then a range, then an amount. | ||
| + | : | ||
| + | #Load up the arguments. | ||
| + | ->amount ->r ->y0 ->x0 | ||
| + | # | ||
| + | <-r dup mul ->r2 | ||
| + | #Consider a radius shaped box about the origin. | ||
| + | <-r 1 add 0 <-r sub do | ||
| + | <-r 1 add 0 <-r sub do | ||
| + | #Cull squares in the box not in the circle. | ||
| + | I dup mul j dup mul add <-r2 lte if | ||
| + | #Translate to our site of action. | ||
| + | I <-x0 add J <-y0 add dup2 | ||
| + | #Make sure to not inadvertently set digitalis to 0, making it never regrow | ||
| + | GetDigitalis -> | ||
| + | < | ||
| + | < | ||
| + | else | ||
| + | < | ||
| + | endif | ||
| + | endif | ||
| + | Loop | ||
| + | Loop | ||
| + | </ | ||
| + | |||
| + | * **Lay down Digitalis on 3x3 grid under a unit**\\ %% %% \\ //The reason for the 2 is that the limit is one more than the loop iterates through. | ||
| + | CurrentY 2 add CurrentY 1 sub do | ||
| + | CurrentX 2 add CurrentX 1 sub do | ||
| + | I J true SetDigitalisGrowth | ||
| + | I J 1 SetDigitalis | ||
| + | Loop | ||
| + | Loop | ||
| + | |||
| + | </ | ||