Commit graph

1020 commits

Author SHA1 Message Date
Severin Glöckner
9c099d5d07 remove TODOs regaring overlays 2019-10-02 03:50:39 +02:00
Severin Glöckner
6da85e9042 switch from map_data to map_file in SP 2019-10-02 02:54:25 +02:00
mattsc
f5b6b50565 Experimental AI: fix guardians being used for village actions 2019-09-19 19:16:48 -07:00
Martin Hrubý (hrubymar10)
6f468a3757
Migrate links to https if available
Closes #3343
2019-09-08 07:53:28 +02:00
Steve Cotton
1c123fb3fa Allow '1-infinity' in ranges, and tighten the schema's validation of ranges
Fixes #4253.

The schema's validation of ranges now rejects negative numbers, because the C++
code doesn't support them (both before and after this commit):
* utils::parse_range("-7") will return {0,0}, because std::stoi("") throws invalid_argument.
* src/map/location.cpp will parse it as -7, but that will never match an on-map coordinate
2019-08-29 22:28:22 +02:00
gfgtdf
ef06634485 use overlay effect over [unit] overlays= 2019-08-25 22:29:49 +02:00
gfgtdf
5cb93694c6 move loyal overlays to the loyal trait
since the recent changes to overlays= in particular 1a7724e547,
e71033374c and b2cd1cf6c [unit]overlays= is no longer the
recommended way to add an overlay and the use of the
apply_to=overlay effect is reccomended instead, so adding it
to the [trait] is the most natural option here.

this in particular fixes #4058 . Also people simply forgetting the
IS_LOYAL macro was a not-so-uncommon cause of bugs.

In some cases people want to give the LOYAL trait without giving the
loyal overlays for those cases i added a optional OVERLAY parameter to
the {TRAIT_LOYAL} macro, also heroes should now use {TRAIT_LOYAL_HERO}
instead which uses the hero overlay. The IS_LOYAL and IS_HERO macros are
no longer needed in combination with those traits.
2019-08-25 20:36:35 +02:00
mattsc
e148d25d2a ExpAI grab villages CA: fix enemy distance rating under fog
ai_helper.get_closest_enemy() returns math.huge for the enemy distance if no enemy is visible to the AI. This fixes #4157.
2019-07-10 08:07:11 -07:00
Steve Cotton
3420bb17ea Test scenario High XP Attack: use the map that it expects
This scenario uses the huge final map from THoT, with different situations
split across different rooms of the map. THoT's final scenario was redesigned
with a completely new map in 457d9d17f, so this gives the test code its own
copy of the map.

There's a one-hex change to the original: the test puts side 1's leader in a
wall, isolated from the action. To clarify that that's intentional, the map
copy changes that hex to be passable, still surrounded by wall.
2019-03-23 10:10:53 -04:00
Andrius Štikonas
6152883645 Fix some spelling issues
Fix a typo in micro_ai simple_attack demo: you -> your.
Fix inconsistent spaces
Fix misspelled wesnoth in systemd unit file
2019-03-06 11:42:17 -05:00
mattsc
152eb37aec Goto/Assassin MAIs: fix AIs not always working with tunnels
The old syntax for using a custom cost function ignored teleports/tunnels. Using calculate= in the path options table allows also setting the ignore_teleports option (but in this syntax it defaults to 'false', so it does not need to be done specifically).
2018-12-30 16:26:18 -08:00
mattsc
8b3c6b1fa9 Forest Animals MAI: fix AI crash when using custom rabbit hole image 2018-12-27 14:53:47 -08:00
mattsc
8a7a5a153f AI configuration: invert mp_rank based ordering
This is supposed to be equivalent to the campaign rank, so it should be in ascending order.
2018-12-15 13:48:32 -08:00
mattsc
c731be58a9 AI configuration: new optional parameter mp_rank=
This parameter determines in which order the available AIs are shown in the MP computer player selection menu. This can be used for eras, modifications or cores to change which AI is first in the list.
2018-11-17 18:46:06 -08:00
mattsc
f00f9e3901 RCA AI: remove attack_depth aspect from default configuration 2018-11-16 06:45:40 -08:00
mattsc
8c8cafaa70 Deprecate EXPERIMENTAL_AI macro 2018-11-15 06:46:41 -08:00
mattsc
59397a40b5 ExpAI recruiting: fix AI crash for unit type with unknown race 2018-11-13 06:53:20 -08:00
Celtic Minstrel
639787e1c9 Merge pull request #2562 from wesnoth/schema 2018-11-11 13:52:19 -05:00
mattsc
30e1fd1742 Bottleneck Micro AI: simplify a conditional
Use elseif and no need to check experience again, that is already done earlier.
2018-11-09 06:57:07 -08:00
mattsc
bc956b3e7f Lua AIs: fix experience for killing level 0 units 2018-11-09 06:52:08 -08:00
mattsc
1856377d35 Lua AIs: distinguish between healing locations and villages
There are rating contributions for hexes which heal (not all of which are villages) and others for hexes that provide income (villages). Previously only villages were considered for both types of hexes.
2018-11-07 12:24:31 -08:00
mattsc
8bca955ad5 ai_helper: new function get_healing_locations() 2018-11-07 12:17:55 -08:00
mattsc
c1343227e2 Generic recruit engine: cache pathfinding data
This results in a significant speed-up starting from the second recruit each turn.
2018-11-06 09:44:03 -08:00
mattsc
e379cf7333 Generic recruit engine: replace slow location filters 2018-11-06 09:38:33 -08:00
mattsc
0c57ae16e4 Lua AIs: do not use hard-coded values for modifiable parameters 2018-11-05 20:22:11 -08:00
mattsc
e3b2cbfc25 ExpAI recruiting: consider all villages not owned by allies
Instead of only the unowned villages.
2018-11-05 07:19:23 -08:00
mattsc
5e0df80ad0 ExpAI retreating: take healthy trait into account 2018-11-05 07:02:46 -08:00
mattsc
dcf951434e Micro AIs: support named locations for [micro_ai] tag keys 2018-11-05 07:02:33 -08:00
mattsc
8676d3eaf1 ExpAI recruiting: add optional 'enemy_types' parameter
Ths is the enemy type list to be considered if the AI has no information about the enemies to expect, that is, if no enemy units are on the map and no enemy recruit lists can be found. It can be used to prepare AI recruiting for enemy sides that get added later during a scenario.
2018-11-02 15:43:14 -07:00
mattsc
873bf2f390 Multipack Wolves MAI: add [avoid] tag functionality
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
2018-11-01 18:10:38 -07:00
mattsc
d7418ab8e2 Wolves Micro AI: take default AI [avoid] tag into account 2018-11-01 18:07:21 -07:00
mattsc
abaa2dcc84 Swarm Micro AI: add [avoid] tag functionality
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
2018-11-01 18:05:17 -07:00
mattsc
7579d181c0 Goto Micro AI: add [avoid] tag functionality
This includes both adding an [avoid] tag to the MAI itself, and taking the default AI [avoid] tag into account. If both are given, the former takes precedence over the latter.
2018-11-01 08:03:24 -07:00
mattsc
f11700119a Micro AIs: use ai_helper.get_reachmap()
There are no functionality changes in this commit, it's simply switching over to the new ai_helper function. Changes to the MAI functionalities will be added separately.
2018-10-31 15:45:48 -07:00
mattsc
df4065c061 ai_helper: new function get_reachmap()
This is a generalized version of ai_helper.get_reachable_unocc(). It can include or exclude hexes with own units with moves > 0. It also allows passing an optional location set 'avoid_map' with hexes to be excluded.

In principle, this makes get_reachable_unocc() unnecessary, but we keep that function for backward compatibility.
2018-10-30 07:37:52 -07:00
mattsc
10b0631143 Micro AIs: use ai_helper.get_avoid_map()
There are no functionality changes in this commit, it's simply switching over to the new ai_helper function. Changes to the MAI functionalities will be added separately.
2018-10-29 07:26:07 -07:00
mattsc
ae22b2e08f ai_helper: new function get_avoid_map()
The goal is to add [avoid] tag capabilitiy to most Micro AIs.
2018-10-29 07:06:46 -07:00
mattsc
a831edda6b ai_helper.get_closest_enemy: change return values
This is done for consistency with similar functions in mainline, and so that the function actual returns what it name says. This breaks backward compatibility, but note that the only practical difference for that is the order in which the arguments are returned, as both 'closest_enemy' and 'location' contain the enemy location in .x/.y format.
2018-10-27 16:24:13 -07:00
mattsc
5c73537412 ai_helper.lua: deprecate some functions 2018-10-26 07:19:13 -07:00
mattsc
cd8af96607 ai_helper.find_best_move: return nil instead of {} if no move found
This is done for consistency with similar functions in mainline. In principle this breaks backward compatibility.  However, while it is theoretically possible for this to happen, this function will generally always return at least the hex the unit is on, so it is very unlikely that this actually makes a difference somewhere.
2018-10-26 07:19:13 -07:00
mattsc
41bd835f76 Old patrol.lua: deprecation message should not be translatable 2018-10-24 19:53:45 -07:00
mattsc
e3b86f5648 Lua AIs: increase deprecation level of old ai/lua/patrol.lua 2018-10-24 19:51:53 -07:00
mattsc
5fe283d06c Lua AIs: use wesnoth.label instead of wml_action_metatable 2018-10-24 19:50:09 -07:00
Celtic Minstrel
2410c9671c MicroAI Tests: Fix issues found by the schema validator
With this, the MicroAI test scenarios are clean of schema errors
2018-10-23 22:49:40 -04:00
Celtic Minstrel
02da99638a Fix a few schema issues in some of the interactive test scenarios 2018-10-23 22:49:37 -04:00
Celtic Minstrel
79eed95f98 Embrace turns=unlimited as a way of specifying unlimited turns 2018-10-23 22:39:29 -04:00
mattsc
09e3891668 ai_helper.move_unit_out_of_way: prevent potential for divide-by-zero
dx = dy = 0 is a perfectly acceptable choice of values when there is no preferred direction.
2018-10-21 19:30:34 -07:00
Severin Glöckner
a10888ca5b Micro AI Demos: use Cme instead of Chw for lurkers map
[ci skip]

(cherry-picked from commit c5cabd960b)
2018-10-07 03:25:08 +00:00
Severin Glöckner
ccaa9b75ed Micro AI Demos: save maps in new format
[ci skip]

(cherry-picked from commit c5d3539880)
2018-10-07 03:25:08 +00:00
mattsc
c5e41497e1 generic_recruit_engine: remove unnecessary variable assignment
(cherry-picked from commit a781139536)
2018-10-07 03:24:56 +00:00