Expand lua whitespace check.

This commit is contained in:
Pentarctagon 2021-11-22 15:57:41 -06:00 committed by Pentarctagon
parent aa9e51bb1b
commit 254716e41e
28 changed files with 185 additions and 185 deletions

View file

@ -24,7 +24,7 @@ local function iter_possible_targets(moves, attacker)
moves = LS.of_pairs(moves)
-- The criteria are: a) unit is reachable b) unit's health is low
local targets = wesnoth.units.find({
})
return coroutine.wrap(function()
local checked = LS.create()
@ -38,7 +38,7 @@ local function iter_possible_targets(moves, attacker)
end
end
end
end)
end)
end)
end

View file

@ -90,7 +90,7 @@ return {
local debug = wesnoth.require("ai/lua/debug.lua")
debug.init(ai)
end
-- Deprecated functions
ai.get_aggression = wesnoth.deprecate_api('ai.get_aggression', 'ai.aspects.aggression', 2, '1.15', ai.get_aggression)
ai.get_avoid = wesnoth.deprecate_api('ai.get_avoid', 'ai.aspects.avoid', 2, '1.15', ai.get_avoid)

View file

@ -65,7 +65,7 @@ function ca_wolves_move:execution(cfg)
table.sort(wolves, function(a, b)
return M.distance_between(a.x, a.y, target.x, target.y) > M.distance_between(b.x, b.y, target.x, target.y)
end)
-- First wolf moves toward target, but tries to stay away from map edges
local wolf1 = AH.find_best_move(wolves[1], function(x, y)
local dist_1t = M.distance_between(x, y, target.x, target.y)

View file

@ -34,7 +34,7 @@ local function preshow(dialog)
function dialog.unit_help_button.on_button_click()
W.open_help { topic="unit_" .. listedZombies[dialog.unit_list.selected_index] }
end
for i,z in ipairs(zombies) do
if z.allow_recruit then
local unit_type = wesnoth.unit_types[z.type]

View file

@ -2,7 +2,7 @@ local _ = wesnoth.textdomain 'wesnoth-wc'
local on_event = wesnoth.require("on_event")
local strings = {
enemy_pet = _ "$name|'s pet"
enemy_pet = _ "$name|'s pet"
}
-- in the later scenarios there is a small chance that a scenario will be themed for an enemy
-- which means in paticular changing the castle of the enemy accorign to the unit type of that
@ -24,7 +24,7 @@ local function wct_map_enemy_themed(race, pet, castle, village, chance)
}
}
}
}
boss = boss[1]
if boss == nil then
@ -87,7 +87,7 @@ local function wct_map_enemy_themed(race, pet, castle, village, chance)
wml.tag.effect {
apply_to="overlay",
add = "misc/hero-icon.png",
}
}
}
}
}

View file

@ -56,7 +56,7 @@ function wesnoth.wml_actions.wc2_store_carryover(cfg)
wml.variables.wc2_carryover = math.ceil( (nvillages*turns_left + player_gold) * 0.15)
end
-- carryover handling: we use a custom carryover machnics that
-- carryover handling: we use a custom carryover machnics that
-- splits the carryover gold evenly to all players
on_event("prestart", function(cx)
wesnoth.fire_event("wc2_start")
@ -81,7 +81,7 @@ on_event("wc2_start", function(cx)
}
end
end
local gold = (wml.variables.wc2_carryover or 0) + (wml.variables["wc2_difficulty.extra_gold"] or 0)
for i = 1, wml.variables.wc2_player_count do
wesnoth.sides[i].gold = wesnoth.sides[i].gold + gold

View file

@ -169,7 +169,7 @@ function wc2_era.read_era_tag(era_wml)
add_known_faction(faction)
end
end
-- No need to read [hero_types] since wc2_utils.get_wc2_data also reads from [era]
-- No need to read [hero_types] since wc2_utils.get_wc2_data also reads from [era]
end
function wc2_era.init_era_default()
@ -178,7 +178,7 @@ function wc2_era.init_era_default()
end
function wc2_era.init_data()
for i,v in ipairs(wml.get_child(wc2_utils.get_wc2_data("hero_types"), "hero_types")) do
add_known_hero_group(v[1], v[2])
end

View file

@ -96,8 +96,8 @@ function artifacts.give_item(unit, index, visualize)
if make_holder_loyal then
table.insert(object, wml.tag.effect { apply_to= "loyal" })
end
-- IDEA: i _could_ replace the follwing with a 'apply_to=wc2_artifact' effect that
-- basicially applies all effects in the [artifact]s definition. The obvious
-- advantage would be a smaller savefile size. Also this woudl change how savefiles
@ -125,7 +125,7 @@ on_event("wc2_drop_pickup", function(ec)
return
end
if not unit then
if not unit then
return
end
@ -134,7 +134,7 @@ on_event("wc2_drop_pickup", function(ec)
if not wml.variables["wc2_config_experimental_pickup"] and not is_human then
return
end
local index = item.variables.wc2_atrifact_id
local filter = artifacts.get_artifact(index).filter
@ -153,7 +153,7 @@ on_event("wc2_drop_pickup", function(ec)
return
end
end
wc2_dropping.item_taken = true
artifacts.give_item(unit, index, true)
@ -162,7 +162,7 @@ end)
-- returns a list of artifact ids, suitable for the give type ('enemy' for example).
function artifacts.fresh_artifacts_list(for_type)
local res = {}
local res = {}
for i,v in ipairs(artifacts.get_artifact_list()) do
if not for_type or not stringx.map_split(v.not_available or "")[for_type] then
table.insert(res, i)
@ -194,7 +194,7 @@ on_event("die", function(event_context)
end)
-- returns true if there is an item in the map at the given position,
-- used to determine whether to show the artifact info menu at that position.
-- used to determine whether to show the artifact info menu at that position.
function artifacts.is_item_at(x,y)
for i,item in ipairs(wesnoth.interface.get_items(x,y)) do
if item.variables.wc2_atrifact_id then
@ -204,7 +204,7 @@ function artifacts.is_item_at(x,y)
return false
end
-- shows an information [message] about the item laying at position
-- shows an information [message] about the item laying at position
-- @a cfg.x, cfg.y
function wesnoth.wml_actions.wc2_show_item_info(cfg)
local x = cfg.x

View file

@ -17,7 +17,7 @@ function color.help_text(str)
return color.color_text("#ff95ff", str)
end
-- note: the default argument for the first parameter is the
-- note: the default argument for the first parameter is the
-- currently active side, not the currently viewing side
function color.tc_text(team_num, text)
if text == nil then

View file

@ -8,7 +8,7 @@ local dropping = {}
dropping.remove_current_item = function()
local ec = wesnoth.current.event_context
wesnoth.interface.remove_item(ec.x1, ec.y1, dropping.current_item.name)
dropping.item_taken = true
end

View file

@ -1,7 +1,7 @@
local _ = wesnoth.textdomain 'wesnoth-wc'
local T = wml.tag
local terrain_map = { fungus = "Tt", cave = "Ut", sand = "Dt",
local terrain_map = { fungus = "Tt", cave = "Ut", sand = "Dt",
reef = "Wrt", hills = "Ht", swamp_water = "St", shallow_water = "Wst", castle = "Ct",
mountains = "Mt", deep_water = "Wdt", flat = "Gt", forest = "Ft", frozen = "At",
village = "Vt", impassable = "Xt", unwalkable = "Qt", rails = "Rt"
@ -111,7 +111,7 @@ function wesnoth.effects.wc2_update_aura(u, cfg)
local darkens = wesnoth.units.matches(u, { ability = "darkness" } )
local forcefield = wesnoth.units.matches(u, { ability = "forcefield" } )
local halo = ""
if illuminates and darkens then
if illuminates and darkens then
wesnoth.interface.add_chat_message("WC2", "Warning illuminates and darkens discovered on a unit")
end
if forcefield and illuminates then
@ -125,7 +125,7 @@ function wesnoth.effects.wc2_update_aura(u, cfg)
elseif illuminates then
halo = "halo/illuminates-aura.png"
end
wesnoth.units.add_modification(u, "object", {
T.effect {
apply_to = "halo",

View file

@ -38,7 +38,7 @@ function wc2_invest.initialize()
side.variables["wc2.items_left"] = table.concat(all_items, ",")
wc2_invest.add_items(side_num, 9)
else
wc2_invest.add_items(side_num, 1)
wc2_invest.add_items(side_num, 1)
end
end
end
@ -59,7 +59,7 @@ function wc2_invest.do_gold()
local side = wesnoth.sides[side_num]
local leaders = wesnoth.units.find_on_map { side = side_num, canrecruit = true }
side.gold = side.gold + 70
wesnoth.wml_actions.wc2_map_supply_village {
wesnoth.wml_actions.wc2_map_supply_village {
x = leaders[1].x,
y = leaders[1].y
}
@ -103,7 +103,7 @@ function wc2_invest.do_hero(t, is_local)
side.variables["wc2.heroes"] = table.concat(heroes_available, ",")
wc2_heroes.place(t, side_num, x, y, false)
end
end
function wc2_invest.do_training(t)
@ -116,7 +116,7 @@ function wc2_invest.do_item(t)
local side = wesnoth.sides[side_num]
local leaders = wesnoth.units.find_on_map { side = side_num, canrecruit = true }
local x,y = leaders[1].x, leaders[1].y
local items_available = stringx.split(side.variables["wc2.items"] or "")
local i = find_index(items_available, tostring(t))
if i == nil then
@ -166,7 +166,7 @@ function wc2_invest.invest()
error("wc2 invest: invalid pick , pick='" .. tostring(res.pick) .. "'.")
end
end
end
function wesnoth.wml_actions.wc2_invest(cfg)

View file

@ -26,7 +26,7 @@ function wc2_show_invest_dialog_impl(args)
local details = dialog.details
local root_node = dialog.left_tree
function gui.widget.add_invest_category(parent_node, name)
function gui.widget.add_invest_category(parent_node, name)
local node = parent_node:add_item_of_type("category")
node.category_name.label = name
node.unfolded = true
@ -36,7 +36,7 @@ function wc2_show_invest_dialog_impl(args)
function gui.widget.add_invest_item(parent_node, args)
local node_type = args.desc and "item_desc" or "item"
local page_type = args.page_type or ""
local node = parent_node:add_item_of_type(node_type)
local details_page = details:add_item_of_type(page_type)
@ -51,7 +51,7 @@ function wc2_show_invest_dialog_impl(args)
end
local cati_current = 0
if show_artifacts then
if show_artifacts then
local node = root_node:add_invest_category(_ "Artifacts")
for i,v in ipairs(available_artifacts) do
@ -72,7 +72,7 @@ function wc2_show_invest_dialog_impl(args)
if show_heroes then
local node = root_node:add_invest_category(_ "Heroes")
if available_commanders then
local desc = _ "Commanders will take your leaders place when the leader dies, possible commanders:"
for j,v in ipairs(available_commanders) do

View file

@ -1,5 +1,5 @@
local supply_images =
local supply_images =
{
"misc/blank-hex.png~BLIT(items/straw-bale2.png~CROP(24,15,48,57))~BLIT(items/straw-bale1.png~CROP(0,9,72,63))",
"misc/blank-hex.png~BLIT(items/straw-bale1.png~CROP(8,15,64,57))~BLIT(items/leather-pack.png~CROP(0,10,62,62),10,0)~BLIT(items/leather-pack.png~CROP(0,0,69,72),3,0)",
@ -18,9 +18,9 @@ function wesnoth.wml_actions.wc2_map_supply_village(t)
local unit = wesnoth.units.get(t.x, t.y)
local loc = unit.loc
wesnoth.current.map[loc] = "^Vov"
wesnoth.map.set_owner(loc, unit.side, false)
local supply_image = ((wml.variables.wc2_supply_image_counter or 0) % #supply_images ) + 1
wml.variables.wc2_supply_image_counter = supply_image
wesnoth.wml_actions.item {

View file

@ -5,188 +5,188 @@ type_infos = {
founddialogue = _"You look like you could use some help. Mind if I join in? Its been a while since I had a good fight!",
reply = _ "Excellent. We could always use more help.",
},
["Orcish Grunt"] = {
["Orcish Grunt"] = {
founddialogue=_"bout time. Been forever since I had a good fight, eh?",
image="units/orcs/grunt.png",
name="Orcish Grunt",
},
["Troll Whelp"] = {
["Troll Whelp"] = {
founddialogue=_"Who you? I help you smash!",
image="units/trolls/whelp.png",
name="Troll Whelp",
},
["Orcish Archer"] = {
["Orcish Archer"] = {
founddialogue=_"My clan was destroyed long ago, leaving me to fend for myself. Let me join your army and I will fight as though your clan was my own!",
image="units/orcs/archer.png",
name="Orcish Archer",
},
["Orcish Assassin"] = {
["Orcish Assassin"] = {
founddialogue=_"Hey boss. Looks like youve got some prey that need killing.",
image="units/orcs/assassin.png",
name="Orcish Assassin",
},
["Wolf Rider"] = {
["Wolf Rider"] = {
founddialogue=_"I hunts. I join you, I hunts good for you!",
image="units/goblins/wolf-rider.png",
name="Wolf Rider",
alt_reply = { {
alt_reply = { {
race="wose",
reply=_"Very well. But take care where your dog does its stuff.",
} }
},
["Orcish Leader"] = {
["Orcish Leader"] = {
founddialogue=_"Heh, looks like you whelps might be getting in over your heads. Good thing Im here now to win this fight for ya, huh?",
image="units/orcs/leader.png",
name="Orcish Leader",
},
["Naga Fighter"] = {
["Naga Fighter"] = {
founddialogue=_"I too have come a long way to this strange land. Perhaps we were destined to join blades here.",
image="units/nagas/fighter.png",
name="Naga Fighter",
alt_reply = { {
alt_reply = { {
race="gryphon",
reply=_"Looks like we fished some tasty help.",
} }
},
["Elvish Fighter"] = {
["Elvish Fighter"] = {
founddialogue=_"Need a friendly blade?",
image="units/elves-wood/fighter.png",
name="Elvish Fighter",
},
["Elvish Archer"] = {
["Elvish Archer"] = {
founddialogue=_"You look like you could use some help. Mind if I join in? Its been a while since I had a good fight!",
image="units/elves-wood/archer.png",
name="Elvish Archer",
},
["Elvish Shaman"] = {
["Elvish Shaman"] = {
founddialogue=_"The mother forest sends you her blessings. Let us join together against her foes.",
image="units/elves-wood/shaman.png",
name="Elvish Shaman",
alt_reply = { {
alt_reply = { {
race="elf,wose",
reply=_"Yeah, flower power!",
} }
},
["Elvish Scout"] = {
["Elvish Scout"] = {
founddialogue=_"I offer you the service of my arrows and my steed. You will find none that fly faster than either.",
image="units/elves-wood/scout/scout.png",
name="Elvish Scout",
},
["Wose"] = {
["Wose"] = {
founddialogue=_"Hmm! Welcome, tree-friends. We will pound our enemies into dust!",
image="units/woses/wose.png",
name="Wose",
},
["Merman Hunter"] = {
["Merman Hunter"] = {
founddialogue=_"Greetings, friends. I am a lone hunter and have no legions of warriors to offer you, but I will gladly lend my arms to your cause.",
image="units/merfolk/hunter.png",
name="Merman Hunter",
alt_reply = { {
alt_reply = { {
race="gryphon",
reply=_"Looks like we fished some tasty help.",
} }
},
["Mermaid Initiate"] = {
["Mermaid Initiate"] = {
founddialogue=_"You have come a long way over the ocean, yet I see that you know little of her ways. Let me show you.",
image="units/merfolk/initiate.png",
name="Mermaid Initiate",
alt_reply = { {
alt_reply = { {
race="gryphon",
reply=_"Looks like we fished some tasty help.",
} }
},
["Cavalryman"] = {
["Cavalryman"] = {
founddialogue=_"Youre not from around here, but I seem to find myself between employers at the moment and Im not picky. Ill fight for you, if youll have me.",
image="units/human-loyalists/cavalryman/cavalryman.png~CROP(14,14,72,72)",
name="Cavalryman",
alt_reply = { {
alt_reply = { {
gender="female",
reply=_"Of course. How could a girl say no to a man riding a horse?",
} }
},
["Horseman"] = {
["Horseman"] = {
founddialogue=_"Hurrah! Now THIS is a battle too grand to be missed. Save some for me, eh?",
image="units/human-loyalists/horseman/horseman.png",
name="Horseman",
alt_reply = { {
alt_reply = { {
gender="female",
reply=_"Of course. How could a girl say no to a man riding a horse?",
} }
},
["Spearman"] = {
["Spearman"] = {
founddialogue=_"Ho there, friends! I am but a soldier of humble circumstances, yet long have I dreamed of joining great wars beyond our shores. Let me join your mission!",
image="units/human-loyalists/spearman.png",
name="Spearman",
},
["Fencer"] = {
["Fencer"] = {
founddialogue=_"Looks like youre a bit down on your luck, my friends. But now that I am here, theres nothing to worry about!",
image="units/human-loyalists/fencer.png",
name="Fencer",
},
["Heavy Infantryman"] = {
["Heavy Infantryman"] = {
founddialogue=_"Finally reinforcements are here! Ive been pinned down for days. Help me fight my way out of here and Ill gladly follow you!",
image="units/human-loyalists/heavyinfantry.png",
name="Heavy Infantryman",
},
["Bowman"] = {
["Bowman"] = {
founddialogue=_"Greetings, my lords. I have watched your battle from afar and yearn to join such a glorious campaign. I pledge myself to your service!",
image="units/human-loyalists/bowman.png",
name="Bowman",
},
["Sergeant"] = {
["Sergeant"] = {
founddialogue=_"Youre not from around here, but I seem to find myself between employers at the moment and Im not picky. Ill fight for you, if youll have me.",
image="units/human-loyalists/sergeant.png",
name="Sergeant",
},
["Mage"] = {
["Mage"] = {
founddialogue=_"Long have I studied the ways of lore, and I have much wisdom to offer. Allow me to guide you on your quest and together we will accomplish great things!",
image="units/human-magi/mage.png",
name="Mage",
},
["Merman Fighter"] = {
["Merman Fighter"] = {
founddialogue=_"I bring greetings from the merfolk. We have heard your plight, and though we have few warriors to spare among us, I would gladly lend my trident to your cause.",
image="units/merfolk/fighter.png",
name="Merman Fighter",
alt_reply = { {
alt_reply = { {
race="gryphon",
reply=_"Looks like we fished some tasty help.",
} }
},
["Dwarvish Fighter"] = {
["Dwarvish Fighter"] = {
founddialogue=_"Having trouble, eh? Never worry, lads, well sort em out soon enough!",
image="units/dwarves/fighter.png",
name="Dwarvish Fighter",
},
["Thief"] = {
["Thief"] = {
founddialogue=_"Youve got me, guv, its a fair cop! Just lemme work for you instead. You wont regret it, guv, I promise!",
image="units/human-outlaws/thief.png",
name="Thief",
},
["Dwarvish Thunderer"] = {
["Dwarvish Thunderer"] = {
founddialogue=_"Listen up, ye primitive screwheads! This... is me BOOM STICK. Lemme show you what this baby can do!",
image="units/dwarves/thunderer/thunderer.png",
name="Dwarvish Thunderer",
},
["Poacher"] = {
["Poacher"] = {
founddialogue=_"What, you want my help? A guy like me? Huh, thats rich. Oh well... lets give it a shot, eh?",
image="units/human-outlaws/poacher.png",
name="Poacher",
},
["Dwarvish Guardsman"] = {
["Dwarvish Guardsman"] = {
founddialogue=_"A soldier is no good without something to fight for. Let me fight for you!",
image="units/dwarves/guard.png",
name="Dwarvish Guardsman",
},
["Footpad"] = {
["Footpad"] = {
founddialogue=_"Hey, hey, easy there! I done nothin to hurt you. Were all friends here, right? Looks like you might be in a tight spot, but dont worry. No ones better at getting out of tight spots than me, boss!",
image="units/human-outlaws/footpad.png",
name="Footpad",
},
["Dwarvish Ulfserker"] = {
["Dwarvish Ulfserker"] = {
founddialogue=_"Chin up, lads. Today is a good day to die!",
image="units/dwarves/ulfserker.png",
name="Dwarvish Ulfserker",
alt_reply = { {
alt_reply = { {
race="dwarf",
reply=_"Brave words. Welcome to The Fight Club...",
}, {
@ -194,125 +194,125 @@ type_infos = {
reply=_"Brave words. Welcome little big man.",
} }
},
["Gryphon Rider"] = {
["Gryphon Rider"] = {
founddialogue=_"Need a hand? Me an me bird can get just about anywheres you need.",
image="units/dwarves/gryphon-rider.png",
name="Gryphon Rider",
alt_reply = { {
alt_reply = { {
race="merman,naga",
reply=_"Sounds good. You scared me for a moment.",
}, {
}, {
race="gryphon,bats",
reply=_"Cool. We could always need more air power.",
} }
},
["Dwarvish Scout"] = {
["Dwarvish Scout"] = {
founddialogue=_"Having trouble, eh? Never worry, lads, well sort em out soon enough!",
image="units/dwarves/scout.png",
name="Dwarvish Scout",
},
["Drake Fighter"] = {
["Drake Fighter"] = {
founddialogue=_"The ancient spirits tell me my destiny lies with yours. My sword is at your command.",
image="units/drakes/fighter.png",
name="Drake Fighter",
},
["Drake Clasher"] = {
["Drake Clasher"] = {
founddialogue=_"Stand fast, for I bring you the strength of dragons to assist you in your battle!",
image="units/drakes/clasher.png",
name="Drake Clasher",
},
["Drake Burner"] = {
["Drake Burner"] = {
founddialogue=_"Today is a most auspicious day for you, for I deem you worthy of the power of dragonfire. Show me your foes and I will incinerate them!",
image="units/drakes/burner.png",
name="Drake Burner",
alt_reply = { {
alt_reply = { {
race="drake",
reply=_"Perfect. We can always use more firepower.",
} }
},
["Saurian Augur"] = {
["Saurian Augur"] = {
founddialogue=_"You no fight good enough, no have saurian way. I show you way of saurian!",
image="units/saurians/augur/augur.png",
name="Saurian Augur",
alt_reply = { {
alt_reply = { {
race="lizard",
reply=_"Sure, bro...",
} }
},
["Drake Glider"] = {
["Drake Glider"] = {
founddialogue=_"You may be out to take over the land and the seas, but youll never get anywhere without control of the skies. Fortunately Im here to help you!",
image="units/drakes/glider.png",
name="Drake Glider",
alt_reply = { {
alt_reply = { {
race="gryphon,bats",
reply=_"Cool. We could always need more air power.",
} }
},
["Saurian Skirmisher"] = {
["Saurian Skirmisher"] = {
founddialogue=_"Tribe fall long time ago, now tribe lost. This last fight of tribe. I fight with you, make last very great!",
image="units/saurians/skirmisher/skirmisher.png",
name="Saurian Skirmisher",
},
["Skeleton"] = {
["Skeleton"] = {
founddialogue=_"Dont hit me! Im just your average regular friendly talking skeleton, see? Looks like you fellows could use some help!",
image="units/undead-skeletal/skeleton/skeleton.png",
name="Skeleton",
},
["Skeleton Archer"] = {
["Skeleton Archer"] = {
founddialogue=_"I am called forth from eternal rest, bound to follow he who called me. Show me the enemy, master!",
image="units/undead-skeletal/archer.png",
name="Skeleton Archer",
},
["Ghoul"] = {
["Ghoul"] = {
founddialogue=_"I say, old sport! It looks like youve got a spot of bother. Well, chin up, I say! Im sure well make a simply smashing team-up. We can sort this lot out and be done by tea, what?",
image="units/undead/ghoul.png",
name="Ghoul",
reply=_"Have at thee, unholy abomin... wait, huh?",
alt_reply = { {
alt_reply = { {
race="undead,bats",
reply=_"Excellent. We could always use more help.",
} }
},
["Dark Adept"] = {
["Dark Adept"] = {
founddialogue=_"You may not trust me or my reasons, but it seems you are not in a position to be choosy about your allies. Let me assist you and you just may survive.",
image="units/undead-necromancers/adept.png",
name="Dark Adept",
},
["Ghost"] = {
["Ghost"] = {
founddialogue=_"Who calls me from my slumber? I sense a great battle being joined. Point me towards the enemy and I will feast upon their very souls!",
image="units/undead/ghost-s-2.png",
name="Ghost",
},
["Vampire Bat"] = {
["Vampire Bat"] = {
founddialogue=_"Skreeeeeeee!",
image="units/undead/bat-se-3.png",
name="Vampire Bat",
reply=_"This creature seems unusually intelligent for its kind. Perhaps it will help us!",
alt_reply = { {
alt_reply = { {
race="undead,bats",
reply=_"Excellent. We could always use more help.",
} }
},
["Young Ogre"] = {
["Young Ogre"] = {
founddialogue=_"You friend are? I friend help!",
image="units/ogres/young-ogre.png",
name="Young Ogre",
alt_reply = { {
alt_reply = { {
race="ogre,troll",
reply=_"Me friend. We can play together.",
} }
},
["Thug"] = {
["Thug"] = {
founddialogue=_"What, you want my help? A guy like me? Huh, thats rich. Oh well... lets give it a shot, eh?",
image="units/human-outlaws/thug.png",
name="Thug",
},
["Goblin Spearman"] = {
["Goblin Spearman"] = {
founddialogue=_"Ah, please no hurtings me! I helps you, see?",
image="units/goblins/spearman.png",
name="Goblin Spearman",
reply=_"Fine. We could need a small help.",
alt_reply = { {
alt_reply = { {
race="orc,troll,dwarf,ogre,gryphon,wolf",
reply=_"Excellent. We could always need cannon fodder.",
}, {
@ -320,65 +320,65 @@ type_infos = {
reply=_"Excellent. We could always use more help.",
} }
},
["Walking Corpse"] = {
["Walking Corpse"] = {
founddialogue=_"...",
image="units/undead/zombie.png",
name="Walking Corpse",
reply=_"Odd, it doesnt seem to attack. I wonder if we can use it?",
alt_reply = { {
alt_reply = { {
race="undead,bats",
reply=_"Excellent. We could always use more help.",
type="Dark Adept,Dark Sorcerer,Necromancer,Lich",
} }
},
["Ruffian"] = {
["Ruffian"] = {
founddialogue=_"Oooh oooh oooh! I want to help! Pick me, pick me!",
name="Ruffian",
reply=_"...fine. I guess.",
alt_reply = { {
alt_reply = { {
race="human",
reply=_"Excellent. We could always use more help.",
} }
},
["Peasant"] = {
["Peasant"] = {
founddialogue=_"Oooh oooh oooh! I want to help! Pick me, pick me!",
name="Peasant",
reply=_"...fine. I guess.",
alt_reply = { {
alt_reply = { {
race="human",
reply=_"Excellent. We could always use more help.",
} }
},
["Woodsman"] = {
["Woodsman"] = {
founddialogue=_"Ho there, friends! I am but a soldier of humble circumstances, yet long have I dreamed of joining great wars beyond our shores. Let me join your mission!",
name="Woodsman",
},
["Dune Herbalist"] = {
["Dune Herbalist"] = {
founddialogue=_"Long have I studied the ways of lore, and I have much wisdom to offer. Allow me to guide you on your quest and together we will accomplish great things!",
image="units/dunefolk/herbalist.png",
name="Dune Herbalist",
},
["Dune Soldier"] = {
["Dune Soldier"] = {
founddialogue=_"I too have come a long way to this strange land. Perhaps we were destined to join blades here.",
image="units/dunefolk/soldier.png",
name="Dune Soldier",
},
["Dune Rover"] = {
["Dune Rover"] = {
founddialogue=_"Ho there, friends! I am but a soldier of humble circumstances, yet long have I dreamed of joining great wars beyond our shores. Let me join your mission!",
image="units/dunefolk/rover.png",
name="Dune Rover",
},
["Dune Piercer"] = {
["Dune Piercer"] = {
founddialogue=_"Heh, looks like you whelps might be getting in over your heads. Good thing Im here now to win this fight for ya, huh?",
image="units/dunefolk/piercer.png",
name="Dune Piercer",
},
["Dune Burner"] = {
["Dune Burner"] = {
founddialogue=_"You may not trust me or my reasons, but it seems you are not in a position to be choosy about your allies. Let me assist you and you just may survive.",
image="units/dunefolk/burner.png",
name="Dune Burner",
},
["Dune Rider"] = {
["Dune Rider"] = {
founddialogue=_"A soldier is no good without something to fight for. Let me fight for you!",
image="units/dunefolk/rider.png",
name="Dune Rider",

View file

@ -182,7 +182,7 @@ function wc2_utils.load_wc2_data()
end
table.insert(data_dict, {id="era", data = wesnoth.scenario.era})
-- make sure the result does not depend on the order in which these addons are loaded.
table.sort(data_dict, function(a,b) return a.id<b.id end)

View file

@ -65,7 +65,7 @@ end
function dr_road(from, to, cost)
return { {
terrain = from,
terrain = from,
cost = cost,
convert_to = to
} }
@ -73,7 +73,7 @@ end
function dr_bridge(from, bridge, road, cost)
return { {
terrain = from,
terrain = from,
cost = cost,
convert_to_bridge = bridge .. "|," .. bridge .. "/," .. bridge .. "\\",
convert_to = road,
@ -213,26 +213,26 @@ end
function default_generate_map(data)
local max_island = 10
local max_coastal = 5
data.village = flatten1(data.village or {})
data.road_cost = flatten1(data.road_cost or {})
data.convert = flatten1(data.convert or {})
local cfg = wc2_convert.lon_to_wml(data, "mg_main")
local w, h = cfg.map_width, cfg.map_height
local orig_island_size = cfg.island_size
local orig_nvillages = cfg.villages
cfg.island_size = 0;
cfg.nvillages = (orig_nvillages * w * h) // 1000;
cfg.island_off_center = 0;
if orig_island_size >= max_coastal then
-- Islands look good with much fewer iterations than normal, and fewer lakes
cfg.iterations = cfg.iterations // 10
cfg.max_lakes = (cfg.max_lakes or 0) // 9
-- The radius of the island should be up to half the width of the map
local island_radius = 50 + ((max_island - orig_island_size) * 50) // (max_island - max_coastal)
cfg.island_size = (island_radius * (w/2)) // 100;

View file

@ -72,7 +72,7 @@ local function generate(length, villages, castle, iterations, size, players, isl
}
res.convert = {
wct_fix_river_into_ocean("g", 29),
dr_wild_temp("Xu", "Xuc", "Xue", "Xuce"),
dr_wild_temp("Ms^Xm", "Mm^Xm", "Md^Xm", "Md^Dr"),
dr_wild_temp("Ms", "Mm", "Md", "Mv"),
@ -108,7 +108,7 @@ local function generate(length, villages, castle, iterations, size, players, isl
adjacent_liked="Wwg, Wwg",
},
}
res.castle = {
res.castle = {
valid_terrain="Gll, Gs, Gg, Gd, Aa, Ss, Sm, Dd, Ms, Mm, Md, Mv, Ha, Hh, Hhd, Hd",
min_distance=13,
}

View file

@ -1,5 +1,5 @@
-- The invest dialog spawns items below the keeps, so we have to
-- The invest dialog spawns items below the keeps, so we have to
-- make sure the tiles below keeps are passable for all units
function wct_fix_impassible_item_spawn()

View file

@ -5,12 +5,12 @@ function world_conquest_tek_map_noise_proxy(radius, fraction, terrain)
for terrain_i = 1, math.ceil(#terrain_to_change / fraction) do
local loc_a = terrain_to_change[terrain_i]
local terrain_to_swap_b = map:find_in_radius({loc_a}, radius, nop_filter)
terrain_to_swap_b = map:find(f.all(
f.none(f.is_loc(loc_a)),
f.terrain(terrain)
), terrain_to_swap_b)
if #terrain_to_swap_b > 0 then
local loc_b = terrain_to_swap_b[mathx.random(#terrain_to_swap_b)]
local terrain_a, terrain_b = map[loc_a], map[loc_b]
@ -23,7 +23,7 @@ end
function world_conquest_tek_map_noise_classic(tree)
-- generic utility to soft chunks of rought terrain and add extra rought on grass zones.
-- created for classic maps postgeneration.
set_terrain_simul {
{ "Gs^Ft,Gs^Ft,Hh,Hh,Hh",
f.terrain("Gs"),

View file

@ -10,7 +10,7 @@ function wct_dirt_beachs(rng_range)
),
fraction_rand = rng_range,
}
end
-- pack of generic tweaks to default generator
@ -28,7 +28,7 @@ function world_conquest_tek_map_rebuild(cave, reef)
exact = false,
percentage = reef,
}
-- add reefs
set_terrain { "Wwr",
f.any(
@ -68,7 +68,7 @@ function wct_fill_lava_chasms()
),
layer = "base",
}
end
function world_conquest_tek_map_dirt(mushrooms)
@ -80,7 +80,7 @@ function world_conquest_tek_map_dirt(mushrooms)
end
terrain_to_change = wct_store_possible_muddy_swamps()
end
wct_randomize_snowed_forest()
wct_volcanos_dirt()
-- volcanos dry mountains
@ -91,7 +91,7 @@ function world_conquest_tek_map_dirt(mushrooms)
),
layer = "base",
}
-- lava dry mountains
set_terrain { "Md",
f.all(
@ -100,7 +100,7 @@ function world_conquest_tek_map_dirt(mushrooms)
),
layer = "base",
}
-- some impassible become mushrooms
set_terrain { mushrooms,
f.all(
@ -109,7 +109,7 @@ function world_conquest_tek_map_dirt(mushrooms)
),
fraction_rand = "9..11",
}
wct_dirt_beachs("9..11")
end
@ -124,7 +124,7 @@ function wct_change_map_water(t)
set_terrain { "Wo" .. t,
f.terrain("Wo"),
}
end
function wct_map_decorative_docks()
@ -153,7 +153,7 @@ function wct_map_decorative_docks()
exact = false,
percentage = 18,
}
-- chance of trash near docks
set_terrain { "Ds,Ds,Ds,Ds,Ds,Ds^Edt",
f.all(
@ -168,7 +168,7 @@ function wct_map_decorative_docks()
f.adjacent(f.terrain("Ds^Edt"))
),
}
end
function wct_store_possible_flowers(terrain)
@ -177,8 +177,8 @@ function wct_store_possible_flowers(terrain)
f.adjacent(f.terrain(terrain)),
f.adjacent(f.terrain("D*^*,S*^*,Hd"), nil, 0)
))
end
function wct_store_possible_map4_castle(value)
@ -213,7 +213,7 @@ function wct_store_possible_roads(village)
)),
f.adjacent(f.terrain("R*,Kh*,Ch*"))
))
end
function wct_road_to_village(road, village)
@ -227,7 +227,7 @@ function wct_road_to_village(road, village)
end
-- builds roads using terrain @a terrain
-- for each step we call @get_next
-- for each step we call @get_next
function wct_iterate_roads_to(get_next, radius, terrain)
print_time("wct_iterate_roads_to start")
for r = radius, 1, -1 do
@ -283,7 +283,7 @@ function wct_iterate_roads_to_2(f_validpath, f_src, f_dest, terrain_road, radius
next_locs[#next_locs + 1] = loc_ad
end
if dist_ad and map[loc_ad] == terrain_road then
--we merged with another path.
--we merged with another path.
goto path_found
end
end
@ -300,13 +300,13 @@ function wct_iterate_roads_to_2(f_validpath, f_src, f_dest, terrain_road, radius
end
end
function wct_iterate_roads_to_ex(t)
function wct_iterate_roads_to_ex(t)
print_time("wct_iterate_roads_to_ex start")
wct_iterate_roads_to_2(t.f_validpath, t.f_src, t.f_dest, t.terrain_road, t.radius)
print_time("wct_iterate_roads_to_ex end")
end
function wct_break_walls(wall, terrain)
local terrain_to_change = wct_store_broken_wall_candidates(wall)
while #terrain_to_change > 0 do
local loc = terrain_to_change[mathx.random(#terrain_to_change)]
@ -321,7 +321,7 @@ function wct_store_broken_wall_candidates(wall)
f.adjacent(f.terrain("M*^Xm,X*"), nil, "2-6"),
f.adjacent(f.terrain("Mv"), nil, 0)
))
end
function wct_store_possible_muddy_swamps()
@ -329,7 +329,7 @@ function wct_store_possible_muddy_swamps()
f.terrain("Ss"),
f.adjacent(f.terrain("D*^*,Hd,Sm,Rd"), nil, "5-6")
))
end
function wct_map_reduce_castle_expanding_recruit(castle, terrain)
@ -341,12 +341,12 @@ function wct_map_reduce_castle_expanding_recruit(castle, terrain)
f.terrain(castle)
),
}
end
function wct_map_cave_path_to(terrain)
set_terrain { terrain,
f.terrain("Ur"),
}
end

View file

@ -8,7 +8,7 @@ local function wild_volcano_for_lava_zone(terrain_to_change)
f.find_in("terrain_to_change"),
f.adjacent(f.find_in("terrain_to_change"), "se,s,sw", 3)
), { terrain_to_change = terrain_to_change })
if #possible_volcano > 0 then
local loc = possible_volcano[mathx.random(#possible_volcano)]
set_terrain { "Md^Xm",
@ -674,21 +674,21 @@ local function river_to_lava_postfix(terrain_to_change)
),
filter_extra = { terrain_to_change = terrain_to_change },
}
wild_volcano_for_lava_zone(terrain_to_change)
local filter_adjacent_grassland = wesnoth.map.filter(f.all(
f.terrain("G*^*"),
f.adjacent(f.find_in("terrain_to_change"))
), { terrain_to_change = terrain_to_change })
adjacent_grssland = map:find(filter_adjacent_grassland)
set_terrain {
terrain = "Ur,Re,Re,Gd,Gd,Gd",
locs = adjacent_grssland,
layer = "base"
}
set_terrain {
terrain = "*^Fdw",
filter = f.all(
@ -707,7 +707,7 @@ local function river_to_lava_postfix(terrain_to_change)
filter_extra = { adjacent_grssland = adjacent_grssland },
layer = "overlay"
}
end
local wild_replacement_chances_zone_8_1 = {

View file

@ -15,7 +15,7 @@ end
return { generators = generators, get_enemy_data = get_enemy_data, turns = 23, player_gold = 100 }
-- [[
-- wct_enemy, 7 Werte
-- wct_enemy, 7 Werte
-- 1-2 wct_enemy_group_recall
-- 3-5 wct_enemy_group_commander
-- 6 wct_enemy_group_leader

View file

@ -1,5 +1,5 @@
-- the Dialog we show in the generate map tool in wesnoths own map editor.
-- in case that someone wants to create a map based on a random wcii map in his campaign.
-- in case that someone wants to create a map based on a random wcii map in his campaign.
local T = wml.tag
local _ = wesnoth.textdomain 'wesnoth-wc'
@ -38,7 +38,7 @@ function wc2_debug_settings()
local sl_scenario = window.sl_scenario
local sl_map = window.sl_map
local sl_players = window.sl_players
local function on_set_map()
globals.settings.scenario_num = sl_scenario.value
@ -47,7 +47,7 @@ function wc2_debug_settings()
local generators = get_defaults(sl_players.value, globals.settings.scenario_num)
local map_data = generators[sl_map.value]
if map_data then
window.sl_length.value = map_data.length
window.sl_villages.value = map_data.villages
window.sl_castle.value = map_data.castle

View file

@ -1,4 +1,4 @@
-- The addons own 'pick your advances' mod.
-- The addons own 'pick your advances' mod.
-- Works independed from the reset of the wc2 code (but needs wc2_utils.lua)
local on_event = wesnoth.require("on_event")
local wc2_utils = wesnoth.require("./../game_mechanics/utils.lua")

View file

@ -15,7 +15,7 @@ local strings = {
-- can move in same turn as when recruited/recalled
function wesnoth.effects.wc2_unitmarker(u, cfg)
local number = math.min(cfg.number or 1, #img_is_special_overlays)
u.variables["mods.wc2_unitmarker"] = number
u:add_modification("object", {
wml.tag.effect {
@ -23,7 +23,7 @@ function wesnoth.effects.wc2_unitmarker(u, cfg)
add = img_is_special_overlays[number],
}
}, false)
end
function wesnoth.wml_actions.wc2_toggle_overlay(cfg)

View file

@ -30,13 +30,13 @@ schema.time_area = {
schema.scenario = {
tags = {
music = {
type = "list",
type = "list",
},
label = {
type = "list",
type = "list",
},
load_resource = {
type = "list",
type = "list",
},
event = {
type = "list",
@ -66,14 +66,14 @@ schema.scenario = {
schema.side = {
tags = {
village = {
type = "list",
type = "list",
},
unit = {
type = "list",
id = "unit",
},
leader = {
type = "list",
type = "list",
id = "unit",
},
variables = {
@ -90,16 +90,16 @@ schema.time = {
schema.mg_main = {
tags = {
height = {
type = "list",
type = "list",
},
convert = {
type = "list",
},
road_cost = {
type = "list",
type = "list",
},
village = {
type = "list",
type = "list",
},
castle = {
type = "single",
@ -137,7 +137,7 @@ schema.wct_enemy_group = {
id = "wct_enemy_group_commander",
},
leader = {
type = "list",
type = "list",
id = "wct_enemy_group_leader",
},
},
@ -150,7 +150,7 @@ schema.wct_enemy_group = {
schema.wct_enemy = {
tags = {
group = {
type = "list",
type = "list",
id = "wct_enemy_group",
},
},
@ -162,7 +162,7 @@ schema.wct_enemy = {
schema.wct_artifact = {
tags = {
animate_unit = {
type = "list",
type = "list",
},
effect = {
type = "list",
@ -188,7 +188,7 @@ schema.wct_artifact_list = {
}
-- i cannot do this because the code in training.lua does
-- i cannot do this because the code in training.lua does
-- variable subsutution on [chance] which only works on configs.
-- schema.wct_trainer_chance = {
-- }
@ -225,7 +225,7 @@ schema.wct_trainer_list = {
}
schema.__attributes = {}
schema.__attributes.comma_list =
schema.__attributes.comma_list =
{
to_lon = function(attr)
return split_to_array(attr)
@ -241,7 +241,7 @@ function converter.wml_to_lon(cfg, name)
end
local attrs = tag_info.attributes or {}
local tags = tag_info.tags or {}
local res = {}
for name2, info2 in pairs(tags) do
if info2.type == "single" then
@ -254,12 +254,12 @@ function converter.wml_to_lon(cfg, name)
end
end
end
for k,v in pairs(cfg) do
if type(k) == "number" then
else --string
local conv = attrs[k] and schema.__attributes[attrs[k]]
if conv then
if conv then
res[k] = conv.to_lon(v)
else
res[k] = v
@ -276,7 +276,7 @@ function converter.lon_to_wml(t, name)
end
local attrs = tag_info.attributes or {}
local tags = tag_info.tags or {}
local res = {}
for name2, info2 in pairs(tags) do
if info2.type == "single" then
@ -290,11 +290,11 @@ function converter.lon_to_wml(t, name)
end
end
end
for k,v in pairs(t) do
if not tags[k] then
local conv = attrs[k] and schema.__attributes[attrs[k]]
if conv then
if conv then
res[k] = conv.to_wml(v)
else
res[k] = v

View file

@ -6,8 +6,8 @@ make -C data/tools reindent
if [[ "$OS" == "Linux" ]]; then
find src/ -name \*.\[ch\]pp -print0 | xargs -0 sed -i 's/[[:blank:]]*$//'
find data/lua/ -name \*.lua -print0 | xargs -0 sed -i 's/[[:blank:]]*$//'
find data/ -name \*.lua -print0 | xargs -0 sed -i 's/[[:blank:]]*$//'
else
find src/ -name \*.\[ch\]pp -print0 | xargs -0 sed -i '' 's/[[:blank:]]*$//'
find data/lua/ -name \*.lua -print0 | xargs -0 sed -i '' 's/[[:blank:]]*$//'
find data/ -name \*.lua -print0 | xargs -0 sed -i '' 's/[[:blank:]]*$//'
fi