aboutsummaryrefslogtreecommitdiff
path: root/internal/game/assassin.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-19 18:20:26 -0400
committerhistoria <[not public]>2026-06-19 18:20:26 -0400
commit0ea4eec5dd2122c6704216971eb1249276297867 (patch)
tree430fbbef04e837820f1d031c190f52ecd6112e25 /internal/game/assassin.go
parent3a58125d14bb307f861b38c6c5b0a63babde7e08 (diff)
downloadthehouseoficarus-0ea4eec5dd2122c6704216971eb1249276297867.tar.gz
shop fixes, 'toggle' completely removed, movement speed increased
Diffstat (limited to 'internal/game/assassin.go')
-rw-r--r--internal/game/assassin.go112
1 files changed, 1 insertions, 111 deletions
diff --git a/internal/game/assassin.go b/internal/game/assassin.go
index d7af1a4..1927399 100644
--- a/internal/game/assassin.go
+++ b/internal/game/assassin.go
@@ -3,52 +3,12 @@ package game
import (
"fmt"
"math/rand"
- "strings"
- "thehouseoficarus/internal/combat"
"thehouseoficarus/internal/net"
"thehouseoficarus/internal/player"
"thehouseoficarus/internal/world"
)
-func getPlayerFlagInt(p *player.Player, key string) int {
- if p.Flags == nil {
- return 0
- }
- val, ok := p.Flags[key]
- if !ok {
- return 0
- }
- switch v := val.(type) {
- case int:
- return v
- case int64:
- return int(v)
- case float64:
- return int(v)
- }
- return 0
-}
-
-func getPlayerFlagString(p *player.Player, key string) string {
- if p.Flags == nil {
- return ""
- }
- val, ok := p.Flags[key]
- if !ok {
- return ""
- }
- s, _ := val.(string)
- return s
-}
-
-func setPlayerFlag(p *player.Player, key string, val any) {
- if p.Flags == nil {
- p.Flags = make(map[string]any)
- }
- p.Flags[key] = val
-}
-
type assassinTaskEntry struct {
MobID string
MinLevel int
@@ -114,10 +74,7 @@ func (g *Game) onAssassinKill(sess *net.Session, p *player.Player, mob *world.Mo
return
}
xp := mob.MaxHP * 2
- newLevel := p.AddSkillXP(player.Assassin, xp)
- if newLevel > 0 {
- sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d Assassin! ***", newLevel)))
- }
+ g.awardSkillXP(sess, p, player.Assassin, xp)
if p.OptionBool("xp_drops") {
sess.WriteLine(g.colorize(sess, "xp", fmt.Sprintf(" (+%dxp asm)", xp)))
}
@@ -215,70 +172,3 @@ func streakBonus(streak int) int {
}
return 0
}
-
-func (g *Game) tryFinishingBlow(sess *net.Session, input string) bool {
- p := sess.Player.(*player.Player)
- cs := combat.GetCombat(p.Name)
- if cs == nil {
- return false
- }
- mob := g.MobStore.GetInstance(cs.MobID)
- if mob == nil || mob.FinishingBlow == "" || mob.HP != 1 {
- return false
- }
- lower := strings.ToLower(input)
- var itemPart, targetPart string
- for _, sep := range []string{" on ", " with "} {
- if idx := strings.Index(lower, sep); idx > 0 {
- itemPart = strings.TrimSpace(input[:idx])
- targetPart = strings.TrimSpace(input[idx+len(sep):])
- break
- }
- }
- if targetPart == "" {
- itemPart = strings.TrimSpace(input)
- if mob.MatchQuality(itemPart) != world.MatchNone {
- targetPart = itemPart
- itemPart = strings.TrimSpace(mob.FinishingBlow)
- }
- }
- if targetPart == "" {
- return false
- }
- if mob.MatchQuality(targetPart) == world.MatchNone {
- return false
- }
- g.doFinishingBlow(sess, p, mob, itemPart)
- return true
-}
-
-func (g *Game) doFinishingBlow(sess *net.Session, p *player.Player, mob *world.MobInstance, itemInput string) {
- fbDef, err := g.ItemStore.Load(mob.FinishingBlow)
- if err != nil {
- sess.WriteLine("Something went wrong.")
- return
- }
- if !fbDef.MatchesName(itemInput) && !strings.EqualFold(itemInput, fbDef.ID) {
- sess.WriteLine(fmt.Sprintf("That won't work on %s. You need %s.", mobDisplayName(mob, true), fbDef.Name))
- return
- }
- if !p.HasItem(mob.FinishingBlow) {
- sess.WriteLine(fmt.Sprintf("You don't have any %s.", fbDef.Name))
- return
- }
- autoKey := "assassin_unlocked_auto_" + mob.FinishingBlow
- consumed := true
- if p.Flags != nil {
- if val, ok := p.Flags[autoKey]; ok {
- if b, ok := val.(bool); ok && b {
- consumed = false
- }
- }
- }
- if consumed {
- p.RemoveItem(mob.FinishingBlow, 1)
- }
- sess.WriteLine(fmt.Sprintf("\nYou use the %s on %s!", g.itemColorize(sess, fbDef, fbDef.Name), g.colorize(sess, "mob_name", mobDisplayName(mob, true))))
- mob.HP = 0
- g.endCombat(sess, p, mob)
-}