aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_attack.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_attack.go')
-rw-r--r--internal/game/cmd_attack.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/internal/game/cmd_attack.go b/internal/game/cmd_attack.go
index a8dc5d3..77cd569 100644
--- a/internal/game/cmd_attack.go
+++ b/internal/game/cmd_attack.go
@@ -164,6 +164,14 @@ func (g *Game) startCombat(sess *net.Session, p *player.Player, mob *world.MobIn
}
p.ActionState = &ActionState{Type: ActionCombating, TargetName: mob.Name}
+ if g.Hub != nil {
+ for _, other := range g.Hub.PlayersInRoom(p.RoomID) {
+ if other != sess && other.Player != nil {
+ other.WriteLine(g.colorize(other, "broadcast", fmt.Sprintf("\n%s attacks %s!", p.Name, mobDisplayName(mob, true))))
+ }
+ }
+ }
+
g.Ticks.Subscribe(engine.ToTicks(playerSpeed), func() bool {
cs := combat.GetCombat(p.Name)
if cs == nil || !cs.Active {
@@ -243,7 +251,7 @@ func (g *Game) playerAttack(sess *net.Session, p *player.Player, mob *world.MobI
if isRanged {
rangedBonus, _ := combat.RangedStyleBonus(string(p.AttackStyle))
equipAttack := totals.RangedAttack
- effectiveRanged := p.Level(player.Ranged) + g.techLevelBonus(p, "ranged")
+ effectiveRanged := p.Level(player.Ranged) + g.techLevelBonus(p, "ranged") + g.buffLevelBonus(p, "ranged")
attRoll = combat.AttackRoll(effectiveRanged, rangedBonus, equipAttack)
mobDefBonus := combat.SelectDefenseBonus(attackType,
@@ -256,14 +264,14 @@ func (g *Game) playerAttack(sess *net.Session, p *player.Player, mob *world.MobI
equipAttack := combat.SelectAttackBonus(attackType,
totals.StabAttack, totals.SlashAttack, totals.CrushAttack,
totals.ScienceAttack, totals.RangedAttack)
- effectiveAttack := p.Level(player.Attack) + g.techLevelBonus(p, "attack")
+ effectiveAttack := p.Level(player.Attack) + g.techLevelBonus(p, "attack") + g.buffLevelBonus(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)+g.techLevelBonus(p, "strength"), strBonus, totals.StrengthBonus)
+ maxHit = combat.MaxHit(p.Level(player.Strength)+g.techLevelBonus(p, "strength")+g.buffLevelBonus(p, "strength"), strBonus, totals.StrengthBonus)
}
if combat.HitCheck(attRoll, defRoll) {
@@ -362,7 +370,7 @@ 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)+g.techLevelBonus(p, "defense"), defStyleBonus, equipDef)
+ defRoll := combat.DefenseRoll(p.Level(player.Defense)+g.techLevelBonus(p, "defense")+g.buffLevelBonus(p, "defense"), defStyleBonus, equipDef)
if combat.HitCheck(attRoll, defRoll) {
maxHit := combat.MaxHit(mob.Strength, 0, mob.StrengthBonus)