Commit graph

24919 commits

Author SHA1 Message Date
newfrenchy83
7d6e2b2a10 Lua API: implicitly clear animator after playing it (#3536)
This prevents the animator from holding a strong reference to the target unit, which was keeping the unit object alive and thus preventing the unit halo, if any, from disappearing.
2018-09-09 18:47:56 +03:00
Celtic Minstrel
59e78e5565 Move wmlxgettext to the data/tools directory so that it's automatically included in official packages 2018-09-08 18:07:42 -04:00
mattsc
2591e435a5 EI custom ogre AI: remove a commented out line 2018-09-07 09:50:52 -07:00
mattsc
a781139536 generic_recruit_engine: remove unnecessary variable assignment 2018-09-07 09:50:51 -07:00
mattsc
dcadab91a4 Lua AIs: use ai_helper.get_locations_no_borders() 2018-09-07 09:50:42 -07:00
mattsc
10463fdf60 ai_helper: new function get_locations_no_borders() 2018-09-07 09:50:23 -07:00
newfrenchy83
3541629197 [heal_unit]: clear the animation after playing it (#3526)
Fixes another case of unit halo remaining after death.
2018-09-07 19:35:39 +03:00
Jyrki Vesterinen
e63bd35f9d [animate_unit]: clear the animation after playing it
This avoids a reference to the unit from being leaked, which prevented the
unit's halo (if any) from disappearing when the unit died.

Fixes #3509. Closes #3520.
2018-09-06 20:16:00 +03:00
mattsc
75843541bc Lua AIs: use ai_helper get_unit functions where applicable
The ai_helper functions are optimized for speed (as much as possible in a general setting) and do all the necessary tests.  For example, get_units_with_attacks() checks both whether the unit has attacks left, and whether it has any attacks in the first place.
2018-09-05 19:38:28 -07:00
mattsc
a7d80240f2 ai_helper: get_unit functions should only return live units
Live beiing defined as in get_live_units(), that is, non-petrified units
2018-09-05 19:34:44 -07:00
mattsc
fdc3249496 Lua AIs: use ai_helper.robust_move_and_attack()
ai_helper.robust_move_and_attack() does the stop_unit_moves automatically if the unit is at the destination hex.
2018-09-04 07:16:56 -07:00
mattsc
23f35546fc Lua AIs: remove commented-out debug code 2018-09-03 14:48:10 -07:00
mattsc
ec45b53fe2 Experimental AI: rename config file
This stopped being a rush AI long ago.
2018-09-03 12:01:41 -07:00
mattsc
35ba820509 Experimental AI: adjustments to candidate action scores
The relative ranking of the CA scores is not changed, except for one case when two CAs had the same score.

Reasons:
- All scores should be lower than the scores of the default Goto CA (200,000) and the default scores of most Micro AIs (300,000).
- Break tie, resulting in uncertain order of execution, of place_healers and retreat_injured CA. Healers should be placed first, to allow retreating injured units to adjacent hexes.
- Set default for generic_recruit_engine to slightly above default AI recruiting score. That way it takes effect even if the default CA is not removed.
- Increase move_to_any_enemy CA score from 1 to 1,000. It is still the lowest score that way, but allows for setting up custom CAs with even lower scores (even if it is just for end-of-turn statistics or the like).
2018-09-03 11:05:49 -07:00
mattsc
b92d8e8226 recruit_rushers CA: don't reserve village for passive leader 2018-09-03 08:01:28 -07:00
mattsc
0bcb98cf50 recruit_rushers CA: check if castle_switch CA is present
So that it is possible to use the recruit_rushers CA without the castle_switch CA.
2018-09-03 07:40:27 -07:00
Severin Glöckner
ce056894da DM S21: use type_adv_tree
the one usage of type is left deliberately, to point out that it affects 3
instad of 2 or 4 types.

[ci skip]
2018-09-03 15:07:09 +02:00
Severin Glöckner
2e7d901517 NR deaths: use one event for both lich brothers
They text is the same, whoever of them dies

[ci skip]
2018-09-03 15:05:52 +02:00
Severin Glöckner
47c3947d0a NR S12: hide empty sides
There has been a report that some scenario would be nearly unbeatable if they
are empty in the first place, so this has the side effect of not showing the
player that he misses something. (Nevertheless, they should be hidden)

[ci skip]
2018-09-03 15:05:52 +02:00
Severin Glöckner
79993ea601 NR S13: slight bonus for AI controlled sides:
- allied AI leaders, whose death causes defeat, use passive_leader=yes
- increased amount of money which the lich brothers have, if one has not the
alternative leaders who can recall units
- also increased Krash's gold to the same amount of as Eryssa has (they are the
alternative leaders)

[ci skip]
2018-09-03 15:05:52 +02:00
joeylmaalouf
3d481c1b8b Allow ties to be reported as such in the turns_over_advantage calculation (fixes #1341) 2018-09-02 22:40:41 -05:00
mattsc
45a3bf9363 Lua AIs: replace tabs with spaces 2018-09-02 15:08:24 -07:00
mattsc
3bfd59f28b Lua AIs: do not use engine's 'data' variable unless necessary
Now that all the AIs use external CAs, there is no need to use the persistent 'data' variable any more, unless information is to be exchanged between different CAs or is supposed to be persistent across save/load cycles.
2018-09-02 13:20:34 -07:00
mattsc
62625fd5e2 Protect Unit MAI: remove unused configuration variables
They cannot be set for the MAI, and they would have to be set through 'cfg' not 'data' anyway.
2018-09-02 08:54:31 -07:00
DisherProject
9086e17b15 AOI: General AI rewrite
Removes all the default values and improves the syntax where
possible
2018-09-02 15:04:48 +03:00
DisherProject
240d235059 AOI S2: Prefer "id" to "speaker" in non-[message]'s SUFs 2018-09-02 15:04:48 +03:00
DisherProject
34f417c4eb AOI S3: Clear all enemies on victory
... for consistency with the previous message stating that
all orcs are killed by the elves.
2018-09-02 15:04:48 +03:00
DisherProject
64917b70b5 EI S13: Rewrite dragon's AI
Most part of the old AI had no evident effect: the dragon just
moved here and there without attacking you, and since he flied
over shallow water, it was impossible to chase him. The micro
ai makes Khrakhras wander around and attack you when you
approach his castle.
2018-09-02 15:00:30 +03:00
DisherProject
50e4cc5d3f EI S12-S16: Split objectives into main and alternative ones
Also adds a new objective in S16, which was not stated but
actually makes you win.
2018-09-02 15:00:30 +03:00
DisherProject
643f1336dd EI S8: Fix event not being fired
The second event took as filtered unit an ogre that has reached
the border of the map. Unfortunately, he was removed by the map
before such event was fired, causing it to never happen.
2018-09-02 15:00:30 +03:00
DisherProject
e07819619c EI: Remove old TODO and add a new one 2018-09-02 15:00:30 +03:00
mattsc
42b4430841 Lua AIs: avoid calling wesnoth.get_terrain() more than needed
It probably doen't make a noticeable difference for these AIs, but in general we should not call the slow functions more than necessary.
2018-09-01 14:29:51 -07:00
josteph
bcb6153b89 Liberty S8: Fix family reference
According to po comments in S1, Baldras is Harper's mother's brother.

Also change "mom"/"dad" to "mother"/"father" to match the general
medieval setting of dialogs.
2018-09-01 13:43:19 -05:00
josteph
4c612400cf Liberty S8: Fix ambiguous pronoun 2018-09-01 13:43:09 -05:00
mattsc
5474785718 Experimental AI: convert to using external CAs 2018-08-31 18:31:29 -07:00
Nils Kneuper
ff861673a4 updated Ukrainian translation 2018-08-31 21:02:20 +02:00
mattsc
c2635abde1 Experimental AI: fix eval/exec debug output
This involves making the output independent of the stats CA (which is not used any more) and adding missing output to some CAs.
2018-08-31 07:04:58 -07:00
mattsc
1040dbe5c9 AToTB S2: rename custom AI file
For consistency with the other mainline campaigns
2018-08-30 18:08:04 -07:00
mattsc
35d257f8fd Lua AIs: don't compare variables with nil
... unless there is a difference between nil and false. Done mostly for consistency with all the other uses.
2018-08-30 17:37:12 -07:00
mattsc
a23f06dc20 Lua AIs: don't initiate variables as empty tables
... if they might not be needed.
2018-08-30 17:27:18 -07:00
josteph
8fd1b822db Liberty S3: Play orcish war drums 2018-08-30 15:09:13 -05:00
josteph
6a1b59327e Fix various typos.
AOI S3: Address Erlornas as "lord" in lowercase as done elsewhere in the
scenario.
2018-08-30 14:49:42 -05:00
josteph
e2c591edbd Liberty S3: Add a story part 2018-08-30 14:40:23 -05:00
mattsc
0e7c09f7b5 Lua AIs: no need to set variables to nil explicitely
This is mostly done for consistency across the Lua AI code
2018-08-30 07:35:57 -07:00
mattsc
80ae232935 Herding Micro AI: fix variabls not being local 2018-08-30 07:23:41 -07:00
mattsc
cb423b2fbd Lua AIs: use math.huge to initialize extrema variables 2018-08-30 07:18:04 -07:00
mattsc
f4f2a441e4 Fast Micro AI: code cleanup
Most of the Fast MAI attack utils had been taken from a more general codebase and included things not needed here. This AI is supposed to be a slimmed down version doing only the absolutely necessary in as fast as possible a fashion.
2018-08-29 19:26:49 -07:00
mattsc
1680436f72 Lua AIs: remove another unused library inclusion 2018-08-29 08:48:30 -07:00
mattsc
8a996c55b9 Lua AIs: remove inclusions of unused libraries 2018-08-29 08:00:32 -07:00
mattsc
5335a2af33 Lua AI utility functions: fix for chance-to-hit specials without id
All mainline chance-to-hit weapon specials have ids, but it is not required for UMC specials.
2018-08-29 07:27:24 -07:00