share/hedgewars/Data/Scripts/Multiplayer/Battalion.lua
changeset 12984 353603f5cec3
parent 12983 7c3454083489
child 12985 add647b0036e
equal deleted inserted replaced
12983:7c3454083489 12984:353603f5cec3
   242 local CurHog = nil -- Current Hedgehog
   242 local CurHog = nil -- Current Hedgehog
   243 local LastTeam = nil -- Last Team
   243 local LastTeam = nil -- Last Team
   244 local CurTeam = nil -- Current Team
   244 local CurTeam = nil -- Current Team
   245 
   245 
   246 local mode = 'default' -- Which game type to play
   246 local mode = 'default' -- Which game type to play
       
   247 local modeExplicit = false -- Whether the mode was set in script param
   247 local luck = 100 -- Multiplier for bonuses like crates
   248 local luck = 100 -- Multiplier for bonuses like crates
   248 local strength = 1 -- Multiplier for more weapons
   249 local strength = 1 -- Multiplier for more weapons
   249 local mutate = false -- Whether or not to mutate the hogs
   250 local mutate = false -- Whether or not to mutate the hogs
   250 
   251 
   251 local highHasBonusWeps = false -- whether or not a hog got bonus weapons on current turn
   252 local highHasBonusWeps = false -- whether or not a hog got bonus weapons on current turn
  1463 function onParameters()
  1464 function onParameters()
  1464   parseParams()
  1465   parseParams()
  1465 
  1466 
  1466   if params['mode'] ~= nil then
  1467   if params['mode'] ~= nil then
  1467     mode = params['mode']
  1468     mode = params['mode']
       
  1469     if mode == "default" or mode == "king" or mode == "points" or mode == "highland" then
       
  1470        modeExplicit = true
       
  1471     end
  1468   end
  1472   end
  1469 
  1473 
  1470   if params['mutate'] ~= nil then
  1474   if params['mutate'] ~= nil then
  1471     mutate = params['mutate']
  1475     mutate = params['mutate']
  1472   end
  1476   end
  1614     txt = txt .. loc("Variants: Hogs will be randomized from 12 different variants") .. "|"
  1618     txt = txt .. loc("Variants: Hogs will be randomized from 12 different variants") .. "|"
  1615     txt = txt .. loc("Weapons: Hogs will get 1 out of 3 weapons randomly each turn") .. "|"
  1619     txt = txt .. loc("Weapons: Hogs will get 1 out of 3 weapons randomly each turn") .. "|"
  1616     txt = txt .. loc("Helpers: Hogs will get 1 out of 2 helpers randomly each turn") .. "|"
  1620     txt = txt .. loc("Helpers: Hogs will get 1 out of 2 helpers randomly each turn") .. "|"
  1617     txt = txt .. loc("Crates: Crates drop randomly with chance of being empty") .. "|"
  1621     txt = txt .. loc("Crates: Crates drop randomly with chance of being empty") .. "|"
  1618     txt = txt .. loc("Last Resort: Having less than 25% base health gives kamikaze") .. "|"
  1622     txt = txt .. loc("Last Resort: Having less than 25% base health gives kamikaze") .. "|"
  1619     txt = txt .. loc("Modifiers: Unlimited ammo, per-hog ammo") .. "|"
  1623     txt = txt .. loc("Modifiers: Unlimited attacks, per-hog ammo") .. "|"
  1620   else
  1624   else
  1621     txt = txt .. loc("Crates: Crates drop randomly and may be empty") .. "|"
  1625     txt = txt .. loc("Crates: Crates drop randomly and may be empty") .. "|"
  1622     txt = txt .. loc("Modifiers: Unlimited ammo, shared clan ammo") .. "|"
  1626     txt = txt .. loc("Modifiers: Unlimited attacks, shared clan ammo") .. "|"
  1623   end
  1627   end
  1624 
  1628 
  1625   if luck ~= 100 then
  1629   if luck ~= 100 then
  1626     txt = txt .. string.format(loc("Luck: %d%% (modifier for crates)"), luck) .. "|"
  1630     txt = txt .. string.format(loc("Luck: %d%% (modifier for crates)"), luck) .. "|"
  1627   end
  1631   end
  1630     txt = txt .. string.format(loc("Strength: %d (multiplier for ammo)"), strength) .. "|"
  1634     txt = txt .. string.format(loc("Strength: %d (multiplier for ammo)"), strength) .. "|"
  1631   end
  1635   end
  1632 
  1636 
  1633   if mode == 'highland' then
  1637   if mode == 'highland' then
  1634     txt = txt .. " |"
  1638     txt = txt .. " |"
  1635     txt = txt .. loc("--- Highland ---").."|"
  1639     txt = txt .. loc("--- Highland Mode ---").."|"
  1636     txt = txt .. string.format(loc("Enemy kills: Collect victim's weapons and +%d%% of its base health"), highEnemyKillHPBonus).."|"
  1640     txt = txt .. string.format(loc("Enemy kills: Collect victim's weapons and +%d%% of its base health"), highEnemyKillHPBonus).."|"
  1637     txt = txt .. string.format(loc("Friendly kills: Clear killer's pool and -%d%% of its base health"), highFriendlyKillHPBonus).."|"
  1641     txt = txt .. string.format(loc("Friendly kills: Clear killer's pool and -%d%% of its base health"), highFriendlyKillHPBonus).."|"
  1638     txt = txt .. string.format(loc("Turns: Hogs get %d random weapon(s) from their pool"), highPickupCount).."|"
  1642     txt = txt .. string.format(loc("Turns: Hogs get %d random weapon(s) from their pool"), highPickupCount).."|"
  1639     txt = txt .. loc("Hint: Kills won't transfer a hog's pool to the killer's pool").."|"
  1643     txt = txt .. loc("Hint: Kills won't transfer a hog's pool to the killer's pool").."|"
  1640     txt = txt .. loc("Specials: Kings and air generals drop helpers, not weapons").."|"
  1644     txt = txt .. loc("Specials: Kings and air generals drop helpers, not weapons").."|"
  1641     icon = 1 -- Target
  1645     icon = 1 -- Target
  1642   elseif mode == 'king' then
  1646   elseif mode == 'king' then
  1643     txt = txt .. " |"
  1647     txt = txt .. " |"
  1644     txt = txt .. loc("--- King ---").."|"
  1648     txt = txt .. loc("--- King Mode ---").."|"
  1645     txt = txt .. loc("Variants: The last hog of each team will be a king").."|"
  1649     txt = txt .. loc("Protect the King: When the king dies, the team is vaporized").."|"
  1646     txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|"
  1650     txt = txt .. string.format(loc("Turns: King's health is set to %d%% of the team health"), kingLinkPerc).."|"
  1647     icon = 0 -- Golden Crown
  1651     icon = 0 -- Golden Crown
  1648   elseif mode == 'points' then
  1652   elseif mode == 'points' then
  1649     txt = txt .. " |"
  1653     txt = txt .. " |"
  1650     txt = txt .. loc("--- Points ---").."|"
  1654     txt = txt .. loc("--- Points Mode ---").."|"
  1651     txt = txt .. loc("Variants: Kings and air generals are disabled").."|"
  1655     txt = txt .. loc("Variants: Kings and air generals are disabled").."|"
  1652     txt = txt .. string.format(loc("Weapons: Each team starts with %d weapon points"), pointsWepBase).."|"
  1656     txt = txt .. string.format(loc("Weapons: Each team starts with %d weapon points"), pointsWepBase).."|"
  1653     txt = txt .. string.format(loc("Helpers: Each team starts with %d helper points"), pointsHlpBase).."|"
  1657     txt = txt .. string.format(loc("Helpers: Each team starts with %d helper points"), pointsHlpBase).."|"
  1654     txt = txt .. string.format(loc("Turns: Refill %d weapon and %d helper points|and randomize weapons and helpers based on team points"), pointsWepTurn, pointsHlpTurn).."|"
  1658     txt = txt .. string.format(loc("Turns: Refill %d weapon and %d helper points|and randomize weapons and helpers based on team points"), pointsWepTurn, pointsHlpTurn).."|"
  1655     icon = 4 -- Golden Star
  1659     icon = 4 -- Golden Star
  1662   txt = txt .. loc("Weapons: Nearly every hog variant gets 1 kamikaze").."|"
  1666   txt = txt .. loc("Weapons: Nearly every hog variant gets 1 kamikaze").."|"
  1663   txt = txt .. loc("Crates: Crates drop more often with a higher chance of bonus ammo").."|"
  1667   txt = txt .. loc("Crates: Crates drop more often with a higher chance of bonus ammo").."|"
  1664   txt = txt .. loc("Water: Rises by 37 per turn").."|"
  1668   txt = txt .. loc("Water: Rises by 37 per turn").."|"
  1665   txt = txt .. loc("Health: Hogs lose up to 7% base health per turn").."|"
  1669   txt = txt .. loc("Health: Hogs lose up to 7% base health per turn").."|"
  1666 
  1670 
  1667   if mode == 'default' then
  1671   -- Add hint if mode was not set in script parameter, or set incorrectly
       
  1672   if not modeExplicit then
  1668     txt = txt .. " |"
  1673     txt = txt .. " |"
  1669     txt = txt .. loc("--- Hint ---").."|"
  1674     txt = txt .. loc("--- Hint ---").."|"
  1670     txt = txt .. loc("Modes: Activate “highland”, “king” or “points” mode by putting mode=<name>|into the script parameter").."|"
  1675     txt = txt .. loc("Modes: Activate “highland”, “king” or “points” mode by putting mode=<name>|into the script parameter").."|"
  1671   end
  1676   end
  1672 
  1677