1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

66 Commits

Author SHA1 Message Date
Xilmi
6c4996ff54 AI will now devalue the usefulness of non-flying units when attacking defensive structures in order to prevent suiciding against castles 2025-02-09 17:33:39 +00:00
Ivan Savenko
3479ec9651 Per-hero artifact scoring for NKAI
AI now has better (but not perfect) system for scoring artifacts.

All artifacts now have their base score, based on bonuses provided by
the artifact. For composite artifacts, AI will also consider bonuses
from its components.

When exploring, AI will now weight artifacts as min(base score, price /
5), meaning even artifacts that AI can't score will still have some
priority, if only to sell them or deny them to enemy

AI will now also consider what to equip when trading with heroes or on
the end of AI pass. When considering what to equip, hero will use base
score of an artifact, adjusted by how relevant particular bonus /
artifact for a hero. Some examples:
- Morale-bonusing artifacts have their score reduced based on percentage
of undeads in the army, all the way to 0 for undead-only troops
- Artifacts that give spells (books, hat) will have score reduced based
on how many of these spells are already known by hero
- Land movement artifacts have zero score while on water and vice versa
- Necromancy artifacts will have zero score if hero does not have
necromancy
- Archery artifacts are scaled by amount of ranged troops, and only used
if hero has archery skill

AI may still equip 'bad' artifact, however this should only happen if
hero has no other artifacts to equip into said slot.

TODO's for future PR's (although not sure if / when I will work on
these):
- avoid equipping duplicates of the same artifact. Most notably with
scrolls, but may happen with other misc artifacts or rings.

- consideration for various spell-immunity neclaces

- consideration for birectional artifacts, like Shackles of War, or some
Spheres - since these artifacts need consideration on what our expected
enemy is to correctly estimate whether

- equipping artifacts based on immediate need - for example, equipping
recovery artifacts before end of day, equipping legion pieces only in
town on day 7, preparing for strong / weak enemies (or even preparing
for specific enemy in advance)

- transferring resource-generating artifacts and such to scout heroes,
allowing main hero to focus on combat

- ensure that AI can equip combined artifacts even if non-primary slots
are in use - by considering whether score of combined artifact is higher
than score of all used slots
2025-01-18 13:14:24 +00:00
Ivan Savenko
b25702f15e expose safeAttackRatio to AI config 2024-11-28 11:53:51 +00:00
Xilmi
a70f5de8c6 Merge remote-tracking branch 'upstream/develop' into develop 2024-11-07 14:35:13 +01:00
Ivan Savenko
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +00:00
Ivan Savenko
c98ac01e7a Replaced public artType member of ArtifactInstance with getter 2024-10-30 16:47:01 +00:00
Ivan Savenko
08fbcd5239 TerrainTile now uses identifiers instead of pointers to VLC 2024-10-30 16:22:11 +00:00
Xilmi
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02:00
Ivan Savenko
10ad0fc760 Split CHeroHandler.cpp/.h into 1 file per class
All parts of CHeroHandler.cpp are now in lib/entities/hero
Adjusted includes to use new paths
No functionality changes
2024-10-13 14:01:09 +00:00
Xilmi
065125e770 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-10 14:57:27 +02:00
Ivan Savenko
8225eb454e Added GameSettings to gamestate, potentially allowing to define game
settings per map (or in random map template)
2024-09-05 15:16:27 +00:00
Xilmi
fbe1e171fe Merge remote-tracking branch 'upstream/develop' into develop 2024-07-15 18:36:19 +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
Andrii Danylchenko
6f5710e809
Merge pull request #4110 from vcmi/rewardables
NKAI: rewardables
2024-07-14 09:02:37 +03:00
Ivan Savenko
6b8f94e6e7 Merge remote-tracking branch 'vcmi/master' into develop 2024-07-11 17:43:44 +00:00
Andrii Danylchenko
1be36e1ad4 NKAI: rewardables 2024-07-07 21:58:39 +03:00
Ivan Savenko
24b77b0972 Remove access to hero name translation 2024-07-03 17:01:38 +00:00
Alexander Wilms
02e429e973 Fix typos using https://github.com/crate-ci/typos
Changes were reviewed manually
2024-06-24 03:47:19 +02:00
Andrii Danylchenko
6e641dbdea #3824 - fix empty army with only commander issues 2024-04-26 23:18:20 +03:00
Andrii Danylchenko
3939c4b9d3 NKAI: stability fixes and regression 2024-04-20 14:32:58 +03:00
Andrii Danylchenko
ed76d8a652 NKAI: allow multiple tasks to be executed from one calculation 2024-04-14 16:46:05 +03:00
Andrii Danylchenko
728f673763 NKAI: remove static ai field 2024-03-31 21:11:25 +03:00
Andrii Danylchenko
d6f1a5c2b3 NKAI: parallel capture objects 2024-03-29 20:39:03 +02:00
Andrii Danylchenko
35429eab52 NKAI: moddable configuration 2024-03-01 22:03:07 +02:00
Ivan Savenko
d5c4478816 Remove most of non-const access to VLC entities 2024-01-19 13:54:49 +02:00
Ivan Savenko
62cd8b12d4 Converted several namespace enums to enum class 2023-08-25 13:38:02 +03:00
Ivan Savenko
17d3d663ee Converted creature ID and spell ID to new form 2023-08-25 13:38:02 +03:00
Ivan Savenko
87957e74c1 Replaced boost::thread_specific_ptr with thread_local 2023-08-23 16:32:29 +03:00
Tomasz Zieliński
3b238ff15e Fix weekly visitable check 2023-08-01 17:30:47 +03:00
SoundSSGood
9b5f6ec7cf CArtifact getters setters 2023-07-05 15:48:08 +03:00
Ivan Savenko
85262cf4f5 Moved CGameState files into a separate directory 2023-06-26 17:15:59 +03:00
Ivan Savenko
f7b27da00e Implemented support for "coast visitable" objects:
- objects marked as coast visitable can be visited from land even when
placed in water
- added isBlockedVisitable and isCoastVisitable method to
CGObjectInstance
- implemented json config for these properties in banks
2023-06-25 17:42:33 +03:00
Andrii Danylchenko
0829593356 NKAI: composite pathfinder actions and fix for guarded bordergate 2023-05-07 09:15:37 +03:00
Konstantin
05eccbc2bb vcmi: split bonus to enumerator and HeroBonus.h 2023-05-03 18:01:06 +03:00
nordsoft
1b4d117790 deeper decoupling 2023-04-30 17:13:07 +04:00
nordsoft
e47bb3f1f9 Separate configuration and object 2023-04-30 00:59:02 +04:00
Konstantin
11b237a23c vcmi: massive refactoring v1 2023-04-05 22:33:12 +03:00
Ivan Savenko
a0e9e01b48 Renamed & reorganized all game mechanics settings names 2023-03-16 18:11:35 +02:00
Ivan Savenko
383387ef29 Integrated defaultMods into mod system 2023-03-16 17:55:09 +02:00
Ivan Savenko
144ddba97d Replaced AI assertion failure with error in log 2023-03-07 00:06:58 +02:00
Ivan Savenko
f8f6df02f3 Removed remaining hardcoded objects 2023-01-23 15:27:27 +02:00
Ivan Savenko
fa6f7513e8 All heroes-related strings are passed through translator 2023-01-20 15:18:36 +02:00
Andrii Danylchenko
e31beafa17 #1100 - fix visiting allied dwellings 2022-11-23 02:40:56 +04:00
Andrii Danylchenko
e9c725181c NKAI: fix retreat logic 2022-10-15 15:15:12 +03:00
Andrii Danylchenko
eeea01d778 NKAI: namespace 2022-10-04 08:40:14 +03:00
Andrey Filipenkov
72feb538ce add explicit null pointer checks 2022-09-25 10:05:16 +03:00
nordsoft
c24fc89fe3 Lambda decltype on compile time instead of runtime 2022-09-14 12:08:20 +03:00
Andrey Filipenkov
af6d666778 use high_resolution_clock instead of steady_clock 2021-11-23 11:56:06 +03:00
Andrey Filipenkov
fc064b1c45 replace boost::chrono with std::chrono 2021-11-23 10:23:55 +03:00
Andrii Danylchenko
79d06bbaa6 Nullkiller: fix merge conflicts 2021-07-26 21:02:50 +03:00