the moon (#932)

(an instance of generic thing made by Marcus)

                      MO
                       ON
     Shine the sharp horns of a crescent moon waxing to full
              above a horizon of a range of clouds........

Go to location of this object, a peregrination.



VERB SOURCE CODE:

moon_phase:
p = (time() - #932.calibration) % #932.period;
waxing = "";
phased = args[2];
if ((p < 86400) || (p > (#932.period - 86400)))
    phase = phased.new_moon_msg;
elseif ((p > ((#932.period / 2) - 86400)) && (p < ((#932.period / 2) + 86400)))
    phase = phased.full_moon_msg;
else
    if (((p > ((#932.period / 4) - 129600)) && (p < ((#932.period / 4) + 129600))) 
|| ((p > (((this.period * 3) / 4) - 129600)) && (p < (((this.period * 3) / 4) + 129600))))
        phase = phased.half_moon_msg;
    elseif ((p < (#932.period / 4)) || (p > ((#932.period * 3) / 4)))
        phase = phased.crescent_moon_msg;
    else
        phase = phased.gibbous_moon_msg;
    endif
    if (p > (#932.period / 2))
        waxing = phased.moon_waning_msg;
    else
        waxing = phased.moon_waxing_msg;
    endif
endif
if (typeof(args[1]) == STR)
    s = strsub(args[1], "%waxing?", waxing);
    return strsub(s, "%moonphase", phase);
elseif (typeof(args[1]) == LIST)
    l = {};
    for s in (args[1])
        s = strsub(s, "%waxing?", waxing);
        s = strsub(s, "%moonphase", phase);
        l = {@l, s};
    endfor
    return l;
else
    return args[1];
endif
.


phase:
this.location:announce_all(this:moon_phase("There shine%moonphase%waxing?"));
.


look_self:
desc = this:moon_phase(this:description(), this);
if (desc)
    player:tell_lines(this:moon_phase(desc, this));
else
    player:tell("You see nothing special.");
endif
.



PROPERTY DATA:
      full_moon_msg
      new_moon_msg
      half_moon_msg
      gibbous_moon_msg
      crescent_moon_msg
      moon_waxing_msg
      moon_waning_msg
      calibration
      period