//
// Copyright(C) 2014-2015 Samuel Villarreal
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//      Rider Script Object Class
//

#include "scripts/common.txt"

//-----------------------------------------------------------------------------
//
// Rider
//
//-----------------------------------------------------------------------------

/*
==============================================================
TurokRider
==============================================================
*/

final class TurokRider : TurokEnemy
{
    TurokRider(kActor @actor)
    {
        super(actor);
    }
    
    /*
    ==============================================================
    RiderFireMissiles
    ==============================================================
    */
    
    void RiderFireMissiles(kActor @instigator, const float w, const float x, const float y, const float z)
    {
        if(self.GetTarget() is null)
        {
            return;
        }

		if (Game.GetCurrentMapID() == 53) {
			self.SpawnFx("fx/ponly_spellcast.kfx", kVec3(x, y, z));
			return;
		}

        self.SpawnFx("fx/generic_200.kfx", kVec3(x, y, z));
    }
    
    /*
    ==============================================================
    RiderFireShots
    ==============================================================
    */
    
    void RiderFireShots(kActor @instigator, const float w, const float x, const float y, const float z)
    {
        if(self.GetTarget() is null)
        {
            return;
        }
        		
		if (Game.GetCurrentMapID() == 53) {
			self.SpawnFx("fx/ponly_generic_178.kfx", kVec3(x, y, z)); //raptor missle
			return;
		}

        self.SpawnFx("fx/generic_201.kfx", kVec3(x, y, z));
    }
    
    /*
    ==============================================================
    GunFire
    ==============================================================
    */
    
    void GunFire(kActor @instigator, const float w, const float x, const float y, const float z)
    {
        if(self.GetTarget() is null)
        {
            return;
        }
		
		if (Game.GetCurrentMapID() == 53) {
			self.SpawnFx("fx/generic_178.kfx", kVec3(x, y, z)); //raptor missle
			return;
		}

        self.PlaySound("sounds/shaders/generic_8_enemy_human_gunfire.ksnd");
        
        self.SpawnFx("fx/robot_bullet.kfx", kVec3(x, y, z));
    }
    
    /*
    ==============================================================
    OnBeginLevel
    ==============================================================
    */
    
    void OnBeginLevel(void)
    {
        if(Game.GetCurrentMapID() == 2)
        {
            self.Flags() |= AF_STATIONARY;
            self.Origin().x -= (3*GAME_SCALE);
        }
    }
}
