public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { if (affectedAgent.IsHuman) { switch (agentState) { case AgentState.Routed: this.BattleObserver.TroopNumberChanged(affectedAgent.Team.Side, affectedAgent.Origin.BattleCombatant, affectedAgent.Character, -1, numberRouted: 1); break; case AgentState.Unconscious: this.BattleObserver.TroopNumberChanged(affectedAgent.Team.Side, affectedAgent.Origin.BattleCombatant, affectedAgent.Character, -1, numberWounded: 1); break; case AgentState.Killed: this.BattleObserver.TroopNumberChanged(affectedAgent.Team.Side, affectedAgent.Origin.BattleCombatant, affectedAgent.Character, -1, 1); break; default: throw new ArgumentOutOfRangeException(nameof(agentState), (object)agentState, (string)null); } ++this._removedAgentCountForSides[(int)affectedAgent.Team.Side]; } if (affectorAgent == null || !affectorAgent.IsHuman || !affectedAgent.IsHuman || agentState != AgentState.Unconscious && agentState != AgentState.Killed) { return; } this.BattleObserver.TroopNumberChanged(affectorAgent.Team.Side, affectorAgent.Origin.BattleCombatant, affectorAgent.Character, killCount: 1); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { if (affectedAgent.Formation == null) { return; } if (this._casualtyCounts.ContainsKey(affectedAgent.Formation)) { this._casualtyCounts[affectedAgent.Formation]++; } else { this._casualtyCounts[affectedAgent.Formation] = 1; } if (this._powerLoss.ContainsKey(affectedAgent.Formation)) { this._powerLoss[affectedAgent.Formation] += affectedAgent.Character.GetPower(); } else { this._powerLoss[affectedAgent.Formation] = affectedAgent.Character.GetPower(); } }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { this.OnAgentWentInOrRemoved(affectedAgent, true); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { VictoryComponent component = affectedAgent.GetComponent <VictoryComponent>(); if (component == null) { return; } affectedAgent.RemoveComponent((AgentComponent)component); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { base.OnAgentRemoved(affectedAgent, affectorAgent, agentState, killingBlow); if (!GameNetwork.IsServer || this.CurrentMultiplayerState == MissionLobbyComponent.MultiplayerGameState.Ending || agentState != AgentState.Killed && agentState != AgentState.Unconscious && agentState != AgentState.Routed || (affectedAgent == null || !affectedAgent.IsHuman)) { return; } MissionPeer assistorPeer = affectorAgent?.MissionPeer != null?this.RemoveHittersAndGetAssistorPeer(affectorAgent.MissionPeer, affectedAgent) : (MissionPeer)null; if (affectedAgent.MissionPeer != null) { this.OnPlayerDies(affectedAgent.MissionPeer, assistorPeer); } else { this.OnBotDies(affectedAgent, assistorPeer); } if (affectorAgent == null || !affectorAgent.IsHuman) { return; } if (affectorAgent != affectedAgent) { if (affectorAgent.MissionPeer != null) { this.OnPlayerKills(affectorAgent.MissionPeer, affectedAgent, assistorPeer); } else { this.OnBotKills(affectorAgent, affectedAgent); } } else { if (affectorAgent.MissionPeer == null) { return; } affectorAgent.MissionPeer.Score -= this._gameMode.GetScoreForKill(affectedAgent); this._missionScoreboardComponent.PlayerPropertiesChanged(affectorAgent.MissionPeer.GetNetworkPeer()); GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(affectorAgent.MissionPeer.GetNetworkPeer(), affectedAgent.MissionPeer.GetNetworkPeer(), affectorAgent.MissionPeer.KillCount, affectorAgent.MissionPeer.AssistCount, affectorAgent.MissionPeer.DeathCount, affectorAgent.MissionPeer.Score)); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None); } }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { Agent captain = affectedAgent?.Formation?.Captain; if (captain == null || captain != affectedAgent) { return; } Agent bestCaptain = this.FindBestCaptain(affectedAgent.Formation); affectedAgent.Formation.Captain = bestCaptain; }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { if (affectorAgent == null || affectedAgent == null || (!affectorAgent.IsHuman || !affectedAgent.IsHuman) || agentState != AgentState.Killed && agentState != AgentState.Unconscious) { return; } bool flag1 = affectorAgent != null && affectorAgent.Team.IsPlayerTeam; bool flag2 = affectorAgent != null && affectorAgent.IsMainAgent; HighlightsController.Highlight highlight = new HighlightsController.Highlight(); highlight.Start = Mission.Current.Time; highlight.End = Mission.Current.Time; bool flag3 = false; if (flag2 | flag1 && (killingBlow.WeaponRecordWeaponFlags.HasAllFlags <WeaponFlags>(WeaponFlags.Burning) || killingBlow.WeaponRecordWeaponFlags.HasAllFlags <WeaponFlags>(WeaponFlags.AffectsArea))) { highlight.HighlightType = this._highlightsController.GetHighlightTypeWithId("hlid_wall_break_kill"); flag3 = true; } MBReadOnlyList <Agent> teamAgents1 = affectedAgent.Team?.TeamAgents; bool flag4 = teamAgents1 == null || teamAgents1.Any <Agent>((Func <Agent, bool>)(agent => agent.State != AgentState.Killed && agent.State != AgentState.Unconscious)); if (!flag4 && flag2 | flag1) { highlight.HighlightType = this._highlightsController.GetHighlightTypeWithId("hlid_kill_last_enemy_on_battlefield"); flag3 = true; } if (flag2) { MBReadOnlyList <Agent> teamAgents2 = affectorAgent.Team?.TeamAgents; if ((teamAgents2 == null ? 1 : (teamAgents2.Any <Agent>((Func <Agent, bool>)(agent => !agent.IsMainAgent && agent.State != AgentState.Killed && agent.State != AgentState.Unconscious)) ? 1 : 0)) == 0 && !flag4) { highlight.HighlightType = this._highlightsController.GetHighlightTypeWithId("hlid_win_battle_as_last_man_standing"); flag3 = true; } } if (!flag3) { return; } this._highlightsController.SaveHighlight(highlight, affectedAgent.Position); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { if (!affectedAgent.IsHuman) { return; } MissionMultiplayerDuel.DuelInfo duel = this._activeDuels.Where <MissionMultiplayerDuel.DuelInfo>((Func <MissionMultiplayerDuel.DuelInfo, bool>)(d => d.RequesteeAgent == affectedAgent || d.RequesterAgent == affectedAgent || d.RequesteeAgent == affectorAgent || d.RequesterAgent == affectorAgent)).FirstOrDefault <MissionMultiplayerDuel.DuelInfo>(); if (duel == null) { return; } this.EndDuel(duel); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { if (!this.IsRoundInProgress || affectedAgent.IsMount) { return; } Team team = affectedAgent.Team; if (this.IsGameModeUsingGold) { this.UpdateTeamPowerBasedOnGold(team); } else { this.UpdateTeamPowerBasedOnTroopCount(team); } }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { bool flag1 = affectorAgent?.Team != null && affectorAgent.Team.IsPlayerTeam; bool flag2 = affectorAgent != null && affectorAgent.IsMainAgent; if (affectorAgent == null || affectedAgent == null || (!affectorAgent.IsHuman || !affectedAgent.IsHuman) || agentState != AgentState.Killed && agentState != AgentState.Unconscious) { return; } if ((flag2 | flag1 && !affectedAgent.Team.IsPlayerAlly && killingBlow.WeaponClass == 12 || killingBlow.WeaponClass == 13) && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_archer_salvo_kills"), affectedAgent.Position)) { if (!this._isArcherSalvoHappening) { this._archerSalvoKillTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 4.0 < (double)Mission.Current.Time)); } this._archerSalvoKillTimes.Add(Mission.Current.Time); if (this._archerSalvoKillTimes.Count >= 5) { this._isArcherSalvoHappening = true; } } if (flag2 && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_killing_spree"), affectedAgent.Position)) { if (!this._isKillingSpreeHappening) { this._playerKillTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 10.0 < (double)Mission.Current.Time)); } this._playerKillTimes.Add(Mission.Current.Time); if (this._playerKillTimes.Count >= 4) { this._isKillingSpreeHappening = true; } } HighlightsController.Highlight highlight = new HighlightsController.Highlight(); highlight.Start = Mission.Current.Time; highlight.End = Mission.Current.Time; bool flag3 = false; if (flag2 && killingBlow.WeaponRecordWeaponFlags.HasAllFlags <WeaponFlags>(WeaponFlags.Burning)) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_burning_ammunition_kill"); flag3 = true; } if (flag2 && killingBlow.IsMissile && killingBlow.BoneIndex == (sbyte)13) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_headshot_kill"); flag3 = true; } if (flag2 && killingBlow.IsMissile && (affectedAgent.HasMount && affectedAgent.IsDoingPassiveAttack) && (killingBlow.WeaponClass == 19 || killingBlow.WeaponClass == 20)) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_throwing_weapon_kill_against_charging_enemy"); flag3 = true; } if (this._isFirstImpact && affectorAgent.Formation != null && (affectorAgent.Formation.IsCavalry() && affectorAgent.Formation.MovementOrder == (object)MovementOrder.MovementOrderCharge) && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"), affectedAgent.Position)) { this._cavalryChargeHitTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 3.0 < (double)Mission.Current.Time)); this._cavalryChargeHitTimes.Add(Mission.Current.Time); if (this._cavalryChargeHitTimes.Count >= 5) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"); highlight.Start = this._cavalryChargeHitTimes[0]; highlight.End = this._cavalryChargeHitTimes.Last <float>(); flag3 = true; this._isFirstImpact = false; this._cavalryChargeHitTimes.Clear(); } } if (!flag3) { return; } this.SaveHighlight(highlight, affectedAgent.Position); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { base.OnAgentRemoved(affectedAgent, affectorAgent, agentState, blow); if (this.UseGold() && affectorAgent != null && (affectedAgent != null && affectedAgent.IsHuman) && (blow.DamageType != DamageTypes.Invalid && (agentState == AgentState.Unconscious || agentState == AgentState.Killed))) { Agent.Hitter assistingHitter = affectedAgent.GetAssistingHitter(affectorAgent.MissionPeer); MultiplayerClassDivisions.MPHeroClass classForCharacter = MultiplayerClassDivisions.GetMPHeroClassForCharacter(affectedAgent.Character); if (affectorAgent.MissionPeer != null && affectorAgent.MissionPeer.Representative is FlagDominationMissionRepresentative representative10) { int gainsFromKillData = representative10.GetGoldGainsFromKillData(MPPerkObject.GetPerkHandler(affectorAgent.MissionPeer), MPPerkObject.GetPerkHandler(assistingHitter?.HitterPeer), classForCharacter, false); if (gainsFromKillData > 0) { this.ChangeCurrentGoldForPeer(affectorAgent.MissionPeer, representative10.Gold + gainsFromKillData); } } if (assistingHitter?.HitterPeer != null && !assistingHitter.IsFriendlyHit && assistingHitter.HitterPeer.Representative is FlagDominationMissionRepresentative representative11) { int gainsFromKillData = representative11.GetGoldGainsFromKillData(MPPerkObject.GetPerkHandler(affectorAgent.MissionPeer), MPPerkObject.GetPerkHandler(assistingHitter.HitterPeer), classForCharacter, false); if (gainsFromKillData > 0) { this.ChangeCurrentGoldForPeer(assistingHitter.HitterPeer, representative11.Gold + gainsFromKillData); } } if (affectedAgent.MissionPeer?.Team != null) { IEnumerable <(MissionPeer, int)> goldRewardsOnDeath = MPPerkObject.GetPerkHandler(affectedAgent.MissionPeer)?.GetTeamGoldRewardsOnDeath(); if (goldRewardsOnDeath != null) { foreach ((MissionPeer peer6, int baseAmount6) in goldRewardsOnDeath) { if (baseAmount6 > 0 && peer6?.Representative is FlagDominationMissionRepresentative representative12) { int local_11 = representative12.GetGoldGainsFromAllyDeathReward(baseAmount6); if (local_11 > 0) { this.ChangeCurrentGoldForPeer(peer6, representative12.Gold + local_11); } } } } } } if (affectedAgent.IsPlayerControlled) { affectedAgent.MissionPeer.GetComponent <FlagDominationMissionRepresentative>().UpdateSelectedClassServer((Agent)null); } else { if (MultiplayerOptions.OptionType.NumberOfBotsPerFormation.GetIntValue() <= 0 || this.WarmupComponent != null && this.WarmupComponent.IsInWarmup || (affectedAgent.IsMount || affectedAgent.OwningAgentMissionPeer == null || (affectedAgent.Formation == null || affectedAgent.Formation.CountOfUnits != 1))) { return; } if (!GameNetwork.IsDedicatedServer) { MatrixFrame cameraFrame = Mission.Current.GetCameraFrame(); Vec3 position = cameraFrame.origin + cameraFrame.rotation.u; MBSoundEvent.PlaySound(SoundEvent.GetEventIdFromString("event:/alerts/report/squad_wiped"), position); } GameNetwork.BeginBroadcastModuleEvent(); GameNetwork.WriteMessage((GameNetworkMessage) new FormationWipedMessage()); GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.ExcludeOtherTeamPlayers, affectedAgent.OwningAgentMissionPeer.GetNetworkPeer()); } }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow) { if (blow.DamageType == DamageTypes.Invalid || agentState != AgentState.Unconscious && agentState != AgentState.Killed || !affectedAgent.IsHuman) { return; } if (affectorAgent != null && affectorAgent.IsEnemyOf(affectedAgent)) { this._missionScoreboardComponent.ChangeTeamScore(affectorAgent.Team, this.GetScoreForKill(affectedAgent)); } else { this._missionScoreboardComponent.ChangeTeamScore(affectedAgent.Team, -this.GetScoreForKill(affectedAgent)); } MissionPeer missionPeer = affectedAgent.MissionPeer; if (missionPeer != null) { int num1 = 100; if (affectorAgent != affectedAgent) { List <MissionPeer>[] missionPeerListArray = new List <MissionPeer> [2]; for (int index = 0; index < missionPeerListArray.Length; ++index) { missionPeerListArray[index] = new List <MissionPeer>(); } foreach (NetworkCommunicator networkPeer in GameNetwork.NetworkPeers) { MissionPeer component = networkPeer.GetComponent <MissionPeer>(); if (component != null && component.Team != null && component.Team.Side != BattleSideEnum.None) { missionPeerListArray[(int)component.Team.Side].Add(component); } } int num2 = missionPeerListArray[1].Count - missionPeerListArray[0].Count; BattleSideEnum battleSideEnum = num2 == 0 ? BattleSideEnum.None : (num2 < 0 ? BattleSideEnum.Attacker : BattleSideEnum.Defender); if (battleSideEnum != BattleSideEnum.None && battleSideEnum == missionPeer.Team.Side) { int num3 = Math.Abs(num2); int count = missionPeerListArray[(int)battleSideEnum].Count; if (count > 0) { int num4 = num1 * num3 / 10 / count * 10; num1 += num4; } } } this.ChangeCurrentGoldForPeer(missionPeer, missionPeer.Representative.Gold + num1); } MultiplayerClassDivisions.MPHeroClass classForCharacter = MultiplayerClassDivisions.GetMPHeroClassForCharacter(affectedAgent.Character); Agent.Hitter assistingHitter = affectedAgent.GetAssistingHitter(affectorAgent?.MissionPeer); if (affectorAgent?.MissionPeer != null && affectorAgent != affectedAgent && !affectorAgent.IsFriendOf(affectedAgent)) { TeamDeathmatchMissionRepresentative representative = affectorAgent.MissionPeer.Representative as TeamDeathmatchMissionRepresentative; int dataAndUpdateFlags = representative.GetGoldGainsFromKillDataAndUpdateFlags(MPPerkObject.GetPerkHandler(affectorAgent.MissionPeer), MPPerkObject.GetPerkHandler(assistingHitter?.HitterPeer), classForCharacter, false, blow.IsMissile); this.ChangeCurrentGoldForPeer(affectorAgent.MissionPeer, representative.Gold + dataAndUpdateFlags); } if (assistingHitter?.HitterPeer != null && !assistingHitter.IsFriendlyHit) { TeamDeathmatchMissionRepresentative representative = assistingHitter.HitterPeer.Representative as TeamDeathmatchMissionRepresentative; int dataAndUpdateFlags = representative.GetGoldGainsFromKillDataAndUpdateFlags(MPPerkObject.GetPerkHandler(affectorAgent?.MissionPeer), MPPerkObject.GetPerkHandler(assistingHitter.HitterPeer), classForCharacter, true, blow.IsMissile); this.ChangeCurrentGoldForPeer(assistingHitter.HitterPeer, representative.Gold + dataAndUpdateFlags); } if (missionPeer?.Team == null) { return; } IEnumerable <(MissionPeer, int)> goldRewardsOnDeath = MPPerkObject.GetPerkHandler(missionPeer)?.GetTeamGoldRewardsOnDeath(); if (goldRewardsOnDeath == null) { return; } foreach ((MissionPeer peer, int baseAmount) in goldRewardsOnDeath) { if (peer?.Representative is TeamDeathmatchMissionRepresentative representative1) { int local_21 = representative1.GetGoldGainsFromAllyDeathReward(baseAmount); if (local_21 > 0) { this.ChangeCurrentGoldForPeer(peer, representative1.Gold + local_21); } } } }