Skip to content

Commit

Permalink
During allies' turns, their units' orbs show the move status (#1424)
Browse files Browse the repository at this point in the history
Instead of using the allied orb during their turn, the unmoved, moved and
partial orbs are shown. The player's own units will be shown with the moved orb
during the ally's turn, which matches the previous behavior. This is intended for
co-operative MP campaigns, where it will make it easier for players to discuss
possible moves. The UX is also visible in SP scenarios with allied sides, HttT's
first scenario is an easy place to see what it does.

If another status is added to the orb_status enum, this code is likely to
support it with no changes needed for the parts in this commit. For example,
issue #5155's proposed orb_status::disengaged has been tested with this.

Updated the documentation about orb colors. In these docs I've moved all of
the images to a single line above the bullet-pointed list, as otherwise the
layout looked bad once a line wrapped - the first line appeared
horizontally-aligned with the center of the image, the second started under the
image.

Added documentation about the delay in multiplayer games, as the purpose of this
orb-coloring feature is to assist discussion in multiplayer games.
  • Loading branch information
stevecotton committed Oct 17, 2020
1 parent 934cae6 commit b38d272
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -3,6 +3,7 @@
### Language and i18n
### Lua API
### Multiplayer
* During allies' turns, use orb colors to show which ones can still move (issue #1424). Also enabled for allied AI sides in singleplayer.
### Terrain
### Units
### User interface
Expand Down
22 changes: 15 additions & 7 deletions data/core/help.cfg
Expand Up @@ -277,7 +277,11 @@ To see where the enemy can move to during their next turn, press Ctrl-v or Cmd-v
title= _ "Shroud and Fog of War"
text= _ "In some scenarios, parts of the map will be hidden from you. There are two mechanisms that can be used separately or together. The <italic>text='shroud'</italic> hides both the terrain and any units at a location. However, once it is cleared, you can always see that location. The <italic>text='fog of war'</italic> only hides units and ownership of villages (other than by you or your allies). The fog of war is cleared temporarily when you have units nearby, but returns when they leave. Both the shroud and the fog of war are cleared by units. Each unit clears locations adjacent to those within one turn’s move (ignoring zones of control and enemy units).

Normally you can undo a unit’s movement, as long as an event with a randomized result has not occurred, such as combat or recruitment (as most units receive random traits when recruited). Exploring hidden terrain by clearing shroud or fog will also prevent undos to a previous state. You may wish to activate <bold>text='Delay Shroud Updates'</bold> in the actions menu. This will prevent units from clearing shroud or fog until the next randomized event or a manual update via <bold>text='Update Shroud Now'</bold> (or the end of your turn) and thereby preserve your ability to undo movement."
Normally you can undo a unit’s movement, as long as an event with a randomized result has not occurred, such as combat or recruitment (as most units receive random traits when recruited). Exploring hidden terrain by clearing shroud or fog will also prevent undos to a previous state. You may wish to activate <bold>text='Delay Shroud Updates'</bold> in the actions menu. This will prevent units from clearing shroud or fog until the next randomized event or a manual update via <bold>text='Update Shroud Now'</bold> (or the end of your turn) and thereby preserve your ability to undo movement." + "

" + _ "<header>text='Multiplayer and undo'</header>" + "

" + _ "In multiplayer games, moves that have been sent to the network can’t be undone; the game delays sending data to try to preserve your undo ability. When discussing with teammates, remember that the other players are usually looking at a snapshot from the time of the last combat or fog-revealing move. Chat messages and map labels are sent immediately, however they don’t cause the undoable moves to be sent."
[/topic]
# wmllint: markcheck on

Expand Down Expand Up @@ -376,13 +380,17 @@ If a strike is determined to hit, it will always do at least 1 point of damage.
[topic]
id=orbs
title= _ "Orbs"
text= _ "On top of the energy bar shown next to each unit of yours is an orb. For units you control, this orb is:" + "
text= _ "There are colored indicators above the energy bars of some units, consisting of a colored orb and (for leaders) a crown." + "
<img>src=help/orb-green.png align=here</img> <img>src=help/orb-yellow.png align=here</img> <img>src=help/orb-red.png align=here</img> <img>src=help/orb-blue.png align=here</img> <img>src=help/orb-none.png align=here</img>
<img>src=help/orb-green.png align=here</img>" + _ " green if it hasn’t moved this turn," + "
<img>src=help/orb-yellow.png align=here</img>" + _ " yellow if it has moved, but could still move further or attack, or" + "
<img>src=help/orb-red.png align=here</img>" + _ " red if it can no longer move or attack, or the user ended the unit’s turn." + "
<img>src=help/orb-blue.png align=here</img>" + _ " blue if the unit is an ally you do not control." + "
<img>src=help/orb-none.png align=here</img>" + _ " Enemy units have no orb on top of their energy bar."
" + _ "The orbs show whether the unit can move, and the standard colors are:" + "
" + _ "• <bold>text='Green'</bold> if it hasn’t moved this turn." + "
" + _ "• <bold>text='Yellow'</bold> if it has moved, but could still move further or attack." + "
" + _ "• <bold>text='Red'</bold> if it can no longer move or attack.
• Red is also used after the ‘end unit turn’ command, and when a unit is in the middle of a multi-turn move (has been told to move further than it can in the current turn)." + "
" + _ "• <bold>text='Blue'</bold> for allied units. During the ally’s own turn, their units will be shown with the green/yellow/red colors; however their moves, and the corresponding orb changes, are delayed as explained in <ref>dst='shroud_and_fog' text='Shroud and Fog of War'</ref>." + "
" + _ "• Enemy units normally don’t have orbs, however these can be enabled in the advanced preference “Customize orb colors”."
[/topic]
# wmllint: markcheck on

Expand Down
22 changes: 15 additions & 7 deletions src/units/drawer.cpp
Expand Up @@ -252,13 +252,21 @@ void unit_drawer::redraw_unit (const unit & u) const

using namespace orb_status_helper;
std::unique_ptr<image::locator> orb_img = nullptr;
if(std::size_t(side) != viewing_team + 1) {
if(viewing_team_ref.is_enemy(side)) {
if(preferences::show_enemy_orb() && !u.incapacitated())
orb_img = get_orb_image(orb_status::enemy);
} else if(preferences::show_allied_orb())
orb_img = get_orb_image(orb_status::allied);
} else if(playing_team == viewing_team && !u.user_end_turn()) {
if(viewing_team_ref.is_enemy(side)) {
if(preferences::show_enemy_orb() && !u.incapacitated())
orb_img = get_orb_image(orb_status::enemy);
} else if(static_cast<std::size_t>(side) != playing_team + 1) {
// We're looking at either the player's own unit or an ally's unit, but either way it
// doesn't belong to the playing_team and isn't expected to move until after its next
// turn refresh.
auto os = orb_status::moved;
if(static_cast<std::size_t>(side) != viewing_team + 1)
os = orb_status::allied;
if(prefs_show_orb(os))
orb_img = get_orb_image(os);
} else {
// We're looking at either the player's own unit, or an ally's unit, during the unit's
// owner's turn.
auto os = dc.unit_orb_status(u);
if(prefs_show_orb(os))
orb_img = get_orb_image(os);
Expand Down

0 comments on commit b38d272

Please sign in to comment.