evennia / evennia

Python MUD/MUX/MUSH/MU* development system
http://www.evennia.com
BSD 3-Clause "New" or "Revised" License
1.8k stars 698 forks source link

[Documentation] Inconsistent sides lists in turn-based combat tutorial #3199

Closed InspectorCaracal closed 1 year ago

InspectorCaracal commented 1 year ago

Existing page / new

Turn-based combat, getting sides

Documentation issue

As the example code stands, the combatant is included in the allies list in PvP, but not included anywhere for other cases. Based on the combat-over check, it seems as though the combatant is expected to be included in allies, but either way it should be consistent between the two situations.

Suggested change

In the NPCs VS PCs situation, it shouldn't be necessary to filter the combatant from either list - they should probably be simple assignments.

Griatch commented 1 year ago

The get_sides method was intended to ignore the combatant in the allies return; so it's the PvP case that is wrong. Looking over this though, having to remember that the caller is not included in the allies add extra complexity and makes it harder to reason around this method. So I have refactored the code (and the tutorial) to consistently include the combatant in the allies return list.