public void AddActorToScene(long userFactionId, Asset asset) { var faction = Service.GetFactionOfAsset(asset); var order = Service.GetOrderOfAssetFromPerspective(userFactionId, asset.Id); var actorName = Microsoft.Security.Application.AntiXss.GetSafeHtmlFragment(asset.Name); var actorImageUrl = Microsoft.Security.Application.AntiXss.GetSafeHtmlFragment(asset.ImageUrl); var actor = new Perspective.Actor() { Id = asset.Id, FactionId = faction.Id, FactionName = faction.Name, FactionHexColour = faction.HexColour, Turn = asset.Turn, Value = asset.Value, Name = actorName, Covert = asset.Covert, ImageUrl = actorImageUrl, IsSentinel = order.IsSentinel, // Specializations HasAmbush = asset.HasAmbush, HasDisguise = asset.HasDisguise, HasInfuse = asset.HasInfuse, HasInvestigate = asset.HasInvestigate, HasManeuver = asset.HasManeuver, HasSalvage = asset.HasSalvage, HasPropagate = asset.HasPropagate, HasVanish = asset.HasVanish, // Infusions InfusedWithAmbush = asset.InfusedWithAmbush, InfusedWithSalvage = asset.InfusedWithSalvage, InfusedWithDisguise = asset.InfusedWithDisguise, InfusedWithVanish = asset.InfusedWithVanish, InfusedWithManeuver = asset.InfusedWithManeuver, InfusedWithInfuse = asset.InfusedWithInfuse, InfusedWithInvestigate = asset.InfusedWithInvestigate, InfusedWithPropagate = asset.InfusedWithPropagate, // Result Data ValueLossFromCompromised = asset.ValueLossFromCompromised, ValueLossFromDamage = asset.ValueLossFromDamage, ValueIncreaseFromDamage = asset.ValueIncreaseFromDamage, ExpectedValueChange = asset.ExpectedValueChange, ShroudedByFactionIds = asset.ShroudedByFactionIds, WasShrouded = asset.WasShrouded, WasEnhanced = asset.WasEnhanced, WasInfusedWith = asset.WasInfusedWith, WasPropagatedWith = asset.WasPropagatedWith, WasSeizedByFactionId = asset.WasSeizedByFactionId, }; this.Actors.Add(actor); AddActorToTroupe(userFactionId, actor, order); }
private void InfiltrateAssetByFactions(Perspective.Actor actor, List <long> infiltratingFactionIds, int profileCount) { foreach (var factionId in infiltratingFactionIds) { var infiltration = new Infiltration() { FactionId = factionId, ProfileCount = profileCount, }; actor.Infiltrations.Add(infiltration); } }
private int GetDefense(Perspective.Actor actor) { var result = actor.Value; foreach (var action in this._perspective.Scenes.SingleOrDefault(s => s.TargetId == actor.Id).Troupes) { if (action.Action.Equals(Order.Actions.Enhance.ToString()) || action.Action.Equals(Order.Actions.Shroud.ToString())) { if (action.SpecializationAccess.Contains(Asset.Specialziations.Ambush.ToString()) && action.Action.Equals(Order.Actions.Shroud.ToString())) { result += 2 * action.Strength; } else { result += action.Strength; } } } return(result); }