manabase


Namemanabase JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/Aphosis/manabase
SummaryManabase generator for all your Magic: The Gathering needs.
upload_time2020-11-21 20:04:06
maintainer
docs_urlNone
authorAphosis
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # manabase

Landing rock solid mana bases for your decks.

Manabase is a command-line tool that helps you generate a mana base for your
Magic: The Gathering decks.

It uses [scryfall](https://scryfall.com/) as its source of truth to find suitable
lands and mana rocks for your colors.

Note: Manabase comes pre-configured for Commander decks, but is fully customizable.

## Installation

Manabase is available on [PyPI](https://pypi.org/project/manabase/)
Install manabase using `pip`:

```bash
pip install --user manabase
```

# Quickstart

To generate a new manabase with default settings, run the following command:

```bash
manabase generate WUB
```

This will output a manabase of 37 unique lands for a white, blue and black deck.

## Usage

Manabase offers a primary command, `manabase`, that generates a list of lands and
optionally rocks for a set of colors.

### Colors

Colors must be specified in the command, and are expressed as a string of letters.

Each color has one unique letter assigned:

- White: `W`
- Blue: `U`
- Black: `B`
- Red: `R`
- Green: `G`

So if you wanted to generate a red and green manabase, you would use the command
`manabase generate RG`.

### Filters

Manabase includes a set of powerful filters, defining which type of lands and rocks are
allowed in the output list.

These type of cards are called cycles, and are defined by MTG Gamepedia for both
[lands](https://mtg.gamepedia.com/Dual_land) and [rocks](https://mtg.gamepedia.com/Mana_stone)

Following is a list of supported cycles, and the name of the corresponding
filter.

Lands:

- [`battle`](https://mtg.gamepedia.com/Battle_land): Battle for Zendikar dual lands.
- [`bond`](https://mtg.gamepedia.com/Bond_land): Battlebond and Commander Legends crowd lands.
- [`bounce`](https://mtg.gamepedia.com/Bounce_land): Ravnica bounce lands.
- [`check`](https://mtg.gamepedia.com/Check_land): Ixalan and Innistrad check lands.
- [`cycling`](https://mtg.gamepedia.com/Cycling_land#Dual-colored_Cycling_Lands):
  Amonkhet cycling lands.
- [`fast`](https://mtg.gamepedia.com/Fast_land): Mirrodin and Kaladesh fast lands.
- [`fetch`](https://mtg.gamepedia.com/Fetch_land): Onslaught and Zendikar fetch lands.
- [`filter`](https://mtg.gamepedia.com/Filter_land): Odyssey and Future Sight filter lands.
- [`horizon`](https://mtg.gamepedia.com/Horizon_land): Future Sight and Modern Horizons horizon lands.
- [`original`](https://mtg.gamepedia.com/Dual_land#Original_dual_lands):
  The original dual lands.
- [`pain`](https://mtg.gamepedia.com/Pain_land): Ice Age and Apocalypse pain lands.
- [`reveal`](https://mtg.gamepedia.com/Reveal_land): Innistrad reveal lands.
- [`scry`](https://mtg.gamepedia.com/Scry_land): Theros and M21 scry lands.
- [`shock`](https://mtg.gamepedia.com/Shock_land): Ravnica shock lands.

Rocks:

- `banner`: Khans of Tarkir banners.
- `cluestone`: Ravnica clue stones.
- `crystal`: Ikoria crystals.
- `locket`: Ravnica lockets.
- `obelisk`: Alara obelisks.
- `signet`: Ravnica signets.
- `talisman`: Mirrodin talismans.

Additionally, two color-related filters are provided:

These are:

- `producer`: This filter checks if the card produces mana of the given colors.
- `reference`: This filter checks if a reference to a land type of the given
  colors is contained in the card text.

Without these filters, all colors could be matched.

Examples:

`fetch` will accept all fetch lands.
`producer` will accept all cards that can produce your colors.

### Operators

Filters can be combined using four operators:

- `&`: Accepts only cards matching both filters.
- `|`: Accepts cards matching either filter.
- `^`: Accepts cards matching one filter or the other, but not both.
- `~`: Inverts the following filter results.

Moreover, you can group operators and filters using parenthesis to
control operator precedence.

Examples:

- `reference & fetch` would match only fetch lands respecting your colors.
- `(producer & original) | (reference & fetch)` would match either original
  dual lands producing your colors, or fetch lands of your colors.

### Filter arguments

Finally, some filters can take arguments to control their behavior.

`producer` and `reference` each take `exclusive` and `minimum_count` arguments.

`exclusive`, which is true by default, prevents cards matching colors other than
yours. For example, if you asked for white and blue, a white and red producer would
be excluded, because it contains red.

`minimum_count` sets the number of colors a card should match, among your colors,
before being accepted. By default this is 2, which means cards have to produce
or reference at least two of your colors to be accepted.

This filters can help you define a better behavior, for example for fetch lands
it makes sense to disable the `exclusive` argument and set the `minimum_count`
to 1, so that all fetch lands matching at least one of your colors are included.

To override arguments, specify your argument values in the right order, between
curly braces, separated by commas.

Examples:

- `producer { 0, 3 }` would match all cards producing at least three of your
  colors, without excluding other colors.
- `reference { 0, 1 } & fetch` would match fetch lands producing at least one
  of your colors, without excluding other colors.

### Commands

In the following examples, we are using the `manabase` command to generate
a set of lands for a white, blue and black deck.

Generate a set of lands using default settings:

```bash
manabase generate WUB
```

Generate a set of 23 maximum lands, with 4 occurrence of each land:

```bash
manabase generate --lands=23 --occurrences=4 WUB
```

Generate a list of only fetch lands and original dual lands.

```bash
manabase generate --filters="(producer & original) | (reference & fetch)" WUB
```

### Land Fillers

If Manabase cannot find as many lands as you asked for, it will begin filling
the list with basic lands.

You have the option to specify weights to refine the distribution of these basic
lands.

By default, the same amount of each basic land will be added.

If your mana costs are heavier in one color for example, you might want to add
more of one basic land than the others.

The following command will generate a manabase including more Plains than
Island or Swamp cards.

```bash
manabase generate --filler-weights="4 1 1" WUB
```

The number of weights must match the number of colors, and express a ratio
between the basic land distribution.

In our case, a two thirds of all basic lands should be plains, will the last
third will be equally Island and Swamp cards.

### Presets

Specifying command-line arguments can be a bit cumbersome, especially for the
`--filters` option.

A generation preset allows you to specify any **options** the `generate` command
takes in, and apply them automatically.

For the following sections, it is assumed the preset name is `default`.

#### Creating a preset

To create a new preset, use the `manabase presets new` command, with a name for
the new preset and any option the `generate` command can take.

```bash
manabase presets new default --filters="(producer & (original | shock)) | (reference & fetch)" --lands=37 --occurrences=1
```

#### Selecting the active preset

The active preset is the one used automatically when using the
`generate` command.

You can activate an existing preset with the following command.

```bash
manabase presets use default
```

Note: when you create a new preset, it is automatically activated
for you.

#### Printing the active preset

You can print the active preset with the following command.

```bash
manabase presets active
```

#### Listing existing presets

You can list existing preset names with the following command.

```bash
manabase presets list
```

#### Printing a preset

To print a preset content to the terminal, use the following command.

```bash
manabase presets show default
```

#### Updating a preset

Updating a preset replaces all its options with new ones.

If you meant to add a new option, or update a single option, use the `patch` subcommand.

```bash
manabase presets update default --lands=35
```

#### Patching a preset

Patching a preset adds a new option or updates an existing one.

```bash
manabase presets patch default --occurrences=4
```

#### Deleting a preset

Deleting a presets erases its file from disk.

```bash
manabase presets delete default
```

## Contributing

This package uses [`poetry`](https://python-poetry.org/) to manage its
dependencies.

### Installing

[Install poetry](https://python-poetry.org/docs/#installation).

Clone this repository:

```bash
git clone https://github.com/Aphosis/manabase
cd manabase
```

Install manabase for development:

```bash
poetry install
```

### Tests

Tests are written using [pytest](https://docs.pytest.org/en/stable/).

Once `manabase` has been installed, you can run tests to check if your
changes did not introduce regressions.

To run the test suite, `cd` into the `manabase` folder, then run:

```bash
pytest
```

Pytest is configured in `pyproject.toml`, you do not need to specify any
extra arguments.

## License

This tool is licensed under MIT.

## Non affiliation disclaimer

Manabase is not affiliated, associated, authorized, endorsed by, or in any way
officially connected with Wizards of the Coast, or any of its subsidiaries or
its affiliates.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Aphosis/manabase",
    "name": "manabase",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Aphosis",
    "author_email": "aphosis.github@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/66/b9/9fd6016d65cb1ca87c144228ba3a91b826cbf7f60a49d535bccb7bf732f6/manabase-0.3.1.tar.gz",
    "platform": "",
    "description": "# manabase\n\nLanding rock solid mana bases for your decks.\n\nManabase is a command-line tool that helps you generate a mana base for your\nMagic: The Gathering decks.\n\nIt uses [scryfall](https://scryfall.com/) as its source of truth to find suitable\nlands and mana rocks for your colors.\n\nNote: Manabase comes pre-configured for Commander decks, but is fully customizable.\n\n## Installation\n\nManabase is available on [PyPI](https://pypi.org/project/manabase/)\nInstall manabase using `pip`:\n\n```bash\npip install --user manabase\n```\n\n# Quickstart\n\nTo generate a new manabase with default settings, run the following command:\n\n```bash\nmanabase generate WUB\n```\n\nThis will output a manabase of 37 unique lands for a white, blue and black deck.\n\n## Usage\n\nManabase offers a primary command, `manabase`, that generates a list of lands and\noptionally rocks for a set of colors.\n\n### Colors\n\nColors must be specified in the command, and are expressed as a string of letters.\n\nEach color has one unique letter assigned:\n\n- White: `W`\n- Blue: `U`\n- Black: `B`\n- Red: `R`\n- Green: `G`\n\nSo if you wanted to generate a red and green manabase, you would use the command\n`manabase generate RG`.\n\n### Filters\n\nManabase includes a set of powerful filters, defining which type of lands and rocks are\nallowed in the output list.\n\nThese type of cards are called cycles, and are defined by MTG Gamepedia for both\n[lands](https://mtg.gamepedia.com/Dual_land) and [rocks](https://mtg.gamepedia.com/Mana_stone)\n\nFollowing is a list of supported cycles, and the name of the corresponding\nfilter.\n\nLands:\n\n- [`battle`](https://mtg.gamepedia.com/Battle_land): Battle for Zendikar dual lands.\n- [`bond`](https://mtg.gamepedia.com/Bond_land): Battlebond and Commander Legends crowd lands.\n- [`bounce`](https://mtg.gamepedia.com/Bounce_land): Ravnica bounce lands.\n- [`check`](https://mtg.gamepedia.com/Check_land): Ixalan and Innistrad check lands.\n- [`cycling`](https://mtg.gamepedia.com/Cycling_land#Dual-colored_Cycling_Lands):\n  Amonkhet cycling lands.\n- [`fast`](https://mtg.gamepedia.com/Fast_land): Mirrodin and Kaladesh fast lands.\n- [`fetch`](https://mtg.gamepedia.com/Fetch_land): Onslaught and Zendikar fetch lands.\n- [`filter`](https://mtg.gamepedia.com/Filter_land): Odyssey and Future Sight filter lands.\n- [`horizon`](https://mtg.gamepedia.com/Horizon_land): Future Sight and Modern Horizons horizon lands.\n- [`original`](https://mtg.gamepedia.com/Dual_land#Original_dual_lands):\n  The original dual lands.\n- [`pain`](https://mtg.gamepedia.com/Pain_land): Ice Age and Apocalypse pain lands.\n- [`reveal`](https://mtg.gamepedia.com/Reveal_land): Innistrad reveal lands.\n- [`scry`](https://mtg.gamepedia.com/Scry_land): Theros and M21 scry lands.\n- [`shock`](https://mtg.gamepedia.com/Shock_land): Ravnica shock lands.\n\nRocks:\n\n- `banner`: Khans of Tarkir banners.\n- `cluestone`: Ravnica clue stones.\n- `crystal`: Ikoria crystals.\n- `locket`: Ravnica lockets.\n- `obelisk`: Alara obelisks.\n- `signet`: Ravnica signets.\n- `talisman`: Mirrodin talismans.\n\nAdditionally, two color-related filters are provided:\n\nThese are:\n\n- `producer`: This filter checks if the card produces mana of the given colors.\n- `reference`: This filter checks if a reference to a land type of the given\n  colors is contained in the card text.\n\nWithout these filters, all colors could be matched.\n\nExamples:\n\n`fetch` will accept all fetch lands.\n`producer` will accept all cards that can produce your colors.\n\n### Operators\n\nFilters can be combined using four operators:\n\n- `&`: Accepts only cards matching both filters.\n- `|`: Accepts cards matching either filter.\n- `^`: Accepts cards matching one filter or the other, but not both.\n- `~`: Inverts the following filter results.\n\nMoreover, you can group operators and filters using parenthesis to\ncontrol operator precedence.\n\nExamples:\n\n- `reference & fetch` would match only fetch lands respecting your colors.\n- `(producer & original) | (reference & fetch)` would match either original\n  dual lands producing your colors, or fetch lands of your colors.\n\n### Filter arguments\n\nFinally, some filters can take arguments to control their behavior.\n\n`producer` and `reference` each take `exclusive` and `minimum_count` arguments.\n\n`exclusive`, which is true by default, prevents cards matching colors other than\nyours. For example, if you asked for white and blue, a white and red producer would\nbe excluded, because it contains red.\n\n`minimum_count` sets the number of colors a card should match, among your colors,\nbefore being accepted. By default this is 2, which means cards have to produce\nor reference at least two of your colors to be accepted.\n\nThis filters can help you define a better behavior, for example for fetch lands\nit makes sense to disable the `exclusive` argument and set the `minimum_count`\nto 1, so that all fetch lands matching at least one of your colors are included.\n\nTo override arguments, specify your argument values in the right order, between\ncurly braces, separated by commas.\n\nExamples:\n\n- `producer { 0, 3 }` would match all cards producing at least three of your\n  colors, without excluding other colors.\n- `reference { 0, 1 } & fetch` would match fetch lands producing at least one\n  of your colors, without excluding other colors.\n\n### Commands\n\nIn the following examples, we are using the `manabase` command to generate\na set of lands for a white, blue and black deck.\n\nGenerate a set of lands using default settings:\n\n```bash\nmanabase generate WUB\n```\n\nGenerate a set of 23 maximum lands, with 4 occurrence of each land:\n\n```bash\nmanabase generate --lands=23 --occurrences=4 WUB\n```\n\nGenerate a list of only fetch lands and original dual lands.\n\n```bash\nmanabase generate --filters=\"(producer & original) | (reference & fetch)\" WUB\n```\n\n### Land Fillers\n\nIf Manabase cannot find as many lands as you asked for, it will begin filling\nthe list with basic lands.\n\nYou have the option to specify weights to refine the distribution of these basic\nlands.\n\nBy default, the same amount of each basic land will be added.\n\nIf your mana costs are heavier in one color for example, you might want to add\nmore of one basic land than the others.\n\nThe following command will generate a manabase including more Plains than\nIsland or Swamp cards.\n\n```bash\nmanabase generate --filler-weights=\"4 1 1\" WUB\n```\n\nThe number of weights must match the number of colors, and express a ratio\nbetween the basic land distribution.\n\nIn our case, a two thirds of all basic lands should be plains, will the last\nthird will be equally Island and Swamp cards.\n\n### Presets\n\nSpecifying command-line arguments can be a bit cumbersome, especially for the\n`--filters` option.\n\nA generation preset allows you to specify any **options** the `generate` command\ntakes in, and apply them automatically.\n\nFor the following sections, it is assumed the preset name is `default`.\n\n#### Creating a preset\n\nTo create a new preset, use the `manabase presets new` command, with a name for\nthe new preset and any option the `generate` command can take.\n\n```bash\nmanabase presets new default --filters=\"(producer & (original | shock)) | (reference & fetch)\" --lands=37 --occurrences=1\n```\n\n#### Selecting the active preset\n\nThe active preset is the one used automatically when using the\n`generate` command.\n\nYou can activate an existing preset with the following command.\n\n```bash\nmanabase presets use default\n```\n\nNote: when you create a new preset, it is automatically activated\nfor you.\n\n#### Printing the active preset\n\nYou can print the active preset with the following command.\n\n```bash\nmanabase presets active\n```\n\n#### Listing existing presets\n\nYou can list existing preset names with the following command.\n\n```bash\nmanabase presets list\n```\n\n#### Printing a preset\n\nTo print a preset content to the terminal, use the following command.\n\n```bash\nmanabase presets show default\n```\n\n#### Updating a preset\n\nUpdating a preset replaces all its options with new ones.\n\nIf you meant to add a new option, or update a single option, use the `patch` subcommand.\n\n```bash\nmanabase presets update default --lands=35\n```\n\n#### Patching a preset\n\nPatching a preset adds a new option or updates an existing one.\n\n```bash\nmanabase presets patch default --occurrences=4\n```\n\n#### Deleting a preset\n\nDeleting a presets erases its file from disk.\n\n```bash\nmanabase presets delete default\n```\n\n## Contributing\n\nThis package uses [`poetry`](https://python-poetry.org/) to manage its\ndependencies.\n\n### Installing\n\n[Install poetry](https://python-poetry.org/docs/#installation).\n\nClone this repository:\n\n```bash\ngit clone https://github.com/Aphosis/manabase\ncd manabase\n```\n\nInstall manabase for development:\n\n```bash\npoetry install\n```\n\n### Tests\n\nTests are written using [pytest](https://docs.pytest.org/en/stable/).\n\nOnce `manabase` has been installed, you can run tests to check if your\nchanges did not introduce regressions.\n\nTo run the test suite, `cd` into the `manabase` folder, then run:\n\n```bash\npytest\n```\n\nPytest is configured in `pyproject.toml`, you do not need to specify any\nextra arguments.\n\n## License\n\nThis tool is licensed under MIT.\n\n## Non affiliation disclaimer\n\nManabase is not affiliated, associated, authorized, endorsed by, or in any way\nofficially connected with Wizards of the Coast, or any of its subsidiaries or\nits affiliates.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Manabase generator for all your Magic: The Gathering needs.",
    "version": "0.3.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "a4c39507f23915562bf8c06db19c93c4",
                "sha256": "5325fd1d0cac1d71cbc2e854b3b7955167dcd34206be723ecc992abf21629fa3"
            },
            "downloads": -1,
            "filename": "manabase-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4c39507f23915562bf8c06db19c93c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 39420,
            "upload_time": "2020-11-21T20:04:05",
            "upload_time_iso_8601": "2020-11-21T20:04:05.047935Z",
            "url": "https://files.pythonhosted.org/packages/49/b8/bcca1ee2d5476a430ed0bc4c347886873b39d3604b132e292078a0ed7825/manabase-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "5c1ca1074e2ff773a997dbee1b221aa8",
                "sha256": "4ca2dfd0a2147a7c0e9ce5e3794842550d3f948e0cb9767c43ad8e3ba211c5b2"
            },
            "downloads": -1,
            "filename": "manabase-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5c1ca1074e2ff773a997dbee1b221aa8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 28744,
            "upload_time": "2020-11-21T20:04:06",
            "upload_time_iso_8601": "2020-11-21T20:04:06.688271Z",
            "url": "https://files.pythonhosted.org/packages/66/b9/9fd6016d65cb1ca87c144228ba3a91b826cbf7f60a49d535bccb7bf732f6/manabase-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-21 20:04:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "Aphosis",
    "error": "Could not fetch GitHub repository",
    "lcname": "manabase"
}
        
Elapsed time: 0.17655s