FGO-Automata

一个FGO脚本和API フェイトグランドオーダー自動化

This project is maintained by Meowcolm024

FGO-Automata

GitHub release (latest by date including pre-releases) GitHub issues GitHub pull requests GitHub

FGO-Automata allows you to play Fate/GO just like writting Python Script.

注意FGO-Automata适用于国服和日服的Fate/Grand Order. PS:中文版README

更多相关资料(如演示视频)For other related materials, see Wiki

If you’re playing with other versions of Fate/GO (like TW or US), you may need to remake the template images in /assets

Table of Contents

- [FGO-Automata](#fgo-automata) - [Table of Contents](#table-of-contents) - [Install](#install) - [Setup](#setup) - [Notice](#notice) - [FGO-Automata Script](#fgo-automata-script) - [Usage](#usage) - [Cheatsheet](#cheatsheet) - [References](#references) - [1. Initialization](#1-initialization) - [1. Import package](#1-import-package) - [2. Setup the Class](#2-setup-the-class) - [3. AP related (Optional)](#3-ap-related-optional) - [2. Start battle](#2-start-battle) - [1. Quick Start (Recommended)](#1-quick-start-recommended) - [2. Reset Checkpoint (Optional)](#2-reset-checkpoint-optional) - [3. Reset Support (DEPRECATED)](#3-reset-support-deprecated) - [4. Use Advance Support Selection (Optional)](#4-use-advance-support-selection-optional) - [5. Start Battle (Optional)](#5-start-battle-optional) - [3. During battle](#3-during-battle) - [1. Select cards](#1-select-cards) - [2. Select Servant skills](#2-select-servant-skills) - [3. Select Master skills](#3-select-master-skills) - [4. Select Servant](#4-select-servant) - [5. Change Servants](#5-change-servants) - [4. Finish battle](#4-finish-battle) - [5. Other functions](#5-other-functions) - [1. Wait for a certain scene](#1-wait-for-a-certain-scene) - [2. Tap screen](#2-tap-screen) - [3. Toggle Master Skill](#3-toggle-master-skill) - [4. Update Support List](#4-update-support-list) - [5. Battle ID related](#5-battle-id-related) - [6. Auto Battle](#6-auto-battle) - [7. Reset Ckp/Spt/Sft](#7-reset-ckpsptsft) - [8. Get screenshot](#8-get-screenshot) - [Making Templates](#making-templates) - [JP](#jp) - [Acknowledgements](#acknowledgements) - [TO-DO](#to-do)

Install

Required libs: ADB, PIL, OpenCV, numpy and pytesseract

  1. Clone the repo: git clone https://github.com/Meowcolm024/FGO-Automata.git
  2. Install ADB:
    • macOS: brew cask install android-platform-tools
    • Windows: choco install adb
  3. Install required packages: pip install -r requirements.txt
  4. Install Tesseract (Required by pytesseract)
    • macOS: brew install tesseract
    • Windows: Click here

Setup

There are mainly 4 ways to set up FGO-Automata(as automation script):

You can also use FGO-Automata as an API in your own project, just import the package :)

Notice

When using FGO-Automata as a automation script, notice the following things:

  1. Turn OFF skill confirmation(Quick Cast).
  2. When using config.bat or demon.py, make sure you can pass the Checkpoint within 3 turns.
  3. Recommended: turn ON Speed Up Death Animation and 2x Speed
  4. Resolution requirement: 1920x1080(recommended), or other 1080p screens (shifts setting required)

FGO-Automata Script

Usage

Cheatsheet

``` python # comments start with '#' sft=(248,0) # set shifts ckp="assets/Qp4.png" # reset checkpoint spt="assets/eg-sp1.png" # reset support start # quick start s7 # select servant skill 7 s5t1 # select servant skill 5 target 1 m1 # select master skill 1 m2t3 # select master skill 2 target 3 m3o1t2 # select Order Change: change servant 1 for servant 2 c2 # select card 2 c65 # select card 6, 5 finish # finish battle show # show current setting ```

References

1. Initialization

1. Import package

from core.Automata import Automata

2. Setup the Class

rin = Automata("assets/checkpoint.png", "assets/qp.png")
shiki = Automata("assets/checkpoint.png", "assets/qp.png", sft=(248, 0))
ryougi = Automata("assets/checkpoint.png", "assets/qp.png", sft=(248, 0), apl=(1, "silver"))
# .set_apples(<number of the apples>, <apple type>)
shiki.set_apples(0, "silver")

2. Start battle

# .quick_start(advance=True)
shiki.quick_start()

2. Reset Checkpoint (Optional)

shiki.select_checkpoint("assets/checkpoint2.png") # the argument is optional

3. Reset Support (DEPRECATED)

# start
shiki.select_support("assets/qp2.png") # the argument is optional

About support selection
It will only select the support servant in first page(the first 3 servants) if there isn’t any match, it will automatically select the first support servant by default

4. Use Advance Support Selection (Optional)

rin.advance_support()  # w/o any param
ryougi.advance_support(tms=5)  # update time only
shiki.advance_support(spt="assets/sp3.png", tms=1)

5. Start Battle (Optional)

shiki.start_battle()

3. During battle

1. Select cards

# .select_cards(<list of the desired cards(in order)>)
shiki.select_cards([7])
rin.select_cards([8,6])
ryougi.select_cards([1,2,3])

Notice there are two extra commands to select cards, which are documented in the source code :)

2. Select Servant skills

# skill w/o target
# .select_servant_skill(<id of the skill>)
shiki.select_servant_skill(4)
# with target Servant
# select_servant_skill(<id of the skill>, <id of the target servant>)
ryougi.select_servant_skill(2, 3)
shiki.select_servant_skill2(2, 3)
ryougi.select_servant_skill2(1, 2, 1)
shiki.select_servant_skillM([(1,0)]) # skill 1 w/o target servants
ryougi.select_servant_skill([(2,0), (4,1)]) # skill 2 w/o target and skill 4 w/ target servant 1

3. Select Master skills

# skill w/o target
# .select_master_skill(<id of the skill>)
shiki.select_master_skill(2)
# with target Servant
# .select_master_skill(<id of the skill>, <id of the target servant>)
ryougi.select_master_skill(1, 3)
# Order Change
# .select_master_skill(<id of the skill>, <id of the first servant>, <id of the second servant>)
rin.select_master_skill(3, 1, 1)

4. Select Servant

# .select_servant(<id of the skill>)
shiki.select_servant(1)

5. Change Servants

# .change_servant(<id of the first servant>, <id of the second servant>)
shiki.change_servant(1, 1)

4. Finish battle

# finish
shiki.finish_battle()
ryougi.finish_battle(cont=False)

5. Other functions

1. Wait for a certain scene

shiki.wait("assets/checkpoint.png")

2. Tap screen

shiki.tap((100, 100), 0, 0)

3. Toggle Master Skill

shiki.toggle_master_skill()

4. Update Support List

# .update_support() -> bool
x = shiki.update_support()
# .get_current_battle -> int
x = shiki.get_current_battle()
# .reached_battle(target) -> bool
x = shiki.reached_battle(2)

6. Auto Battle

# use_dynamica(target)
shiki.use_dynamica(2)

The Dynamica will ignore Brave Chain, NP Cards and Skills

7. Reset Ckp/Spt/Sft

shiki.reset_checkpoint("assets/Qp4.png")
shiki.reset_support("assets/eg-sp1.png")
shiki.reset_shifts((0, 0))

8. Get screenshot

# .aquire_screenshot() -> str:
shiki.aquire_screenshot()

Making Templates

Here are two examples of the template:

![checkpoint](/FGO-Automata/assets/eg-ckp.png) ![another checkpoint](assets/Training4.png) - These are templates of _checkpoints_ ![support](/FGO-Automata/assets/eg-sp2.png) ![another support](/FGO-Automata/assets/eg-sp3.png) - These are templates of _supports_

The template image of the support can either be an image of a Craft Essence or a Servant(You don’t need to precisely cut the image like above.).
You can use the filter feature in the game to filter the crafts and use an image of a desired Servant for selection.

Notice that your template should be distinctive.

JP

To use this script for JP version, change the variant IMAGE_BASE in the crds.py file to:

IMAGE_BASE = "assets/jp/"

Acknowledgements

Thanks

TO-DO