Logo Search packages:      
Sourcecode: rafkill version File versions  Download package

gun_missle.cpp

#include "gunobj.h"
#include "gun_missle.h"

#include "weapon_rocket.h"
#include "hull_weapon_rocket_normal.h"
#include "hull_weapon_rocket_heavy.h"

WeaponMissle::WeaponMissle( int z, int d, int al ):
WeaponObject( d, "Missle", 45000, al, z, 4 ) {
}


WeaponObject * WeaponMissle::copy() {
      return new WeaponMissle( strength, dir, alignment );
}


void WeaponMissle::MakeShot(int x, int y, vector< SpaceObject * > * Ammo, vector< SpaceObject * > * fight ) {

      switch( strength ) {
            case 0  : {

                  shot_counter = 17;
                  Ammo->push_back( new Rocket(x,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  break;

            }
            case 1  : {

                  shot_counter = 17;
                  Ammo->push_back( new Rocket(x-10,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x+10,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  break;

            }

            case 2  : {
                  shot_counter = 15;
                  Ammo->push_back( new Rocket(x-15,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x+15,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  break;
            }

            case 3  : {

                  shot_counter = 15;
                  Ammo->push_back( new Rocket(x-15,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x+15,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x-25,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x+25,y,0,-2.0, new NormalRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x,y-5,0,-2.0, new HeavyRocket_WHull(), alignment ) );

            }

            case 4  : {

                  shot_counter = 15;
                  Ammo->push_back( new Rocket(x-15,y+5,0,-2.0, new HeavyRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x+15,y+5,0,-2.0, new HeavyRocket_WHull(), alignment ) );
                  Ammo->push_back( new Rocket(x,   y,  0,-2.0, new HeavyRocket_WHull(), alignment ) );
                  break;
            }

      }                               //switch

}

Generated by  Doxygen 1.6.0   Back to index