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) | ||
return tonumber(data) or 0 | return tonumber(data) or 0 | ||
end | end | ||
-- | function formatData(data, round) | ||
-- local formattedData | |||
-- if data and data > 0 then | |||
-- formattedData = string.format(round, data) | |||
-- end | |||
return string.format(round or "%.1f", data) | return string.format(round or "%.1f", data) | ||
end | end | ||
Ligne 39 : | Ligne 25 : | ||
-- Type d'arme | -- Type d'arme | ||
local weaponCompletType = | local weaponCompletType = localdata["type"] or "" | ||
local weaponType = weaponCompletType:gsub( | local weaponType = weaponCompletType:gsub(" unique", "") | ||
local isUnique = weaponCompletType:find(' unique') | local isUnique = weaponCompletType:find(' unique') | ||
-- | -- Dégâts | ||
local attacksPerSec = forceNumber(localdata["attack shots/sec"]) | local attacksPerSec = forceNumber(localdata["attack shots/sec"]) | ||
-- | -- Augmentation des dégâts via les aptitudes | ||
local | -- 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 | |||
local perksAttacksPerSecTotal = attacksPerSec + perksAttacksPerSec | |||
-- Multiplicateur de critique | |||
local critChance = forceNumber(localdata["crit % mult"]) | |||
local critChanceModified = 0 | |||
if weaponType == 'gunautomatic' and perksAttacksPerSecTotal > 0 then | |||
critChanceModified = critChance / perksAttacksPerSecTotal | |||
end | end | ||
-- Nombre de projectiles | -- Nombre de 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"]) | proj = forceNumber(localdata["projectiles"]) | ||
if proj == 0 then proj = 1 end | 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 shotsPerReload = 0 | local shotsPerReload = 0 | ||
if ammoUse > 0 then | if ammoUse > 0 then | ||
Ligne 71 : | Ligne 70 : | ||
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 | 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 | |||
-- Dégâts par type (simple, explosif, poison) | |||
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 | else | ||
break | break | ||
Ligne 144 : | Ligne 129 : | ||
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 du DPS | ||
local DPS = (damNormTotal + damExplTotal) * attacksPerSec | |||
local DPSPerks = (perksDamNormTotal + perksDamExplTotal) * perksAttacksPerSecTotal | |||
-- | -- Calcul du DPS en prenant en compte la durée de rechargement | ||
local DPSReload = 0 | |||
local DPSReloadPerks = 0 | |||
local | |||
local | |||
local coeff = 1 | local coeff = 1 | ||
Ligne 175 : | Ligne 164 : | ||
if shotsPerReload > 0 then | if shotsPerReload > 0 then | ||
if attacksPerSec > 0 then | if attacksPerSec > 0 then | ||
DPSReload = ((damNormTotal + damExplTotal) * shotsPerReload) / | |||
((shotsPerReload / attacksPerSec) + reloadTime * coeff) | ((shotsPerReload / attacksPerSec) + reloadTime * coeff) | ||
end | end | ||
if perksAttacksPerSecTotal > 0 then | if perksAttacksPerSecTotal > 0 then | ||
DPSReloadPerks = ((perksDamNormTotal + perksDamExplTotal) * shotsPerReload) / | |||
((shotsPerReload / perksAttacksPerSecTotal) + perksReloadTimeTotal * coeff) | ((shotsPerReload / perksAttacksPerSecTotal) + perksReloadTimeTotal * coeff) | ||
end | end | ||
end | end | ||
-------------------------------------------------------- | -------------------------------------------------------- | ||
Ligne 196 : | Ligne 178 : | ||
-------------------------------------------------------- | -------------------------------------------------------- | ||
local damagePerAttackCell = formatData(damNormTotal) | |||
if perksDamNormTotal > 0 then damagePerAttackCell = damagePerAttackCell .. ' (' .. formatData(perksDamNormTotal) .. ')' end | |||
if | if damExplTotal > 0 then | ||
damagePerAttackCell = damagePerAttackCell .. ' + ' .. formatData(damExplTotal) | |||
if perksDamExplTotal > 0 then damagePerAttackCell = damagePerAttackCell .. ' (' .. formatData(perksDamExplTotal) .. ')' end | |||
damagePerAttackCell = damagePerAttackCell .. ' ' .. icon.build({ 'explosion' }) | |||
end | end | ||
if damEffTotal > 0 then | |||
if | |||
local effectDuration = localdata["effect duration"] or "1" | local effectDuration = localdata["effect duration"] or "1" | ||
damagePerAttackCell = damagePerAttackCell .. ' + ' .. formatData(damEffTotal) | |||
if | if perksDamEffTotal > 0 then damagePerAttackCell = damagePerAttackCell .. ' (' .. formatData(perksDamEffTotal) .. ')' end | ||
damagePerAttackCell = damagePerAttackCell .. ' sur ' .. effectDuration .. ' s ' .. icon.build({ 'effet' }) | |||
end | end | ||
local damagePerProjCell = formatData(damNormProj) | |||
if perksDamNormProj > 0 then damagePerProjCell = damagePerProjCell .. ' (' .. formatData(perksDamNormProj) .. ')' end | |||
if | if damExplProj > 0 then | ||
damagePerProjCell = damagePerProjCell .. ' + ' .. formatData(damExplProj) | |||
if perksDamExplProjTotal > 0 then damagePerProjCell = damagePerProjCell .. ' (' .. formatData(perksDamExplProjTotal) .. ')' end | |||
damagePerProjCell = damagePerProjCell .. ' ' .. icon.build({ 'explosion' }) | |||
end | end | ||
if damEffProj > 0 then | |||
if | |||
local effectDuration = localdata["effect duration"] or "1" | local effectDuration = localdata["effect duration"] or "1" | ||
damagePerProjCell = damagePerProjCell .. ' + ' .. formatData(damEffProj) | |||
if | if perksDamEffProjTotal > 0 then damagePerProjCell = damagePerProjCell .. ' (' .. formatData(perksDamEffProjTotal) .. ')' end | ||
damagePerProjCell = damagePerProjCell .. ' sur ' .. effectDuration .. ' s ' .. icon.build({ 'effet' }) | |||
end | end | ||
local dpsCell = formatData(DPS) | |||
local dpsCell = | if DPSPerks > 0 then dpsCell = dpsCell .. ' ('.. formatData(DPSPerks) .. ')' end | ||
if | if damEffTotal > 0 then | ||
dpsCell = dpsCell .. ' + ' .. formatData(damEffTotal) | |||
end | if perksDamEffTotal > 0 then dpsCell = dpsCell .. ' (' .. perksDamEffTotal .. ')' end | ||
if | dpsCell = dpsCell .. ' ' .. icon.build({ 'effet' }) | ||
dpsCell = dpsCell .. ' + ' .. | |||
if | |||
dpsCell = dpsCell .. ' ' .. | |||
end | end | ||
local dpsReloadCell = formatData(DPSReload) | |||
local dpsReloadCell = | if DPSReloadPerks > 0 then dpsReloadCell = dpsReloadCell .. ' ('.. formatData(DPSReloadPerks) .. ')' end | ||
if | if damEffTotal > 0 then | ||
dpsReloadCell = dpsReloadCell .. ' + ' .. formatData(damEffTotal) | |||
end | if perksDamEffTotal > 0 then dpsReloadCell = dpsReloadCell .. ' (' .. formatData(perksDamEffTotal) .. ')' end | ||
if | dpsReloadCell = dpsReloadCell .. ' ' .. icon.build({ 'effet' }) | ||
dpsReloadCell = dpsReloadCell .. ' + ' .. | |||
if | |||
dpsReloadCell = dpsReloadCell .. ' ' .. | |||
end | end | ||
local critMultCell = critChance | |||
if critChanceModified > 0 then critMultCell = critChanceModified end | |||
critMultCell = 'x ' .. formatData(critMultCell, "%.2f") | |||
local attackPerSecondCell = formatData(attacksPerSec) | |||
local | if perksAttacksPerSecTotal > 0 then attackPerSecondCell = attackPerSecondCell .. ' (' .. formatData(perksAttacksPerSecTotal) .. ')' end | ||
if | |||
end | |||
local reloadTimeCell = formatData(reloadTime) | |||
local reloadTimeCell = | if perksReloadTimeTotal > 0 then reloadTimeCell = reloadTimeCell .. ' (' .. formatData(perksReloadTimeTotal) .. ')' end | ||
if | |||
end | |||
-------------------------------------------------------- | -------------------------------------------------------- | ||
Ligne 304 : | Ligne 242 : | ||
{ type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Arme', link = 'Armes' }}, | { type = 'title', value = 'nom', subtitle = 'sous-titre', icon = 'icône', subhead = { games = 'jeux', subject = 'Arme', link = 'Armes' }}, | ||
{ 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 = '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 | { type = 'row', label = 'Dégâts par attaque', value = function() return damagePerAttackCell end }, | ||
{ type = 'row', label = 'Dégâts par projectile', value = function() return | { 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', 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 par seconde (avec rechargement)', value = function() return dpsReloadCell end }, | ||
{ type = 'row', label = 'Dégâts critiques', value = 'crit dmg' }, | { type = 'row', label = 'Dégâts critiques', value = 'crit dmg' }, | ||
{ type = 'row', label = 'Multiplicateur de critique', value = function() return critMultCell end }, | { type = 'row', label = 'Multiplicateur de critique', value = function() return critMultCell end }, | ||
{ type = 'row', label = 'Attaques par seconde', value = function() return | { type = 'row', label = 'Attaques par seconde', value = function() return attackPerSecondCell end }, | ||
{ type = 'row', label = 'Points d\'action', value = 'ap' }, | { type = 'row', label = 'Points d\'action', value = 'ap' }, | ||
{ type = 'row', label = 'Projectiles', value = 'projectiles' }, | { type = 'row', label = 'Projectiles', value = 'projectiles' }, | ||
Ligne 325 : | Ligne 259 : | ||
{ type = 'row', label = 'Type de munitions', value = 'ammo' }, | { type = 'row', label = 'Type de munitions', value = 'ammo' }, | ||
{ type = 'row', label = 'Projectiles par tir', value = 'ammo use' }, | { type = 'row', label = 'Projectiles par tir', value = 'ammo use' }, | ||
{ type = 'row', label = 'Tirs par magasin', | { type = 'row', label = 'Tirs par magasin', function() return formatData(shotsPerReload) end }, | ||
{ type = 'row', label = 'Capacité', value = 'clip rounds' }, | { type = 'row', label = 'Capacité', value = 'clip rounds' }, | ||
{ type = 'row', label = 'Durée de rechargement', value = function() return reloadTimeCell end } | { type = 'row', label = 'Durée de rechargement', value = function() return reloadTimeCell end } | ||
}}, | }}, | ||
{ type = 'table', title = 'Effets des aptitudes' | { type = 'table', title = 'Effets des aptitudes', rows = { | ||
-- TODO | |||
}}, | }}, | ||
{ type = 'table', title = 'Autres propriétés', rows = { | { type = 'table', title = 'Autres propriétés', rows = { | ||
Ligne 342 : | Ligne 274 : | ||
}}, | }}, | ||
{ 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' } | ||
} | } | ||
} | } |