Class Encounter
The Encounter contains a Party, can accept a Party to initiate a battle, and may contain a reward. The encounter also handles creating GameActions and assigning targets.
Inheritance
Inherited Members
Namespace: osrlib.Core
Assembly: osrlib.Core.dll
Syntax
public class Encounter
Properties
| Improve this Doc View SourceAdventuringParty
Gets the Party of adventurers for the encounter.
Declaration
public Party AdventuringParty { get; }
Property Value
Type | Description |
---|---|
Party |
Remarks
This is typically the party controlled by the player.
AutoBattleEnabled
Gets or sets a value that specifies whether the Encounter resolves all GameActions between Beings in the Encounter until one side is defeated.
Declaration
public bool AutoBattleEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EncounterParty
Gets or sets the Party in this encounter.
Declaration
public Party EncounterParty { get; set; }
Property Value
Type | Description |
---|---|
Party |
IsEncounterEnded
Gets whether the Encounter has been completed.
Declaration
public bool IsEncounterEnded { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEncounterStarted
Gets whether the Encounter has been started.
Declaration
public bool IsEncounterStarted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Position
Gets or sets the position within the Dungeon of this Encounter.
Declaration
public GamePosition Position { get; set; }
Property Value
Type | Description |
---|---|
GamePosition |
Methods
| Improve this Doc View SourcePerformStep()
Moves the Encounter forward one step by dequeuing an attacker and adding as potential targets the opposing party's living members.
Declaration
public void PerformStep()
Remarks
This method first fills the Encounter's attack queue if it's empty, then dequeues a Being and populates its PotentialTargets collection with living Beings from the opposing party. Doing so raises its PotentialTargetsAdded event which allows subscribers (such as a GUI application) to prompt for target selection. Targets are selected by adding calling SelectTarget(Being)"/> method.
SetAdventuringParty(Party)
Adds the specified Party of adventurers that will perform GameActions on the EncounterParty.
Declaration
public void SetAdventuringParty(Party adventurers)
Parameters
Type | Name | Description |
---|---|---|
Party | adventurers | The Party of adventurers to act upon the EncounterParty in this Encounter. |
StartEncounter()
Starts the Encounter. To resolve the Encounter, subscribe to all party members' PotentialTargetsAdded event, and then call PerformStep() to move the Encounter forward until the EncounterEnded is raised.
Declaration
public void StartEncounter()
Remarks
Before calling StartEncounter(), subscribe to each party members'
PotentialTargetsAdded event to be notified when the caller should select a
target and subsequently call PerformAction(). After PerformAction has been called, check
IsEncounterEnded before calling PerformStep again. If AutoBattleEnabled is true
, this will
initiate resolution of the full Encounter (e.g. resolve all combat between Encounter parties).
Events
| Improve this Doc View SourceEncounterEnded
Event raised when one Party within the encounter is determined the victor, or the encounter is stopped in some other manner.
Declaration
public event EventHandler EncounterEnded
Event Type
Type | Description |
---|---|
System.EventHandler |
EncounterStarted
Event raised when a Party is added to this encounter and GameActions begin.
Declaration
public event EventHandler EncounterStarted
Event Type
Type | Description |
---|---|
System.EventHandler |