equal
deleted
inserted
replaced
1 -- Hedgewars - Knockball for 2+ Players |
1 -- Hedgewars - Knockball for 2+ Players |
2 |
2 |
3 HedgewarsScriptLoad("/Scripts/Locale.lua") |
3 HedgewarsScriptLoad("/Scripts/Locale.lua") |
4 |
4 |
5 local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0} |
|
6 |
|
7 local ball = nil |
5 local ball = nil |
8 |
|
9 local started = false |
|
10 |
6 |
11 function onGameInit() |
7 function onGameInit() |
12 GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams |
8 GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams |
13 TurnTime = 20000 |
9 TurnTime = 20000 |
14 CaseFreq = 0 |
10 CaseFreq = 0 |
20 HealthDecrease = 0 |
16 HealthDecrease = 0 |
21 end |
17 end |
22 |
18 |
23 function onGameStart() |
19 function onGameStart() |
24 ShowMission(loc("Knockball"), loc("Not So Friendly Match"), loc("Bat balls at your enemies and|push them into the sea!"), -amBaseballBat, 0) |
20 ShowMission(loc("Knockball"), loc("Not So Friendly Match"), loc("Bat balls at your enemies and|push them into the sea!"), -amBaseballBat, 0) |
25 started = true |
|
26 end |
21 end |
27 |
22 |
28 function onGameTick() |
23 function onGameTick() |
29 if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end |
24 if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end |
30 end |
25 end |
46 end |
41 end |
47 end |
42 end |
48 end |
43 end |
49 |
44 |
50 function onGearDelete(gear) |
45 function onGearDelete(gear) |
51 if not started then |
|
52 return |
|
53 end |
|
54 if gear == ball then |
46 if gear == ball then |
55 ball = nil |
47 ball = nil |
56 elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then |
|
57 local clan = GetHogClan(CurrentHedgehog) |
|
58 local s |
|
59 if clan ~= nil then |
|
60 if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then |
|
61 score[clan] = score[clan] + 1 |
|
62 s = string.format(loc("%s is out and Team %d|scored a point!| |Score:"), GetHogName(gear), clan + 1) |
|
63 else |
|
64 score[clan] = score[clan] - 1 |
|
65 s = string.format(loc("%s is out and Team %d|scored a penalty!| |Score:"), GetHogName(gear), clan + 1) |
|
66 end |
|
67 s = s .. " " .. score[0] |
|
68 for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end |
|
69 ShowMission(loc("Knockball"), loc("Not So Friendly Match"), s, -amBaseballBat, 0) |
|
70 end |
|
71 end |
48 end |
72 end |
49 end |
73 |
50 |
74 function onNewTurn() |
51 function onNewTurn() |
75 SetWeapon(amBaseballBat) |
52 SetWeapon(amBaseballBat) |