author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 28 May 2019 01:28:59 +0200 | |
changeset 15090 | e16f906224fd |
parent 14720 | 368e582fcd18 |
child 15810 | acf70c44065b |
permissions | -rw-r--r-- |
6349 | 1 |
-------------------------------- |
2 |
-- HIGHLANDER / HOGS OF WAR |
|
3 |
-- by mikade |
|
4 |
-------------------------------- |
|
5 |
||
8682 | 6 |
------------------------- |
7 |
-- ideas for the future |
|
8 |
------------------------- |
|
9085
092051fda7e1
As per request, add ice-gun (untested!)
mikade <redgrinner@gmail.com>
parents:
8713
diff
changeset
|
9 |
-- add structure |
8682 | 10 |
-- allow switcher, resurrector |
11 |
-- nerf teleport |
|
12 |
-- balance weapon distribution across entire team / all teams |
|
13 |
-- add other inequalities/bonuses like... ??? |
|
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
14 |
-- * some hogs start off with an extra 25 health? |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
15 |
-- * some hogs start off poisoned? |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
16 |
-- * some hogs start off with a rope and 2 drills but die after their turn? |
8682 | 17 |
|
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
18 |
------------------ |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
19 |
-- script follows |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
20 |
------------------ |
8682 | 21 |
|
8713 | 22 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
23 |
HedgewarsScriptLoad("/Scripts/Tracker.lua") |
|
10219
bbeb1e9aaa65
param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents:
10096
diff
changeset
|
24 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
6349 | 25 |
|
14317
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
26 |
-- These define weapons allowed by the script. |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
27 |
local atkWeps = { |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
28 |
[amBazooka]=true, [amBee]=true, [amMortar]=true, [amDrill]=true, [amSnowball]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
29 |
[amGrenade]=true, [amClusterBomb]=true, [amMolotov]=true, [amWatermelon]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
30 |
[amHellishBomb]=true, [amGasBomb]=true, [amShotgun]=true, [amDEagle]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
31 |
[amFlamethrower]=true, [amSniperRifle]=true, [amSineGun]=true, [amMinigun]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
32 |
[amFirePunch]=true, [amWhip]=true, [amBaseballBat]=true, [amKamikaze]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
33 |
[amSeduction]=true, [amHammer]=true, [amMine]=true, [amDynamite]=true, [amCake]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
34 |
[amBallgun]=true, [amSMine]=true, [amRCPlane]=true, [amBirdy]=true, [amKnife]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
35 |
[amAirAttack]=true, [amMineStrike]=true, [amNapalm]=true, [amDrillStrike]=true, [amPiano]=true, [amAirMine] = true, |
13872
f01798038c2e
Rename amDuck and related symbols to amCreeper, gtCreeper, etc.
Wuzzy <Wuzzy2@mail.ru>
parents:
13685
diff
changeset
|
36 |
[amCreeper]=true, |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
37 |
} |
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
38 |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
39 |
local utilWeps = { |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
40 |
[amBlowTorch]=true, [amPickHammer]=true, [amGirder]=true, [amPortalGun]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
41 |
[amRope]=true, [amParachute]=true, [amTeleport]=true, [amJetpack]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
42 |
[amInvulnerable]=true, [amLaserSight]=true, [amVampiric]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
43 |
[amLowGravity]=true, [amExtraDamage]=true, [amExtraTime]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
44 |
[amLandGun]=true, [amRubber]=true, [amIceGun]=true, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
45 |
} |
6820
7db9e89b3f80
- don't give hogs air weps when border is enabled
mikade <redgrinner@gmail.com>
parents:
6378
diff
changeset
|
46 |
|
12706
b5e2834cd7b3
Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents:
12704
diff
changeset
|
47 |
-- Intentionally left out: |
b5e2834cd7b3
Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents:
12704
diff
changeset
|
48 |
-- * Resurrector (guaranteed to screw up the game) |
b5e2834cd7b3
Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents:
12704
diff
changeset
|
49 |
-- * Time Box |
b5e2834cd7b3
Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents:
12704
diff
changeset
|
50 |
-- * Switch Hedgehog (not sure why) |
b5e2834cd7b3
Fix rubber duck not being used in Highlander
Wuzzy <almikes@aol.com>
parents:
12704
diff
changeset
|
51 |
|
10088 | 52 |
local wepArray = {} |
6349 | 53 |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
54 |
local atkChoices = {} |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
55 |
local utilChoices = {} |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
56 |
|
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
57 |
local currHog |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
58 |
local lastHog |
6349 | 59 |
local started = false |
60 |
local switchStage = 0 |
|
61 |
||
8682 | 62 |
local lastWep = amNothing |
63 |
local shotsFired = 0 |
|
64 |
||
10088 | 65 |
local probability = {1,2,5,10,20,50,200,500,1000000}; |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
66 |
local atktot = 0 |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
67 |
local utiltot = 0 |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
68 |
|
13458
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
69 |
local teleportConverted = false -- used for special handling of teleport when gfPlaceHog is active |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
70 |
|
12703
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
71 |
-- Script parameter stuff |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
72 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
73 |
--[[ Loyal Highlander. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
74 |
If true, killing hogs of your own clan doesn't give you their weapons. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
75 |
Otherwise, killing any hog gives you their weapons. ]] |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
76 |
local loyal = false |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
77 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
78 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
79 |
--[[ Multiple weapon usages. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
80 |
This is a bit tricky to explain. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
81 |
First, remind yourselves that hogs can never hold more than 1 of the same ammo type. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
82 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
83 |
This param changes how ammo will be restocked after killing a hog if you |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
84 |
already owned this ammo. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
85 |
Basically this is about if you can use the same weapon multiple times in a |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
86 |
turn by killing enemies in a clever way. |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
87 |
We need to distinguish between your current inventory and the “reset inventory”, |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
88 |
that is, the state to which your inventory will get reset in the next turn. |
10219
bbeb1e9aaa65
param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents:
10096
diff
changeset
|
89 |
|
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
90 |
No Multi-Use (default): |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
91 |
If you kill a hog who owns a weapon you currently have in your reset inventory, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
92 |
but not your inventory, you DO NOT get this weapon again. |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
93 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
94 |
Multi-Use: |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
95 |
If you kill a hog who owns a weapon you currently have in your reset inventory, |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
96 |
but not your inventory, you DO get this weapon. |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
97 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
98 |
Example 1: |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
99 |
You have a ballgun, and use it to kill a hog who also owns a ballgun. |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
100 |
No Multi-Use: You will NOT get another ballgun, since it's in your |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
101 |
reset inventory. |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
102 |
Multi-Use: You get another ballgun. |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
103 |
|
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
104 |
Example 2: |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
105 |
You have a grenade and a bazooka in your inventory. You use the bazooka |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
106 |
to kill a hedgehog who owns a grenade. |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
107 |
In both ammo limit modes, you do NOT win any ammo since you already have |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
108 |
a grenade in your inventory (not just your reset inventory), and the |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
109 |
rule “no more than 1 ammo per type” applies. |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
110 |
]] |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
111 |
local multiUse = false |
12703
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
112 |
|
10219
bbeb1e9aaa65
param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents:
10096
diff
changeset
|
113 |
function onParameters() |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
114 |
parseParams() |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
115 |
multiUse = params["multiuse"] == "true" |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
116 |
loyal = params["loyal"] == "true" |
10219
bbeb1e9aaa65
param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents:
10096
diff
changeset
|
117 |
end |
bbeb1e9aaa65
param for original highlander mode - right now just allows getting another copy of a weapon you already had, but had used that turn.
nemo
parents:
10096
diff
changeset
|
118 |
|
8682 | 119 |
function CheckForWeaponSwap() |
120 |
if GetCurAmmoType() ~= lastWep then |
|
121 |
shotsFired = 0 |
|
122 |
end |
|
123 |
lastWep = GetCurAmmoType() |
|
124 |
end |
|
125 |
||
126 |
function onSlot() |
|
127 |
CheckForWeaponSwap() |
|
128 |
end |
|
129 |
||
130 |
function onSetWeapon() |
|
131 |
CheckForWeaponSwap() |
|
132 |
end |
|
133 |
||
134 |
function onHogAttack() |
|
135 |
CheckForWeaponSwap() |
|
136 |
shotsFired = shotsFired + 1 |
|
137 |
end |
|
138 |
||
6349 | 139 |
function StartingSetUp(gear) |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
140 |
for i = 0, AmmoTypeMax do |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
141 |
if i ~= amNothing then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
142 |
setGearValue(gear,i,0) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
143 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
144 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
145 |
for w,c in pairs(wepArray) do |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
146 |
if c == 9 and (atkWeps[w] or utilWeps[w]) then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
147 |
setGearValue(gear,w,1) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
148 |
end |
6349 | 149 |
end |
150 |
||
8682 | 151 |
setGearValue(gear,amSkip,100) |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
152 |
|
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
153 |
local r = 0 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
154 |
if atktot > 0 then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
155 |
r = GetRandom(atktot)+1 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
156 |
for i = 0, AmmoTypeMax do |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
157 |
if i ~= amNothing then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
158 |
if atkChoices[i] >= r then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
159 |
setGearValue(gear,i,1) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
160 |
break |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
161 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
162 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
163 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
164 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
165 |
if utiltot > 0 then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
166 |
r = GetRandom(utiltot)+1 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
167 |
for i = 0, AmmoTypeMax do |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
168 |
if i ~= amNothing then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
169 |
if utilChoices[i] >= r then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
170 |
setGearValue(gear,i,1) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
171 |
break |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
172 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
173 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
174 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
175 |
end |
6349 | 176 |
end |
177 |
||
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
178 |
function ConvertValues(gear) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
179 |
for w,c in pairs(wepArray) do |
13458
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
180 |
-- Add hog ammo loadout, but don't touch teleport if in hog placement phase. |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
181 |
-- If in hog placement phase, teleport will be touched later (see onNewTurn). |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
182 |
if not (GetGameFlag(gfPlaceHog) and TotalRounds == -1 and (w == amTeleport)) then |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
183 |
AddAmmo(gear, w, getGearValue(gear,w) ) |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
184 |
end |
6349 | 185 |
end |
186 |
end |
|
187 |
||
8682 | 188 |
-- this is called when a hog dies |
6349 | 189 |
function TransferWeps(gear) |
190 |
||
12703
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
191 |
if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear and (not loyal or (GetHogClan(CurrentHedgehog) ~= GetHogClan(gear))) then |
11848
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
192 |
|
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
193 |
local x,y,color |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
194 |
local vgear |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
195 |
local dspl = IsHogLocal(CurrentHedgehog) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
196 |
local ammolist = '' |
11848
6a0d6b00dac8
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
sheepluva
parents:
11494
diff
changeset
|
197 |
|
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
198 |
if dspl then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
199 |
x,y = GetGearPosition(CurrentHedgehog) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
200 |
color = GetClanColor(GetHogClan(CurrentHedgehog)) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
201 |
end |
6349 | 202 |
|
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
203 |
for w,c in pairs(wepArray) do |
13453
7d69c5605a9d
Highlander: Localize global variable
Wuzzy <Wuzzy2@mail.ru>
parents:
13452
diff
changeset
|
204 |
local val = getGearValue(gear,w) |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
205 |
if val ~= 0 and (multiUse or (wepArray[w] ~= 9 and getGearValue(CurrentHedgehog, w) == 0)) then |
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
206 |
setGearValue(CurrentHedgehog, w, val) |
8682 | 207 |
|
208 |
-- if you are using multi-shot weapon, gimme one more |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
209 |
if (GetCurAmmoType() == w) and (shotsFired ~= 0) then |
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
210 |
AddAmmo(CurrentHedgehog, w, val+1) |
8682 | 211 |
-- assign ammo as per normal |
212 |
else |
|
10083
b20f9481e5cb
Make highlander configurable using weapons, commit weaponset mimicking old values
nemo
parents:
10036
diff
changeset
|
213 |
AddAmmo(CurrentHedgehog, w, val) |
8682 | 214 |
end |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
215 |
if dspl then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
216 |
if ammolist == '' then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
217 |
ammolist = GetAmmoName(w) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
218 |
else |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
219 |
ammolist = ammolist .. ' • ' .. GetAmmoName(w) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
220 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
221 |
x = x + 2 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
222 |
y = y + 32 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
223 |
vgear = AddVisualGear(x, y, vgtAmmo, 0, true) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
224 |
if vgear ~= nil then |
13685
09ea1faf97ca
Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents:
13458
diff
changeset
|
225 |
local vgtFrame = w |
09ea1faf97ca
Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents:
13458
diff
changeset
|
226 |
SetVisualGearValues(vgear,nil,nil,nil,nil,nil,vgtFrame) |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
227 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
228 |
end |
8682 | 229 |
|
6349 | 230 |
end |
231 |
end |
|
232 |
||
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
233 |
if dspl and ammolist ~= '' then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
234 |
PlaySound(sndShotgunReload); |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
235 |
AddCaption(ammolist, color, capgrpAmmoinfo) |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
236 |
end |
6349 | 237 |
end |
238 |
||
239 |
end |
|
240 |
||
241 |
function onGameInit() |
|
14720 | 242 |
EnableGameFlags(gfInfAttack, gfPerHogAmmo) |
10250
887610b44848
disable these weaponset flags. they bug up highlander and otherwise have no useful impact on the script.
nemo
parents:
10219
diff
changeset
|
243 |
DisableGameFlags(gfResetWeps, gfSharedAmmo) |
6349 | 244 |
HealthCaseProb = 100 |
12703
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
245 |
if loyal then |
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
246 |
Goals = loc("Loyal Highlander: Eliminate enemy hogs to take their weapons") .. "|" |
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
247 |
else |
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
248 |
Goals = loc("Highlander: Eliminate hogs to take their weapons") .. "|" |
6726d5edfdfb
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
Wuzzy <almikes@aol.com>
parents:
12340
diff
changeset
|
249 |
end |
12704
c4ea9f8fb483
Highlander: Mention the "max. 1 ammo per type" rule in mission panel
Wuzzy <almikes@aol.com>
parents:
12703
diff
changeset
|
250 |
Goals = Goals .. loc("Replenishment: Weapons are restocked on turn start of a new hog") .. "|" .. |
13275
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
251 |
loc("Ammo Limit: Hogs can’t have more than 1 ammo per type") .. "|" |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
252 |
if multiUse then |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
253 |
Goals = Goals .. loc("Multi-Use: You can take and use the same ammo type multiple times in a turn") |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
254 |
else |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
255 |
Goals = Goals .. loc("No Multi-Use: Once you used an ammo, you can’t take it again in this turn") |
7ed4ab32f351
Highlander: Rename “mode=orig” to “multiuse=true” and explain the meaning of this scriptparam in mision panel
Wuzzy <Wuzzy2@mail.ru>
parents:
12956
diff
changeset
|
256 |
end |
6349 | 257 |
end |
258 |
||
259 |
function onGameStart() |
|
14317
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
260 |
-- Remove air strikes in maps with border |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
261 |
if MapHasBorder() or GetGameFlag(gfBorder) then |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
262 |
atkWeps[amAirAttack] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
263 |
atkWeps[amMineStrike] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
264 |
atkWeps[amNapalm] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
265 |
atkWeps[amDrillStrike] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
266 |
atkWeps[amPiano] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
267 |
end |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
268 |
-- Disable redundant utilities |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
269 |
if GetGameFlag(gfVampiric) then |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
270 |
utilWeps[amVampiric] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
271 |
end |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
272 |
if GetGameFlag(gfLowGravity) then |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
273 |
utilWeps[amLowGravity] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
274 |
end |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
275 |
if GetGameFlag(gfLaserSight) then |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
276 |
utilWeps[amLaserSight] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
277 |
end |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
278 |
if GetGameFlag(gfInvulnerable) then |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
279 |
utilWeps[amInvulnerable] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
280 |
end |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
281 |
if TurnTime > 999000 then |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
282 |
utilWeps[amExtraTime] = nil |
0855344f54a7
Highlander: Fix hogs receiving air strikes in maps with border
Wuzzy <Wuzzy2@mail.ru>
parents:
13872
diff
changeset
|
283 |
end |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
284 |
utilChoices[amSkip] = 0 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
285 |
local c = 0 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
286 |
for i = 0, AmmoTypeMax do |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
287 |
if i ~= amNothing then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
288 |
atkChoices[i] = 0 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
289 |
utilChoices[i] = 0 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
290 |
if i ~= 7 then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
291 |
wepArray[i] = 0 |
13458
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
292 |
c = GetAmmo(i) |
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
293 |
if c > 8 then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
294 |
c = 9 |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
295 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
296 |
wepArray[i] = c |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
297 |
if c < 9 and c > 0 then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
298 |
if atkWeps[i] then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
299 |
atktot = atktot + probability[c] |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
300 |
atkChoices[i] = atktot |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
301 |
elseif utilWeps[i] then |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
302 |
utiltot = utiltot + probability[c] |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
303 |
utilChoices[i] = utiltot |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
304 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
305 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
306 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
307 |
end |
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
308 |
end |
6349 | 309 |
|
310 |
runOnGears(StartingSetUp) |
|
311 |
runOnGears(ConvertValues) |
|
312 |
end |
|
313 |
||
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
314 |
function CheckForHogSwitch() |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
315 |
|
12321
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
316 |
--[[ Restock the weapons of the hog on turn start, provided it is not the same hog as before. |
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
317 |
This exception is done do avoid a single hog receiving tons of weapons when it is the only unfrozen |
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
318 |
hog and takes consecutive turns. ]] |
1be56fa243c8
Clarify how the weapons restocking works in Highlander
Wuzzy <almikes@aol.com>
parents:
12320
diff
changeset
|
319 |
|
12309
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
320 |
if (CurrentHedgehog ~= nil) then |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
321 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
322 |
currHog = CurrentHedgehog |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
323 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
324 |
if currHog ~= lastHog then |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
325 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
326 |
-- re-assign ammo to this guy, so that his entire ammo set will |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
327 |
-- be visible during another player's turn |
13458
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
328 |
if lastHog ~= nil and GetHealth(lastHog) then |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
329 |
ConvertValues(lastHog) |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
330 |
end |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
331 |
|
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
332 |
-- give the new hog what he is supposed to have, too |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
333 |
ConvertValues(CurrentHedgehog) |
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
334 |
|
12309
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
335 |
end |
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
336 |
|
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
337 |
lastHog = currHog |
12309
6b34067a6344
Fix broken ammo preview caused by previous commit
Wuzzy <almikes@aol.com>
parents:
12308
diff
changeset
|
338 |
|
6349 | 339 |
end |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
340 |
|
6349 | 341 |
end |
342 |
||
8682 | 343 |
function onNewTurn() |
12320
a85212a8d0e0
Backed out changeset 82951b9b3c2f
Wuzzy <almikes@aol.com>
parents:
12309
diff
changeset
|
344 |
CheckForHogSwitch() |
13458
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
345 |
|
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
346 |
-- If hog placement phase is over, set the hog's actual teleport loadout |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
347 |
if GetGameFlag(gfPlaceHog) and TotalRounds == 0 and not teleportConverted then |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
348 |
runOnHogs(function(gear) |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
349 |
AddAmmo(gear, amTeleport, getGearValue(gear, amTeleport)) |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
350 |
end) |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
351 |
-- This makes sure this code is only run once |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
352 |
teleportConverted = true |
7a0a56c52fd2
Highlander: Fix all hogs getting teleport after hog placement phase
Wuzzy <Wuzzy2@mail.ru>
parents:
13453
diff
changeset
|
353 |
end |
8682 | 354 |
end |
355 |
||
6349 | 356 |
function onGearAdd(gear) |
357 |
||
358 |
if (GetGearType(gear) == gtHedgehog) then |
|
359 |
trackGear(gear) |
|
360 |
end |
|
361 |
||
362 |
end |
|
363 |
||
364 |
function onGearDelete(gear) |
|
365 |
||
13452
f38b72d64157
Highlander: Clean up code style, indents and delete useless old comments
Wuzzy <Wuzzy2@mail.ru>
parents:
13275
diff
changeset
|
366 |
if (GetGearType(gear) == gtHedgehog) then |
6349 | 367 |
TransferWeps(gear) |
368 |
trackDeletion(gear) |
|
369 |
end |
|
370 |
||
371 |
end |