func specificSkillMenu(s *Session, skill types.Skill) { utils.ExecMenu(fmt.Sprintf("Skill - %s", skill.GetName()), s, func(menu *utils.Menu) { menu.AddAction("e", fmt.Sprintf("Effect - %v", skill.GetEffect()), func() bool { return true }) menu.AddAction("p", fmt.Sprintf("Power - %v", skill.GetPower()), func() bool { dmg, valid := s.getInt("New power: ", 0, 1000) if valid { skill.SetPower(dmg) } return true }) menu.AddAction("c", fmt.Sprintf("Cost - %v", skill.GetCost()), func() bool { cost, valid := s.getInt("New cost: ", 0, 1000) if valid { skill.SetCost(cost) } return true }) menu.AddAction("v", fmt.Sprintf("Variance - %v", skill.GetVariance()), func() bool { variance, valid := s.getInt("New variance: ", 0, 1000) if valid { skill.SetVariance(variance) } return true }) menu.AddAction("s", fmt.Sprintf("Speed - %v", skill.GetSpeed()), func() bool { speed, valid := s.getInt("New speed: ", 0, 1000) if valid { skill.SetSpeed(speed) } return true }) menu.AddAction("d", "Delete", func() bool { model.DeleteSkill(skill.GetId()) return false }) }) }
target = s.pc } else { charList := model.CharactersIn(s.pc.GetRoomId()) index := utils.BestMatch(targetName, charList.Names()) if index == -1 { s.printError("Target not found") } else if index == -2 { s.printError("Which target do you mean?") } else { target = charList[index] } } if target != nil { s.WriteLineColor(types.ColorRed, "Casting %s on %s", skill.GetName(), target.GetName()) combat.StartFight(s.pc, skill, target) } } }, }, "sb": aAlias("skillbook"), "skillbook": { exec: func(s *Session, arg string) { utils.ExecMenu("Skill Book", s, func(menu *utils.Menu) { menu.AddAction("a", "Add", func() bool { utils.ExecMenu("Select a skill to add", s, func(menu *utils.Menu) { for i, skill := range model.GetAllSkills() { sk := skill menu.AddActionI(i, skill.GetName(), func() bool { s.pc.AddSkill(sk.GetId())