diff options
| author | historia <[not public]> | 2026-06-19 02:40:22 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-19 02:40:22 -0400 |
| commit | 2ae4a052fd1c15c3c6ba0f1dd324d896371aaffc (patch) | |
| tree | 3caef60f71a462b7e7ace668053e1f02fb61db15 /internal/game/cmd_attack.go | |
| parent | 86aec0e14eb6fec0a39d742bab1761dad8d7012c (diff) | |
| download | thehouseoficarus-2ae4a052fd1c15c3c6ba0f1dd324d896371aaffc.tar.gz | |
feat: rough technology skill added
Diffstat (limited to 'internal/game/cmd_attack.go')
| -rw-r--r-- | internal/game/cmd_attack.go | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/internal/game/cmd_attack.go b/internal/game/cmd_attack.go index 4d2d19f..401837f 100644 --- a/internal/game/cmd_attack.go +++ b/internal/game/cmd_attack.go @@ -209,25 +209,27 @@ func (g *Game) playerAttack(sess *net.Session, p *player.Player, mob *world.MobI if isRanged { rangedBonus, _ := combat.RangedStyleBonus(string(p.AttackStyle)) equipAttack := totals.RangedAttack - attRoll = combat.AttackRoll(p.Level(player.Ranged), rangedBonus, equipAttack) + effectiveRanged := p.Level(player.Ranged) + g.techLevelBonus(p, "ranged") + attRoll = combat.AttackRoll(effectiveRanged, rangedBonus, equipAttack) mobDefBonus := combat.SelectDefenseBonus(attackType, mob.StabDefense, mob.SlashDefense, mob.CrushDefense, mob.ScienceDefense, mob.RangedDefense) defRoll = combat.DefenseRoll(mob.Defense, 0, mobDefBonus) - maxHit = combat.MaxHit(p.Level(player.Ranged), rangedBonus, totals.RangedStrength) + maxHit = combat.MaxHit(effectiveRanged, rangedBonus, totals.RangedStrength) } else { attBonus, strBonus, _ := combat.AttackStyleBonus(string(p.AttackStyle)) equipAttack := combat.SelectAttackBonus(attackType, totals.StabAttack, totals.SlashAttack, totals.CrushAttack, totals.ScienceAttack, totals.RangedAttack) - attRoll = combat.AttackRoll(p.Level(player.Attack), attBonus, equipAttack) + effectiveAttack := p.Level(player.Attack) + g.techLevelBonus(p, "attack") + attRoll = combat.AttackRoll(effectiveAttack, attBonus, equipAttack) mobDefBonus := combat.SelectDefenseBonus(attackType, mob.StabDefense, mob.SlashDefense, mob.CrushDefense, mob.ScienceDefense, mob.RangedDefense) defRoll = combat.DefenseRoll(mob.Defense, 0, mobDefBonus) - maxHit = combat.MaxHit(p.Level(player.Strength), strBonus, totals.StrengthBonus) + maxHit = combat.MaxHit(p.Level(player.Strength)+g.techLevelBonus(p, "strength"), strBonus, totals.StrengthBonus) } if combat.HitCheck(attRoll, defRoll) { @@ -311,11 +313,12 @@ func (g *Game) mobAttack(sess *net.Session, p *player.Player, mob *world.MobInst equipDef := combat.SelectDefenseBonus(mobAttackType, totals.StabDefense, totals.SlashDefense, totals.CrushDefense, totals.ScienceDefense, totals.RangedDefense) - defRoll := combat.DefenseRoll(p.Level(player.Defense), defStyleBonus, equipDef) + defRoll := combat.DefenseRoll(p.Level(player.Defense)+g.techLevelBonus(p, "defense"), defStyleBonus, equipDef) if combat.HitCheck(attRoll, defRoll) { maxHit := combat.MaxHit(mob.Strength, 0, mob.StrengthBonus) dmg := combat.RollDamage(maxHit) + dmg = g.applyTechProtection(p, mob, dmg) p.HP -= dmg if p.HP < 0 { @@ -358,6 +361,21 @@ func (g *Game) endCombat(sess *net.Session, p *player.Player, mob *world.MobInst p.ActionState = nil if p.HP <= 0 { + if p.HasActiveTech("retribution") { + retDef := GetTechDef("retribution") + if retDef != nil && mob != nil && mob.HP > 0 { + retDmg := int(float64(p.MaxHP()) * retDef.Effects.RetributionPct) + if retDmg > 0 { + mob.HP -= retDmg + if mob.HP < 0 { + mob.HP = 0 + } + sess.WriteLine(fmt.Sprintf("\nDead Man's Switch activates! %s takes %d damage!", + mobDisplayName(mob, true), retDmg)) + } + } + } + p.DeactivateAllTechs() sess.WriteLine(g.colorize(sess, "death", "\nOh dear, you are dead!")) p.ClearMoveState() g.dropItemsOnDeath(p) |
