private void AddSpecialAttackDamageBuff(SpecialAttack specialAttack, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.SquadWars); }
public static void AddWarBuffs(BattleType battleType, List <string> attackerBuffs, List <string> defenderBuffs) { BuffController buffController = Service.BuffController; buffController.ClearWarBuffs(); if (battleType != BattleType.PvpAttackSquadWar && battleType != BattleType.PveBuffBase) { return; } StaticDataController staticDataController = Service.StaticDataController; if (attackerBuffs != null) { int i = 0; int count = attackerBuffs.Count; while (i < count) { WarBuffVO warBuff = staticDataController.Get <WarBuffVO>(attackerBuffs[i]); buffController.AddAttackerWarBuff(warBuff); i++; } } if (battleType != BattleType.PveBuffBase && defenderBuffs != null) { int j = 0; int count2 = defenderBuffs.Count; while (j < count2) { WarBuffVO warBuff2 = staticDataController.Get <WarBuffVO>(defenderBuffs[j]); buffController.AddDefenderWarBuff(warBuff2); j++; } } }
private static void AddBuffIcon(AbstractUXList list, string buffBaseId, int order, StaticDataController dc) { WarBuffVO warBuffVO = dc.Get <WarBuffVO>(buffBaseId); UXElement uXElement = list.CloneTemplateItem(buffBaseId); UXSprite uXSprite = uXElement as UXSprite; if (uXSprite != null) { uXSprite.SpriteName = warBuffVO.BuffIcon; } list.AddItem(uXElement, order); }
private static void AddWarBuffAssets(List <string> warBuffs, List <IAssetVO> assets, IDataController dc) { if (warBuffs != null) { int i = 0; int count = warBuffs.Count; while (i < count) { WarBuffVO warBuffVO = dc.Get <WarBuffVO>(warBuffs[i]); ProjectileUtils.AddBuffProjectileAssets(warBuffVO.TroopBuffUid, assets, dc); ProjectileUtils.AddBuffProjectileAssets(warBuffVO.BuildingBuffUid, assets, dc); i++; } } }
private void ApplyEntityWarBuffs(SmartEntity entity) { TeamComponent teamComp = entity.TeamComp; if (teamComp == null) { return; } TeamType teamType = teamComp.TeamType; List <WarBuffVO> listOfWarBuffsBasedOnTeam = this.GetListOfWarBuffsBasedOnTeam(teamType); int num = 0; if (listOfWarBuffsBasedOnTeam != null) { num = listOfWarBuffsBasedOnTeam.Count; } if (num == 0) { return; } for (int i = 0; i < num; i++) { WarBuffVO warBuffVO = listOfWarBuffsBasedOnTeam[i]; switch (warBuffVO.BuffType) { case SquadWarBuffType.ShieldRegeneration: this.AddShieldRegenerationWarBuff(entity, warBuffVO); break; case SquadWarBuffType.HealthRegeneration: this.AddHealthRegenerationWarBuff(entity, warBuffVO); break; case SquadWarBuffType.MaxHealth: this.AddMaxHealthWarBuff(entity, warBuffVO); break; case SquadWarBuffType.VehicleDamage: this.AddVehicleDamageBuff(entity, warBuffVO); break; case SquadWarBuffType.InfantryDamage: this.AddInfantryDamageBuff(entity, warBuffVO); break; } } }
private void AddHealthRegenerationWarBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; TroopComponent troopComp = entity.TroopComp; bool flag = false; BuffTypeVO buffType = null; if (troopComp != null) { buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); flag = (troopComp.TroopType.Type == TroopType.Infantry); } if (flag) { this.TryAddBuffStack(entity, buffType, ArmorType.Infantry, BuffVisualPriority.SquadWars, entity); } }
private void AddMaxHealthWarBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuildingComponent buildingComp = entity.BuildingComp; if (buildingComp == null) { return; } bool flag = buildingComp.BuildingType.Type == BuildingType.HQ || buildingComp.BuildingType.Type == BuildingType.Wall; HealthComponent healthComp = entity.HealthComp; if (flag && healthComp != null) { BuffTypeVO buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.BuildingBuffUid); this.TryAddBuffStack(entity, buffType, GameUtils.DeduceArmorType(entity), BuffVisualPriority.SquadWars, entity); } }
private void AddVehicleDamageBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; TroopComponent troopComp = entity.TroopComp; bool flag = false; BuffTypeVO buffType = null; if (troopComp != null) { buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); TroopTypeVO troopTypeVO = (TroopTypeVO)troopComp.TroopType; flag = (troopTypeVO.Type == TroopType.Vehicle); } if (flag) { this.TryAddBuffStack(entity, buffType, ArmorType.Vehicle, BuffVisualPriority.SquadWars, entity); } }
private void AddInfantryDamageBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; TroopComponent troopComp = entity.TroopComp; BuffTypeVO buffTypeVO = null; if (troopComp != null) { TroopTypeVO troopTypeVO = (TroopTypeVO)troopComp.TroopType; if (troopTypeVO.Type == TroopType.Infantry) { buffTypeVO = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); } } if (buffTypeVO != null) { this.TryAddBuffStack(entity, buffTypeVO, ArmorType.Infantry, BuffVisualPriority.SquadWars, entity); } }
private void ApplySpecialAttackWarBuffs(SpecialAttack specialAttack) { TeamType teamType = specialAttack.TeamType; List <WarBuffVO> listOfWarBuffsBasedOnTeam = this.GetListOfWarBuffsBasedOnTeam(teamType); int num = 0; if (listOfWarBuffsBasedOnTeam != null) { num = listOfWarBuffsBasedOnTeam.Count; } if (num == 0) { return; } for (int i = 0; i < num; i++) { WarBuffVO warBuffVO = listOfWarBuffsBasedOnTeam[i]; if (warBuffVO.BuffType == SquadWarBuffType.SpecialAttackDamage) { this.AddSpecialAttackDamageBuff(specialAttack, warBuffVO); } } }
private void AddShieldRegenerationWarBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuildingComponent buildingComp = entity.BuildingComp; ShieldGeneratorComponent shieldGeneratorComp = entity.ShieldGeneratorComp; TroopComponent troopComp = entity.TroopComp; TroopShieldHealthComponent troopShieldHealthComp = entity.TroopShieldHealthComp; BuffTypeVO buffType; if (buildingComp != null && shieldGeneratorComp != null) { buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.BuildingBuffUid); } else { if (troopComp == null || troopShieldHealthComp == null) { return; } buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); } this.TryAddBuffStack(entity, buffType, ArmorType.Shield, BuffVisualPriority.SquadWars, entity); entity.BuffComp.SetBuildingLoadedEvent(EventId.ShieldStarted, new VisualReadyDelegate(this.BuildingShieldStarted)); }
private void Refresh() { WarBuffVO warBuffVO = Service.Get <IDataController>().Get <WarBuffVO>(this.buffBaseData.BuffBaseId); SquadWarManager warManager = Service.Get <SquadController>().WarManager; SquadWarSquadData squadData = warManager.GetSquadData(this.buffBaseData.OwnerId); FactionType factionType = FactionType.Neutral; string text = this.buffBaseData.GetDisplayBaseLevel().ToString(); if (squadData != null) { factionType = squadData.Faction; } string uid; string text2; if (factionType == FactionType.Empire) { uid = warBuffVO.MasterEmpireBuildingUid; text2 = LangUtils.GetFactionName(factionType); } else if (factionType == FactionType.Rebel) { uid = warBuffVO.MasterRebelBuildingUid; text2 = LangUtils.GetFactionName(factionType); } else { uid = warBuffVO.MasterNeutralBuildingUid; text2 = this.lang.Get("BUFF_BASE_UNOWNED_FACTION_NAME", new object[0]); } this.spriteFactionIcon.SpriteName = UXUtils.GetIconNameFromFactionType(factionType); this.labelBuffBaseName.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_TITLE", new object[] { this.lang.Get(warBuffVO.BuffBaseName, new object[0]), LangUtils.GetPlanetDisplayName(warBuffVO.PlanetId) }); this.labelBuffBaseLevel.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_LEVEL", new object[] { text, text2 }); this.labelCaptureRequirement.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_CAPTURE_REQUIREMENT", new object[0]); this.labelProduces.Text = this.lang.Get("BUFF_BASE_PRODUCES", new object[0]); this.labelBuffDescription.Text = this.lang.Get(warBuffVO.BuffStringDesc, new object[0]); this.labelLocked.Text = this.lang.Get("PLANET_LOCKED_REQUIREMENT", new object[0]); this.labelLocked.Visible = !Service.Get <CurrentPlayer>().IsPlanetUnlocked(warBuffVO.PlanetId); TextureVO textureVO = null; IDataController dataController = Service.Get <IDataController>(); if (warBuffVO.PlanetId == GameConstants.TATOOINE_PLANET_UID) { textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_tatooine"); } else if (warBuffVO.PlanetId == GameConstants.YAVIN_PLANET_UID) { textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_yavin"); } else if (warBuffVO.PlanetId == GameConstants.DANDORAN_PLANET_UID) { textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_dandoran"); } else if (warBuffVO.PlanetId == GameConstants.ERKIT_PLANET_UID) { textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_erkit"); } else if (warBuffVO.PlanetId == GameConstants.TFA_PLANET_UID) { textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_tfa"); } else if (warBuffVO.PlanetId == GameConstants.HOTH_PLANET_UID) { textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_hoth"); } if (textureVO != null) { this.textureBaseDetail.LoadTexture(textureVO.AssetName); } BuildingTypeVO data = Service.Get <IDataController>().Get <BuildingTypeVO>(uid); UXUtils.SetupGeometryForIcon(this.spriteBuffBaseIcon, data); this.spriteBuffIcon.SpriteName = warBuffVO.BuffIcon; string empty = string.Empty; if (warManager.CanScoutBuffBase(this.buffBaseData, ref empty)) { this.btnScout.VisuallyEnableButton(); this.labelScout.TextColor = this.labelScout.OriginalTextColor; return; } this.btnScout.VisuallyDisableButton(); this.labelScout.TextColor = UXUtils.COLOR_LABEL_DISABLED; }
protected override void SetupView() { base.GetElement <UXElement>("ReplayResults").Visible = false; base.GetElement <UXButton>("ButtonReplayBattle").Visible = false; this.lastBattle = null; this.battleType = BattleType.ClientBattle; if (this.isReplay) { this.lastBattle = Service.Get <BattlePlaybackController>().CurrentBattleEntry; BattleRecord currentBattleRecord = Service.Get <BattlePlaybackController>().CurrentBattleRecord; this.battleType = ((currentBattleRecord != null) ? currentBattleRecord.BattleType : BattleType.ClientBattle); } else { CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); this.lastBattle = currentBattle; this.battleType = ((currentBattle != null) ? currentBattle.Type : BattleType.ClientBattle); } if (this.lastBattle == null) { Service.Get <StaRTSLogger>().Error("Last battle is null"); return; } base.GetElement <UXLabel>("LabelPercentageSquadWar").Text = this.lang.Get("PERCENTAGE", new object[] { this.lastBattle.DamagePercent }); bool flag = this.battleType == BattleType.PvpAttackSquadWar; UXLabel element = base.GetElement <UXLabel>("LabelResultsSquadWar"); if (flag) { int num = Service.Get <SquadController>().WarManager.CalculateVictoryPointsTaken(this.lastBattle); element.Text = this.lang.Get("VICTORY_POINTS_EARNED", new object[] { num }); } else { bool flag2 = this.lastBattle.Defender.PlayerFaction != FactionType.Smuggler; bool won = this.lastBattle.Won; string text = (this.lastBattle.Defender.PlayerFaction == FactionType.Empire) ? "squadwars_end_celeb_empire" : "squadwars_end_celeb_rebel"; string text2 = (this.lastBattle.Attacker.PlayerFaction == FactionType.Empire) ? "squadwars_end_celeb_empire" : "squadwars_end_celeb_rebel"; this.currentOwnerTexture = base.GetElement <UXTexture>("TextureFactionIconCurrent"); this.currentOwnerTexture.LoadTexture((!flag2 & won) ? text2 : text); this.newOwnerTexture = base.GetElement <UXTexture>("TextureFactionIconNew"); this.newOwnerTexture.LoadTexture(won ? text2 : text); if (won) { SquadWarManager warManager = Service.Get <SquadController>().WarManager; string currentlyScoutedBuffBaseId = warManager.GetCurrentlyScoutedBuffBaseId(); WarBuffVO warBuffVO = Service.Get <IDataController>().Get <WarBuffVO>(currentlyScoutedBuffBaseId); SquadWarBuffBaseData currentlyScoutedBuffBaseData = warManager.GetCurrentlyScoutedBuffBaseData(); string text3 = this.lang.Get(warBuffVO.BuffBaseName, new object[0]); string text4 = currentlyScoutedBuffBaseData.GetDisplayBaseLevel().ToString(); this.buffBaseUpgradeLabel.Visible = true; this.buffBaseUpgradeLabel.Text = this.lang.Get("WAR_BUFF_BASE_UPGRADED", new object[] { text3, text4 }); this.labelBuffBaseCapturedSquadWar.Visible = true; this.labelBuffBaseCapturedSquadWar.Text = this.lang.Get("WAR_BATTLE_END_BUFF_BASE_CAPTURED", new object[] { text3 }); } } element.Visible = flag; UXLabel element2 = base.GetElement <UXLabel>("LabelAttacksLeftSquadWar"); bool visible = false; if (this.lastBattle.AttackerID == Service.Get <CurrentPlayer>().PlayerId) { SquadWarParticipantState currentParticipantState = Service.Get <SquadController>().WarManager.GetCurrentParticipantState(); if (currentParticipantState != null) { element2.Text = this.lang.Get("WAR_PLAYER_DETAILS_TURNS_LEFT", new object[] { currentParticipantState.TurnsLeft }); visible = true; } } element2.Visible = visible; this.InitVictoryPoints(this.lastBattle); this.attackerBuffsGrid = base.GetElement <UXGrid>("GridBuffsRightSquadWar"); SquadWarBuffIconHelper.SetupBuffIcons(this.attackerBuffsGrid, "SpriteIconBuffRightSquadWar", this.lastBattle.AttackerWarBuffs); this.defenderBuffsGrid = base.GetElement <UXGrid>("GridBuffsLeftSquadWar"); SquadWarBuffIconHelper.SetupBuffIcons(this.defenderBuffsGrid, "SpriteIconBuffLeftSquadWar", this.lastBattle.DefenderWarBuffs); if (this.lastBattle.Won) { base.AnimateStars(this.lastBattle.EarnedStars); } base.InitTroopGrid("GridTroopsExpendedSquadWar", "TemplateTroopsExpendedSquadWar", this.lastBattle); }
public void AddDefenderWarBuff(WarBuffVO warBuff) { this.defenderWarBuffs.Add(warBuff); }
public void AddAttackerWarBuff(WarBuffVO warBuff) { this.attackerWarBuffs.Add(warBuff); }