Modification de Module:Infobox/Arme gamebryo
La modification peut être annulée. Veuillez vérifier les différences ci-dessous pour voir si c’est bien ce que vous voulez faire, puis publier ces changements pour finaliser l’annulation de cette modification.
Version actuelle | Votre texte | ||
Ligne 1 : | Ligne 1 : | ||
local localdata = require( 'Module:Infobox/Localdata' ) | local localdata = require( 'Module:Infobox/Localdata' ) | ||
local icon = require( 'Module:Icône' ) | local icon = require( 'Module:Icône' ) | ||
-------------------------------------------------------- | -------------------------------------------------------- | ||
Ligne 18 : | Ligne 6 : | ||
-------------------------------------------------------- | -------------------------------------------------------- | ||
-- Récupère un paramètre | -- Récupère un paramètre en forçant à 0 | ||
-- | -- si nil ou n'est pas nombre | ||
function forceNumber(data) | function forceNumber(data) | ||
if not data or type(data) ~= 'number' then | |||
return 0 | |||
end | |||
return data | |||
end | end | ||
-- | function formatData(data, round) | ||
-- local formattedData | |||
return string.format(round | -- if data and data > 0 then | ||
-- formattedData = string.format(round, data) | |||
-- end | |||
return string.format(round, data) | |||
end | end | ||
-- | -- Type d'arme | ||
local weaponCompletType = localdata["type"] or "" | |||
local weaponType = weaponCompletType:gsub(" unique", "") | |||
local isUnique = weaponCompletType:find(' unique') | |||
-- Dégâts | |||
local attacksPerSec = forceNumber(localdata["attack shots/sec"]) | |||
-- Augmentation des dégâts via les aptitudes | |||
-- Les aptitudes agissent comme un coefficient multiplicateur | |||
local perksAttacksPerSec = 0 | |||
for i = 1, 9 do | |||
local perkAttsecMult = forceNumber(localdata["perk" .. i .. " attsec mult"]) | |||
if perkAttsecMult > 0 then | |||
perksAttacksPerSec = perksAttacksPerSec + (attacksPerSec * perkAttsecMult) | |||
else | |||
break | |||
end | |||
end | end | ||
local perksAttacksPerSecTotal = attacksPerSec + perksAttacksPerSec | |||
-- | -- Dégâts critiques | ||
local | local critChance = forceNumber(localdata["crit % mult"]) | ||
local critChanceModified = 0 | |||
local | if weaponType == 'gunautomatic' and perksAttacksPerSecTotal > 0 then | ||
critChanceModified = critChance / perksAttacksPerSecTotal | |||
if weaponType == | |||
end | end | ||
-- | -- projectiles | ||
local proj = 1 | local proj = 1 | ||
if weaponType == "gun" or weaponType == "gunautomatic" or weaponType == "gunhandload" then | if weaponType == "gun" or weaponType == "gunautomatic" or weaponType == "gunhandload" then | ||
proj = forceNumber(localdata["projectiles"]) | |||
if proj == 0 then proj = 1 end | |||
end | end | ||
local clipRounds = forceNumber(localdata["clip rounds"]) | |||
local clipRounds = forceNumber(localdata["clip rounds"]) | local ammoUse = forceNumber(localdata["ammo use"]) | ||
local ammoUse = forceNumber(localdata["ammo use"]) | |||
local shotsPerReload = 0 | local shotsPerReload = 0 | ||
if ammoUse > 0 then | if ammoUse > 0 then | ||
shotsPerReload = math.floor(clipRounds / ammoUse) | |||
end | end | ||
-- | -- Durée de rechargement | ||
local reloadTime = 0 | |||
if weaponType == "gun" or weaponType == "gunautomatic" or weaponType == "gunhandload" then | |||
reloadTime = forceNumber(localdata["reload time"]) | |||
end | |||
-- Durée de rechargement en prenant en compte les aptitudes | |||
-- | |||
local perksReloadTime = 0 | local perksReloadTime = 0 | ||
for i = 1, 9 do | for i = 1, 9 do | ||
local perkReloadTime = localdata["perk" .. i .. " reload mult"] | |||
if perkReloadTime and type(perkReloadTime) == "number" then | |||
perksReloadTime = perksReloadTime + (reloadTime * perkReloadTime) | |||
else | |||
break | |||
end | |||
end | |||
local perksReloadTimeTotal = reloadTime - perksReloadTime | |||
local damNormTotal = forceNumber(localdata["damage"]) | |||
local damNormProj = damNormTotal / proj | |||
local damEffProj = forceNumber(localdata["effect damage"]) | |||
local damEffTotal = damEffProj * proj | |||
local damExplProj = forceNumber(localdata["explosion damage"]) | |||
local damExplTotal = damExplProj * proj | |||
local perksDamNorm = 0 | |||
for i = 1, 9 do | |||
local perkDamNormMult = localdata["perk" .. i .. " mult"] or 0 | |||
local perkDamNormAdd = localdata["perk" .. i .. " add"] or 0 | |||
if type(perkDamNormMult) == "number" and type(perkDamNormAdd) == "number" then | |||
perksDamNorm = perksDamNorm + (damNormTotal * perkDamNormMult) + perkDamNormAdd | |||
else | |||
break | |||
end | |||
end | |||
local perksDamNormProj = perksDamNorm / proj | |||
local perksDamNormTotal = damNormTotal + perksDamNorm | |||
local perksDamNormProjTotal = damNormProj + perksDamNormProj | |||
local perksDamEff = 0 | |||
for i = 1, 9 do | |||
local perkDamEffMult = localdata["perk" .. i .. " eff mult"] or 0 | |||
local perkDamEffAdd = localdata["perk" .. i .. " eff add"] or 0 | |||
if type(perkDamEffMult) == "number" and type(perkDamEffAdd) == "number" then | |||
perksDamEff = perksDamEff + (damEffProj * perkDamEffMult) + perkDamEffAdd | |||
else | |||
break | |||
end | |||
end | end | ||
local | local perksDamEffProj = perksDamEff / proj | ||
local perksDamEffTotal = damEffTotal + perksDamEff | |||
local perksDamEffProjTotal = damEffProj + perksDamEffProj | |||
local | local perksDamExpl = 0 | ||
local | for i = 1, 9 do | ||
local | local perkDamExplMult = localdata["perk" .. i .. " eff mult"] or 0 | ||
local perkDamExplAdd = localdata["perk" .. i .. " eff add"] or 0 | |||
if type(perkDamExplMult) == "number" and type(perkDamExplAdd) == "number" then | |||
perksDamExpl = perksDamExpl + (damExplTotal * perkDamExplMult) + perkDamExplAdd | |||
else | |||
break | |||
end | |||
end | |||
local | local perksDamExplProj = perksDamExpl / proj | ||
local | local perksDamExplTotal = damExplTotal + perksDamExpl | ||
local | local perksDamExplProjTotal = damExplTotal + perksDamExplProj | ||
local | -- Calcul des DPS | ||
local DPS = (damNormTotal + damExplTotal) * attacksPerSec | |||
local DPSPerks = (perksDamNormTotal + perksDamExplTotal) * perksAttacksPerSecTotal | |||
-- | -- Calcul de la durée de rechargement | ||
local DPSReload = 0 | |||
local DPSReloadPerks = 0 | |||
local | |||
local | |||
local coeff = 1 | local coeff = 1 | ||
if weaponType == "gunhandload" then | if weaponType == "gunhandload" then | ||
coeff = shotsPerReload | |||
end | end | ||
if shotsPerReload > 0 then | if shotsPerReload > 0 then | ||
if attacksPerSec > 0 then | |||
DPSReload = ((damNormTotal + damExplTotal) * shotsPerReload) / | |||
((shotsPerReload / attacksPerSec) + reloadTime * coef) | |||
end | |||
if perksAttacksPerSecTotal > 0 then | |||
DPSReloadPerks = ((perksDamNormTotal + perksDamExplTotal) * shotsPerReload) / | |||
((shotsPerReload / perksAttacksPerSecTotal) + perksReloadTimeTotal * coef) | |||
end | |||
end | end | ||
-------------------------------------------------------- | -------------------------------------------------------- | ||
Ligne 196 : | Ligne 175 : | ||
-------------------------------------------------------- | -------------------------------------------------------- | ||
attacksPerSec = formatData(attacksPerSec, "%.1f") | |||
local | perksAttacksPerSec = formatData(perksAttacksPerSec, "%.1f") | ||
if | perksAttacksPerSecTotal = formatData(perksAttacksPerSecTotal, "%.1f") | ||
critChance = formatData(critChance, "%.2f") | |||
critChanceModified = formatData(critChanceModified, "%.2f") | |||
reloadTime = formatData(reloadTime, "%.1f") | |||
perksReloadTime = formatData(perksReloadTime, "%.1f") | |||
perksReloadTimeTotal = formatData(perksReloadTimeTotal, "%.1f") | |||
damNormProj = formatData(damNormProj, "%.1f") | |||
perksDamNorm = formatData(perksDamNorm, "%.1f") | |||
perksDamNormProj = formatData(perksDamNormProj, "%.1f") | |||
perksDamNormTotal = formatData(perksDamNormTotal, "%.1f") | |||
perksDamNormProjTotal = formatData(perksDamNormProjTotal, "%.1f") | |||
perksDamEffProj = formatData(perksDamEffProj, "%.1f") | |||
perksDamEffTotal = formatData(perksDamEffTotal, "%.1f") | |||
perksDamEffProjTotal = formatData(perksDamEffProjTotal, "%.1f") | |||
perksDamExpl = formatData(perksDamExpl, "%.1f") | |||
perksDamExplProj = formatData(perksDamExplProj, "%.1f") | |||
perksDamExplTotal = formatData(perksDamExplTotal, "%.1f") | |||
perksDamExplProjTotal = formatData(perksDamExplProjTotal, "%.1f") | |||
DPS = formatData(DPS, "%.1f") | |||
DPSPerks = formatData(DPSPerks, "%.1f") | |||
DPSReload = formatData(DPSReload, "%.1f") | |||
DPSReloadPerks = formatData(DPSReloadPerks, "%.1f") | |||
local damagePerAttackCell = damNormTotal | |||
if perksDamNormTotal > 0 then damagePerAttackCell = damagePerAttackCell .. ' (' .. perksDamNormTotal .. ')' end | |||
if damExplTotal > 0 then | |||
damagePerAttackCell = damagePerAttackCell .. ' + ' .. damExplTotal | |||
if perksDamExplTotal > 0 then damagePerAttackCell = damagePerAttackCell .. ' (' .. perksDamExplTotal .. ')' end | |||
damagePerAttackCell = damagePerAttackCell .. ' ' .. icon.build({ 'explosion' }) | |||
end | end | ||
if | |||
if damEffTotal > 0 then | |||
local effectDuration = localdata["effect duration"] or "1" | |||
damagePerAttackCell = damagePerAttackCell .. ' + ' .. damEffTotal | |||
if perksDamEffTotal > 0 then damagePerAttackCell = damagePerAttackCell .. ' (' .. perksDamEffTotal .. ')' end | |||
damagePerAttackCell = damagePerAttackCell .. ' sur ' .. effectDuration .. ' s ' .. icon.build({ 'effet' }) | |||
end | end | ||
if | |||
local damagePerProjCell = damNormProj | |||
if perksDamNormProj > 0 then damagePerProjCell = damagePerProjCell .. ' (' .. perksDamNormProj .. ')' end | |||
if damExplProj > 0 then | |||
damagePerProjCell = damagePerProjCell .. ' + ' .. damExplProj | |||
if perksDamExplProjTotal > 0 then damagePerProjCell = damagePerProjCell .. ' (' .. perksDamExplProjTotal .. ')' end | |||
damagePerProjCell = damagePerProjCell .. ' ' .. icon.build({ 'explosion' }) | |||
end | end | ||
if damEffProj > 0 then | |||
local effectDuration = localdata["effect duration"] or "1" | |||
damagePerProjCell = damagePerProjCell .. ' + ' .. damEffProj | |||
if perksDamEffProjTotal > 0 then damagePerProjCell = damagePerProjCell .. ' (' .. perksDamEffProjTotal .. ')' end | |||
damagePerProjCell = damagePerProjCell .. ' sur ' .. effectDuration .. ' s ' .. icon.build({ 'effet' }) | |||
end | end | ||
local dpsCell = DPS | |||
local dpsCell = | if DPSPerks > 0 then dpsCell = dpsCell .. ' ('.. DPSPerks .. ')' end | ||
if | if damEffTotal > 0 then | ||
dpsCell = dpsCell .. ' + ' .. damEffTotal | |||
end | if perksDamEffTotal > 0 then dpsCell = dpsCell .. ' (' .. perksDamEffTotal .. ')' end | ||
if | dpsCell = dpsCell .. ' ' .. icon.build({ 'effet' }) | ||
end | end | ||
local dpsReloadCell = DPSReload | |||
local dpsReloadCell = | if DPSReloadPerks > 0 then dpsReloadCell = dpsReloadCell .. ' ('.. DPSReloadPerks .. ')' end | ||
if | if damEffTotal > 0 then | ||
dpsReloadCell = dpsReloadCell .. ' + ' .. damEffTotal | |||
end | if perksDamEffTotal > 0 then dpsReloadCell = dpsReloadCell .. ' (' .. perksDamEffTotal .. ')' end | ||
if | dpsReloadCell = dpsReloadCell .. ' ' .. icon.build({ 'effet' }) | ||
end | end | ||
local critMultCell = critChance | |||
local critMultCell = | if critChanceModified > 0 then critMultCell = critChanceModified end | ||
critMultCell = 'x ' .. critMultCell | |||
if | |||
local attackPerSecondCell = attacksPerSecError | |||
local | if perksAttacksPerSecTotal > 0 then attackPerSecondCell = attackPerSecondCell .. ' (' .. perksAttacksPerSecTotal .. ')' end | ||
if | |||
end | |||
local reloadTimeCell = reloadTime | |||
if perksReloadTimeTotal > 0 then reloadTimeCell = reloadTimeCell .. ' (' .. perksReloadTimeTotal .. ')' end | |||
if | |||
end | |||
-------------------------------------------------------- | -------------------------------------------------------- | ||
Ligne 305 : | Ligne 265 : | ||
{ type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }}, | { type = 'images', imageparameters = { 'image', 'image2', 'image3', 'image4', 'image5' }, captionparameter = { 'légende', 'image desc' }}, | ||
{ type = 'table', title = 'Conditions d\'utilisation', rows = { | { type = 'table', title = 'Conditions d\'utilisation', rows = { | ||
{ type = 'row', label = 'Compétence', value = ' | { type = 'row', label = 'Compétence', value = 'compétence' }, | ||
{ type = 'row', label = 'Force', value = ' | { type = 'row', label = 'Force', value = 'force' } | ||
}}, | }}, | ||
{ type = 'table', title = 'Statistiques de combat', collapseparameters = { collapsible = true, collapsed = true }, rows = { | { type = 'table', title = 'Statistiques de combat', collapseparameters = { collapsible = true, collapsed = true }, rows = { | ||
{ type = 'row', label = 'Dégâts par attaque', value = function() return damagePerAttackCell end }, | |||
{ type = 'row', label = 'Dégâts par projectile', value = function() return damagePerProjCell end }, | |||
{ type = 'row', label = 'Dégâts par seconde', value = function() return dpsCell end }, | |||
{ type = 'row', label = 'Dégâts par seconde (avec rechargement)', value = function() return dpsReloadCell end }, | |||
{ type = 'row', label = 'Dégâts critiques', value = 'crit dmg' }, | |||
{ type = 'row', label = 'Multiplicateur de critique', value = function() return critMultCell end }, | |||
{ type = 'row', label = 'Attaques par seconde', value = function() return attackPerSecondCell end }, | |||
{ type = 'row', label = 'Points d\'action', value = 'ap' }, | |||
{ type = 'row', label = 'Projectiles', value = 'projectiles' }, | |||
{ type = 'row', label = 'Dispersion', value = 'min spread' }, | |||
{ type = 'row', label = 'Effet', value = 'other effect' }, | |||
{ type = 'row', label = 'Effet critique', value = 'crit effect' } | |||
}}, | |||
{ type = 'table', title = 'Munitions et rechargement', collapseparameters = { collapsible = true, collapsed = true }, rows = { | |||
{ type = 'row', label = 'Type de munitions', value = 'ammo' }, | |||
{ type = 'row', label = 'Projectiles par tir', value = 'ammo use' }, | |||
{ type = 'row', label = 'Tirs par magasin', function() return shotsPerReload end }, | |||
{ type = 'row', label = 'Capacité', value = 'clip rounds' }, | |||
{ type = 'row', label = 'Durée de rechargement', value = function() return reloadTimeCell end } | |||
}}, | }}, | ||
{ type = 'table', title = 'Autres propriétés', rows = { | { type = 'table', title = 'Autres propriétés', rows = { | ||
Ligne 340 : | Ligne 295 : | ||
{ type = 'row', label = 'Réparation', value = 'repair' }, | { type = 'row', label = 'Réparation', value = 'repair' }, | ||
{ type = 'row', label = 'Quêtes', value = 'quêtes' } | { type = 'row', label = 'Quêtes', value = 'quêtes' } | ||
}}, | |||
{ type = 'table', title = 'Effets des aptitudes', rows = { | |||
-- TODO | |||
}}, | }}, | ||
{ type = 'table', title = 'Technique', collapseparameters = { collapsible = true, collapsed = true }, rows = { | { type = 'table', title = 'Technique', collapseparameters = { collapsible = true, collapsed = true }, rows = { | ||
{ type = 'row', label = '[[Form ID]]', value = ' | { type = 'row', label = '[[Form ID|Base ID]]', value = 'baseid' }, | ||
{ type = 'row', label = ' | { type = 'row', label = 'Editor ID', value = 'editorid' } | ||
}}, | }}, | ||
{ type = 'text', value = 'pied' } | { type = 'text', value = 'pied' } | ||
} | } | ||
} | } |