# Obsidian
# by Eric Foley, 5/97

{From the tales of the bards, Vol. XIII...

Having been disappointed with the development
of Emerald, the Lord of the Darkbringers set
about to find a way that he could enter the
mortal arena at his own tournament without
completely embarassing himself.  So long had
it been since he had last designed a mortal
robot by actually starting with a mortal, as
opposed to designing a titan and then
stripping it down to mortal hardware, that
the Dark RoboMaster began to fear that he
would never again gain one of the prizes that
had last been his way back in the Sixth
Tournament.

Then he came upon an idea.  Having observed
that in the last two tournaments, hellbores
had been all but completely abandoned as
useless by the dashers of the world, he hit
upon the idea of designing a machine that
would open combat by putting up a shield so
stiff that few of the missile-using dashers
could penetrate both it and the machine's
armor.  He soon found that someone had
already put this idea into a machine called
the Magic Sword, but this did not deter him.

He first tried to construct a fadeaway
machine, but soon found that he could not
grant the machine the intelligence to
properly support the tactic with the finesse
it needed, and thus the fruit of his labor
would lose the advantage gained against
dashers with poor performance against non-
dashers.  Finally he wound up putting
together a hesitating machine gunner that,
to his chagrin, was a lot more similar to
Magic Sword than he would have liked.  This
heavily-armored bot was called Obsidian.

Obsidian differed from Magic Sword in several
ways, however.  It would take some pains in
group mode to see to it that he at least
didn't wander right into a crowd to open
things up, hopefully hiking his survival
points a bit.  In solo mode, Obsidian would
not fire just one shot, but two -- one aimed
at where an enemy would be if they followed
a constant speed and course, and another
aimed slightly behind that, in order to
destroy other hesitator machines.  In
addition, Obsidian would wander out into the
arena if he saw an enemy directly ahead of
him in solo mode.

The spray, the diversion of its course, and
the "Prepare to die" speech at the beginning
of combat almost brought a nostalgic warmth
to the Dark Lord's heart, mindful of a
certain ancient standby that had won him
much glory in elder days.  Casting off such
fuzzy emotions quickly, he sent Obsidian in
both an individual and team incarnation into
the tournament, halfway confident that both
versions would at least be solid contenders.}

#!!NoStoWarnings

    1 history' setparam
    history 0 > NoSound ifg
    snd5
NoSound:
    20 top' setparam
    280 bottom' setparam
    20 left' setparam
    280 right' setparam
    StartE top' setint
    StartS right' setint
    StartW bottom' setint
    StartN left' setint
    LookOutYouIdiot wall' setint
    95 shield' sto
    Robots 2 > GroupMode ifg
    Spray range' setint
    x y > SoloStartNE ifg
    300 x - y > SoloStartW ifg

SoloStartS:
    y 270 > StartW if
    6 speedy' sto
    x 150 > -2 * 1 + speedx' sto
    MidLoop rti

LookOutYouIdiot:
    x 10 < StartN ifg
    x 290 > StartS ifg
    y 10 < StartE ifg
    y 290 > StartW ifg
    rti

SoloStartW:
    x 30 < StartN if
    -6 speedx' sto
    y 150 > -2 * 1 + speedy' sto
    MidLoop rti

SoloStartNE:
    300 x - y > SoloStartN ifg
SoloStartE:
    x 270 > StartS if
    6 speedx' sto
    y 150 > -2 * 1 + speedy' sto
    MidLoop rti

SoloStartN:
    y 30 < StartE if
    -6 speedy' sto
    x 150 > -2 * 1 + speedx' sto
    MidLoop rti

Shoot:
    doppler
    range dup 60 < and GroupKill ifg
    -12 arctan aim + aim' sto
    18 fire' sto
    Robots 3 < SpraySwap ifg
    rti

SpraySwap:
    Spray range' setint
    snd6
    rti

Spray:
    aim doppler
    range dup 80 < and Kill ifg
    dup 2 roll 5 * + aim' sto
    9 fire' sto
    -2 * aim + aim' sto
    9 fire' sto
    speedx speedy arctan aim = HeadOut ifg
    rti

HeadOut:
    aim 30 + dup 9 sin speedx' sto
    -9 cos speedy' sto
    rti

GroupKill:
    drop
    100 50
    sync
    range dup 60 < and not Hold ifg
    bullet' sto bullet' sto
    snd4
    rti

Kill:
    sync
    range not Hold ifg
    snd4
    100 bullet' sto
    100 bullet' sto
Hold:
    drop drop
    rti

StartN:
    drop
    0 speedx' sto
    10 x - movex' sto
    -6 speedy' sto
    WestWallLoop rti

StartW:
    drop
    0 speedy' sto
    290 y - movey' sto
    -6 speedx' sto
    SouthWallLoop rti
    
StartS:
    drop
    0 speedx' sto
    290 x - movex' sto
    6 speedy' sto
    EastWallLoop rti

StartE:
    drop
    0 speedy' sto
    10 y - movey' sto
    6 speedx' sto
    NorthWallLoop rti

MidLoop:
    0 aim' sto
    40 aim' sto
    80 aim' sto
    120 aim' sto
    160 aim' sto
    200 aim' sto
    240 aim' sto
    280 aim' sto
    320 aim' sto
    10 aim' sto
    50 aim' sto
    90 aim' sto
    130 aim' sto
    170 aim' sto
    210 aim' sto
    250 aim' sto
    290 aim' sto
    330 aim' sto
    20 aim' sto
    60 aim' sto
    100 aim' sto
    140 aim' sto
    180 aim' sto
    220 aim' sto
    260 aim' sto
    300 aim' sto
    340 aim' sto
    30 aim' sto
    70 aim' sto
    110 aim' sto
    150 aim' sto
    190 aim' sto
    230 aim' sto
    270 aim' sto
    310 aim' sto
    350 aim' sto
    MidLoop rti

# Wall loops

WestWallLoop:
    0 aim' sto
    30 aim' sto
    60 aim' sto
    90 aim' sto
    120 aim' sto
    150 aim' sto
    180 aim' sto
    10 aim' sto
    40 aim' sto
    70 aim' sto
    100 aim' sto
    130 aim' sto
    160 aim' sto
    20 aim' sto
    50 aim' sto
    80 aim' sto
    110 aim' sto
    140 aim' sto
    170 aim' sto
    WestWallLoop rti

NorthWallLoop:
    90 aim' sto
    120 aim' sto
    150 aim' sto
    180 aim' sto
    210 aim' sto
    240 aim' sto
    270 aim' sto
    100 aim' sto
    130 aim' sto
    160 aim' sto
    190 aim' sto
    220 aim' sto
    250 aim' sto
    110 aim' sto
    140 aim' sto
    170 aim' sto
    200 aim' sto
    230 aim' sto
    260 aim' sto
    NorthWallLoop rti

EastWallLoop:
    180 aim' sto
    210 aim' sto
    240 aim' sto
    270 aim' sto
    300 aim' sto
    330 aim' sto
    0 aim' sto
    190 aim' sto
    220 aim' sto
    250 aim' sto
    280 aim' sto
    310 aim' sto
    340 aim' sto
    200 aim' sto
    230 aim' sto
    260 aim' sto
    290 aim' sto
    320 aim' sto
    350 aim' sto
    EastWallLoop rti

SouthWallLoop:
    270 aim' sto
    300 aim' sto
    330 aim' sto
    0 aim' sto
    30 aim' sto
    60 aim' sto
    90 aim' sto
    280 aim' sto
    310 aim' sto
    340 aim' sto
    10 aim' sto
    40 aim' sto
    70 aim' sto
    290 aim' sto
    320 aim' sto
    350 aim' sto
    20 aim' sto
    50 aim' sto
    80 aim' sto
    SouthWallLoop rti

GroupMode:
    16
    x y > GroupStartNE ifg
    300 x - y > GroupCheckW GroupCheckS ifeg

GroupStartNE:
    300 x - y > GroupCheckN GroupCheckE ifeg

SwapStartN:
    drop
    2 / dup not StartNorth ifg

GroupCheckN:
    SwapStartE range' setint
    inton
    0 aim' sto
    10 aim' sto
    350 aim' sto
    20 aim' sto
    340 aim' sto
    30 aim' sto
    330 aim' sto
    intoff

StartNorth:
    dropall
    Shoot range' setint
    SoloStartN jump

SwapStartE:
    drop
    2 / dup not StartEast ifg

GroupCheckE:
    SwapStartS range' setint
    inton
    90 aim' sto
    100 aim' sto
    80 aim' sto
    110 aim' sto
    70 aim' sto
    120 aim' sto
    60 aim' sto
    intoff

StartEast:
    dropall
    Shoot range' setint
    SoloStartE jump

SwapStartS:
    drop
    2 / dup not StartSouth ifg

GroupCheckS:
    SwapStartW range' setint
    inton
    180 aim' sto
    190 aim' sto
    170 aim' sto
    200 aim' sto
    160 aim' sto
    210 aim' sto
    150 aim' sto
    intoff

StartSouth:
    dropall
    Shoot range' setint
    SoloStartS jump

SwapStartW:
    drop
    2 / dup not StartWest ifg

GroupCheckW:
    SwapStartN range' setint
    inton
    270 aim' sto
    260 aim' sto
    280 aim' sto
    250 aim' sto
    290 aim' sto
    240 aim' sto
    300 aim' sto
    intoff

StartWest:
    dropall
    Shoot range' setint
    SoloStartW jump
