You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scan the src/engine/core/handler(h/cpp) file and the src/engine/core/action_targeting(h/cpp) file. Rename the latter file to target_resolver. Rename its namaspace accordingly.
The handler.h file contains many functions like:
RoomRnum FindRoomRnum(CharData *ch, char *rawroomstr, int trig)
ObjData *SearchObjByRnum(ObjRnum rnum)
CharData *SearchCharInRoomByName(const char *name, RoomRnum room)
Move these functions to the target resolver.
Scan the code, especially interpreter.cpp, for other functions with similar tasks. Pay attention to the PerformImmortWhere function. 5. It's necessary to implement a general target resolving mechanism, focusing on classes like FoesRosterType.
The resolver, or one of its classes if there are multiple classes, receives instructions on where exactly to search (equipment, inventory, room, container, containers, world, and so on). The order in which to search is determined. Search by name or some other method. Are we looking for one target or several? Provide the ability to specify a custom filter, for example by passing a functor, as is done in FoesRoster. Keep in mind that the "enemy list" itself (not all characters in the room) is already a type of filter. That is, the module itself can have built-in standard filters like "enemies only," "allies only," or "visible only," so that each user of the class isn't forced to write their own filter. The output is a target or list of targets.
The class's users will be spells, abilities, commands, and generally anyone who needs to find a specific object (item, monster, player, etc.) or a list of objects in the world.
RoomRnum FindRoomRnum(CharData *ch, char *rawroomstr, int trig)
ObjData *SearchObjByRnum(ObjRnum rnum)
CharData *SearchCharInRoomByName(const char *name, RoomRnum room)