1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00
This commit is contained in:
Laserlicht 2024-01-27 01:16:55 +01:00 committed by GitHub
parent e8c541f873
commit a2fd5039ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 52 additions and 5 deletions

View File

@ -171,8 +171,10 @@
"vcmi.battleOptions.showStickyHeroInfoWindows.hover": "Show heroes statistics windows",
"vcmi.battleOptions.showStickyHeroInfoWindows.help": "{Show heroes statistics windows}\n\nPermanently toggle on heroes statistics windows that show primary stats and spell points.",
"vcmi.battleOptions.skipBattleIntroMusic.hover": "Skip Intro Music",
"vcmi.battleOptions.skipBattleIntroMusic.help": "{Skip Intro Music}\n\nAllow actions during the intro music that plays at the beginning of each battle.",
"vcmi.battleOptions.skipBattleIntroMusic.help": "{Skip Intro Music}\n\nAllow actions during the intro music that plays at the beginning of each battle.",
"vcmi.battleOptions.endWithAutocombat.hover": "Ends battle",
"vcmi.battleOptions.endWithAutocombat.help": "{Ends battle}\n\nAuto-Combat plays battle to end instant",
"vcmi.adventureMap.revisitObject.hover" : "Revisit Object",
"vcmi.adventureMap.revisitObject.help" : "{Revisit Object}\n\nIf a hero currently stands on a Map Object, he can revisit the location.",

View File

@ -171,6 +171,8 @@
"vcmi.battleOptions.showStickyHeroInfoWindows.help": "{Statistikfenster für Helden anzeigen}\n\nDauerhaftes Einschalten des Statistikfenster für Helden, das die primären Werte und Zauberpunkte anzeigt.",
"vcmi.battleOptions.skipBattleIntroMusic.hover": "Intro-Musik überspringen",
"vcmi.battleOptions.skipBattleIntroMusic.help": "{Intro-Musik überspringen}\n\n Überspringe die kurze Musik, die zu Beginn eines jeden Kampfes gespielt wird, bevor die Action beginnt. Kann auch durch Drücken der ESC-Taste übersprungen werden.",
"vcmi.battleOptions.endWithAutocombat.hover": "Kampf beenden",
"vcmi.battleOptions.endWithAutocombat.help": "{Kampf beenden}\n\nAutokampf spielt den Kampf sofort zu Ende",
"vcmi.adventureMap.revisitObject.hover" : "Objekt erneut besuchen",
"vcmi.adventureMap.revisitObject.help" : "{Objekt erneut besuchen}\n\nSteht ein Held gerade auf einem Kartenobjekt, kann er den Ort erneut aufsuchen.",

View File

@ -552,6 +552,12 @@ void BattleWindow::bAutofightf()
if (owner.actionsController->spellcastingModeActive())
return;
if(settings["battle"]["endWithAutocombat"].Bool())
{
endWithAutocombat();
return;
}
//Stop auto-fight mode
if(owner.curInt->isAutoFightOn)
{
@ -722,7 +728,7 @@ void BattleWindow::blockUI(bool on)
setShortcutBlocked(EShortcut::BATTLE_WAIT, on || owner.tacticsMode || !canWait);
setShortcutBlocked(EShortcut::BATTLE_DEFEND, on || owner.tacticsMode);
setShortcutBlocked(EShortcut::BATTLE_SELECT_ACTION, on || owner.tacticsMode);
setShortcutBlocked(EShortcut::BATTLE_AUTOCOMBAT, owner.actionsController->spellcastingModeActive());
setShortcutBlocked(EShortcut::BATTLE_AUTOCOMBAT, settings["battle"]["endWithAutocombat"].Bool() ? on || owner.tacticsMode : owner.actionsController->spellcastingModeActive());
setShortcutBlocked(EShortcut::BATTLE_END_WITH_AUTOCOMBAT, on || owner.tacticsMode);
setShortcutBlocked(EShortcut::BATTLE_TACTICS_END, on && owner.tacticsMode);
setShortcutBlocked(EShortcut::BATTLE_TACTICS_NEXT, on && owner.tacticsMode);
@ -737,7 +743,8 @@ std::optional<uint32_t> BattleWindow::getQueueHoveredUnitId()
void BattleWindow::endWithAutocombat()
{
close();
if(!owner.makingTurn() || owner.tacticsMode)
return;
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
@ -753,6 +760,8 @@ void BattleWindow::endWithAutocombat()
owner.requestAutofightingAIToTakeAction();
close();
owner.curInt->battleInt.reset();
}

View File

@ -68,6 +68,10 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner)
{
enableAutocombatSpellsChangedCallback(value);
});
addCallback("endWithAutocombatChanged", [this](bool value)
{
endWithAutocombatChangedCallback(value);
});
build(config);
std::shared_ptr<CToggleGroup> animationSpeedToggle = widget<CToggleGroup>("animationSpeedPicker");
@ -99,6 +103,9 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner)
std::shared_ptr<CToggleButton> enableAutocombatSpellsCheckbox = widget<CToggleButton>("enableAutocombatSpellsCheckbox");
enableAutocombatSpellsCheckbox->setSelected(settings["battle"]["enableAutocombatSpells"].Bool());
std::shared_ptr<CToggleButton> endWithAutocombatCheckbox = widget<CToggleButton>("endWithAutocombatCheckbox");
endWithAutocombatCheckbox->setSelected(settings["battle"]["endWithAutocombat"].Bool());
}
int BattleOptionsTab::getAnimSpeed() const
@ -248,3 +255,8 @@ void BattleOptionsTab::enableAutocombatSpellsChangedCallback(bool value)
enableAutocombatSpells->Bool() = value;
}
void BattleOptionsTab::endWithAutocombatChangedCallback(bool value)
{
Settings endWithAutocombat = settings.write["battle"]["endWithAutocombat"];
endWithAutocombat->Bool() = value;
}

View File

@ -33,6 +33,7 @@ private:
void skipBattleIntroMusicChangedCallback(bool value);
void showStickyHeroWindowsChangedCallback(bool value, BattleInterface * parentBattleInterface);
void enableAutocombatSpellsChangedCallback(bool value);
void endWithAutocombatChangedCallback(bool value);
public:
BattleOptionsTab(BattleInterface * owner = nullptr);
};

View File

@ -304,7 +304,7 @@
"type" : "object",
"additionalProperties" : false,
"default" : {},
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "rangeLimitHighlightOnHover", "showQueue", "swipeAttackDistance", "queueSize", "stickyHeroInfoWindows", "enableAutocombatSpells" ],
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "rangeLimitHighlightOnHover", "showQueue", "swipeAttackDistance", "queueSize", "stickyHeroInfoWindows", "enableAutocombatSpells", "endWithAutocombat" ],
"properties" : {
"speedFactor" : {
"type" : "number",
@ -350,6 +350,10 @@
"enableAutocombatSpells" : {
"type": "boolean",
"default": true
},
"endWithAutocombat" : {
"type": "boolean",
"default": false
}
}
},

View File

@ -47,6 +47,9 @@
},
{
"text": "core.genrltxt.401" // First Aid Tent
},
{
"text": "vcmi.battleOptions.endWithAutocombat.hover"
}
]
},
@ -86,6 +89,20 @@
{}
]
},
{
"type" : "verticalLayout",
"customType" : "checkbox",
"position": {"x": 380, "y": 233},
"items":
[
{
"help": "vcmi.battleOptions.endWithAutocombat",
"name": "endWithAutocombatCheckbox",
"callback": "endWithAutocombatChanged"
}
]
},
/////////////////////////////////////// Left section - checkboxes
{
"name": "creatureInfoLabels",