/// <summary> /// Returns the banner key for a Polybian unit according to the rotation /// </summary> /// <param name="agent"></param> /// <returns></returns> public string GetPolybianBannerForAgent(IBMBAgent agent) { string id = agent.Character.Id; List <string> troopBanners = _polybianDict[id].BannerCodes; int rotatedBanner = _polybianIdCount[id] % troopBanners.Count; return(troopBanners[rotatedBanner]); }
/// <summary> /// Counts an agent in for the Polybian banner rotation /// </summary> /// <param name="agent"></param> public void CountAgentForPolybian(IBMBAgent agent) { string id = agent.Character.Id; if (!_polybianIdCount.ContainsKey(id)) { _polybianIdCount.Add(id, 0); } _polybianIdCount[id]++; }
public bool AgentGetsFancyBanner(IBMBAgent agent) { if (!_settings.EnableFormationBanners || !agent.IsInPlayerParty) { return(false); } if (agent.Character.IsPlayerCharacter) { return(false); } if (_settings.AllowCompanions && _settings.CompanionsUseFormationBanners && agent.Character.Occupation == CharacterOccupation.Wanderer) { return(true); } if (agent.Character.IsHero) { return(false); } return(true); }
/// <summary> /// Decides if an agent qualifies for a banner based on settings and mission type /// </summary> /// <param name="agent"></param> /// <returns></returns> public bool AgentIsEligible(IBMBAgent agent) { if (_allowedBearerTypes.Contains(agent.Character)) { if (_settings.AllowBandits == BanditAssignMode.RecruitedOnly) { if (agent.Character.Occupation == CharacterOccupation.Bandit && !agent.ServesUnderLord) { return(false); } } if (_settings.AllowCaravanGuards == CaravanAssignMode.OnlyMasters && agent.IsInCaravanParty) { if (agent.IsCaravanPartyLeader) { return(true); } } if (_missionType == MissionType.FieldBattle || _missionType == MissionType.CustomBattle) { return(true); } else if (_settings.AllowSieges && _missionType == MissionType.Siege) { return((_settings.SiegeAttackersUseBanners && agent.IsAttacker) || (_settings.SiegeDefendersUseBanners && agent.IsDefender)); } else if (_settings.AllowHideouts && _missionType == MissionType.Hideout) { return((_settings.HideoutAttackersUseBanners && agent.IsAttacker) || (_settings.HideoutBanditsUseBanners && agent.IsDefender)); } } return(false); }
/// <summary> /// Keeps track of agents in dictionaries and decides if they get banners /// </summary> /// <param name="agent"></param> /// <returns>true if the agent should receive a banner</returns> public bool AgentGetsBanner(IBMBAgent agent) { string agentParty = agent.PartyName; IBMBCharacter agentCharacter = agent.Character; TroopSpecialization agentSpec = agent.Character.Type; FormationGroup agentFormation = agent.Formation; /* Caravan masters bypass count if they lead caravans */ if (_settings.AllowCaravanGuards == CaravanAssignMode.OnlyMasters && agent.IsInCaravanParty) { if (agent.IsCaravanPartyLeader) { CountBannerGivenToParty(agentParty); return(true); } return(false);//Other caravan guards in the caravan party don't get banner } /* Add to maps */ if (!_processedByTroop.ContainsKey(agentParty)) { _processedByTroop.Add(agentParty, new Dictionary <IBMBCharacter, List <IBMBAgent> >()); } if (!_processedByTroop[agentParty].ContainsKey(agentCharacter)) { _processedByTroop[agentParty].Add(agentCharacter, new List <IBMBAgent>()); } if (!_processedByFormation.ContainsKey(agentParty)) { _processedByFormation.Add(agentParty, new Dictionary <FormationGroup, List <IBMBAgent> >()); } if (!_processedByFormation[agentParty].ContainsKey(agentFormation)) { _processedByFormation[agentParty].Add(agentFormation, new List <IBMBAgent>()); } if (!_processedBySpec.ContainsKey(agentParty)) { _processedBySpec.Add(agentParty, new Dictionary <TroopSpecialization, List <IBMBAgent> >()); } if (!_processedBySpec[agentParty].ContainsKey(agentSpec)) { _processedBySpec[agentParty].Add(agentSpec, new List <IBMBAgent>()); } _processedBySpec[agentParty][agentSpec].Add(agent); _processedByFormation[agentParty][agentFormation].Add(agent); _processedByTroop[agentParty][agentCharacter].Add(agent); /* Give banner or skip */ //int processedTroops = _settings.UnitCountMode == UnitCountMode.Type ? _processedByType[agentParty][agentSpec].Count : _processedByTroop[agentParty][agentCharacter].Count; int processedTroops = GetProcessedTroopsByMode(agentParty, agentSpec, agentFormation, agentCharacter); if (agentCharacter.IsHero || processedTroops % _settings.BearerToTroopRatio == 0) { CountBannerGivenToParty(agentParty); return(true); } return(false); }
/// <summary> /// Checks if a given agent is present in the Polybian dictionary /// </summary> /// <param name="agent"></param> /// <returns></returns> public bool PolybianUnitExists(IBMBAgent agent) { return(_polybianDict.ContainsKey(agent.Character.Id)); }
public bool AgentGetsFancyShield(IBMBAgent agent) { return(_settings.FormationBannersUseInShields && AgentGetsFancyBanner(agent)); }