var Constructor = function()
{
    this.getWeatherName = function()
    {
        return qsTr("Tropical Depression");
    };

    this.getDescription = function()
    {
        return qsTr("A severe tropical depression generating fierce winds that hinder aerial mobility, reducing the movement range of aircraft, helicopters, and drones by -1, reducing vision by -1, and producing fog of war.");
    };

    this.getWeatherTerrainSprite = function()
    {
        return "weather_rain";
    };

    this.getWeatherSymbol = function()
    {
        return "weather_symbol_tropical_depression";
    };

	this.getVisionrangeModifier = function()
	{

	    return -1;
	};
	
	this.getMovementCostModifier = function(weather, unit, terrain, map)
	{
	    var uType = unit.getUnitType();
	    if (uType === GameEnums.UnitType_Air || 
	        uType === GameEnums.REMOTE_WEAPON || 
	        uType === GameEnums.HELICOPTER || 
	        uType === GameEnums.DRONE)
	    {
	        return 1;
	    }
	    return 0;
	};
	
    this.activate = function(weather, map)
    {
        var animationCount = GameAnimationFactory.getAnimationCount();
        var queueAnimation = null;
        if (animationCount > 0)
        {
            queueAnimation = GameAnimationFactory.getAnimation(animationCount - 1);
        }
        var animation = GameAnimationFactory.createAnimation(map, 0, 0);
        
        animation.addSprite2("white_pixel", 0, 0, 3200, map.getMapWidth(), map.getMapHeight());
        animation.addTweenColor(0, "#00FFFFFF", "#80101040", 3000, true);
        
        animation.setSound("hurricane.wav"); 
        animation.setStartOfAnimationCall("ANIMATION", "preOnAnimationChangedAnimation");

        var variable = weather.getVariables().createVariable("FOGMODE");
        var fogMode = map.getGameRules().getFogMode();
        variable.writeDataInt32(fogMode);
        
        if (fogMode < GameEnums.Fog_OfWar)
        {
            map.getGameRules().setFogMode(GameEnums.Fog_OfWar);
        }
        
        if (queueAnimation !== null)
        {
            queueAnimation.queueAnimation(animation);
        }
    };
	
	this.deactivate = function(weather, map)
	{
	    var variable = weather.getVariables().getVariable("FOGMODE");
	    if (variable !== null)
	    {
	        var mode = variable.readDataInt32();
	        map.getGameRules().setFogMode(mode);
	    }
	};

    this.getDefaultWeatherChance = function()
    {
        return 0;
    };
}

Constructor.prototype = WEATHER;
var WEATHER_TROPICAL_DEPRESSION = new Constructor();