mp

package
v0.0.0-...-5198b88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

mp is a package that provides a mana point system with a maximum and current value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute(level, base, intelligence int) int

Compute returns the computed Max value based on the given level and base value. 8 + 4 by level + bonus point for every 3 constitution point above 10 every level.

Types

type MP

type MP struct {
	Max     *pts.Point
	Current *pts.Point
}

MP represents a mana point system with a maximum and current value.

func New

func New(max int) *MP

New returns a new MP struct with the given max and current values.

func (*MP) Compute

func (mp *MP) Compute(level, base, intelligence int)

Compute returns the computed Max value based on the given level and base value.

func (*MP) Copy

func (mp *MP) Copy() MP

Copy creates a new MP with copies of Max and Current points.

func (*MP) Percent

func (mp *MP) Percent() float64

Percent returns the current MP as a percentage of the maximum MP.

func (*MP) PercentString

func (mp *MP) PercentString() string

PercentString returns the current MP as a percentage string.

func (*MP) Reset

func (mp *MP) Reset()

Reset sets the current MP to the maximum MP.

func (*MP) Set

func (mp *MP) Set(value int)

Set sets the current MP to the given value.

func (*MP) String

func (mp *MP) String() string

String returns the current and maximum MP as a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL