var Constructor = function()
{
    this.getWeatherName = function()
    {
        return qsTr("Solar Flare");
    };

    this.getDescription = function()
    {
        return qsTr("A massive solar flare causing a global EMP. Severe electronic failure blinds and disables all non-infantry units.");
    };

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

    this.getVisionrangeModifier = function(weather, map, unit, terrain)
    {
        if (unit !== null && unit !== undefined)
        {
            if (unit.getUnitType() !== GameEnums.UnitType_Infantry)
            {
                return -99;
            }
        }
        return 0;
    };

    this.onStartOfTurn = function(weather, unit, map)
    {
        if (unit.getUnitType() !== GameEnums.UnitType_Infantry)
        {
            if (!unit.getWeatherImmune())
            {
                if (unit.getOwner() === map.getCurrentPlayer())
                {
                    unit.setHasMoved(true);
                    unit.addOffensiveBonus(-999, 1);
                }
            }
        }
    };

    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", "#80FF8000", 3000, true);
        
        animation.setSound("solar_emp.wav"); 
        animation.setStartOfAnimationCall("ANIMATION", "preOnAnimationChangedAnimation");
        
        if (queueAnimation !== null)
        {
            queueAnimation.queueAnimation(animation);
        }
    };

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

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