Communauté

Premiers pas tout e...
 
Notifications
Retirer tout

Premiers pas tout en douceur

2 Posts
2 Utilisateurs
1 Reactions
647 Vu
(@crimsonlog)
New Member
Inscription: Il y a 2 ans
Posts: 1
Début du sujet  

Bonjour à tous, premier post pour le premier jour de formation GameCodeur.

C'est avec fierté que je vous présente ma "Fiche de Personnage" en LUA que j'ai faite pour l'exercice des Variables Complexes.

N'hésitez pas à me dire ce que vous en pensez, si de bonnes pratiques ou autres me permettraient de m'améliorer et de ne pas prendre de mauvaises habitudes.

(Je n'ai pas trouvé comment partager directement le fichier donc voici un beau pavé de code rien que pour vous)

Merci d'avance 😊 

Logan

 

CharacterRpg = {}

-- Base Stats
CharacterRpg.Level = 125

CharacterRpg.Vitality = 63 + CharacterRpg.Level * 0.1 - (CharacterRpg.Level * 0.1 % 1) -- Increase Max Health / Whole Number

CharacterRpg.Strength = 24 + CharacterRpg.Level * 0.1 - (CharacterRpg.Level * 0.1 % 1) -- Increase Physical Damages / Whole Number

CharacterRpg.Intelligence = 58 + CharacterRpg.Level * 0.1 - (CharacterRpg.Level * 0.1 % 1) -- Increase Magical Damages and Mana Max / Whole Number

CharacterRpg.Endurance = 16 + CharacterRpg.Level * 0.1 - (CharacterRpg.Level * 0.1 % 1) -- Increase Stamina / Whole Number

CharacterRpg.Luck = 20  + CharacterRpg.Level * 0.1 - (CharacterRpg.Level * 0.1 % 1) -- Increase Crit Chances / Whole Number

CharacterRpg.Constitution = 37 + CharacterRpg.Level * 0.1 - (CharacterRpg.Level * 0.1 % 1) -- Increase Resistances / Whole Number


-- HP and Stamina
CharacterRpg.HP = 100 + CharacterRpg.Vitality * 1.5 - (CharacterRpg.Vitality * 1.5 % 1) -- Always a whole number

CharacterRpg.Stamina = 100 + CharacterRpg.Endurance * 1.3 - (CharacterRpg.Endurance * 1.3 % 1) -- Always a whole number

CharacterRpg.Mana = 100 + CharacterRpg.Intelligence * 1.5 - (CharacterRpg.Intelligence * 1.5 % 1) -- Always a whole number


-- Equipment Related Stats
CharacterRpg.Equipment = {}


-- Equipped Weapon Stats
CharacterRpg.Equipment.Weapon = {}

CharacterRpg.Equipment.Weapon.Name = "Magical Sword"

CharacterRpg.Equipment.Weapon.StrengthScale = 1.2

CharacterRpg.Equipment.Weapon.IntelligenceScale = 1.5

CharacterRpg.Equipment.Weapon.Damages = {}

CharacterRpg.Equipment.Weapon.Damages.MagicDamages = 150 + CharacterRpg.Intelligence * CharacterRpg.Equipment.Weapon.IntelligenceScale - (CharacterRpg.Intelligence * CharacterRpg.Equipment.Weapon.IntelligenceScale % 1) -- Always a whole number

CharacterRpg.Equipment.Weapon.Damages.PhysicalDamages = 50 + CharacterRpg.Strength * CharacterRpg.Equipment.Weapon.StrengthScale - (CharacterRpg.Strength * CharacterRpg.Equipment.Weapon.StrengthScale % 1) -- Always a whole number

CharacterRpg.Equipment.Weapon.Damages.CritDamages = 1.5

CharacterRpg.Equipment.Weapon.CritChance = 0.3 * ((CharacterRpg.Luck * 0.5) / 10 )


-- Equipped Armor Stats
CharacterRpg.Equipment.Armor = {}

CharacterRpg.Equipment.Armor.Name = "Legendary Draconic Armor"

CharacterRpg.Equipment.Armor.MagicalResist = 280 + (CharacterRpg.Constitution * 0.6) - (CharacterRpg.Constitution * 0.6 % 1)

CharacterRpg.Equipment.Armor.PhysicalResist = 190 + (CharacterRpg.Constitution * 0.4) - (CharacterRpg.Constitution * 0.4 % 1)





print("Level = ", CharacterRpg.Level)
print("Vitality = ", CharacterRpg.Vitality)
print("Strength = ", CharacterRpg.Strength)
print("Intelligence = ", CharacterRpg.Intelligence)
print("Endurance = ", CharacterRpg.Endurance)
print("Luck = ", CharacterRpg.Luck)
print("Constitution = ", CharacterRpg.Constitution)
print("HP = ", CharacterRpg.HP)
print("Stamina = ", CharacterRpg.Stamina)
print("Mana = ", CharacterRpg.Mana)
print("Weapon = ", CharacterRpg.Equipment.Weapon.Name)
print("Strength scale = ", CharacterRpg.Equipment.Weapon.StrengthScale)
print("Intelligence scale = ", CharacterRpg.Equipment.Weapon.IntelligenceScale)
print("Magic damage = ", CharacterRpg.Equipment.Weapon.Damages.MagicDamages)
print("Melee damage = ", CharacterRpg.Equipment.Weapon.Damages.PhysicalDamages)
print("Critical damage = ", CharacterRpg.Equipment.Weapon.Damages.CritDamages)
print("Crit chance = ", CharacterRpg.Equipment.Weapon.CritChance)
print("Armor = ", CharacterRpg.Equipment.Armor.Name)
print("Magic resistance = ", CharacterRpg.Equipment.Armor.MagicalResist)
print("Physic resistance = ", CharacterRpg.Equipment.Armor.PhysicalResist)

 


   
caprog reacted
Citation
Étiquettes du sujet
(@david)
Membre Admin
Inscription: Il y a 9 ans
Posts: 153
 

Bienvenue <3


   
RépondreCitation
Share:

Dialoguez avec les autres membres de la gamecodeur school.

Accédez maintenant à notre serveur Discord privé : Entraide, Game Jams, Partage de projets, etc.

Vous devez être membre de la Gamecodeur School Premium pour être autorisé à accéder au serveur.