User:Skkias/sandbox/Module:BaseStats: Difference between revisions

From Path of Exile 2 Wiki
Jump to navigation Jump to search
(Created page with "local BaseStats = {} -- Core Attributes BaseStats.attributes = { strength = { name = "Strength", bonus = { life = 2, -- +2 Life per Strength }, description = "Vital for melee weapons and survivability." }, dexterity = { name = "Dexterity", bonus = { accuracy = 5, -- +5 Accuracy per Dexterity evasion = 2, -- Hypothetical bonus }, description = "Essential for ra...")
 
No edit summary
 
Line 1: Line 1:
local BaseStats = {}
local p = {}


-- Core Attributes
-- Define core attributes and bonuses
BaseStats.attributes = {
p.attributes = {
     strength = {
     strength = {
         name = "Strength",
         name = "Strength",
         bonus = {
         bonuses = {
             life = 2, -- +2 Life per Strength
             life = 2, -- +2 Life per Strength
            meleeDamage = 1 -- +1% Melee Damage per Strength
         },
         },
         description = "Vital for melee weapons and survivability."
         description = "Vital for melee weapons and survivability."
Line 12: Line 13:
     dexterity = {
     dexterity = {
         name = "Dexterity",
         name = "Dexterity",
         bonus = {
         bonuses = {
             accuracy = 5, -- +5 Accuracy per Dexterity
             accuracy = 5, -- +5 Accuracy per Dexterity
             evasion = 2, -- Hypothetical bonus
             evasion = 2 -- +2 Evasion per Dexterity
         },
         },
         description = "Essential for ranged weapons and evasion."
         description = "Essential for ranged weapons and evasion."
Line 20: Line 21:
     intelligence = {
     intelligence = {
         name = "Intelligence",
         name = "Intelligence",
         bonus = {
         bonuses = {
             mana = 2, -- +2 Mana per Intelligence
             mana = 2, -- +2 Mana per Intelligence
             energyShield = 1, -- +1 Energy Shield per Intelligence
             energyShield = 1 -- +1 Energy Shield per Intelligence
         },
         },
         description = "Crucial for spellcasting and energy shield management."
         description = "Crucial for spellcasting and energy shield management."
Line 28: Line 29:
}
}


-- Derived Stats
-- Define derived stats
BaseStats.derivedStats = {
p.derivedStats = {
     life = {
     life = {
         name = "Life",
         name = "Life",
         base = 50, -- Base value (example)
         base = 50, -- Base value
         description = "Represents health; increased by Strength and gear."
         description = "Represents health; increased by Strength and gear."
     },
     },
     mana = {
     mana = {
         name = "Mana",
         name = "Mana",
         base = 50, -- Base value (example)
         base = 50, -- Base value
         description = "Resource for skills; increased by Intelligence and gear."
         description = "Resource for skills; increased by Intelligence and gear."
     },
     },
     energyShield = {
     energyShield = {
         name = "Energy Shield",
         name = "Energy Shield",
         base = 0, -- Base value (example)
         base = 0, -- Base value
         description = "Acts as a buffer to Life; scales with Intelligence."
         description = "Acts as a buffer to Life; scales with Intelligence."
    },
    accuracy = {
        name = "Accuracy Rating",
        base = 0, -- Base value (example)
        description = "Determines hit chance; improved by Dexterity."
    },
    evasion = {
        name = "Evasion",
        base = 0, -- Base value (example)
        description = "Chance to dodge attacks; linked to Dexterity."
    },
    armour = {
        name = "Armour",
        base = 0, -- Base value (example)
        description = "Reduces physical damage taken; associated with Strength."
     }
     }
}
}


-- Resistances
-- Example function to calculate total Life based on Strength
BaseStats.resistances = {
function p.calculateLife(strength)
     elemental = {
    local baseLife = p.derivedStats.life.base
        name = "Elemental Resistance",
     local bonus = strength * p.attributes.strength.bonuses.life
         base = 0, -- Base 0% resistance
    return baseLife + bonus
        description = "Mitigates Fire, Cold, and Lightning damage."
end
    },
 
    chaos = {
-- Example function to display all attributes
        name = "Chaos Resistance",
function p.showAttributes()
         base = -60, -- Base -60% resistance
    local output = "== Core Attributes ==\n"
        description = "Reduces Chaos damage taken."
    for key, attr in pairs(p.attributes) do
     }
         output = output .. string.format("=== %s ===\n%s\nBonuses:\n", attr.name, attr.description)
}
        for stat, value in pairs(attr.bonuses) do
            output = output .. string.format("* %s: +%d\n", stat, value)
         end
    end
     return output
end


-- Return the module table
-- Return the module table
return BaseStats
return p

Latest revision as of 20:35, 10 December 2024

local p = {}

-- Define core attributes and bonuses p.attributes = {

   strength = {
       name = "Strength",
       bonuses = {
           life = 2, -- +2 Life per Strength
           meleeDamage = 1 -- +1% Melee Damage per Strength
       },
       description = "Vital for melee weapons and survivability."
   },
   dexterity = {
       name = "Dexterity",
       bonuses = {
           accuracy = 5, -- +5 Accuracy per Dexterity
           evasion = 2 -- +2 Evasion per Dexterity
       },
       description = "Essential for ranged weapons and evasion."
   },
   intelligence = {
       name = "Intelligence",
       bonuses = {
           mana = 2, -- +2 Mana per Intelligence
           energyShield = 1 -- +1 Energy Shield per Intelligence
       },
       description = "Crucial for spellcasting and energy shield management."
   }

}

-- Define derived stats p.derivedStats = {

   life = {
       name = "Life",
       base = 50, -- Base value
       description = "Represents health; increased by Strength and gear."
   },
   mana = {
       name = "Mana",
       base = 50, -- Base value
       description = "Resource for skills; increased by Intelligence and gear."
   },
   energyShield = {
       name = "Energy Shield",
       base = 0, -- Base value
       description = "Acts as a buffer to Life; scales with Intelligence."
   }

}

-- Example function to calculate total Life based on Strength function p.calculateLife(strength)

   local baseLife = p.derivedStats.life.base
   local bonus = strength * p.attributes.strength.bonuses.life
   return baseLife + bonus

end

-- Example function to display all attributes function p.showAttributes()

   local output = "== Core Attributes ==\n"
   for key, attr in pairs(p.attributes) do
       output = output .. string.format("=== %s ===\n%s\nBonuses:\n", attr.name, attr.description)
       for stat, value in pairs(attr.bonuses) do
           output = output .. string.format("* %s: +%d\n", stat, value)
       end
   end
   return output

end

-- Return the module table return p