gbf-beautify-honors

A CLI tool to help you figure out how to beautify honors in the Guild War event.


Keywords
gbf, grandblue, fantasy, granblue-fantasy
License
MIT
Install
pip install gbf-beautify-honors==0.1.3

Documentation

Granblue Fantasy - Beautify Honors

PyPI - Package Version PyPI - Python Version PyPI - Status PyPI - License

A CLI tool to help you figure out how to beautify honors in the Guild War event. (古戦場の貢献度調整)

Read this in other languages: English, 中文.

sample_result

Table of contents

Prerequisites

Please read at least one of these well-written tutorials to known how to get the exact honors.

System requirements

  • Python 3.7+

How to install

It is recommended to use pipx to install this tool because the application will be installed into an isolated and clean environment.

pipx install gbf-beautify-honors

However, you still can use pip to install this cli.

pip install gbf-beautify-honors

How to use

  1. Solo the NM Bosses until the difference between your current honors and expected honors is roughly greater than one million. An appropriate gap is a good start because there may be a greater chance of finding a good way to achieve the goal.
  2. Run the cli tool in interactive mode or direct mode. Help page is simply shown below:
$ gbf-beautify-honors --help
Usage: gbf-beautify-honors [OPTIONS]

Options:
  --current INTEGER   Your current honors  [required]
  --expected INTEGER  Your expected honors  [required]
  --config PATH       Custom config path
  --help              Show this message and exit.

Interactive mode example

$ gbf-beautify-honors
Your current honors : 1398542611
Your expected honors: 1400000000
Custom config path []:

Direct mode example

gbf-beautify-honors --current=1398542611 --expected=1400000000

Examples

Next, we will use some examples to explain how to use this tool, and how to adjust the configuration file.

Case 1: There is a solution

$ gbf-beautify-honors
Your current honors : 1398542611
Your expected honors: 1400000000
Custom config path []:
╒═══════════════════════════════════════╤═════════╤═════════════════╕
│ Action                                │   Honor │   Optimal Times │
╞═══════════════════════════════════════╪═════════╪═════════════════╡
│ Eyeball VH (0 button)                 │    8000 │               1 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast VH (0 button)              │   21400 │               4 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast EX (0 button)              │   50578 │               3 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast EX+ (0 button)             │   80800 │              10 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast EX+ (1 summon)             │   80810 │               5 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Join raid and only use Break Assassin │       1 │               5 │
╘═══════════════════════════════════════╧═════════╧═════════════════╛

Please note that there may be multiple solutions to the same input and there is currently no guarantee of consistent results. Another possibility is shown below:

$ gbf-beautify-honors
Your current honors : 1398542611
Your expected honors: 1400000000
Custom config path []:
╒═══════════════════════════════════════╤═════════╤═════════════════╕
│ Action                                │   Honor │   Optimal Times │
╞═══════════════════════════════════════╪═════════╪═════════════════╡
│ Eyeball H (0 button)                  │    6000 │               3 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Eyeball VH (0 button)                 │    8000 │               3 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast VH (0 button)              │   21400 │               1 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast EX (0 button)              │   50578 │               2 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast EX+ (0 button)             │   80800 │              13 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Meat Beast EX+ (1 summon)             │   80810 │               3 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Join raid and only use Break Assassin │       1 │               3 │
╘═══════════════════════════════════════╧═════════╧═════════════════╛

Case 2: There is no solution

Basically, there is always a solution because we can join raid and only use Break Assassin to get exactly 1 honor. However, this is usually an unrealistic approach, so the default config makes some constraints on the maximum time on each type of battle. This leads to the fact that sometimes it is not possible to find a solution.

$ gbf-beautify-honors
Your current honors : 1399999900
Your expected honors: 1400000000
Custom config path []:
There is no solution to achieve the expected honors. Please relax the constraints and try again.

To solve this problem, we can use custom config to relax the constraints to find a solution.

  1. Download the example config.json.
  2. Modify the max_acceptable_times of the action "Join raid and only use Break Assassin" to 100.
  3. Re-run the script with custom config.
$ gbf-beautify-honors
Your current honors : 1399999900
Your expected honors: 1400000000
Custom config path []: config.json
╒═══════════════════════════════════════╤═════════╤═════════════════╕
│ Action                                │   Honor │   Optimal Times │
╞═══════════════════════════════════════╪═════════╪═════════════════╡
│ Join raid and only use Break Assassin │       1 │             100 │
╘═══════════════════════════════════════╧═════════╧═════════════════╛

The configuration is flexible and you can try to modify different values in it, re-run the script and see if there is a solution. You can also add self-defined action into the config.json as long as you know you can get the exact honor value from this action, e.g. you can add this object into the actions list,

{
    "name": "Some custom action for demo",
    "honor": 11,
    "max_acceptable_times": 10
}

Re-run the script, it just works!

$ gbf-beautify-honors
Your current honors : 1399999900
Your expected honors: 1400000000
Custom config path []: config.json
╒═══════════════════════════════════════╤═════════╤═════════════════╕
│ Action                                │   Honor │   Optimal Times │
╞═══════════════════════════════════════╪═════════╪═════════════════╡
│ Join raid and only use Break Assassin │       1 │               1 │
├───────────────────────────────────────┼─────────┼─────────────────┤
│ Some custom action for demo           │      11 │               9 │
╘═══════════════════════════════════════╧═════════╧═════════════════╛

How it works

We can formulate this problem as an integer programming problem and solve it using the OR-Tools

Is this case, we use an integer variable hi to represent the exact honor earned from battle i (i can be Eyeball N, Meat Beast EX+, ...). And use another integer variable ni to represent the number of battles we need to fight for the battle i.

We want to get exact honors with minimum number of battles (more efficient), so the corresponding integer programming problem is:

formula

formula

Additionally, we can add additional constraints to the integer variable ni to limit the maximum number of each battle. e.g.,

formula

How to develop

Setup

Use poetry to setup dev environment.

poetry install
poetry shell

Use pre-commit hook to check coding style.

pre-commit install -t commit-msg -t pre-commit