aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_trigger.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-19 13:28:06 -0400
committerhistoria <[not public]>2026-06-19 13:28:06 -0400
commit3a58125d14bb307f861b38c6c5b0a63babde7e08 (patch)
treebd89e866447d55e6dffd447d8ef5fabf9b8fbe9d /internal/game/cmd_trigger.go
parent575a71dcfed3b9fa44af244836f638a23df05a9a (diff)
downloadthehouseoficarus-3a58125d14bb307f861b38c6c5b0a63babde7e08.tar.gz
feat: all skills kind of implemented, random prototype content added
Diffstat (limited to 'internal/game/cmd_trigger.go')
-rw-r--r--internal/game/cmd_trigger.go126
1 files changed, 125 insertions, 1 deletions
diff --git a/internal/game/cmd_trigger.go b/internal/game/cmd_trigger.go
index 8e3a84e..7ef4913 100644
--- a/internal/game/cmd_trigger.go
+++ b/internal/game/cmd_trigger.go
@@ -228,6 +228,8 @@ func (g *Game) triggerUtility(sess *net.Session, p *player.Player, mod *ModDef,
g.triggerEmGrab(sess, p, mod, targetArg)
case "superheat":
g.triggerSuperheat(sess, p, mod, targetArg)
+ case "plank_make":
+ g.triggerPlankMake(sess, p, mod, targetArg)
}
}
@@ -440,6 +442,128 @@ func (g *Game) triggerSuperheat(sess *net.Session, p *player.Player, mod *ModDef
}
}
+func (g *Game) triggerPlankMake(sess *net.Session, p *player.Player, mod *ModDef, targetArg string) {
+ if combat.GetCombat(p.Name) != nil {
+ sess.WriteLine("You can't do that during combat!")
+ return
+ }
+
+ logTypes := map[string]struct {
+ plankID string
+ name string
+ cost int
+ }{
+ "logs": {"planks", "planks", 3},
+ "oak_logs": {"oak_planks", "oak planks", 7},
+ "teak_logs": {"teak_planks", "teak planks", 14},
+ "mahogany_logs": {"mahogany_planks", "mahogany planks", 28},
+ }
+
+ if targetArg != "" {
+ slot, inv := g.findInventoryItem(p, targetArg)
+ if slot < 0 {
+ sess.WriteLine("You don't have that item.")
+ return
+ }
+ info, ok := logTypes[inv.ItemID]
+ if !ok {
+ sess.WriteLine("You can't turn that into planks.")
+ return
+ }
+
+ if p.Credits < info.cost {
+ sess.WriteLine(fmt.Sprintf("You need %d credits for Plank Make (70%% of sawmill cost).", info.cost))
+ return
+ }
+
+ if p.Action != nil {
+ g.CancelAction(p)
+ }
+
+ g.consumeJunkCost(p, mod)
+
+ p.RemoveItem(inv.ItemID, 1)
+ p.Credits -= info.cost
+
+ freeSlot := p.FirstFreeSlot()
+ if freeSlot == -1 {
+ sess.WriteLine("Your inventory is full.")
+ return
+ }
+ p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: info.plankID, Quantity: 1})
+
+ sciXP := int(mod.BaseXP)
+ if newLevel := p.AddSkillXP(player.Science, sciXP); newLevel > 0 {
+ sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d science! ***", p.Level(player.Science))))
+ }
+ if newLevel := p.AddSkillXP(player.Construction, 10); newLevel > 0 {
+ sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d construction! ***", p.Level(player.Construction))))
+ }
+ g.AccountStore.SaveCharacter(p)
+
+ sess.WriteLine(fmt.Sprintf("You convert the log into %s.", info.name))
+ if p.OptionBool("xp_drops") {
+ parts := []string{fmt.Sprintf("+%dxp sci", sciXP), "+10xp con"}
+ sess.WriteLine(g.colorize(sess, "xp", "("+strings.Join(parts, ", ")+")"))
+ }
+ return
+ }
+
+ for logID, info := range logTypes {
+ qty := p.CountItem(logID)
+ if qty == 0 {
+ continue
+ }
+
+ totalCost := info.cost * qty
+ if p.Credits < totalCost {
+ continue
+ }
+
+ if p.Action != nil {
+ g.CancelAction(p)
+ }
+
+ g.consumeJunkCost(p, mod)
+
+ p.RemoveItem(logID, qty)
+ p.Credits -= totalCost
+
+ processed := 0
+ for i := 0; i < qty; i++ {
+ freeSlot := p.FirstFreeSlot()
+ if freeSlot == -1 {
+ g.World.AddGroundItem(p.RoomID, info.plankID, qty-i)
+ break
+ }
+ p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: info.plankID, Quantity: 1})
+ processed++
+ }
+
+ sciXP := int(mod.BaseXP) * qty
+ if newLevel := p.AddSkillXP(player.Science, sciXP); newLevel > 0 {
+ sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d science! ***", p.Level(player.Science))))
+ }
+ conXP := 10 * qty
+ if newLevel := p.AddSkillXP(player.Construction, conXP); newLevel > 0 {
+ sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d construction! ***", p.Level(player.Construction))))
+ }
+ g.AccountStore.SaveCharacter(p)
+
+ sess.WriteLine(fmt.Sprintf("You convert %d logs into %s for %d credits.", processed, info.name, totalCost))
+ if processed < qty {
+ sess.WriteLine(fmt.Sprintf("Your inventory is full. The remaining %d planks fall to the ground.", qty-processed))
+ }
+ if p.OptionBool("xp_drops") {
+ parts := []string{fmt.Sprintf("+%dxp sci", sciXP), fmt.Sprintf("+%dxp con", conXP)}
+ sess.WriteLine(g.colorize(sess, "xp", "("+strings.Join(parts, ", ")+")"))
+ }
+ return
+ }
+
+ sess.WriteLine("You don't have any logs to convert.")
+}
+
func (g *Game) triggerEnchant(sess *net.Session, p *player.Player, mod *ModDef, targetArg string) {
if chipInfo, ok := chipMap[mod.ID]; ok {
g.triggerChipBolts(sess, p, mod, chipInfo)
@@ -568,7 +692,7 @@ func (g *Game) scienceAttack(sess *net.Session, p *player.Player, mob *world.Mob
g.consumeJunkCost(p, mod)
equipSciBonus := g.totalEquipScienceAttack(p)
- attRoll := (p.Level(player.Science) + 8) * (equipSciBonus + 64)
+ attRoll := (p.Level(player.Science) + g.buffLevelBonus(p, "science") + 8) * (equipSciBonus + 64)
mobSciDef := mob.ScienceDefense
defRoll := (mob.Defense + 9) * (mobSciDef + 64)