From 9d4b799db4868bcab291b83599ff088763cd4ed6 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 24 Jun 2026 20:58:25 -0400 Subject: feat: new type of non-violent 'combat': work --- internal/game/sys_technology.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'internal/game/sys_technology.go') diff --git a/internal/game/sys_technology.go b/internal/game/sys_technology.go index bb48375..e673dcb 100644 --- a/internal/game/sys_technology.go +++ b/internal/game/sys_technology.go @@ -10,7 +10,7 @@ import ( ) type TechEffects struct { - AttackPercent int + AccuracyPercent int StrengthPercent int DefensePercent int RangedPercent int @@ -39,9 +39,9 @@ var techByID map[string]*TechDef func init() { AllTechs = []TechDef{ - {ID: "clarity_1", Name: "Clarity", Level: 4, DrainRate: 0.05, Category: "attack", Group: "attack_tier", Effects: TechEffects{AttackPercent: 5}}, - {ID: "clarity_2", Name: "Enhanced Clarity", Level: 16, DrainRate: 0.10, Category: "attack", Group: "attack_tier", Effects: TechEffects{AttackPercent: 10}}, - {ID: "clarity_3", Name: "Superior Clarity", Level: 44, DrainRate: 0.15, Category: "attack", Group: "attack_tier", Effects: TechEffects{AttackPercent: 15}}, + {ID: "clarity_1", Name: "Clarity", Level: 4, DrainRate: 0.05, Category: "accuracy", Group: "accuracy_tier", Effects: TechEffects{AccuracyPercent: 5}}, + {ID: "clarity_2", Name: "Enhanced Clarity", Level: 16, DrainRate: 0.10, Category: "accuracy", Group: "accuracy_tier", Effects: TechEffects{AccuracyPercent: 10}}, + {ID: "clarity_3", Name: "Superior Clarity", Level: 44, DrainRate: 0.15, Category: "accuracy", Group: "accuracy_tier", Effects: TechEffects{AccuracyPercent: 15}}, {ID: "amplifier_1", Name: "Power Amplifier", Level: 7, DrainRate: 0.05, Category: "strength", Group: "strength_tier", Effects: TechEffects{StrengthPercent: 5}}, {ID: "amplifier_2", Name: "Enhanced Amplifier", Level: 23, DrainRate: 0.10, Category: "strength", Group: "strength_tier", Effects: TechEffects{StrengthPercent: 10}}, @@ -68,7 +68,7 @@ func init() { {ID: "preserve", Name: "Power Saver", Level: 55, DrainRate: 0.05, Category: "utility", Group: "", Effects: TechEffects{PreserveDrain: 0.2}}, {ID: "retribution", Name: "Dead Man's Switch", Level: 46, DrainRate: 0.10, Category: "utility", Group: "", Effects: TechEffects{RetributionPct: 0.25}}, - {ID: "overclock", Name: "Overclock", Level: 60, DrainRate: 0.25, Category: "combo", Group: "attack_tier", Effects: TechEffects{AttackPercent: 15, StrengthPercent: 15}}, + {ID: "overclock", Name: "Overclock", Level: 60, DrainRate: 0.25, Category: "combo", Group: "accuracy_tier", Effects: TechEffects{AccuracyPercent: 15, StrengthPercent: 15}}, {ID: "fortify", Name: "Fortify", Level: 65, DrainRate: 0.25, Category: "combo", Group: "defense_tier", Effects: TechEffects{DefensePercent: 15, HPRegenMulti: 2.0}}, } @@ -104,8 +104,8 @@ func TechByPrefixMatch(input string) []*TechDef { func techEffectString(tech TechDef) string { var parts []string e := tech.Effects - if e.AttackPercent > 0 { - parts = append(parts, fmt.Sprintf("+%d%% Attack", e.AttackPercent)) + if e.AccuracyPercent > 0 { + parts = append(parts, fmt.Sprintf("+%d%% Accuracy", e.AccuracyPercent)) } if e.StrengthPercent > 0 { parts = append(parts, fmt.Sprintf("+%d%% Strength", e.StrengthPercent)) @@ -163,8 +163,8 @@ func (g *Game) techLevelBonus(p *player.Player, stat string) int { continue } switch stat { - case "attack": - totalPercent += def.Effects.AttackPercent + case "accuracy": + totalPercent += def.Effects.AccuracyPercent case "strength": totalPercent += def.Effects.StrengthPercent case "defense": @@ -182,8 +182,8 @@ func (g *Game) techLevelBonus(p *player.Player, stat string) int { var baseLevel int switch stat { - case "attack": - baseLevel = p.Level(player.Attack) + case "accuracy": + baseLevel = p.Level(player.Accuracy) case "strength": baseLevel = p.Level(player.Strength) case "defense": @@ -217,11 +217,17 @@ func (g *Game) tryRecharge(sess *net.Session, p *player.Player, input string) bo } func (g *Game) applyTechProtection(p *player.Player, mob *world.MobInstance, dmg int) int { + return g.damageAfterTechProtection(p, mob.AttackType, dmg) +} + +// damageAfterTechProtection reduces incoming damage if the player has the +// protection tech matching the given attack type active. Shared by mob combat +// and room hazards. +func (g *Game) damageAfterTechProtection(p *player.Player, attackType string, dmg int) int { if len(p.ActiveTechs) == 0 { return dmg } - attackType := mob.AttackType if attackType == "" { attackType = "crush" } -- cgit v1.2.3