added weaponskills to the exported skill list

added Raufen to the Weapons list as an attack
This commit is contained in:
2025-12-28 17:38:21 +01:00
parent a726922443
commit 0983ca0139
+25 -2
View File
@@ -143,7 +143,7 @@ func mapDerivedValues(char *models.Char) DerivedValueSet {
// mapSkills converts character skills to SkillViewModel // mapSkills converts character skills to SkillViewModel
func mapSkills(char *models.Char) []SkillViewModel { func mapSkills(char *models.Char) []SkillViewModel {
skills := make([]SkillViewModel, 0, len(char.Fertigkeiten)) skills := make([]SkillViewModel, 0, len(char.Fertigkeiten)+len(char.Waffenfertigkeiten))
for _, skill := range char.Fertigkeiten { for _, skill := range char.Fertigkeiten {
skl := SkillViewModel{ skl := SkillViewModel{
@@ -161,13 +161,27 @@ func mapSkills(char *models.Char) []SkillViewModel {
skills = append(skills, skl) skills = append(skills, skl)
} }
// Append weapon skills to the skill list
for _, skill := range char.Waffenfertigkeiten {
skl := SkillViewModel{
Name: skill.Name,
Category: "Waffenfertigkeit",
Value: skill.Fertigkeitswert,
Bonus: skill.Bonus,
PracticePoints: skill.Pp,
IsLearned: skill.Fertigkeitswert > 0,
Bemerkung: skill.Bemerkung,
}
skills = append(skills, skl)
}
return skills return skills
} }
// mapWeapons converts equipped weapons to WeaponViewModel // mapWeapons converts equipped weapons to WeaponViewModel
// EW = Waffenfertigkeit.Fertigkeitswert + Character.AngriffBonus + Weapon.Anb // EW = Waffenfertigkeit.Fertigkeitswert + Character.AngriffBonus + Weapon.Anb
func mapWeapons(char *models.Char) []WeaponViewModel { func mapWeapons(char *models.Char) []WeaponViewModel {
weapons := make([]WeaponViewModel, 0, len(char.Waffen)) weapons := make([]WeaponViewModel, 0, len(char.Waffen)+1)
// Calculate character's bonuses using character logic // Calculate character's bonuses using character logic
attrs := mapAttributes(char) attrs := mapAttributes(char)
@@ -184,6 +198,15 @@ func mapWeapons(char *models.Char) []WeaponViewModel {
Grad: char.Grad, Grad: char.Grad,
}) })
// Add Raufen as the first weapon
raufenDamage := fmt.Sprintf("1W6%+d", bonusValues.SchadensBonus)
weapons = append(weapons, WeaponViewModel{
Name: "Raufen",
Value: bonusValues.Raufen,
Damage: raufenDamage,
IsRanged: false,
})
// Create a map of weapon skills for quick lookup // Create a map of weapon skills for quick lookup
weaponSkills := make(map[string]int) weaponSkills := make(map[string]int)
for _, skill := range char.Waffenfertigkeiten { for _, skill := range char.Waffenfertigkeiten {