• Home
  • API reference
  • Source code
Show / Hide Table of Contents
  • osrlib.Controllers
    • GameManager
  • osrlib.Core
    • Ability
    • AbilityType
    • Adventure
    • Alignment
    • Being
    • BeingTargetingEventArgs
    • BeingTargetingEventHandler
    • CharacterClass
    • Dungeon
    • Encounter
    • GameAction
    • GameActionEventArgs
    • GameActionEventHandler
    • GamePosition
    • Modifier
    • Party
    • Quest
    • User
    • Weapon
    • WeaponType
  • osrlib.Dice
    • DiceHand
    • DiceRoll
    • DiceRolledEventArgs
    • DiceRolledEventHandler
    • Die
  • osrlib.SaveLoad
    • SaveLoadLocal
    • SaveType
  • osrlib.Tests
    • CoreRulesTests
    • DiceTests
    • PartyGenerator
    • ReadMeTests
    • SaveLoadTests
    • SteppedBattleTests
  • osrlib.Utility
    • Randomizer

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
System.Object
Encounter
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: osrlib.Core
Assembly: osrlib.Core.dll
Syntax
public class Encounter

Properties

| Improve this Doc View Source

AdventuringParty

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

EncounterParty

Gets or sets the Party in this encounter.

Declaration
public Party EncounterParty { get; set; }
Property Value
Type Description
Party
| Improve this Doc View Source

IsEncounterEnded

Gets whether the Encounter has been completed.

Declaration
public bool IsEncounterEnded { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsEncounterStarted

Gets whether the Encounter has been started.

Declaration
public bool IsEncounterStarted { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

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 Source

PerformStep()

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 Source

EncounterEnded

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
| Improve this Doc View Source

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
  • Improve this Doc
  • View Source
Back to top Generated by DocFX