111 lines
2.4 KiB
Plaintext
111 lines
2.4 KiB
Plaintext
![]() |
extern void object::Attack( )
|
|||
|
{
|
|||
|
int list[], i;
|
|||
|
object p;
|
|||
|
float dist;
|
|||
|
point dest;
|
|||
|
|
|||
|
errmode(0); // ne stoppe pas si erreur
|
|||
|
while ( ismovie() != 0 ) wait(1);
|
|||
|
|
|||
|
i = 0;
|
|||
|
list[i++] = WingedGrabber;
|
|||
|
list[i++] = TrackedGrabber;
|
|||
|
list[i++] = WheeledGrabber;
|
|||
|
list[i++] = LeggedGrabber;
|
|||
|
list[i++] = WingedShooter;
|
|||
|
list[i++] = TrackedShooter;
|
|||
|
list[i++] = WheeledShooter;
|
|||
|
list[i++] = LeggedShooter;
|
|||
|
list[i++] = WingedOrgaShooter;
|
|||
|
list[i++] = TrackedOrgaShooter;
|
|||
|
list[i++] = WheeledOrgaShooter;
|
|||
|
list[i++] = LeggedOrgaShooter;
|
|||
|
list[i++] = WingedSniffer;
|
|||
|
list[i++] = TrackedSniffer;
|
|||
|
list[i++] = WheeledSniffer;
|
|||
|
list[i++] = LeggedSniffer;
|
|||
|
list[i++] = Thumper;
|
|||
|
list[i++] = PhazerShooter;
|
|||
|
list[i++] = Recycler;
|
|||
|
list[i++] = Shielder;
|
|||
|
list[i++] = Subber;
|
|||
|
list[i++] = Me;
|
|||
|
list[i++] = Derrick;
|
|||
|
list[i++] = BotFactory;
|
|||
|
list[i++] = PowerStation;
|
|||
|
list[i++] = Converter;
|
|||
|
list[i++] = RepairCenter;
|
|||
|
list[i++] = DefenseTower;
|
|||
|
list[i++] = ResearchCenter;
|
|||
|
list[i++] = RadarStation;
|
|||
|
list[i++] = ExchangePost;
|
|||
|
list[i++] = PowerPlant;
|
|||
|
list[i++] = AutoLab;
|
|||
|
list[i++] = NuclearPlant;
|
|||
|
list[i++] = Titanium;
|
|||
|
// list[i++] = PowerCell;
|
|||
|
list[i++] = NuclearCell;
|
|||
|
|
|||
|
while ( true )
|
|||
|
{
|
|||
|
if ( load == null ) // ne porte rien ?
|
|||
|
{
|
|||
|
p = radar(OrgaMatter); // cherche mati<74>re
|
|||
|
if ( p == null )
|
|||
|
{
|
|||
|
jet(1); // monte
|
|||
|
dest = position;
|
|||
|
dest.x += (rand()-0.5)*10;
|
|||
|
dest.y += (rand()-0.5)*10;
|
|||
|
goto(dest); // va n'importe o<>
|
|||
|
wait(2);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
dest = p.position;
|
|||
|
dest.z = position.z;
|
|||
|
dist = distance(dest, position);
|
|||
|
if ( dist > 1.25 )
|
|||
|
{
|
|||
|
jet(1); // monte
|
|||
|
goto(p.position); // va sur la mati<74>re
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
jet(-1); // descend
|
|||
|
while ( altitude > 0 );
|
|||
|
grab(); // prend la mati<74>re
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else // porte mati<74>re ?
|
|||
|
{
|
|||
|
jet(1); // monte
|
|||
|
p = radar(list, 0, 360, 0, 1000, 1, FilterOnlyLanding);
|
|||
|
if ( p == null )
|
|||
|
{
|
|||
|
dest = position;
|
|||
|
dest.x += (rand()-0.5)*10;
|
|||
|
dest.y += (rand()-0.5)*10;
|
|||
|
goto(dest); // va n'importe o<>
|
|||
|
wait(2);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
dest = p.position;
|
|||
|
dest.z = position.z;
|
|||
|
dist = distance(dest, position);
|
|||
|
if ( dist > 1.25 )
|
|||
|
{
|
|||
|
goto(p.position); // va sur la cible
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
drop(); // l<>che la mati<74>re
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|