forked from jzy-chitong56/AMAI-CN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Blizzard3.eai
78 lines (71 loc) · 2.73 KB
/
Blizzard3.eai
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//***************************************************************************
//*
//* Melee Template Starting AI Scripts
//*
//***************************************************************************
//===========================================================================
function PickMeleeAI takes player num, string s1, string s2, string s3 returns nothing
local integer pick
// easy difficulty never uses any custom AI scripts
// that are designed to be a bit more challenging
//
if GetAIDifficulty(num) == AI_DIFFICULTY_NEWBIE then
call StartMeleeAI(num,s1)
return
endif
if s2 == null then
set pick = 1
elseif s3 == null then
set pick = GetRandomInt(1,2)
else
set pick = GetRandomInt(1,3)
endif
if pick == 1 then
call StartMeleeAI(num,s1)
elseif pick == 2 then
call StartMeleeAI(num,s2)
else
call StartMeleeAI(num,s3)
endif
endfunction
//===========================================================================
function MeleeStartingAI takes nothing returns nothing
local integer index
local player indexPlayer
local race indexRace
set index = 0
loop
set indexPlayer = Player(index)
if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
set indexRace = GetPlayerRace(indexPlayer)
if (GetPlayerController(indexPlayer) == MAP_CONTROL_COMPUTER) then
// Run a race-specific melee AI script.
if (indexRace == RACE_HUMAN) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "HUMAN"
call PickMeleeAI(indexPlayer, "%2", null, null)
#ENDINCLUDE
elseif (indexRace == RACE_ORC) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "ORC"
call PickMeleeAI(indexPlayer, "%2", null, null)
#ENDINCLUDE
elseif (indexRace == RACE_UNDEAD) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "UNDEAD"
call PickMeleeAI(indexPlayer, "%2", null, null)
#ENDINCLUDE
call RecycleGuardPosition(bj_ghoul[index])
elseif (indexRace == RACE_NIGHTELF) then
#INCLUDETABLE <$VER$\races.txt> #COND "%1" eq "ELF"
call PickMeleeAI(indexPlayer, "%2", null, null)
#ENDINCLUDE
else
// Unrecognized race.
endif
call ShareEverythingWithTeamAI(indexPlayer)
endif
endif
set index = index + 1
exitwhen index == GetBJMaxPlayers()
endloop
set indexPlayer = null
set indexRace = null
endfunction