public void can_add() { Stats stats = new Stats(); stats.Add(StatType.MoveSpeed, 3f); Assert.AreEqual(3f, stats.Get(StatType.MoveSpeed)); stats.Add(StatType.MoveSpeed, 5f); Assert.AreEqual(8f, stats.Get(StatType.MoveSpeed)); }
public void can_add() { Stats stats = new Stats(); // Create a new MoveSpeed stat with value 3 stats.Add(StatType.MoveSpeed, 3f); Assert.AreEqual(3f, stats.Get(StatType.MoveSpeed)); // Increment the now existing MoveSpeed stat by 5 stats.Add(StatType.MoveSpeed, 5f); Assert.AreEqual(8f, stats.Get(StatType.MoveSpeed)); }
public void Initialize(System.Data.SQLite.SQLiteDataReader data, List <string> elementsData, List <State> statesData) { Initialize(data); Id = Int(data["Environment_ID"]); ReadPassiveEffect(this, data["PassiveEffectID"], elementsData, statesData); MapForeground = BytesToImage(data, 8); MapBackground = BytesToImage(data, 9); BattleForeground = BytesToImage(data, 10); BattleBackground = BytesToImage(data, 11); StatModifiers = new Stats(); StatModifiers.Add(8, Int(data["Accuracy"]) - 100); StatModifiers.Add(9, Int(data["Evasion"]) - 100); StatModifiers.Add(10, Int(data["CriticalRate"]) - 100); StatModifiers.Add(11, Int(data["CritEvadeRate"]) - 100); }
/// <summary> /// Reads the prototype from the specified JObject. /// </summary> /// <param name="jsonProto">The JProperty containing the prototype.</param> public void ReadJsonPrototype(JProperty jsonProto) { Type = jsonProto.Name; JToken innerJson = jsonProto.Value; Slot = PrototypeReader.ReadJson(Slot, innerJson["Slot"]); LocalizationName = PrototypeReader.ReadJson("gear_" + Type, innerJson["LocalizationName"]); LocalizationDescription = PrototypeReader.ReadJson("gear_" + Type + "_desc", innerJson["LocalizationDescription"]); if (innerJson["Stats"] != null) { foreach (JToken stat in innerJson["Stats"]) { Stat prototypeStat = PrototypeManager.Stat.Get(((JProperty)stat).Name); Stat newStat = prototypeStat.Clone(); int value = 0; value = PrototypeReader.ReadJson(value, stat); newStat.Value = value; Stats.Add(((JProperty)stat).Name, newStat); } } if (innerJson["Slots"] != null) { string[] slots = new string[0]; slots = PrototypeReader.ReadJson(slots, innerJson["Slots"]); foreach (string slot in slots) { Slots.Add(slot, false); } } }
private void UpdateStats() { int wins = 0; int losses = 0; if (_games == null || _games.Count == 0) { UpdateGames(); } Stats.Clear(); var filter = new GameFilter(null, SelectedRegion, SelectedGameMode, SelectedTimeFrame, SelectedGameFormat, PlayerClass.ALL, SelectedClass, RankMin, RankMax); var filtered = filter.Apply(_games); var stats = ViewModelHelper.GetArchetypeStats(filtered); foreach (var s in stats) { Stats.Add(s); wins += s.TotalWins; losses += s.TotalLosses; } TotalWins = wins; TotalLosses = losses; }
public void AddStatModifier(string statShortName, int modifier) { if (Stats.Count == 0) { Stats.Add(statShortName, modifier); } else { foreach (var stat in Stats) { if (stat.Key == statShortName) { if (modifier == 0) { Stats.Remove(statShortName); return; } else { Stats[statShortName] = modifier; return; } } } Stats.Add(statShortName, modifier); } }
public void Update(string val) { var doubleRepres = val.GetValue(); if (string.IsNullOrEmpty(val)) { Stats[_emptyString].Count++; } else { if (!Stats.ContainsKey(val) && Stats.Keys.Count < _maximumNumberOfStrings) { Stats.Add(val, new DiscreteStringStatisticElement() { Count = 0, Representation = doubleRepres }); } if (!Stats.ContainsKey(val)) { return; } Stats[val].Count++; } base.Update(doubleRepres); }
public void NewGame() { CurrentRoundNumber = 2; var order = new List <Suit>() { Suit.Klaveren, Suit.Schoppen, Suit.Harten, Suit.Koeken, Suit.Geen }; order.Shuffle(random); SuitOrder = order.ToArray(); SuitIndex = 0; rounds.Add(new Round(CurrentRoundNumber)); CurrentRound.DealerPosition = 0; foreach (var item in SuitOrder) { Debug.WriteLine(item); } foreach (var player in Players) { Stats.Add(player, new Statistic() { Player = player, Result = 0 }); } numRoundsTillEnd = 52 / Players.Count; }
public NonPlayer(Database.World.Model.Entity entity) : base(EntityType.NonPlayer) { CreatureId = entity.Creature; DisplayInfo = entity.DisplayInfo; OutfitInfo = entity.OutfitInfo; Faction1 = (Faction)entity.Faction1; Faction2 = (Faction)entity.Faction2; Rotation = new Vector3(entity.Rx, entity.Ry, entity.Rz); if (EntityManager.VendorInfo.TryGetValue(entity.Id, out VendorInfo vendorInfo)) { VendorInfo = vendorInfo; } CalculateProperties(); // temp shit Stats.Add(Stat.Health, new StatValue(Stat.Health, 800)); Stats.Add(Stat.Level, new StatValue(Stat.Level, 1)); Stats.Add((Stat)15, new StatValue((Stat)15, 1)); Stats.Add((Stat)20, new StatValue((Stat)20, 1)); Stats.Add((Stat)21, new StatValue((Stat)21, 1)); Stats.Add((Stat)22, new StatValue((Stat)22, 1)); }
public Player() { Kind = Toolbox.EntityType.Player; if (TileIndex == null) { TileIndex = Vector2.Zero; } if (!Stats.ContainsKey(Toolbox.Stat.Speed)) { Stats.Add(Toolbox.Stat.Speed, 4f); } else { Stats[Toolbox.Stat.Speed] = 4f; } Anime = new Animation() { ImageName = "character_32x48", Frames = new Vector2(3, 4), Type = Toolbox.AnimationType.Spritesheet, Active = true }; Orientation = Toolbox.Orientation.South; Anime.Init(); }
//Load from save file public Weapon(int id, string title, string desc, string slug, int type, int rarity, int dmg, int[][] statBonuses) { foreach (int[] stat in statBonuses) { Stats.Add(new ElementalStat((Element)stat[0], stat[1])); } }
public void Draw(Mesh mesh) { if (mesh != null && mesh.Fragment != null && mesh.VertexBuffer != null && mesh.IndexBuffer != null) { WP.View = mesh.Projection == Mesh.ProjectionType.Unit ? UnitView : PixelView; System.Windows.Media.Matrix world = System.Windows.Media.Matrix.Multiply(mesh.LocalTransform, mesh.WorldTransform); WP.World = Utils.Convert(world); SharpDX.Matrix vw = SharpDX.Matrix.Multiply(WP.World, WP.View); Vector4 posA = Vector2.Transform(new Vector2((float)mesh.AABB.Left, (float)mesh.AABB.Bottom), vw); Vector4 posB = Vector2.Transform(new Vector2((float)mesh.AABB.Right, (float)mesh.AABB.Top), vw); float minX = Math.Min(posA.X, posB.X); float maxX = Math.Max(posA.X, posB.X); if (maxX < -1f || minX > 1f) { return; } PrimitiveTopology topology = mesh.Geometry == Mesh.GeometryType.Polygons ? PrimitiveTopology.TriangleList : PrimitiveTopology.LineList; int indexCount = (mesh.Geometry == Mesh.GeometryType.Polygons ? 3 : 2) * mesh.PrimitiveCount; SetAlphaBlend(mesh.UseAlpha); Setup(mesh.Fragment, mesh.VertexBufferBinding, mesh.IndexBuffer, topology); RenderDevice.ImmediateContext.DrawIndexed(indexCount, 0, 0); SetAlphaBlend(false); Statistics.Add(mesh.PrimitiveCount); } }
public void LoadStats(float[][] stats) { foreach (float[] item in stats) { Stats.Add(new EquipmentStat(item)); } }
public void AddStat(IStat stat, NodeType nodeType = NodeType.Total) { var resultStat = new ResultStatViewModel(_nodeFactory.CreateResult(stat, nodeType), RemoveStat); Stats.Add(resultStat); AddAvailableStat(stat); }
public override void RefreshStats() { Stats.Clear(); Stats.Add(MonsterInfo.Stats); LevelInfo = SEnvir.CompanionLevelInfoList.Binding.First(x => x.Level == UserCompanion.Level); MoveDelay = MonsterInfo.MoveDelay; AttackDelay = MonsterInfo.AttackDelay; foreach (UserItem item in Equipment) { if (item == null) { continue; } Stats.Add(item.Info.Stats); Stats.Add(item.Stats); } Stats[Stat.CompanionBagWeight] += LevelInfo.InventoryWeight; Stats[Stat.CompanionInventory] += LevelInfo.InventorySpace; RefreshWeight(); }
async Task ExecuteLoadStatsCommand() { if (IsBusy) { return; } IsBusy = true; try { Stats.Clear(); var stats = await DataStore.GetStatsAsync(true); foreach (Stat stat in stats) { Stats.Add(stat); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void RunSimulation(SpiceNetlistReaderResult model, BaseSimulation simulation, int index) { var simulationStats = new SimulationStatistics() { SimulationNo = index, SimulationName = simulation.Name }; simulation.Run(model.Circuit); simulationStats.Iterations = simulation.Statistics.Get <BaseSimulationStatistics>().Iterations; simulationStats.SolveTime = simulation.Statistics.Get <BaseSimulationStatistics>().SolveTime.ElapsedMilliseconds; simulationStats.LoadTime = simulation.Statistics.Get <BaseSimulationStatistics>().LoadTime.ElapsedMilliseconds; simulationStats.ReorderTime = simulation.Statistics.Get <BaseSimulationStatistics>().ReorderTime.ElapsedMilliseconds; simulationStats.BehaviorCreationTime = simulation.Statistics .Get <SpiceSharp.Simulations.SimulationStatistics>().BehaviorCreationTime.ElapsedMilliseconds; if (simulation is TimeSimulation) { simulationStats.Timepoints = simulation.Statistics.Get <TimeSimulationStatistics>().TimePoints; simulationStats.TransientIterations = simulation.Statistics.Get <TimeSimulationStatistics>().TransientIterations; simulationStats.TransientTime = simulation.Statistics.Get <TimeSimulationStatistics>().TransientTime .ElapsedMilliseconds; simulationStats.AcceptedTimepoints = simulation.Statistics.Get <TimeSimulationStatistics>().Accepted; simulationStats.RejectedTimepoints = simulation.Statistics.Get <TimeSimulationStatistics>().Rejected; } Dispatcher.Invoke(() => { Stats.Add(simulationStats); }); }
protected internal override void Render(int X, int Y) { if (!Engine.m_Ingame || !Renderer.DrawPing) { return; } int ping = Engine.Ping; string str = (ping / 5 * 5).ToString(); int index = (ping - 25) / 75; if (index < 0) { index = 0; } else if (index > 6) { index = 6; } if (ping < 5) { str = "below 5"; } else if (ping > 5000) { str = "over 5000"; } this.Hue = this.m_Hues[index]; this.Text = string.Format("Ping: {0}", (object)str); base.Render(X, Y); Stats.Add((Gump)this); }
///////////////////////////////////////////////////////////////////////////////////////////////////// #region PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Builds the random stats. /// </summary> /// <param name="startingYear">The starting year.</param> /// <param name="endingYear">The ending year.</param> public void BuildRandomStats(int startingYear, int endingYear) { for (int year = startingYear; year <= endingYear; year++) { Stats.Add(BatterSeasonStats.Random(year)); } }
private new void load(OsuColour colour) { double pp = Score.PP ?? 0; Stats.Add(new OsuSpriteText { Text = $"{pp:0}pp", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 18, Font = "Exo2.0-BoldItalic", }); if (weight.HasValue) { Stats.Add(new OsuSpriteText { Text = $"weighted: {pp * weight:0}pp ({weight:P0})", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, TextSize = 11, Font = "Exo2.0-RegularItalic", }); } }
public ServerStatisticsManager(LiteDatabase database, string collectionName, string entityName) : base(database, collectionName, entityName) { foreach (var constructor in Constructors) { Stats.Add((IBaseStatistics)constructor.Invoke(null)); } }
public VoidPoolStats(VoidPoolController controller) { BestSingle = new Dictionary <Mobile, long>(); OverallTotal = new Dictionary <Mobile, long>(); Top20 = new List <Dictionary <Mobile, long> >(); Controller = controller; Stats.Add(this); }
public void IncrimentStat(string name, double count = 1) { if (!Stats.ContainsKey(name)) { Stats.Add(name, 0); } Stats[name] += count; }
public void AddStat(StatTemplate stat) { if (Stats.ContainsKey(stat.Key)) { return; } Stats.Add(stat.Key, new StatInstance(this, stat)); RefreshProperties(); }
public Player(string name) { Name = name; Stats.Add("Health", 100); Stats.Add("Mana", 25); Stats.Add("Speed", 10); Stats.Add("Attack", 15); Stats.Add("Defense", 15); }
protected Person(float maxHealth, float moveSpeed, float armor) { Health = new HealthCharacteristic(maxHealth, Die); MoveSpeed = new SpeedCharacteristic(moveSpeed); PersonArmor = new ArmorCharacteristic(armor); Stats.Add(Type.Health, Health); Stats.Add(Type.Speed, MoveSpeed); Stats.Add(Type.Armor, PersonArmor); }
protected internal override void Render(int X, int Y) { if (!Engine.m_Ingame || !Renderer.Transparency) { return; } base.Render(X, Y); Stats.Add((Gump)this); }
public void MessageReceived(object message) { Stats.Add(message); Received.Add(message); if (_waitForReceived != null && _waitForReceived(message)) { Reset.Set(); } }
public static Stats FromDictionary(Dictionary <string, double> source) { Stats result = new Stats(); foreach (var kvp in source) { result.Add(kvp.Key, kvp.Value); } return(result); }
protected override void RefreshBase() { Stats.Clear(); Stats.Add(Master.Stats); Stats[Stat.HP] = 1500; MoveSpeed = 100; AttackSpeed = Master.AttackSpeed; }