Esempio n. 1
0
func (c *Creature) Use(i item.Itemer) {
	if !item.IsUsable(i) {
		status.Println("You can't use that item!", termbox.ColorRed+termbox.AttrBold)
		return
	}
	if !item.IsPermanent(i) {
		if i.Count() > 1 {
			i.SetCount(i.Count() - 1)
		} else {
			delete(c.Inventory, i.Hotkey())
		}
	}
	c.use(i)
}
Esempio n. 2
0
func InvText(i item.Itemer) string {
	invStr := ""
	if item.IsStackable(i) {
		name := i.Name()
		if i.Count() > 1 {
			name = inflections.Pluralize(name)
		}
		invStr = fmt.Sprintf("%c - %d %s", i.Hotkey(), i.Count(), name)
	} else {
		invStr = fmt.Sprintf("%c - %s", i.Hotkey(), i.Name())
	}

	if item.IsEquipable(i) {
		if creature.Hero.IsEquipped(i) {
			invStr += " (wielding)"
		}
	}
	return invStr
}