louisdespi Floodeur prématuré

Inscrit le: 21 Oct 2007 Messages: 437 Sujets: 70
|
Posté le: 20/11/09 23:03 Sujet du message: Mon IA |
|
|
| Jass: | //==================================
//===========Louis-human.ai=========
//==================================
globals
boolean Rushing = false
endglobals
//----------
//-Constuct-
//----------
function Construc takes nothing returns nothing
call SetBuildUnit( 6,PEASANT ) // SetBuildUnit : est une fonction qui appelle la création d'une unité, d'un bâtiment. Dans ce cas-ci, on demande la création du 6ième paysan, puisqu'on commence avec 5 paysans
call SetBuildUnit( 1,HUMAN_ALTAR )
if GetUnitCountDone( HUMAN_ALTAR )>0 then // si le nombre d'autel des roi est supérieur à 0 alors
call SetBuildUnit( 1,hero_id ) // on crée le premier héros
endif // fermeture de la condition
call SetBuildUnit( 1,BARRACKS )
call SetBuildUnit( 1,HOUSE )
call SetBuildUnit( 1,BLACKSMITH )
call SetBuildUnit( 2,HOUSE )
if GetUnitCountDone( BARRACKS )>0 and GetUnitCountDone( BLACKSMITH )>0 then
call SetBuildUnit( 3,RIFLEMAN )
call SetBuildUnit( 3,HOUSE )
call SetBuildUnit( 5,RIFLEMAN )
call SetBuildUnit( 4,HOUSE )
call SetBuildUnit( 10,RIFLEMAN )
endif
endfunction
//-------------
//-InitOptions-
//-------------
function InitOptions takes nothing returns nothing
loop
call SetDefendPlayer( false )
call SetRandomPaths( false )
call SetTargetHeroes( true )
call SetPeonsRepair( false )
if not Rushing then
call SetHeroesFlee( true )
call SetUnitsFlee( true )
call SetGroupsFlee( true )
endif
call SetHeroesBuyItems( true )
call SetWatchMegaTargets( true )
call SetIgnoreInjured( false )
call SetHeroesTakeItems( true )
call SetSlowChopping( false )
call SetCaptainChanges( true )
call SetSmartArtillery( true )
call Sleep(2)
endloop
endfunction
//---------------
//-PickMeleeHeroHuman-
//---------------
function PickMeleeHeroHuman takes nothing returns integer
local integer first
local integer second
local integer third
local integer last
local integer array heroes
set heroes[1] = BLOOD_MAGE
set heroes[2] = MTN_KING
set heroes[3] = PALADIN
set heroes[4] = ARCHMAGE
set hero_id = heroes[1]
set heroes[1] = heroes[4]
set hero_id2 = heroes[2]
set heroes[2] = heroes[3]
set hero_id3 = heroes[3]
return hero_id
endfunction
//-----------
//-PrepArmee-
//-----------
function PrepArmee takes nothing returns nothing
call AwaitMeleeHeroes( )
call InitMeleeGroup( )
call SetMeleeGroup( hero_id )
call SetMeleeGroup( RIFLEMAN )
call SetInitialWave(10)
endfunction
//--------
//-Attaque
//--------
function Attaque takes nothing returns nothing
local unit target
local integer wave
loop
exitwhen GetUnitCountDone( hero_id ) > 0 and GetUnitCountDone ( RIFLEMAN ) >= 3
call Sleep( 2 )
endloop
loop
loop
exitwhen not CaptainRetreating()
call Sleep(2)
endloop
set target = GetCreepCamp( 0,9,false )
call PrepArmee( )
call SetAllianceTarget( target )
call FormGroup( 3,true )
call AttackMoveKillA( target )
call Sleep( 15 )
set wave = wave + 1
endloop
endfunction
//--------
//-Récole-
//--------
function Recolte takes nothing returns nothing
call HarvestGold(0,GetUnitCountDone(PEASANT)/2)
call HarvestWood(0,GetUnitCountDone(PEASANT)/2)
endfunction
//-------------
//-PéonTravail-
//-------------
function PeonTravail takes nothing returns nothing
loop // On ouvre la boucle
//Récolte
call ClearHarvestAI( )
call Recolte( )
//Bâtiments
call InitBuildArray( )
call Construc( )
call Sleep( 3 )
endloop // On referme la boucle
endfunction
//======
//=Main=
//======
function main takes nothing returns nothing
call InitAI( )
call PickMeleeHeroHuman( )
call SetPlayerName( ai_player, "Louisdespi" )
call CreateCaptains( )
call Sleep( 0.1 )
call StartThread( function PeonTravail )
call StartThread( function Attaque )
call StartThread( function InitOptions )
call PlayGame( )
endfunction |
Voilà, je pose mon IA sur ce topic pour que tout le monde puisse en profiter. Je compte aussi la détailler pour ceux que ça intéresse. Pour l'instant elle n'est bien sûr qu'a sa première version qui est encore bien précaire. Mais je posterai plus tard les version prochaine _________________
|
|