Skip to content

Commit

Permalink
Moved the mercenary camp definition to GSML, and made it use unit cla…
Browse files Browse the repository at this point in the history
…ss stocks to simplify its definition
  • Loading branch information
Andrettin committed Jul 8, 2022
1 parent c67eb22 commit 92fc13e
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 95 deletions.
9 changes: 0 additions & 9 deletions data/buttons/troll_unit_training.cfg

This file was deleted.

82 changes: 82 additions & 0 deletions data/unit_types/buildings/mercenary_camp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
unit_mercenary_camp = {
name = "Mercenary Camp"
parent = unit_template_building
unit_class = mercenary_camp
civilization = neutral
description = "This camp houses a number of mercenary groups, who offer their talents for hire."
image_file = "buildings/neutral/mercenary_camp.png"
frame_size = { 96 99 }
animation_set = animations_mercenary_camp
icon = icon_mercenary_camp
neutral_minimap_color = { 192 192 192 }
tile_size = { 3 3 }
box_size = { 96 96 }
construction = land_building
costs = {
time = 200
copper = 700
lumber = 1350
}
repair_hp = 4
repair_costs = {
copper = 1
lumber = 1
}
hit_points = 800
armor = 20
missile = missile_none
priority = 30
annoy_computer_factor = 35
explode_when_killed = missile_explosion
corpse_type = unit_destroyed_3x3_place
domain = land
right_mouse_action = rally_point
burn_percent = 50
burn_damage_rate = 1
recruit_heroes = true
drops = {
unit_wood_pile
}
unit_stocks = {
unit_ettin = 1
unit_troll_warrior = 2
}
unit_class_stocks = {
thief = 6
infantry = 4
spearman = 4
shooter = 3
gunpowder_infantry = 3
cavalry = 2
siege_engine = 1
glider = 1
flying_rider = 1
}
affixes = {
upgrade_prefix_frail
upgrade-item-prefix-impregnable
upgrade-item-prefix-sturdy
upgrade-item-prefix-vulnerable
upgrade-item-suffix-of-frailty
upgrade-item-suffix-of-vulnerability
}
variations = {
mercenary_camp = {
unit_conditions = {
not = {
scripted_condition = is_on_snowy_terrain
}
}
}
mercenary_camp_snow = {
image_file = "buildings/neutral/mercenary_camp_snow.png"
unit_conditions = {
scripted_condition = is_on_snowy_terrain
}
}
}
sounds = {
selected = click
dead = building_destroyed
}
}
2 changes: 1 addition & 1 deletion data/unit_types/buildings/teutonic/dock.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
unit_teuton_dock = {
parent = unit_template_dock
civilization = teuton
civilization = teutonic
description = "Shipbuilding is an ancient craft in the Teuton shores. Already in antiquity they constructed sturdy ships, capable of assaulting the vulnerable coasts to the west. During medieval times, their shipbuilding flourished even further, as the Hanseatic League dominated commerce in the Baltic and North Seas."
image_file = "buildings/teutonic/dock.png"
frame_size = { 96 96 }
Expand Down
Binary file added graphics/buildings/neutral/mercenary_camp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/buildings/neutral/mercenary_camp_snow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions graphics/credits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
/graphics/buildings/neutral/iron_deposit_snow.png (by Jinn) (licensed under the CC0)
/graphics/buildings/neutral/iron_mine.png (by Jinn) (licensed under the CC0)
/graphics/buildings/neutral/iron_mine_snow.png (by Jinn) (licensed under the CC0)
/graphics/buildings/neutral/mercenary_camp.png (by Jinn) (licensed under the CC0)
/graphics/buildings/neutral/mercenary_camp_snow.png (by Jinn) (licensed under the CC0)
/graphics/buildings/neutral/mithril_deposit.png (by Jinn) (licensed under the CC0)
/graphics/buildings/neutral/mithril_deposit_snow.png (by Jinn) (licensed under the CC0)
Expand Down Expand Up @@ -1170,8 +1171,6 @@
/graphics/neutral/buildings/gold_rock_small_4_shadow.png (by Jinn) (licensed under the CC0)
/graphics/neutral/buildings/land_construction_site.png (by Jinn) (licensed under the CC0)
/graphics/neutral/buildings/land_construction_site_1x1.png (by Jinn) (licensed under the CC0)
/graphics/neutral/buildings/mercenary_camp.png (by Jinn and b_o) (licensed under the GPL 2.0 and the CC-BY-SA 3.0)
/graphics/neutral/buildings/mercenary_camp_shadow.png (by Jinn) (licensed under the CC0)
/graphics/neutral/buildings/mithril_mine.png (by Jinn) (licensed under the CC0)
/graphics/neutral/buildings/mithril_mine_light.png (by Jinn) (licensed under the CC0)
/graphics/neutral/buildings/mithril_mine_shadow.png (by Jinn) (licensed under the CC0)
Expand Down
Binary file removed graphics/neutral/buildings/mercenary_camp.png
Binary file not shown.
Binary file removed graphics/neutral/buildings/mercenary_camp_shadow.png
Binary file not shown.
2 changes: 1 addition & 1 deletion maps/nidavellir/brown-hills.sms
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ SetUnitVariable(unit, "Active", false)
unit = CreateUnit("unit-potion-of-healing", PlayerNumNeutral, {8, 51})
unit = CreateUnit("unit-potion-of-healing", PlayerNumNeutral, {52, 96})

CreateNeutralBuildings("unit-mercenary-camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)
CreateNeutralBuildings("unit_mercenary_camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)

CreateNeutralBuildings("unit_minor_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 256, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)
CreateNeutralBuildings("unit_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 1024, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)
Expand Down
2 changes: 1 addition & 1 deletion maps/nidavellir/southern-tunnels.sms
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ unit = CreateUnit("unit-dwarven-sentry-tower", 3, {47, 48})
unit = CreateUnit("unit-dwarven-sentry-tower", 3, {51, 48})

if (LoadedGame == false) then
CreateNeutralBuildings("unit-mercenary-camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)
CreateNeutralBuildings("unit_mercenary_camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)

CreateNeutralBuildings("unit_minor_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 256, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)
CreateNeutralBuildings("unit_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 1024, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, false)
Expand Down
8 changes: 4 additions & 4 deletions scripts/map_generation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ function CreateNeutralBuildings(building_type, building_number, min_x, max_x, mi
local building_player = PlayerNumNeutral
while (Count > 0 and WhileCount < building_number * 100) do
local building_spawn_point = FindAppropriateNeutralBuildingSpawnPoint(building_type, min_x, max_x, min_y, max_y, symmetric)
if (building_type == "unit-mercenary-camp" and building_player == PlayerNumNeutral) then
if (building_type == "unit_mercenary_camp" and building_player == PlayerNumNeutral) then
local tile_terrain = GetTileTerrainName(building_spawn_point[1], building_spawn_point[2])
local potential_civilizations = GetTerrainCivilizations(tile_terrain)
local all_factions = GetFactions()
Expand Down Expand Up @@ -2342,7 +2342,7 @@ function GenerateRandomMap(arg)
end

if (arg.MercenaryCamp) then
CreateNeutralBuildings("unit-mercenary-camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)
CreateNeutralBuildings("unit_mercenary_camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)
end

CreateNeutralBuildings("unit_minor_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 256, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)
Expand Down Expand Up @@ -4059,7 +4059,7 @@ function GenerateValley(direction, lake_quantity)
CreateNeutralBuildings("unit_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 1024, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)

if (GetCurrentTileset() == "swamp" or GetCurrentTileset() == "cave") then
CreateNeutralBuildings("unit-mercenary-camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)
CreateNeutralBuildings("unit_mercenary_camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)
end

CreateRoamingFog((CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 4096)
Expand Down Expand Up @@ -6013,7 +6013,7 @@ function GenerateCave(town_halls, symmetric)
CreateNeutralBuildings("unit_building_site", (CMap:get():get_info():get_map_width() * CMap:get():get_info():get_map_height()) / 1024, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)


CreateNeutralBuildings("unit-mercenary-camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)
CreateNeutralBuildings("unit_mercenary_camp", 1, 0, CMap:get():get_info():get_map_width() - 3, 0, CMap:get():get_info():get_map_height() - 3, symmetric)

for i=0,(PlayerMax - 2) do
if (GetPlayerData(i, "Type") == PlayerPerson or GetPlayerData(i, "Type") == PlayerComputer) then
Expand Down
2 changes: 1 addition & 1 deletion scripts/provinces_nidavellir.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ DefineProvince("Southern Tunnels", {
HistoricalSettlementBuildings = {
25, "unit-dwarven-barracks", true, -- had capability to train warriors
25, "unit-dwarven-lumber-mill", true, -- had the capability to train scouts
35, "unit-mercenary-camp", true -- at some point between 35 and 40 the Shinsplitters had the capacity to recruit mercenaries, as shown by them having hired the Surghan Mercenaries
35, "unit_mercenary_camp", true -- at some point between 35 and 40 the Shinsplitters had the capacity to recruit mercenaries, as shown by them having hired the Surghan Mercenaries
}
})

Expand Down
2 changes: 1 addition & 1 deletion scripts/settlements_nidavellir.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DefineSite("driftwood", { -- from Will Doyle's "Island of the Lizard God"
},
HistoricalBuildings = {
600, 0, "town_hall",
600, 0, "mercenary-camp", "ape-cartel",
600, 0, "mercenary_camp", "ape-cartel",
600, 0, "farm",
600, 0, "farm",
600, 0, "farm",
Expand Down
3 changes: 1 addition & 2 deletions scripts/stratagus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ function StandardTriggers()
if (GetArrayIncludes(wyr.preferences.TipsShown, "Mercenary Camp") == false) then
AddTrigger("tip-mercenary-camp",
function()
if (table.getn(GetSelectedUnits()) > 0 and GetUnitVariable(GetSelectedUnits()[1], "Ident") == "unit-mercenary-camp") then
if (table.getn(GetSelectedUnits()) > 0 and GetUnitVariable(GetSelectedUnits()[1], "Ident") == "unit_mercenary_camp") then
return true
else
return false
Expand Down Expand Up @@ -1860,7 +1860,6 @@ Units = {
"unit-diamond-rock", "unit-diamond-deposit", "unit-diamond-mine",
"unit-emerald-rock", "unit-emerald-deposit", "unit-emerald-mine",
"unit-yale-hunting-lodge",
"unit-mercenary-camp",
-- "unit-cavern-entrance",
-- "unit-portal",
"unit-road", "unit-railroad",
Expand Down
71 changes: 0 additions & 71 deletions scripts/units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4767,77 +4767,6 @@ DefineUnitType("unit-long-swordsman", {
}
} )

-- define the mercenary camp after the rest because it refers to unit types of the civilizations
DefineUnitType("unit-mercenary-camp", {
Name = "Mercenary Camp",
Parent = "unit-template-building",
Civilization = "neutral",
Class = "mercenary_camp",
Description = "This camp houses a number of mercenary groups, who offer their talents for hire.",
Image = {"file", "neutral/buildings/mercenary_camp.png", "size", {96, 99}},
Shadow = {"file", "neutral/buildings/mercenary_camp_shadow.png", "size", {96, 99}},
NeutralMinimapColor = {192, 192, 192},
Animations = "animations-mercenary-camp", Icon = "icon-mercenary-camp",
Costs = {"time", 200, "copper", 700, "lumber", 1350},
RepairHp = 4,
RepairCosts = {"copper", 1, "lumber", 1},
Construction = "land_building",
HitPoints = 800,
TileSize = {3, 3}, BoxSize = {96, 96},
Armor = 20, Missile = "missile-none",
Priority = 30, AnnoyComputerFactor = 35,
Corpse = "unit-destroyed-3x3-place",
ExplodeWhenKilled = "missile-explosion",
Domain = "land",
Drops = {"unit_wood_pile"},
RightMouseAction = "rally_point",
BurnPercent = 50,
BurnDamageRate = 1,
RecruitHeroes = true,
UnitStock = {
"unit-dwarven-axefighter", 4, "unit-surghan-mercenary-axefighter", 4, "unit-dwarven-guard", 4, "unit-dwarven-scout", 3, "unit-joruvellir-scout", 3, "unit-dwarven-thunderer", 3, "unit-dwarven-yale-rider", 2, "unit-joruvellir-yale-rider", 2, "unit-dwarven-ballista", 1, "unit_dwarven_gryphon_rider", 1,
"unit_goblin_thief", 6, "unit-goblin-swordsman", 4, "unit-goblin-spearman", 4, "unit-goblin-archer", 3, "unit-goblin-gunpowder-infantry", 3, "unit-goblin-war-machine", 1, "unit-goblin-glider", 1,
"unit-kobold-footpad", 4,
"unit-ettin", 1,
"unit-latin-legionary", 4, "unit-latin-javelineer", 3,
"unit-norse-swordsman", 4,
"unit-orc-spearthrower", 3,
"unit-slavic-swordsman", 4,
"unit-troll-warrior", 2
},
Affixes = {"upgrade_prefix_frail", "upgrade-item-prefix-impregnable", "upgrade-item-prefix-sturdy", "upgrade-item-prefix-vulnerable", "upgrade-item-suffix-of-frailty", "upgrade-item-suffix-of-vulnerability"},
Variations = {
{
"variation-id", "mercenary-camp",
"terrain-forbidden", "snow",
"forbidden-season", "winter"
},
{
"variation-id", "mercenary-camp-snow-winter",
"file", "buildings/neutral/mercenary_camp_snow.png",
"terrain", "dirt",
"terrain", "dry-mud",
"terrain", "grass",
"terrain", "semi_dry_grass",
"terrain", "dry_grass",
"terrain", "snow",
"season", "winter"
},
{
"variation-id", "mercenary-camp-snow",
"file", "buildings/neutral/mercenary_camp_snow.png",
"terrain", "snow"
}
},
Sounds = {
"selected", "click",
-- "acknowledge", "barracks-acknowledge",
-- "ready", "barracks-ready",
-- "help", "basic-dwarf-voices-help",
"dead", "building-destroyed"
}
} )

DefineUnitType("unit-dungeon-wall", {
Name = "Dungeon Wall",
TerrainType = "dungeon-wall",
Expand Down
4 changes: 2 additions & 2 deletions scripts/upgrade_faction_types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ DefineModifier("upgrade_holy_order", -- holy orders' temples have a unit stock f

DefineModifier("upgrade_mercenary_company", -- mercenary companies' mercenary camps produce food, to allow them to train units despite not having farms
{"Supply", 8},
{"apply-to", "unit-mercenary-camp"}
{"apply-to", "unit_mercenary_camp"}
)

DefineModifier("upgrade_mercenary_company", -- mercenary companies' mercenary camps "regenerate", since they aren't supposed to have workers to repair them
{"HitPoints", 1, "Increase"},
{"apply-to", "unit-mercenary-camp"}
{"apply-to", "unit_mercenary_camp"}
)

DefineModifier("upgrade_trading_company",
Expand Down

0 comments on commit 92fc13e

Please sign in to comment.