# role-methods

> Helper methods for role game calculations.

Latest version **1.0.4** (published 2022-03-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install role-methods
pnpm add role-methods
yarn add role-methods
bun add role-methods
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-03-04 |
| First published | 2022-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ivan Saez Zamora |
| Maintainers | ivsaez |
| Keywords | role, game |

## Links

- npm: https://www.npmjs.com/package/role-methods
- Repository: https://github.com/ivsaez/role-methods
- Homepage: https://github.com/ivsaez/role-methods#readme
- Issues: https://github.com/ivsaez/role-methods/issues
- npm.io page: https://npm.io/package/role-methods

## Recent versions

- 1.0.4 (latest) — 2022-03-04
- 1.0.3 — 2022-03-03
- 1.0.2 — 2022-02-26
- 1.0.1 — 2022-02-23
- 1.0.0 — 2022-02-22

## README

��# Description
This is a simple module with some helper methods related to classic role game calculations.

# Provided methods
## random
Returns an integer value between 0 and the provided value (included).

## randomFromList
Returns a random element from a given list.

## critic
Returns an integer indicating if a critic has happened. To consider a critic it gets a random number between 0 and 100, below 10 is a low critic and avobe 90 is a high critic. The method returns -1 for a low critic, 1 for a high critic and 0 otherwise.

## hit
Returns an integer representing the damage of a hit with the specified attack to an specified defense.

## against
Returns a boolean indicating whether the first value wins a second value in a random check.

## coin
Returns a boolean indicating whether the result is head(true) or tails(false).

## check
Returns a boolean indicating whether a random check against a percentage has succeded or not.

---
_Source: https://npm.io/package/role-methods · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
