public void PerformBattle() { AutomataApi.UseSameSnapIn(OnTurnStarted); AutomataApi.Wait(2); var wereNpsClicked = false; if (Preferences.Instance.EnableAutoSkill) { wereNpsClicked = AutoSkill.Execute(); AutoSkill.ResetNpTimer(); } if (!HasClickedAttack) { ClickAttack(); } if (Card.CanClickNpCards) { // We shouldn't do the long wait due to NP spam/danger modes // They click on NPs even when not charged // So, don't assign wereNpsClicked here Card.ClickNpCards(); } Card.ClickCommandCards(5); Card.ResetCommandCards(); AutomataApi.Wait(wereNpsClicked ? 25 : 5); }
public void PerformBattle() { AutomataApi.UseSameSnapIn(OnTurnStarted); AutomataApi.Wait(2); var NpsClicked = false; if (Preferences.Instance.EnableAutoSkill) { NpsClicked = AutoSkill.Execute(); AutoSkill.ResetNpTimer(); } if (!HasClickedAttack) { ClickAttack(); } if (Card.CanClickNpCards) { NpsClicked = Card.ClickNpCards(); } Card.ClickCommandCards(5); if (Preferences.Instance.UnstableFastSkipDeadAnimation) { SkipDeathAnimation(); } Card.ResetCommandCards(); AutomataApi.Wait(NpsClicked ? 25 : 5); }
// Click begin quest in Formation selection, then select boost item, if applicable, then confirm selection. void StartQuest() { Game.MenuStartQuestClick.Click(); AutomataApi.Wait(2); var boostItem = Preferences.Instance.BoostItemSelectionMode; if (boostItem >= 0) { Game.MenuBoostItemClickArray[boostItem].Click(); // in case you run out of items Game.MenuBoostItemSkipClick.Click(); } if (Preferences.Instance.StorySkip) { AutomataApi.Wait(10); if (Game.MenuStorySkipRegion.Exists(ImageLocator.StorySkip)) { Game.MenuStorySkipClick.Click(); AutomataApi.Wait(0.5); Game.MenuStorySkipYesClick.Click(); } } }
void SkipDeathAnimation() { // https://github.com/29988122/Fate-Grand-Order_Lua/issues/55 Experimental for (var i = 0; i < 3; ++i) { Game.BattleSkipDeathAnimationClick.Click(); AutomataApi.Wait(1); } }
void ChooseTarget(int Index) { Game.BattleTargetClickArray[Index].Click(); AutomataApi.Wait(0.5); Game.BattleExtrainfoWindowCloseClick.Click(); HasChoosenTarget = true; }
void Reset() { ResetClick.Click(); AutomataApi.Wait(0.5); ResetConfirmationClick.Click(); AutomataApi.Wait(3); ResetCloseClick.Click(); AutomataApi.Wait(2); }
void SelectSkillTarget(Location Location) { Location.Click(); AutomataApi.Wait(0.5); // Exit any extra menu Game.BattleExtrainfoWindowCloseClick.Click(); WaitForAnimationToFinish(); }
void SelectEnemyTarget(Location Location) { Location.Click(); AutomataApi.Wait(0.5); // Exit any extra menu Game.BattleExtrainfoWindowCloseClick.Click(); ChangeArray(_defaultFunctionArray); }
public void ClickAttack() { Game.BattleAttackClick.Click(); // Although it seems slow, make it no shorter than 1 sec to protect user with less processing power devices. AutomataApi.Wait(1.5); HasClickedAttack = true; Card.ReadCommandCards(); }
public void Click(Location Location) { const int duration = 50; var swipePath = new Path(); swipePath.MoveTo(Location.X, Location.Y); PerformGesture(new GestureDescription.StrokeDescription(swipePath, 0, duration)); AutomataApi.Wait(clickWaitTime); }
void PreloadNp() { if (!Battle.HasClickedAttack) { Battle.ClickAttack(); // There is a delay after clicking attack before NP Cards come up. DON'T DELETE! AutomataApi.Wait(2); } ChangeArray(_cardsPressed); }
public void Swipe(Location Start, Location End) { var swipePath = new Path(); swipePath.MoveTo(Start.X, Start.Y); swipePath.LineTo(End.X, End.Y); var swipeStroke = new GestureDescription.StrokeDescription(swipePath, 0, GestureTimings.SwipeDurationMs); PerformGesture(swipeStroke); AutomataApi.Wait(GestureTimings.SwipeWaitTimeSec); }
public void ContinueClick(Location Location, int Times) { while (Times-- > 0) { var swipePath = new Path(); swipePath.MoveTo(Location.X, Location.Y); var stroke = new GestureDescription.StrokeDescription(swipePath, GestureTimings.ClickDelayMs, GestureTimings.ClickDurationMs); PerformGesture(stroke); } AutomataApi.Wait(GestureTimings.ClickWaitTimeSec); }
void BeginOrderChange() { OpenMasterSkillMenu(); Game.BattleMasterSkill3Click.Click(); if (Preferences.Instance.SkillConfirmation) { Game.BattleSkillOkClick.Click(); } AutomataApi.Wait(0.3); ChangeArray(_startingMemberFunctionArray); }
public void ContinueClick(Location Location, int Times) { const int clickTime = 50; const int clickDelay = 10; while (Times-- > 0) { var swipePath = new Path(); swipePath.MoveTo(Location.X, Location.Y); var stroke = new GestureDescription.StrokeDescription(swipePath, clickDelay, clickTime); PerformGesture(stroke); } AutomataApi.Wait(clickWaitTime); }
// Selections Support option void Support() { // Friend selection var hasSelectedSupport = _support.SelectSupport(Preferences.Instance.Support.SelectionMode); if (hasSelectedSupport && !_isContinuing) { AutomataApi.Wait(4); StartQuest(); // Wait timer till battle starts. // Uses less battery to wait than to search for images for a few seconds. // Adjust according to device. AutomataApi.Wait(10); } }
public void Scroll(Location Start, Location End) { const int swipeDuration = 300; var swipePath = new Path(); swipePath.MoveTo(Start.X, Start.Y); swipePath.LineTo(End.X, End.Y); var swipeStroke = new GestureDescription.StrokeDescription(swipePath, 0, swipeDuration); PerformGesture(swipeStroke); const double scrollWaitTime = 0.7; AutomataApi.Wait(scrollWaitTime); }
protected override void Script() { Scaling.Init(); new Location(1400, 1120).Click(); new Location(1600, 1120).Click(); while (true) { new Location(1600, 1420).Click(); new Location(1600, 1120).Click(); AutomataApi.Wait(3); AutomataApi.ContinueClick(new Location(1600, 1300), 15); AutomataApi.Wait(0.5); } }
void SelectSubMemeber(Location Location) { Location.Click(); AutomataApi.Wait(0.3); Game.BattleOrderChangeOkClick.Click(); // Extra wait to allow order change dialog to close AutomataApi.Wait(1); WaitForAnimationToFinish(15); // Extra wait for the lag introduced by Order change AutomataApi.Wait(1); ChangeArray(_defaultFunctionArray); }
void Withdraw() { if (!Preferences.Instance.WithdrawEnabled) { throw new ScriptExitException("All servants have been defeated and auto-withdrawing is disabled."); } Game.WithdrawRegion.Click(); AutomataApi.Wait(0.5); // Click the "Accept" button after choosing to withdraw Game.WithdrawAcceptClick.Click(); AutomataApi.Wait(1); // Click the "Close" button after accepting the withdrawal Game.StaminaBronzeClick.Click(); }
void RefillStamina() { if (Preferences.Instance.Refill.Enabled && _stonesUsed < Preferences.Instance.Refill.Repetitions) { switch (Preferences.Instance.Refill.Resource) { case RefillResource.SQ: Game.StaminaSqClick.Click(); break; case RefillResource.AllApples: Game.StaminaBronzeClick.Click(); Game.StaminaSilverClick.Click(); Game.StaminaGoldClick.Click(); break; case RefillResource.Gold: Game.StaminaGoldClick.Click(); break; case RefillResource.Silver: Game.StaminaSilverClick.Click(); break; case RefillResource.Bronze: Game.StaminaBronzeClick.Click(); break; } AutomataApi.Wait(1); Game.StaminaOkClick.Click(); ++_stonesUsed; AutomataApi.Wait(3); } else { throw new ScriptExitException("AP ran out!"); } }
void CastNoblePhantasm(Location Location) { if (!Battle.HasClickedAttack) { Battle.ClickAttack(); // There is a delay after clicking attack before NP Cards come up. DON'T DELETE! AutomataApi.Wait(2); } /* * Embed the PreloadNP Feature in this function to as a prerequisite for chaining to be viable. * * Problem with Chaining (as of right now). PreloadNP feature clicks cards prior to knowing what NPs are being clicked. * * If the NP was known (in this function for instance) then the script can register the face of the NP user first, * then use that face to determine what cards to select in PreloadNP. */ Location.Click(); NpsClicked = true; }
// Reset battle state, then click quest and refill stamina if needed. void Menu() { _battle.ResetState(); if (Preferences.Instance.Refill.Enabled) { var refillRepetitions = Preferences.Instance.Refill.Repetitions; if (refillRepetitions > 0) { AutomataApi.Toast($"{_stonesUsed} refills used out of {refillRepetitions}"); } } // Click uppermost quest Game.MenuSelectQuestClick.Click(); AutomataApi.Wait(1.5); // Auto refill while (Game.StaminaScreenRegion.Exists(ImageLocator.Stamina)) { RefillStamina(); } }
void OpenMasterSkillMenu() { Game.BattleMasterSkillOpenClick.Click(); AutomataApi.Wait(0.5); }
// Click through reward screen, continue if option presents itself, otherwise continue clicking through void Result() { // Validator document https://github.com/29988122/Fate-Grand-Order_Lua/wiki/In-Game-Result-Screen-Flow for detail. AutomataApi.ContinueClick(Game.ResultNextClick, 55); // Checking if there was a Bond CE reward if (Game.ResultCeRewardRegion.Exists(ImageLocator.Bond10Reward)) { if (Preferences.Instance.StopAfterBond10) { throw new ScriptExitException("Bond 10 CE GET!"); } Game.ResultCeRewardCloseClick.Click(); // Still need to proceed through reward screen. AutomataApi.ContinueClick(Game.ResultNextClick, 35); } AutomataApi.Wait(5); // Friend request dialogue. Appears when non-friend support was selected this battle. Ofc it's defaulted not sending request. if (Game.ResultFriendRequestRegion.Exists(ImageLocator.FriendRequest)) { Game.ResultFriendRequestRejectClick.Click(); } AutomataApi.Wait(1); // Only for JP currently. Searches for the Continue option after select Free Quests if (Preferences.Instance.GameServer == GameServer.Jp && Game.ContinueRegion.Exists(ImageLocator.Confirm)) { // Needed to show we don't need to enter the "StartQuest" function _isContinuing = true; // Pressing Continue option after completing a quest, reseting the state as would occur in "Menu" function Game.ContinueClick.Click(); _battle.ResetState(); AutomataApi.Wait(1.5); // If Stamina is empty, follow same protocol as is in "Menu" function Auto refill. while (Game.StaminaScreenRegion.Exists(ImageLocator.Stamina)) { RefillStamina(); } return; } // Post-battle story is sometimes there. if (Preferences.Instance.StorySkip) { if (Game.MenuStorySkipRegion.Exists(ImageLocator.StorySkip)) { Game.MenuStorySkipClick.Click(); AutomataApi.Wait(0.5); Game.MenuStorySkipYesClick.Click(); } } AutomataApi.Wait(10); // Quest Completion reward. Exits the screen when it is presented. if (Game.ResultCeRewardRegion.Exists(ImageLocator.Bond10Reward)) { Game.ResultCeRewardCloseClick.Click(); AutomataApi.Wait(1); Game.ResultCeRewardCloseClick.Click(); } AutomataApi.Wait(5); // 1st time quest reward screen, eg. Mana Prisms, Event CE, Materials, etc. if (Game.ResultQuestRewardRegion.Exists(ImageLocator.QuestReward)) { AutomataApi.Wait(1); Game.ResultNextClick.Click(); } }