1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-16 10:19:47 +02:00
Commit Graph

16372 Commits

Author SHA1 Message Date
Xilmi
f094bf9602 Added marketplace to buildable buildings
Before marketplaces could only be built as part of a requirement for other buildings but not on their own when that other building already existed like it is the case in certain campaign-missions.
2024-07-19 15:19:27 +02:00
Xilmi
9c6d8762c5 Lowered restrictions from hero-hiring.
Removed two restrictions from hero-hiring, that prevented AI from hiring heros in certain scenarios.
2024-07-19 15:18:02 +02:00
Xilmi
37c0972a50 New and restored functionality
Added a new div-function to resource-sets. It allows to calculate the amount of times one resource set, for example income, has to be accumulated in order to reach another resource-set, for example required resource. It will return INT_MAX if it's impossible.

Restored the "<" operator-function and made it actually work like it's supposed to.
2024-07-19 15:16:05 +02:00
Xilmi
b0f37748d6 Merge remote-tracking branch 'upstream/develop' into develop 2024-07-16 15:47:59 +02:00
Andrii Danylchenko
d243a2fc12
Merge pull request #4259 from vcmi/fix-4203
BattleAI: fix moving to unreachable in case of back-to-back 2-hex
2024-07-16 16:41:50 +03:00
Ivan Savenko
ad9750ed3e
Merge pull request #4186 from SoundSSGood/end-of-battle-artifacts-transfer
End of battle artifacts transfer
2024-07-16 12:45:13 +03:00
Ivan Savenko
696cce7f7f
Merge pull request #4253 from smanolloff/random-port
Bind VCMI server to a random TCP port
2024-07-16 12:25:29 +03:00
Ivan Savenko
f833f13251
Merge pull request #4260 from vcmi/nullkiller-docs
Add docs for Nullkiller AI
2024-07-16 12:24:34 +03:00
Ivan Savenko
fd04320815
Merge pull request #4267 from IvanSavenko/sonar_fix
Fixed new issues detected by SonarCloud
2024-07-16 12:23:08 +03:00
Ivan Savenko
7e88c88ef0
Merge pull request #4262 from Alexander-Wilms/missing-prompt-after-quitting
Fix missing terminal prompt after quitting
2024-07-16 12:22:42 +03:00
Ivan Savenko
8e8d640923
Merge pull request #4276 from Alexander-Wilms/jsonparser-err-newline
JsonParser::error(): Don't add trailing newline
2024-07-16 12:21:23 +03:00
Ivan Savenko
4ce552369f
Merge pull request #4273 from Alexander-Wilms/gitignore-dolphin-directory
Add .directory files to .gitignore
2024-07-16 12:20:48 +03:00
Ivan Savenko
f920e94366
Merge pull request #4210 from Laserlicht/graphics_improvements
[1.6] Graphics improvements
2024-07-16 12:17:39 +03:00
Ivan Savenko
3134d8383c
Merge pull request #4207 from Laserlicht/map_format_additional
[1.6] Map format additional infos
2024-07-16 12:15:58 +03:00
Alexander Wilms
f22a3d6168
JsonParser::error(): Use empty()
Co-authored-by: Andrey Filipenkov <kambaladecapitator@gmail.com>
2024-07-16 10:30:00 +02:00
Alexander Wilms
466318b77b JsonParser::error(): Don't add trailing newline 2024-07-15 23:58:56 +02:00
SoundSSGood
ff5ddd76b7 suggestions 2024-07-16 00:03:06 +03:00
Alexander Wilms
fb51dfb653 Add .directory files to .gitignore
KDE's file manager Dolphin will create a hidden .directory file in each folder one changes view properties for
2024-07-15 20:32:16 +02:00
Xilmi
455ad648ae More warning fixes
heroRole is no longer needed here.
2024-07-15 20:09:11 +02:00
Xilmi
d4b4a6c4db Warnings
Commented out relics from debugging that were causing warnings for unused variables.
2024-07-15 19:57:33 +02:00
Xilmi
fbe1e171fe Merge remote-tracking branch 'upstream/develop' into develop 2024-07-15 18:36:19 +02:00
Xilmi
4a552d411c Decisionmaking-changes
There's 3 new evaluation-contexts that are now taken into account:
Whether an action is building, whether an action involves sailing and the newly introduced threat.

The value-evaluation of creatures now also takes special resources into account.

No longer treating other AIs differently than players when it comes to how afraid we shall be of them.

The cost of buildings for decision-making now determines missing resources. Available resources are ignored when it comes to how they impact the cost. But missing-resources will heftily impact the assumed price by calculating their market-value. This shall encourage the AI to rather build what it currently can build instead of saving up for something that it lacking the special resources for.

AI is no longer willing to sacrifice more than 25% of their army for any attack except when it has no towns left.

Revamped the priority-tiers of AI decision-making.

Higest priority is conquering enemy towns and killing enemy heroes. However, the AI will no longer try to do so when the target is more than one turn away and protected by a nearby enemy-hero that could kill the one tasked with dealing with the target. Except when they have no towns left. Then they get desperate and try everything.

As a general rule of thumb one could say the AI will prioritize conquest over collecting freebies over investing army to get something that isn't a city. It's a bit more complex than that but this is roughly what can be expected. It will also highly value their own heroes safety during all this.
2024-07-15 18:12:52 +02:00
Xilmi
95ba57dfe2 No more Startup-behavior
Startup-behavior was messing with my intended logic. Mostly by getting excess heroes for no real purpose other than that it could.
This wasted a lot of money that could be better invested on subsequent turns.
I removed it and playing-strength actually went up.
2024-07-15 17:50:30 +02:00
Xilmi
ce4905ac4c Ivan's fix to brown arrows after new turn
A fix Ivan posted about on Discord that takes care of a newly introduced bug in development-branch that you had to reselect your hero manually after a new turn because he would otherwise think he's still on last-turn when it came to executing planned movement.
2024-07-15 17:47:27 +02:00
Xilmi
f8f10adb2e Take magic-capability into account for overall strength-estimation of hero-lead-armies
The magic-strength of a hero now checks if the hero has a spellbook and at least one combat-spell.
The impact of knowledge and spellpower to the hero's magic-strength is now also depending on it's current and max mana-pool-size as an empty mana-pool does not exactly contribute well to fights.

Replaced every call of getFightingStrength() with getHeroStrength() which uses both the fightingStrength and the (reworked) magicStrength to guess how much stronger a hero-lead army is.
2024-07-15 17:42:02 +02:00
Xilmi
83ffbdff2b Fix for double army-loss
Fixed that army loss was taken into account both for the path and the target-object. In certain cases, like a hero defending a town, this could lead to armyloss being twice as high as it should be.
2024-07-15 17:35:54 +02:00
Xilmi
e2e3f9e638 Take hero-stats into account for attacking hero-defended entities
Instead of using just the strength of the raw army, the hero-stats are now taking into account for the generation of the danger-map.
2024-07-15 17:30:42 +02:00
Xilmi
48ecbd4cbf Threat in DangerHitMap
Added new value threat to DangerHitMapAnalayzer. The purpose is to allow decisions to be less binary around enemy heros.
2024-07-15 17:28:10 +02:00
Xilmi
53c51b4278 Allow all buildings
Added resource-silo and special buildings to things that AI can theoretically build.
2024-07-15 17:26:06 +02:00
Ivan Savenko
c00a1e1b0c Fixed new issues detected by SonarCloud 2024-07-15 07:46:40 +00:00
Laserlicht
6aa7c9ebf9
code review 2024-07-15 00:51:41 +02:00
Alexander Wilms
f9de3b2ffd startExecutable(): Restore error handling 2024-07-14 21:04:36 +02:00
Alexander Wilms
875a8cc11a startExecutable(): Use QProcess::start() instead of QProcess::startDetached() to fix the missing prompt after quitting vcmiclient or vcmieditor
vcmilauncher is now hidden while the child process is running, since it doesn't get repainted.

Fixes #2574
2024-07-14 21:04:36 +02:00
Andrii Danylchenko
58add0e182
Add docs for Nullkiller AI 2024-07-14 17:45:41 +03:00
Andrii Danylchenko
a4b6fc75dd BattleAI: fix moving to unreachable in case of back-to-back 2-hex 2024-07-14 11:46:45 +03:00
Andrii Danylchenko
6f5710e809
Merge pull request #4110 from vcmi/rewardables
NKAI: rewardables
2024-07-14 09:02:37 +03:00
Xilmi
d878d0ce18 Avoid being killed
Heroes with conquest-tasks will only endanger themselves to be killed when they can execute a conquest in the same turn.

Heroes with other tasks will dismiss any tasks except of defending when they'd be within one turn of an enemy hero that could kill them.
2024-07-12 23:36:41 +02:00
Xilmi
102b537353 Recruit-behavior
Moved recruit-behavior back to tasks that plans get made for since otherwise it can mess up plans by blocking town-exits.
2024-07-12 23:33:58 +02:00
Xilmi
a821978d4e Merge remote-tracking branch 'upstream/develop' into develop 2024-07-12 17:43:04 +02:00
Xilmi
92bed2305e priority-tiers
Tasks are now in different priority-tiers. For now there's 2 tiers. One for regular tasks and one for tasks of the new "conquest"-type. Regular tasks will only be considered when no possible conquest-type tasks were found.

Slightly reworked scoring heuristics.
2024-07-12 17:41:46 +02:00
Xilmi
9456ab41da Priority-tier
Openmap is no longer tied to difficulty-level due to being configurable anyways.

Tasks are now in different priority-tiers. For now there's 2 tiers. One for regular tasks and one for tasks of the new "conquest"-type. Regular tasks will only be considered when no possible conquest-type tasks were found.

Recruit-hero-behavior is now evaluated before movement to make it more likely a new hero can exchange their stuff with others.
2024-07-12 17:39:52 +02:00
Xilmi
638c1350b8 Path-safety
No longer excluding paths for exposing a hero to an enemy in the behaviors. There definitely are reasons for doing something anyways, even if threatened. The logic for that should be done in the PriorityEvaluator.
2024-07-12 15:43:40 +02:00
Xilmi
663ca23f6f Army-hiring
Supressing hiring army on turn one seems just bad. Starting the main-hero as strong as possible seems like a good idea to me and hiring the available troops outright will help achieve that goal.

However, if there's a hero for hire, who has army with him that is a better deal, we hire that one first.
2024-07-12 15:41:55 +02:00
Xilmi
fdaac9d3c3 Hero-hiring
When we have no hero, we will definitely want to hire one.
We will also want to hire heroes who already pay for more than themselves by coming with an army that has more value than the hero costs.
2024-07-12 15:39:50 +02:00
Xilmi
3fed58c47b Gold-pressure 2024-07-12 15:36:29 +02:00
Simeon Manolov
d997d18438
remove debug line 2024-07-12 15:41:07 +03:00
Simeon Manolov
4be7adbf0a
add missing include 2024-07-12 15:26:31 +03:00
Simeon Manolov
5b6bc10131
Code review 2024-07-12 14:54:28 +03:00
Ivan Savenko
74723bf77e
Merge pull request #4254 from smanolloff/fix-battle-queue
Fix battle turn order for current turn
2024-07-12 14:45:15 +03:00
Simeon Manolov
941cd6768f
Fix battle turn order for current turn 2024-07-12 11:39:57 +03:00