Fate-Grand-Order_Lua
Fate-Grand-Order_Lua copied to clipboard
Feature Request: Auto Team Composer
This script has done a very good job of solving the most tedious part of this game, that being doing the same farming quest over and over. For me that now leaves constructing of teams as the most tedious part of the game; looking up the quest, figuring out what servant/ce composition will be able to three turn the quest, then playing out the quest. And if it's a quest I'll repeat many times editing the lua file, transferring it to my phone, testing it to make sure I didn't make any errors, fixing the inevitable errors, then testing again. I have an idea for a feature that could go a long way to help solve these problems, and while the idea is involved I think it's reasonably feasible.
The way I see it working in my head is that you start the script, navigate a menu to select the quest you want to do, the script calculates a team comp, builds it, then plays out the quest with a skill_command generated when the team comp was calculated.
Short list of things needed for building the script:
Database of Quests
Database of Servants
Database of Craft Essences
Database of Mystic Codes
Database of Owned Servants/CEs/Mystic Codes
Database of Enemy Attributes
Images for Image Recognition
The Quest selector:
You start the script and have two options: Pick a new quest, or pick and run from a list of quests you've already generated a team for. You click new quest and now see various options like Main/Free/Daily/Event/Interlude/Strengthen. You click and drill down through the menu until you've selected something like Main -> Babylonia -> Chapter 5 -> Arrow 3. Perhaps the script could remember what you last picked and start you already navigated to the Singularity/Event so you don't have to drill down from the top each time.
The biggest obstacle for this part of the script is a database of All/Most of the quests in the game. I think the best source for this data might be https://fategrandorder.fandom.com/ If you look at the source for a quest page the data is neatly formatted and looks like it would be simple to convert into a lua table.
Example of their formatting:
Arrow 3= {{Questheader |ap = 23 |bond = 1,540 |qp = 156,000 |exp = 50,140 |image = Ur |jpname = 密林の呼び声 |enname = Call of The Jungle }} {{questbody |npcs = {{inum|{{Medusa (Lancer)}}|Lv70, NP4}} |arrow = Arrow 3 |battle1 = Battle 1/3 |en11 = [[Chimera]] |en11stats = Lvl 35 {{Berserker}} 50,967 HP |en12 = [[Chimera]] |en12stats = Lvl 35 {{Berserker}} 50,967 HP |battle2 = Battle 2/3 |en21 = [[Chimera]] |en21stats = Lvl 40 {{Berserker}} 72,730 HP |en22 = [[White Chimera]] |en22stats = Lvl 38 {{Berserker}} 92,162 HP |battle3 = Fatal Battle 3/3 |b3fatalbattle = y |en31 = [[Jaguar Man]] |en31stats = Lvl 80 {{LancerSilver}} 193,050 HP |dropicons = {{Lancer Monument}} {{Talon of Chaos}} }} *'''Call of the Jungle''' ['''''permanent unremovable''''']
**Jaguar Man gains 2 ticks of NP Charge per turn. |
---|
The page https://fategrandorder.fandom.com/wiki/Category:Quests lists every page with quests on it on the wiki. It only displays a few hundred at a time requiring one to advance though several pages, this could make it more difficult to create an automatic scraper. Each page also has several tags such as "Main Quest", "Event", and "Strengthening Quest" that could be very helpful in sorting them, but the tags don't appear in the source for a page itself. Downloading the source for a page is simple, adding "?action=raw" at the end of a link either shows you the raw source or downloads it in a txt. Example: "https://fategrandorder.fandom.com/wiki/Main_Quest:_Babylonia/Part_1?action=raw"
Quests have both the English and Japanese names, if the selector displayed both than even non-Japanese readers can just compare the symbols and know they're selecting the right quest. If a quest had addition notes like in the example the script could throw a warning and display the notes before asking the user whether they want to continue or play the quest manually if the complication would stop the script from being able to beat the quest.
I would not be surprised if there was a more elegant way to get lists of pages and their tags in from the wiki, which would make that part easier. Perhaps the script could even parse a link to a wiki quest page internally, meaning users wouldn't have to wait for the quest database to be updated when new content drops.
The Team generator:
So this part takes the quest details from the last part and your own personal list of available servants, CEs, and mystic codes and generates a team that the script can Autoskill the quest with. At the very simplest it could list every possible combination that could cast three consecutive NPs test if they could beat the waves and choose the one that uses the fewest undesirable resources. You could tag things like a LV. 10 Combat Uniform or a Bond 10 servant as last resort resources to minimize wasted exp. The hardest part of this is testing if an NP will kill a wave, I've thought of two ways of possibly doing this, a 'best' way and 'maybe good enough' way.
Best Way: Uses the Damage Formula (Details here: http://blogs.nrvnqsr.com/entry.php/3309-How-is-damage-calculated) to calculate damage to the enemy wave. This would require a database of servant skills. This would be quite powerful, able to factor in teamwide buffs over several turns and be much more accurate. I don't know of any database of skills that could be interpreted by a program. Perhaps the language on either https://fategrandorder.fandom.com/ or https://fgo.wiki/ is consistent enough that it would be not too tedious to manually make a table. In addition to buffs from active skills the following data would be needed; Servant's attack, servant's class, enemy's class, servant's attribute, enemy's attribute, servant's NP damage multiplier, NP's card type, NP AOE or Single Target, buffs from passive skills, buffs from CEs, buffs from mystic code skills, and cost in party.
Maybe Good Enough Way: Use the numbers from: https://docs.google.com/spreadsheets/d/1Wc80dpN8-OwH_wf-wrV5zb79d4Smy-WQxkIP1YABPE8 These numbers wouldn't factor in any buffs and assume max skills and all strenthenings. Calculates against enemy wave class/attributes. Some minor adjustments could be calculated by reverse engineering the number and trying to factor in buffs, but it would have some inaccuracy. Perhaps the most common buffs like Waver's attack buff and the most common CE's could be accounted for. One problem is that the doc is based off of current JP information, any strengthenings in the last two years would provide a number that would not be applicable to the NA server. If the doc has version history going back two years we could maybe just grab the old data.
Here is a Lua table of servant stats. Currently it has: English Name, Japanese Name, Class, Attribute, Cost, Max Attack (Max ascension, no Fous), NP Card Type, NP Single Target or AOE, Buffs from passive skills, NP Damage multiplier (both upgraded and non-upgraded), and NP Damage from the NP damage comparison google doc. It's all organized by servant ID, there's a bit of code at the end showing how it can be used. It doesn't have everything that could possibly be useful for this project, but it should be a decent starting point.
The Team assembler:
Takes the generated team and builds it.
Each servant page on https://fategrandorder.fandom.com/ has all the servant's icons that could be used for image recognition. That might not even be necessary though, if the user accurately provided data of every servant they have the script should be able to pick the desired servant just by knowing where it should be in the sort order. CE's might be more troublesome, perhaps working the same way but only working on favorites ones, or with image recognition of the important ones. There are icons of the CE's on the wiki as well. Mystic codes would probably require image recognition.
People could provide a list of servants and CE's to prioritize when filling and empty slots. For events it would theoretically be possible to see what event currency drops and pick the appropriate CE's, but it seems that it could be difficult to implement. Instead the script could pop up a window saying what drops should be expected and then pause to allow manual selection.
The script then plays out the quest with auto skill. Perhaps when selecting the quest the script could ask if you only want the quest played once, or whether you want it played several times, and if it should use apples. Perhaps it could even be smart enough to only ask if its a free quest.
This is a fairly complicated proposition, but I think its definitely feasible and would help save enormous amounts of time. This project might even be within my own skill level to create, but I thought I might as well post this here first to see if anyone's interested who could write it much cleaner and in a fraction of the time it would take me.
Would it be possible to get a screenshot of the buster, arts, and quick cards as well as the noble phantasms of each servant? Also, can it be set up so that the enemy matchups would be similar to the one the game uses?