Module:Game

From Wavu Wiki, the 🌊 wavy Tekken wiki
Revision as of 19:31, 5 October 2024 by DuckmanTheThird (talk | contribs) (Moved Eddy to make the T8 character list alphabetical)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Game/doc

local p = {}

p.pageSuffix = function(game, fighter)
	if (game == 7) and p.Tekken8.hasFighter(fighter) then
		return " (Tekken 7)"
	else
		return ""
	end
end

p.gameFighterPage = function(game, fighter, page)
	-- Handle case for overview page (i.e. `page` is empty string or nil)
	if page == nil then page = "" end
	if page ~= "" then page = " " .. page end
	return fighter .. page .. p.pageSuffix(game, fighter)
end

function genFighterPageFromGame(game)
	return function(fighter, page)
		return p.gameFighterPage(game, fighter, page)
	end
end

function genFighterPageFromGamePage(game, page)
	return function(fighter)
		return p.gameFighterPage(game, fighter, page)
	end
end

function genComboLink(game)
	return function(fighter, section, damage)
		return '[[' .. p.gameFighterPage(game, fighter, "combos") .. '#' .. section .. '|' .. damage ..']]'
	end
end

function genHasFighter(game)
	local map = nil
	return function(fighter)
		if map == nil then
			local gameObj = p.Tekken8
			if game == 7 then
				gameObj = p.Tekken7
			end
			map = {}
			for _, f in ipairs(gameObj.fighters) do
				map[f] = true
			end
		end
		return map[fighter]
	end
end

p.Tekken7 = {
	fighters = {
		"Akuma", "Alisa", "Anna", "Armor King", "Asuka",
		"Bob", "Bryan", "Claudio", "Devil Jin", "Dragunov",
		"Eddy", "Eliza", "Fahkumram", "Feng", "Ganryu",
		"Geese", "Gigas", "Heihachi", "Hwoarang", "Jack-7",
		"Jin", "Josie", "Julia", "Katarina", "Kazumi",
		"Kazuya", "King", "Kuma", "Kunimitsu", "Lars",
		"Law", "Lee", "Lei", "Leo", "Leroy",
		"Lidia", "Lili", "Lucky Chloe", "Marduk", "Master Raven",
		"Miguel", "Negan", "Nina", "Noctis", "Paul",
		"Shaheen", "Steve", "Xiaoyu", "Yoshimitsu", "Zafina"
	},
	tables = {
		Move = 'Move7',
		Punisher = 'Punisher7',
	},
	templates = {
		MoveDisplay = 'MoveDisplay7',
		MoveImpl = 'MoveImpl7',
		PunisherTableDisplay = 'PunisherTableDisplay7',
		WhiffPunisherTableDisplay = 'WhiffPunisherTableDisplay7'
	},
	fighterPage = genFighterPageFromGame(7),
	comboLink = genComboLink(7),
	punishersPage = genFighterPageFromGamePage(7, "punishers"),
	hasFighter = genHasFighter(7)
}

p.Tekken8 = {
	fighters = {
		"Alisa", "Asuka", "Azucena", "Bryan", "Claudio", 
		"Devil Jin", "Dragunov", "Eddy", "Feng", "Heihachi", 
		"Hwoarang", "Jack-8", "Jin", "Jun", "Kazuya", 
		"King", "Kuma", "Lars", "Law", "Lee", 
		"Leo", "Leroy", "Lidia", "Lili", "Nina", 
		"Panda", "Paul", "Raven", "Reina", "Shaheen", 
		"Steve", "Victor", "Xiaoyu", "Yoshimitsu", "Zafina"
	},
	tables = {
		Move = 'Move',
		Punisher = 'Punisher',
	},
	templates = {
		MoveDisplay = 'MoveDisplay',
		MoveImpl = 'MoveImpl',
		PunisherTableDisplay = 'PunisherTableDisplay',
		WhiffPunisherTableDisplay = 'WhiffPunisherTableDisplay'
	},
	fighterPage = genFighterPageFromGame(8),
	comboLink = genComboLink(8),
	punishersPage = genFighterPageFromGamePage(8, "punishers"),
	hasFighter = genHasFighter(8)
}

return p