40 |
40 |
41 -- List of all hog variants with belonging weapons, |
41 -- List of all hog variants with belonging weapons, |
42 -- hitpoints, chances and more |
42 -- hitpoints, chances and more |
43 local variants = {} |
43 local variants = {} |
44 local varName = "" |
44 local varName = "" |
45 local newLine = ""--string.char(0x0A) |
45 local newLine = "" |
46 local gmAny = 0xFFFFFFFF |
46 local gmAny = 0xFFFFFFFF |
47 local version = "0.33" |
|
48 |
47 |
49 --[[ |
48 --[[ |
50 ############################################################################## |
49 ############################################################################## |
51 ### VARIANT SETUP ### |
50 ### VARIANT SETUP ### |
52 ############################################################################## |
51 ############################################################################## |
430 end |
429 end |
431 end |
430 end |
432 |
431 |
433 function AddHogAmmo(hog, ammo) |
432 function AddHogAmmo(hog, ammo) |
434 -- Add weapons of variant |
433 -- Add weapons of variant |
435 --for key, val in pairs(variants[var]["weapons"]) do |
|
436 for key, val in pairs(ammo) do |
434 for key, val in pairs(ammo) do |
437 --AddAmmo(hog, val, 1) |
|
438 AddAmmo(hog, val, GetAmmoCount(hog, val) +1) |
435 AddAmmo(hog, val, GetAmmoCount(hog, val) +1) |
439 end |
436 end |
440 end |
437 end |
441 |
438 |
442 function GetRandomAmmo(hog, sourceType) |
439 function GetRandomAmmo(hog, sourceType) |
1011 if gearType == gtHedgehog then |
1008 if gearType == gtHedgehog then |
1012 trackGear(gear) |
1009 trackGear(gear) |
1013 elseif gearType == gtRCPlane then |
1010 elseif gearType == gtRCPlane then |
1014 SetHealth(gear, 2) |
1011 SetHealth(gear, 2) |
1015 elseif gearType == gtAirBomb then |
1012 elseif gearType == gtAirBomb then |
1016 -- gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom |
1013 -- Set Boom |
1017 SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 20) |
1014 SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 20) |
1018 elseif gearType == gtCake then |
1015 elseif gearType == gtCake then |
1019 -- gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom |
1016 -- Set Boom |
1020 SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 50) |
1017 SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 50) |
1021 elseif gearType == gtDEagleShot then |
1018 elseif gearType == gtDEagleShot then |
1022 -- gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom |
1019 -- Set Boom |
1023 SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 12) |
1020 SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 12) |
1024 end |
1021 end |
1025 end |
1022 end |
1026 |
1023 |
1027 function onHighlandKill(gear) |
1024 function onHighlandKill(gear) |
1124 hpDiff = div(deathMaxHP * highEnemyKillHPBonus, 100) |
1121 hpDiff = div(deathMaxHP * highEnemyKillHPBonus, 100) |
1125 newHP = curHP + hpDiff |
1122 newHP = curHP + hpDiff |
1126 SetHealth(CurHog, newHP) |
1123 SetHealth(CurHog, newHP) |
1127 |
1124 |
1128 local effect = AddVisualGear(GetX(CurHog), GetY(CurHog) - cratePickupGap, vgtHealthTag, hpDiff, false) |
1125 local effect = AddVisualGear(GetX(CurHog), GetY(CurHog) - cratePickupGap, vgtHealthTag, hpDiff, false) |
1129 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1126 -- Set Tint |
1130 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurHog))) |
1127 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurHog))) |
1131 -- Friendly fire! Remove all weapons and helpers from pool |
1128 -- Friendly fire! Remove all weapons and helpers from pool |
1132 else |
1129 else |
1133 highWeapons[CurHog] = {} |
1130 highWeapons[CurHog] = {} |
1134 highHelpers[CurHog] = {} |
1131 highHelpers[CurHog] = {} |
1140 else |
1137 else |
1141 SetHealth(CurHog, 0) |
1138 SetHealth(CurHog, 0) |
1142 end |
1139 end |
1143 |
1140 |
1144 local effect = AddVisualGear(GetX(CurHog), GetY(CurHog) - cratePickupGap, vgtHealthTag, hpDiff, false) |
1141 local effect = AddVisualGear(GetX(CurHog), GetY(CurHog) - cratePickupGap, vgtHealthTag, hpDiff, false) |
1145 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1142 -- Set Tint |
1146 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurHog))) |
1143 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurHog))) |
1147 end |
1144 end |
1148 end |
1145 end |
1149 |
1146 |
1150 function onKingDeath(KingHog) |
1147 function onKingDeath(KingHog) |
1193 |
1190 |
1194 pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weapons'] + 2 |
1191 pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weapons'] + 2 |
1195 pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpers'] + 1 |
1192 pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpers'] + 1 |
1196 |
1193 |
1197 local effect = AddVisualGear(GetX(CurHog) - (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 2, false) |
1194 local effect = AddVisualGear(GetX(CurHog) - (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 2, false) |
1198 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1195 -- Set Tint |
1199 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) |
1196 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) |
1200 |
1197 |
1201 local effect = AddVisualGear(GetX(CurHog) + (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 1, false) |
1198 local effect = AddVisualGear(GetX(CurHog) + (cratePickupGap / 2), GetY(CurHog), vgtHealthTag, 1, false) |
1202 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1199 -- Set Tint |
1203 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0x444444FF) |
1200 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0x444444FF) |
1204 end |
1201 end |
1205 |
1202 |
1206 function onGearDelete(gear) |
1203 function onGearDelete(gear) |
1207 trackDeletion(gear) |
1204 trackDeletion(gear) |
1276 end |
1273 end |
1277 |
1274 |
1278 if hp ~= newHP then |
1275 if hp ~= newHP then |
1279 SetHealth(hog, newHP) |
1276 SetHealth(hog, newHP) |
1280 local effect = AddVisualGear(GetX(hog), GetY(hog) - cratePickupGap, vgtHealthTag, diff, false) |
1277 local effect = AddVisualGear(GetX(hog), GetY(hog) - cratePickupGap, vgtHealthTag, diff, false) |
1281 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1278 -- Set Tint |
1282 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(hog))) |
1279 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(hog))) |
1283 end |
1280 end |
1284 end |
1281 end |
1285 end |
1282 end |
1286 |
1283 |
1357 pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weaponsRem'] + wepWoTax + div(wepToTax * pointsKeepSDPerc, 100) |
1354 pointsPerTeam[team]['weapons'] = pointsPerTeam[team]['weaponsRem'] + wepWoTax + div(wepToTax * pointsKeepSDPerc, 100) |
1358 pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpersRem'] + hlpWoTax + div(hlpToTax * pointsKeepSDPerc, 100) |
1355 pointsPerTeam[team]['helpers'] = pointsPerTeam[team]['helpersRem'] + hlpWoTax + div(hlpToTax * pointsKeepSDPerc, 100) |
1359 end |
1356 end |
1360 |
1357 |
1361 local effect = AddVisualGear(GetX(hog) - (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['weapons'], false) |
1358 local effect = AddVisualGear(GetX(hog) - (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['weapons'], false) |
1362 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1359 -- Set Tint |
1363 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) |
1360 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF) |
1364 |
1361 |
1365 local effect = AddVisualGear(GetX(hog) + (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['helpers'], false) |
1362 local effect = AddVisualGear(GetX(hog) + (cratePickupGap / 2), GetY(hog), vgtHealthTag, pointsPerTeam[team]['helpers'], false) |
1366 -- (vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint) |
1363 -- Set Tint |
1367 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0x444444FF) |
1364 SetVisualGearValues(effect, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0x444444FF) |
1368 end |
1365 end |
1369 |
1366 |
1370 function onPointsTurn() |
1367 function onPointsTurn() |
1371 local hogWepPoints = 0 |
1368 local hogWepPoints = 0 |
1547 |
1544 |
1548 -- Shuffle group for more randomness |
1545 -- Shuffle group for more randomness |
1549 shuffle(group['all']) |
1546 shuffle(group['all']) |
1550 -- We are in points mode, setup other weapons |
1547 -- We are in points mode, setup other weapons |
1551 elseif mode == 'points' then |
1548 elseif mode == 'points' then |
1552 --variants['King']['chance'] = 0 |
|
1553 --if variants['Air General'] ~= nil then |
|
1554 -- variants['Air General']['chance'] = 0 |
|
1555 --end |
|
1556 |
|
1557 -- Translate [ammo] -> points to [points] -> {ammo1, ammo2} |
1549 -- Translate [ammo] -> points to [points] -> {ammo1, ammo2} |
1558 for ammoType, ammoPoints in pairs(pointsWeaponVal) do |
1550 for ammoType, ammoPoints in pairs(pointsWeaponVal) do |
1559 if pointsToWep[ammoPoints] == nil then |
1551 if pointsToWep[ammoPoints] == nil then |
1560 pointsToWep[ammoPoints] = {} |
1552 pointsToWep[ammoPoints] = {} |
1561 end |
1553 end |
1656 elseif mode == 'king' then |
1644 elseif mode == 'king' then |
1657 txt = txt .. " |" |
1645 txt = txt .. " |" |
1658 txt = txt .. loc("--- King ---").."|" |
1646 txt = txt .. loc("--- King ---").."|" |
1659 txt = txt .. loc("Variants: The last hog of each team will be a king").."|" |
1647 txt = txt .. loc("Variants: The last hog of each team will be a king").."|" |
1660 txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|" |
1648 txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|" |
1661 icon = 0 -- Golen Crown |
1649 icon = 0 -- Golden Crown |
1662 elseif mode == 'points' then |
1650 elseif mode == 'points' then |
1663 txt = txt .. " |" |
1651 txt = txt .. " |" |
1664 txt = txt .. loc("--- Points ---").."|" |
1652 txt = txt .. loc("--- Points ---").."|" |
1665 txt = txt .. loc("Variants: Kings and air generals are disabled").."|" |
1653 txt = txt .. loc("Variants: Kings and air generals are disabled").."|" |
1666 txt = txt .. string.format(loc("Weapons: Each team starts with %d weapon points"), pointsWepBase).."|" |
1654 txt = txt .. string.format(loc("Weapons: Each team starts with %d weapon points"), pointsWepBase).."|" |