M&B: Bannerlord 1.2.9
The horns sound, the ravens gather.
Loading...
Searching...
No Matches
TaleWorlds.MountAndBlade.Team Class Reference

Inherits TaleWorlds.Core.IMissionTeam.

Public Types

enum  TroopFilter {
  HighTier = 1 << 8 ,
  LowTier = 1 << 7 ,
  Mount = 1 << 6 ,
  Ranged = 1 << 5 ,
  Melee = 1 << 4 ,
  Shield = 1 << 3 ,
  Spear = 1 << 2 ,
  Thrown = 1 << 1 ,
  Armor = 1 << 0
}
 

Public Member Functions

 Team (MBTeam mbTeam, BattleSideEnum side, Mission mission, uint color=0xFFFFFFFF, uint color2=0xFFFFFFFF, Banner banner=null)
 
void UpdateCachedEnemyDataForFleeing ()
 
void Reset ()
 
void Clear ()
 
void AssignPlayerAsSergeantOfFormation (MissionPeer peer, FormationClass formationClass)
 
void AddTacticOption (TacticComponent tacticOption)
 
void RemoveTacticOption (Type tacticType)
 
void ClearTacticOptions ()
 
void ResetTactic ()
 
void AddTeamAI (TeamAIComponent teamAI, bool forceNotAIControlled=false)
 
void DelegateCommandToAI ()
 
void RearrangeFormationsAccordingToFilters (List< Tuple< Formation, int, TroopFilter, List< Agent > > > MassTransferData)
 
void OnDeployed ()
 
void Tick (float dt)
 
Formation GetFormation (FormationClass formationClass)
 
void SetIsEnemyOf (Team otherTeam, bool isEnemyOf)
 
bool IsEnemyOf (Team otherTeam)
 
bool IsFriendOf (Team otherTeam)
 
void AddAgentToTeam (Agent unit)
 
void RemoveAgentFromTeam (Agent unit)
 
void DeactivateAgent (Agent agent)
 
void OnAgentRemoved (Agent agent)
 
override string ToString ()
 
void OnMissionEnded ()
 
void TriggerOnFormationsChanged (Formation formation)
 
OrderController GetOrderControllerOf (Agent agent)
 
void ExpireAIQuerySystem ()
 
void SetPlayerRole (bool isPlayerGeneral, bool isPlayerSergeant)
 
bool HasAnyEnemyTeamsWithAgents (bool ignoreMountedAgents)
 
bool HasAnyFormationsIncludingSpecialThatIsNotEmpty ()
 
int GetFormationCount ()
 
int GetAIControlledFormationCount ()
 
Vec2 GetAveragePositionOfEnemies ()
 
Vec2 GetAveragePosition ()
 
WorldPosition GetMedianPosition (Vec2 averagePosition)
 
Vec2 GetWeightedAverageOfEnemies (Vec2 basePoint)
 

Static Public Member Functions

static bool DoesFirstFormationClassContainSecond (FormationClass f1, FormationClass f2)
 
static FormationClass GetFormationFormationClass (Formation f)
 
static FormationClass GetPlayerTeamFormationClass (Agent mainAgent)
 

Public Attributes

readonly MBTeam MBTeam
 

Properties

BattleSideEnum Side [get]
 
Mission Mission [get]
 
MBList< FormationFormationsIncludingEmpty [get]
 
MBList< FormationFormationsIncludingSpecialAndEmpty [get]
 
TeamAIComponent TeamAI [get]
 
bool IsPlayerTeam [get]
 
bool IsPlayerAlly [get]
 
bool IsDefender [get]
 
bool IsAttacker [get]
 
uint Color [get]
 
uint Color2 [get]
 
Banner Banner [get]
 
OrderController MasterOrderController [get]
 
OrderController PlayerOrderController [get]
 
TeamQuerySystem QuerySystem [get]
 
DetachmentManager DetachmentManager [get]
 
bool IsPlayerGeneral [get]
 
bool IsPlayerSergeant [get]
 
MBReadOnlyList< AgentActiveAgents [get]
 
MBReadOnlyList< AgentTeamAgents [get]
 
MBReadOnlyList< ValueTuple< float, WorldPosition, int, Vec2, Vec2, bool > > CachedEnemyDataForFleeing [get]
 Keeps a list of enemy data (can be agents or formations) to be used while computing team flee positions. Each tuple represents data for an enemy formation or an enemy agent without formation This is computed/cached only once each tick and only for those teams including retreating agents. Tuple entries are:
 
int TeamIndex [get]
 
float MoraleChangeFactor [get]
 
Formation GeneralsFormation [get, set]
 
Formation BodyGuardFormation [get, set]
 
Agent GeneralAgent [get, set]
 
IEnumerable< AgentHeroes [get]
 
bool HasBots [get]
 
Agent Leader [get]
 
static Team Invalid [get]
 
bool IsValid [get]
 
bool HasTeamAi [get]
 
- Properties inherited from TaleWorlds.Core.IMissionTeam

Events

Action< Team, FormationOnFormationsChanged
 
OnOrderIssuedDelegate OnOrderIssued
 
Action< FormationOnFormationAIActiveBehaviorChanged
 

Member Enumeration Documentation

◆ TroopFilter

Enumerator
HighTier 
LowTier 
Mount 
Ranged 
Melee 
Shield 
Spear 
Thrown 
Armor 

Constructor & Destructor Documentation

◆ Team()

TaleWorlds.MountAndBlade.Team.Team ( MBTeam mbTeam,
BattleSideEnum side,
Mission mission,
uint color = 0xFFFFFFFF,
uint color2 = 0xFFFFFFFF,
Banner banner = null )

Member Function Documentation

◆ UpdateCachedEnemyDataForFleeing()

void TaleWorlds.MountAndBlade.Team.UpdateCachedEnemyDataForFleeing ( )

◆ Reset()

void TaleWorlds.MountAndBlade.Team.Reset ( )

◆ Clear()

void TaleWorlds.MountAndBlade.Team.Clear ( )

◆ DoesFirstFormationClassContainSecond()

static bool TaleWorlds.MountAndBlade.Team.DoesFirstFormationClassContainSecond ( FormationClass f1,
FormationClass f2 )
static

◆ GetFormationFormationClass()

static FormationClass TaleWorlds.MountAndBlade.Team.GetFormationFormationClass ( Formation f)
static

◆ GetPlayerTeamFormationClass()

static FormationClass TaleWorlds.MountAndBlade.Team.GetPlayerTeamFormationClass ( Agent mainAgent)
static

◆ AssignPlayerAsSergeantOfFormation()

void TaleWorlds.MountAndBlade.Team.AssignPlayerAsSergeantOfFormation ( MissionPeer peer,
FormationClass formationClass )

◆ AddTacticOption()

void TaleWorlds.MountAndBlade.Team.AddTacticOption ( TacticComponent tacticOption)

◆ RemoveTacticOption()

void TaleWorlds.MountAndBlade.Team.RemoveTacticOption ( Type tacticType)

◆ ClearTacticOptions()

void TaleWorlds.MountAndBlade.Team.ClearTacticOptions ( )

◆ ResetTactic()

void TaleWorlds.MountAndBlade.Team.ResetTactic ( )

◆ AddTeamAI()

void TaleWorlds.MountAndBlade.Team.AddTeamAI ( TeamAIComponent teamAI,
bool forceNotAIControlled = false )

◆ DelegateCommandToAI()

void TaleWorlds.MountAndBlade.Team.DelegateCommandToAI ( )

◆ RearrangeFormationsAccordingToFilters()

void TaleWorlds.MountAndBlade.Team.RearrangeFormationsAccordingToFilters ( List< Tuple< Formation, int, TroopFilter, List< Agent > > > MassTransferData)

◆ OnDeployed()

void TaleWorlds.MountAndBlade.Team.OnDeployed ( )

◆ Tick()

void TaleWorlds.MountAndBlade.Team.Tick ( float dt)

◆ GetFormation()

Formation TaleWorlds.MountAndBlade.Team.GetFormation ( FormationClass formationClass)

◆ SetIsEnemyOf()

void TaleWorlds.MountAndBlade.Team.SetIsEnemyOf ( Team otherTeam,
bool isEnemyOf )

◆ IsEnemyOf()

bool TaleWorlds.MountAndBlade.Team.IsEnemyOf ( Team otherTeam)

◆ IsFriendOf()

bool TaleWorlds.MountAndBlade.Team.IsFriendOf ( Team otherTeam)

◆ AddAgentToTeam()

void TaleWorlds.MountAndBlade.Team.AddAgentToTeam ( Agent unit)

◆ RemoveAgentFromTeam()

void TaleWorlds.MountAndBlade.Team.RemoveAgentFromTeam ( Agent unit)

◆ DeactivateAgent()

void TaleWorlds.MountAndBlade.Team.DeactivateAgent ( Agent agent)

◆ OnAgentRemoved()

void TaleWorlds.MountAndBlade.Team.OnAgentRemoved ( Agent agent)

◆ ToString()

override string TaleWorlds.MountAndBlade.Team.ToString ( )

◆ OnMissionEnded()

void TaleWorlds.MountAndBlade.Team.OnMissionEnded ( )

◆ TriggerOnFormationsChanged()

void TaleWorlds.MountAndBlade.Team.TriggerOnFormationsChanged ( Formation formation)

◆ GetOrderControllerOf()

OrderController TaleWorlds.MountAndBlade.Team.GetOrderControllerOf ( Agent agent)

◆ ExpireAIQuerySystem()

void TaleWorlds.MountAndBlade.Team.ExpireAIQuerySystem ( )

◆ SetPlayerRole()

void TaleWorlds.MountAndBlade.Team.SetPlayerRole ( bool isPlayerGeneral,
bool isPlayerSergeant )

◆ HasAnyEnemyTeamsWithAgents()

bool TaleWorlds.MountAndBlade.Team.HasAnyEnemyTeamsWithAgents ( bool ignoreMountedAgents)

◆ HasAnyFormationsIncludingSpecialThatIsNotEmpty()

bool TaleWorlds.MountAndBlade.Team.HasAnyFormationsIncludingSpecialThatIsNotEmpty ( )

◆ GetFormationCount()

int TaleWorlds.MountAndBlade.Team.GetFormationCount ( )

◆ GetAIControlledFormationCount()

int TaleWorlds.MountAndBlade.Team.GetAIControlledFormationCount ( )

◆ GetAveragePositionOfEnemies()

Vec2 TaleWorlds.MountAndBlade.Team.GetAveragePositionOfEnemies ( )

◆ GetAveragePosition()

Vec2 TaleWorlds.MountAndBlade.Team.GetAveragePosition ( )

◆ GetMedianPosition()

WorldPosition TaleWorlds.MountAndBlade.Team.GetMedianPosition ( Vec2 averagePosition)

◆ GetWeightedAverageOfEnemies()

Vec2 TaleWorlds.MountAndBlade.Team.GetWeightedAverageOfEnemies ( Vec2 basePoint)

Member Data Documentation

◆ MBTeam

readonly MBTeam TaleWorlds.MountAndBlade.Team.MBTeam

Property Documentation

◆ Side

BattleSideEnum TaleWorlds.MountAndBlade.Team.Side
get

◆ Mission

Mission TaleWorlds.MountAndBlade.Team.Mission
get

◆ FormationsIncludingEmpty

MBList<Formation> TaleWorlds.MountAndBlade.Team.FormationsIncludingEmpty
get

◆ FormationsIncludingSpecialAndEmpty

MBList<Formation> TaleWorlds.MountAndBlade.Team.FormationsIncludingSpecialAndEmpty
get

◆ TeamAI

TeamAIComponent TaleWorlds.MountAndBlade.Team.TeamAI
get

◆ IsPlayerTeam

bool TaleWorlds.MountAndBlade.Team.IsPlayerTeam
get

◆ IsPlayerAlly

bool TaleWorlds.MountAndBlade.Team.IsPlayerAlly
get

◆ IsDefender

bool TaleWorlds.MountAndBlade.Team.IsDefender
get

◆ IsAttacker

bool TaleWorlds.MountAndBlade.Team.IsAttacker
get

◆ Color

uint TaleWorlds.MountAndBlade.Team.Color
get

◆ Color2

uint TaleWorlds.MountAndBlade.Team.Color2
get

◆ Banner

Banner TaleWorlds.MountAndBlade.Team.Banner
get

◆ MasterOrderController

OrderController TaleWorlds.MountAndBlade.Team.MasterOrderController
get

◆ PlayerOrderController

OrderController TaleWorlds.MountAndBlade.Team.PlayerOrderController
get

◆ QuerySystem

TeamQuerySystem TaleWorlds.MountAndBlade.Team.QuerySystem
get

◆ DetachmentManager

DetachmentManager TaleWorlds.MountAndBlade.Team.DetachmentManager
get

◆ IsPlayerGeneral

bool TaleWorlds.MountAndBlade.Team.IsPlayerGeneral
get

◆ IsPlayerSergeant

bool TaleWorlds.MountAndBlade.Team.IsPlayerSergeant
get

◆ ActiveAgents

MBReadOnlyList<Agent> TaleWorlds.MountAndBlade.Team.ActiveAgents
get

◆ TeamAgents

MBReadOnlyList<Agent> TaleWorlds.MountAndBlade.Team.TeamAgents
get

◆ CachedEnemyDataForFleeing

MBReadOnlyList<ValueTuple<float, WorldPosition, int, Vec2, Vec2, bool> > TaleWorlds.MountAndBlade.Team.CachedEnemyDataForFleeing
get
  • MaxSpeed of enemy group
  • MedianPosition of enemy group
  • Size of enemy group (number of agents)
  • Line segment start position of enemy group/formation (if size > 0)
  • Line segment end position of enemy group/formation (if size > 0)
  • Whether if enemy is cavalry REMARK_ATES: This was used to be enemyData within Mission.cs... but moved here for optimization purposes as it can be computed once for each team with panicking formations and agents during pre-tick. This data can be re-used by panicking/retreating agents within this team but will be cleared every tick

◆ TeamIndex

int TaleWorlds.MountAndBlade.Team.TeamIndex
get

◆ MoraleChangeFactor

float TaleWorlds.MountAndBlade.Team.MoraleChangeFactor
get

◆ GeneralsFormation

Formation TaleWorlds.MountAndBlade.Team.GeneralsFormation
getset

◆ BodyGuardFormation

Formation TaleWorlds.MountAndBlade.Team.BodyGuardFormation
getset

◆ GeneralAgent

Agent TaleWorlds.MountAndBlade.Team.GeneralAgent
getset

◆ Heroes

IEnumerable<Agent> TaleWorlds.MountAndBlade.Team.Heroes
get

◆ HasBots

bool TaleWorlds.MountAndBlade.Team.HasBots
get

◆ Leader

Agent TaleWorlds.MountAndBlade.Team.Leader
get

◆ Invalid

Team TaleWorlds.MountAndBlade.Team.Invalid
staticget

◆ IsValid

bool TaleWorlds.MountAndBlade.Team.IsValid
get

◆ HasTeamAi

bool TaleWorlds.MountAndBlade.Team.HasTeamAi
get

Event Documentation

◆ OnFormationsChanged

Action<Team, Formation> TaleWorlds.MountAndBlade.Team.OnFormationsChanged

◆ OnOrderIssued

OnOrderIssuedDelegate TaleWorlds.MountAndBlade.Team.OnOrderIssued

◆ OnFormationAIActiveBehaviorChanged

Action<Formation> TaleWorlds.MountAndBlade.Team.OnFormationAIActiveBehaviorChanged