home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / colobotdemo / colobotdemo10e.exe / script / wasp03.txt < prev    next >
Text File  |  2001-06-10  |  2KB  |  111 lines

  1. extern void object::Attack( )
  2. {
  3.     int        list[], i;
  4.     object    p;
  5.     float    dist;
  6.     point    dest;
  7.  
  8.     errmode(0);  // ne stoppe pas si erreur
  9.     while ( ismovie() != 0 )  wait(1);
  10.  
  11.     i = 0;
  12.     list[i++] = WingedGrabber;
  13.     list[i++] = TrackedGrabber;
  14.     list[i++] = WheeledGrabber;
  15.     list[i++] = LeggedGrabber;
  16.     list[i++] = WingedShooter;
  17.     list[i++] = TrackedShooter;
  18.     list[i++] = WheeledShooter;
  19.     list[i++] = LeggedShooter;
  20.     list[i++] = WingedOrgaShooter;
  21.     list[i++] = TrackedOrgaShooter;
  22.     list[i++] = WheeledOrgaShooter;
  23.     list[i++] = LeggedOrgaShooter;
  24.     list[i++] = WingedSniffer;
  25.     list[i++] = TrackedSniffer;
  26.     list[i++] = WheeledSniffer;
  27.     list[i++] = LeggedSniffer;
  28.     list[i++] = Thumper;
  29.     list[i++] = PhazerShooter;
  30.     list[i++] = Recycler;
  31.     list[i++] = Shielder;
  32.     list[i++] = Subber;
  33.     list[i++] = Me;
  34.     list[i++] = Derrick;
  35.     list[i++] = BotFactory;
  36.     list[i++] = PowerStation;
  37.     list[i++] = Converter;
  38.     list[i++] = RepairCenter;
  39.     list[i++] = DefenseTower;
  40.     list[i++] = ResearchCenter;
  41.     list[i++] = RadarStation;
  42.     list[i++] = ExchangePost;
  43.     list[i++] = PowerPlant;
  44.     list[i++] = AutoLab;
  45.     list[i++] = NuclearPlant;
  46.     list[i++] = Titanium;
  47. //    list[i++] = PowerCell;
  48.     list[i++] = NuclearCell;
  49.  
  50.     while ( true )
  51.     {
  52.         if ( load == null )  // ne porte rien ?
  53.         {
  54.             p = radar(OrgaMatter);  // cherche matiΦre
  55.             if ( p == null )
  56.             {
  57.                 jet(1);  // monte
  58.                 dest = position;
  59.                 dest.x += (rand()-0.5)*10;
  60.                 dest.y += (rand()-0.5)*10;
  61.                 goto(dest);  // va n'importe o∙
  62.                 wait(2);
  63.             }
  64.             else
  65.             {
  66.                 dest = p.position;
  67.                 dest.z = position.z;
  68.                 dist = distance(dest, position);
  69.                 if ( dist > 1.25 )
  70.                 {
  71.                     jet(1);  // monte
  72.                     goto(p.position);  // va sur la matiΦre
  73.                 }
  74.                 else
  75.                 {
  76.                     jet(-1);  // descend
  77.                     while ( altitude > 0 );
  78.                     grab();  // prend la matiΦre
  79.                 }
  80.             }
  81.         }
  82.         else  // porte matiΦre ?
  83.         {
  84.             jet(1);  // monte
  85.             p = radar(list, 0, 360, 0, 1000, 1, FilterOnlyLanding);
  86.             if ( p == null )
  87.             {
  88.                 dest = position;
  89.                 dest.x += (rand()-0.5)*10;
  90.                 dest.y += (rand()-0.5)*10;
  91.                 goto(dest);  // va n'importe o∙
  92.                 wait(2);
  93.             }
  94.             else
  95.             {
  96.                 dest = p.position;
  97.                 dest.z = position.z;
  98.                 dist = distance(dest, position);
  99.                 if ( dist > 1.25 )
  100.                 {
  101.                     goto(p.position);  // va sur la cible
  102.                 }
  103.                 else
  104.                 {
  105.                     drop();  // lΓche la matiΦre
  106.                 }
  107.             }
  108.         }
  109.     }
  110. }
  111.