Function CampaignAI

Line
2402
Location
common.ai
Constant?
no
Type
function
Arguments
integer farms, code heroes
Returns
nothing
2402
function CampaignAI takes integer farms, code heroes returns nothing
2403
    if GetGameDifficulty() == MAP_DIFFICULTY_EASY then
2404
        set difficulty = EASY
2405
2406
        call SetTargetHeroes(false)
2407
        call SetUnitsFlee(false)
2408
2409
    elseif GetGameDifficulty() == MAP_DIFFICULTY_NORMAL then
2410
        set difficulty = NORMAL
2411
2412
        call SetTargetHeroes(false)
2413
        call SetUnitsFlee(false)
2414
2415
    elseif GetGameDifficulty() == MAP_DIFFICULTY_HARD then
2416
        set difficulty = HARD
2417
2418
        call SetPeonsRepair(true)
2419
    else
2420
        set difficulty = INSANE
2421
    endif
2422
2423
    call InitAI()
2424
    call InitBuildArray()
2425
    call InitAssaultGroup()
2426
    call CreateCaptains()
2427
2428
    call SetNewHeroes(false)
2429
    if heroes != null then
2430
        call SetHeroLevels(heroes)
2431
    endif
2432
2433
    call SetHeroesFlee(false)
2434
    call SetGroupsFlee(false)
2435
    call SetSlowChopping(true)
2436
    call GroupTimedLife(false)
2437
    call SetCampaignAI()
2438
    call Sleep(0.1)
2439
2440
    set racial_farm = farms
2441
    call StartThread(function CampaignBasics)
2442
    call StartBuildLoop()
2443
endfunction