private void ApplySpecialAttackEquipmentBuffs(SpecialAttack specialAttack) { StaticDataController staticDataController = Service.StaticDataController; List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(specialAttack.TeamType); int num = (equipmentBuffsForTeam == null) ? 0 : equipmentBuffsForTeam.Count; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedSpecialAttackIds != null) { int j = 0; int num2 = equipmentEffectVO.AffectedSpecialAttackIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedSpecialAttackIds[j] == specialAttack.VO.SpecialAttackID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.Equipment); k++; } break; } j++; } } } }
private static Vector3 DeduceBuffAssetOffset(BuffTypeVO buffType, SmartEntity target) { if (target.TroopComp != null) { BuffAssetOffset offsetType = buffType.OffsetType; if (offsetType == BuffAssetOffset.Top) { return(target.TroopComp.TroopType.BuffAssetOffset); } if (offsetType == BuffAssetOffset.Base) { return(target.TroopComp.TroopType.BuffAssetBaseOffset); } } if (target.BuildingComp != null) { BuffAssetOffset offsetType2 = buffType.OffsetType; if (offsetType2 == BuffAssetOffset.Top) { return(target.BuildingComp.BuildingType.BuffAssetOffset); } if (offsetType2 == BuffAssetOffset.Base) { return(target.BuildingComp.BuildingType.BuffAssetBaseOffset); } } return(Vector3.zero); }
private void AddBuffsOnSpawn(SmartEntity target) { if (target.TroopComp == null) { return; } string[] spawnApplyBuffs = target.TroopComp.TroopType.SpawnApplyBuffs; if (spawnApplyBuffs == null || spawnApplyBuffs.Length == 0) { return; } ArmorType armorType = GameUtils.DeduceArmorType(target); if (armorType == ArmorType.Invalid) { return; } StaticDataController staticDataController = Service.StaticDataController; int i = 0; int num = spawnApplyBuffs.Length; while (i < num) { BuffTypeVO buffTypeVO = staticDataController.Get <BuffTypeVO>(spawnApplyBuffs[i]); if (buffTypeVO.ApplyToSelf) { this.TryAddBuffStack(target, buffTypeVO, armorType, BuffVisualPriority.Default, target); } i++; } }
private void AddSpecialAttackDamageBuff(SpecialAttack specialAttack, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.SquadWars); }
public Buff AddBuffStack(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority) { int num = this.FindBuff(buffType.BuffID); Buff buff; if (num < 0) { buff = new Buff(buffType, armorType, visualPriority); buff.AddStack(); this.Buffs.Add(buff); if (this.sleepState == BuffSleepState.Sleeping) { this.sleepState = BuffSleepState.Awake; } this.SendBuffEvent(EventId.AddedBuff, buff); } else { buff = this.Buffs[num]; if (buffType.Lvl > buff.BuffType.Lvl) { buff.UpgradeBuff(buffType); } buff.AddStack(); } this.OnBuffStackAdded(); return(buff); }
private void ApplyBuffFromBullet(Bullet bullet) { SmartEntity target = bullet.Target; ProjectileTypeVO projectileType = bullet.ProjectileType; if (target == null || target.TeamComp == null || projectileType == null) { return; } if (target.HealthComp == null || target.HealthComp.IsDead()) { return; } string[] applyBuffs = projectileType.ApplyBuffs; if (applyBuffs == null || applyBuffs.Length == 0) { return; } ArmorType armorType = GameUtils.DeduceArmorType(target); if (armorType == ArmorType.Invalid) { return; } bool flag = bullet.Owner == target; bool flag2 = !flag && bullet.OwnerTeam == target.TeamComp.TeamType; StaticDataController staticDataController = Service.StaticDataController; int i = 0; int num = applyBuffs.Length; while (i < num) { BuffTypeVO buffTypeVO = staticDataController.Get <BuffTypeVO>(applyBuffs[i]); if (flag) { if (buffTypeVO.ApplyToSelf) { goto IL_FC; } } else if (flag2) { if (buffTypeVO.ApplyToAllies) { goto IL_FC; } } else if (buffTypeVO.ApplyToEnemies) { goto IL_FC; } IL_10D: i++; continue; IL_FC: this.TryAddBuffStack(target, buffTypeVO, armorType, BuffVisualPriority.Default, bullet.Owner); goto IL_10D; } }
private static void AddBuffProjectileAssets(string buffUid, List <IAssetVO> assets, IDataController dc) { if (!string.IsNullOrEmpty(buffUid)) { BuffTypeVO item = dc.Get <BuffTypeVO>(buffUid); assets.Add(item); } }
private void RemoveTroopAbilitySelfBuff(SmartEntity troop) { BuffTypeVO troopAbilitySelfBuffType = this.GetTroopAbilitySelfBuffType(troop); if (troopAbilitySelfBuffType != null) { this.RemoveBuffStack(troop, troopAbilitySelfBuffType); } }
private void AddTroopAbilitySelfBuff(SmartEntity troop) { BuffTypeVO troopAbilitySelfBuffType = this.GetTroopAbilitySelfBuffType(troop); if (troopAbilitySelfBuffType != null) { this.TryAddBuffStack(troop, troopAbilitySelfBuffType, troop.TroopComp.TroopType.ArmorType, BuffVisualPriority.SelfAbility, troop); } }
public Buff(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority) { this.BuffType = buffType; this.ProcCount = 0; this.StackSize = 0; this.msRemaining = this.BuffType.Duration; this.msToNextProc = this.BuffType.MillisecondsToFirstProc; this.armorTypeIndex = (int)armorType; this.VisualPriority = visualPriority; }
private void AddVisitorToValidate(BuffTypeVO buffType, string summonUid, int numVisitors) { if (buffType.AppliesOnlyToSelf()) { CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); int num = 0; currentBattle.NumVisitors.TryGetValue(summonUid, out num); currentBattle.NumVisitors[summonUid] = num + numVisitors; } }
private void RemoveBuffStack(SmartEntity target, BuffTypeVO buffType) { BuffComponent buffComp = target.BuffComp; if (buffComp == null) { return; } buffComp.RemoveBuffStack(buffType); }
public void UpgradeBuff(BuffTypeVO newBuffType) { this.UpgradeTime(ref this.msRemaining, this.BuffType.Duration, newBuffType.Duration); if (this.ProcCount == 0) { this.UpgradeTime(ref this.msToNextProc, this.BuffType.MillisecondsToFirstProc, newBuffType.MillisecondsToFirstProc); } else { this.UpgradeTime(ref this.msToNextProc, this.BuffType.MillisecondsPerProc, newBuffType.MillisecondsPerProc); } this.BuffType = newBuffType; }
public bool RemoveBuffStack(BuffTypeVO buffType) { int num = this.FindBuff(buffType.BuffID); if (num >= 0) { Buff buff = this.Buffs[num]; if (buff.RemoveStack()) { this.RemoveBuffAt(num); } } return(this.Buffs.Count == 0); }
public Buff(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority) { this.BuffType = buffType; this.ProcCount = 0; this.StackSize = 0; this.msRemaining = this.BuffType.Duration; this.msToNextProc = this.BuffType.MillisecondsToFirstProc; this.armorTypeIndex = (int)armorType; this.VisualPriority = visualPriority; this.BuffData = new Dictionary <string, object>(); if (buffType.Modify == BuffModify.Summon) { this.Details = Service.StaticDataController.Get <SummonDetailsVO>(buffType.Details); } }
public void RemoveBuffsCanceledBy(BuffTypeVO buffType) { this.niter.Init(this.Buffs); while (this.niter.Active()) { int index = this.niter.Index; Buff buff = this.Buffs[index]; if (buff.BuffType.BuffID != buffType.BuffID && buff.BuffType.Tags.Overlaps(buffType.CancelTags)) { this.RemoveBuffAt(index); } this.niter.Next(); } this.niter.Reset(); }
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); } }
public void AddAppliedBuff(BuffTypeVO buffVO, BuffVisualPriority visualPriority) { int num = this.FindSpecialAttackBuff(buffVO.BuffID); Buff buff; if (num < 0) { buff = new Buff(buffVO, ArmorType.FlierVehicle, visualPriority); buff.AddStack(); this.SpecialAttackBuffs.Add(buff); return; } buff = this.SpecialAttackBuffs[num]; if (buffVO.Lvl > buff.BuffType.Lvl) { buff.UpgradeBuff(buffVO); } buff.AddStack(); }
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 static void AddBuffProjectileAssetNames(BuffTypeVO buffTypeVO, List <string> assetNames) { if (!string.IsNullOrEmpty(buffTypeVO.RebelMuzzleAssetName)) { assetNames.Add(buffTypeVO.RebelMuzzleAssetName); } if (!string.IsNullOrEmpty(buffTypeVO.EmpireMuzzleAssetName)) { assetNames.Add(buffTypeVO.EmpireMuzzleAssetName); } if (!string.IsNullOrEmpty(buffTypeVO.RebelImpactAssetName)) { assetNames.Add(buffTypeVO.RebelImpactAssetName); } if (!string.IsNullOrEmpty(buffTypeVO.EmpireImpactAssetName)) { assetNames.Add(buffTypeVO.EmpireImpactAssetName); } }
private static string GetEquipmentBuildingShaderName(EquipmentVO equipmentVO) { StaticDataController staticDataController = Service.StaticDataController; string text = string.Empty; if (!string.IsNullOrEmpty(equipmentVO.BuildingID)) { string uid = equipmentVO.EffectUids[0]; EquipmentEffectVO equipmentEffectVO = staticDataController.Get <EquipmentEffectVO>(uid); string uid2 = equipmentEffectVO.BuffUids[0]; BuffTypeVO buffTypeVO = staticDataController.Get <BuffTypeVO>(uid2); text = buffTypeVO.ShaderName; if (text.StartsWith("PL_2")) { text = text.Replace("PL_2", string.Empty); } } return(text); }
public void OnViewFrameTime(float dt) { this.miter.Init(this.activeProjectiles); while (this.miter.Active()) { Vector3 vector = Vector3.zero; Vector3 vector2 = Vector3.zero; ProjectileView projectileView = this.activeProjectiles[this.miter.Index]; float distSquared; bool flag = projectileView.Update(dt * this.speed, out distSquared); BuffTypeVO buffTypeVO = this.ShouldDeflectProjectile(projectileView, distSquared); bool flag2 = buffTypeVO != null && buffTypeVO.IsDeflector; if (flag | flag2) { Bullet bullet = projectileView.Bullet; if (flag2) { vector = projectileView.ViewPath.CurrentLocation; vector2 = this.ChooseDeflectionTarget(projectileView.StartLocation); Vector3 vector3 = Vector3.Normalize(vector2 - vector); vector3 *= (float)(bullet.ProjectileType.MaxSpeed * 3 * GameConstants.DEFLECTION_VELOCITY_PERCENT) * 0.01f; vector3 *= (float)GameConstants.DEFLECTION_DURATION_MS * 0.001f; vector2 = vector + vector3; } else if (!bullet.ProjectileType.IsBeam) { this.ShowImpactFXForBulletOwner(projectileView, bullet.Owner); } this.ReturnProjectileViewToPool(projectileView); this.activeProjectiles.RemoveAt(this.miter.Index); this.miter.OnRemove(this.miter.Index); if (flag2) { bullet.ChangeToDeflection((uint)GameConstants.DEFLECTION_DURATION_MS, vector, vector2); this.SpawnProjectile(bullet); Service.Get <EventManager>().SendEvent(EventId.ProjectileViewDeflected, buffTypeVO); } } this.miter.Next(); } this.miter.Reset(); }
private void TryAddBuffStack(SmartEntity target, BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority, SmartEntity originator) { if (target == null || buffType == null || !buffType.WillAffect(armorType)) { return; } BuffComponent buffComponent = target.BuffComp; if (buffComponent == null) { buffComponent = new BuffComponent(); target.Add(buffComponent); } else if (buffComponent.IsBuffPrevented(buffType)) { return; } buffComponent.AddBuffStack(buffType, armorType, visualPriority, originator); buffComponent.RemoveBuffsCanceledBy(buffType); }
private void ApplyBuildingEquipmentBuffs(SmartEntity entity) { if (entity.TeamComp == null || entity.BuildingComp == null) { return; } StaticDataController staticDataController = Service.StaticDataController; List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(entity.TeamComp.TeamType); int num = (equipmentBuffsForTeam == null) ? 0 : equipmentBuffsForTeam.Count; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedBuildingIds != null) { string buildingID = entity.BuildingComp.BuildingType.BuildingID; int j = 0; int num2 = equipmentEffectVO.AffectedBuildingIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedBuildingIds[j] == buildingID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffType = staticDataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); this.TryAddBuffStack(entity, buffType, GameUtils.DeduceArmorType(entity), BuffVisualPriority.Equipment, entity); k++; } break; } j++; } } } }
public Buff AddBuffStack(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority, SmartEntity originator) { int num = this.FindBuff(buffType.BuffID); Buff buff; if (num < 0) { buff = new Buff(buffType, armorType, visualPriority); buff.AddStack(); this.Buffs.Add(buff); if (this.sleepState == BuffSleepState.Sleeping) { this.sleepState = BuffSleepState.Awake; } if (!buff.BuffData.ContainsKey("originator")) { buff.BuffData.Add("originator", originator); } else { buff.BuffData["originator"] = originator; } this.SendBuffEvent(EventId.AddedBuff, buff); } else { buff = this.Buffs[num]; if (buffType.Lvl > buff.BuffType.Lvl) { buff.UpgradeBuff(buffType); } buff.BuffData["originator"] = originator; buff.AddStack(); } this.OnBuffStackAdded(); return(buff); }
private void ApplyTroopEquipmentBuffs(SmartEntity entity) { if (entity.TeamComp == null || entity.TroopComp == null) { return; } IDataController dataController = Service.Get <IDataController>(); List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(entity.TeamComp.TeamType); int num = (equipmentBuffsForTeam != null) ? equipmentBuffsForTeam.Count : 0; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedTroopIds != null) { string troopID = entity.TroopComp.TroopType.TroopID; int j = 0; int num2 = equipmentEffectVO.AffectedTroopIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedTroopIds[j] == troopID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffType = dataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); this.TryAddBuffStack(entity, buffType, BuffController.DeduceArmorType(entity), BuffVisualPriority.Equipment); k++; } break; } j++; } } } }
public bool IsBuffPrevented(BuffTypeVO buffType) { BuffSleepState buffSleepState = this.sleepState; if (buffSleepState == BuffSleepState.Sleeping) { return(false); } if (buffSleepState != BuffSleepState.Dead) { int i = 0; int count = this.Buffs.Count; while (i < count) { if (this.Buffs[i].BuffType.PreventTags.Overlaps(buffType.Tags)) { return(true); } i++; } return(false); } return(true); }
public static bool AreAllBulletAssetsLoaded(Bullet bullet, HashSet <IAssetVO> loadedAssets) { ProjectileTypeVO projectileType = bullet.ProjectileType; if (projectileType != null && !loadedAssets.Contains(projectileType)) { return(false); } if (bullet.AppliedBuffs != null) { int i = 0; int count = bullet.AppliedBuffs.Count; while (i < count) { BuffTypeVO buffType = bullet.AppliedBuffs[i].BuffType; if (buffType != null && !loadedAssets.Contains(buffType)) { return(false); } i++; } } return(true); }