public IModifier CreateModifier(IActor target, IActor source, IStat stat, int amount, int duration) { IModifier modifier = this.CreateModifier(target, source, stat, amount); modifier.SetAffectDuration(duration); return modifier; }
public IModifier CreateModifier(IActor target, IActor source, IStat stat, int amount) { IModifier modifier = this.CreateModifier(target, source, amount); modifier.SetAffectedStat(stat); return modifier; }
public virtual void AddAbility(IStat ability) { if (ability == null) { throw new ArgumentNullException(nameof(ability), "The ability argument can not be null."); } if (this.Stats.Contains(ability)) { return; } this.Stats.Add(ability); }
public void SetAffectedStat(IStat affectedTargetStat) { if (affectedTargetStat == null) { throw new ArgumentNullException(nameof(affectedTargetStat), "You can not use a null Stat for this modifier"); } if (string.IsNullOrEmpty(affectedTargetStat.Name)) { throw new ArgumentOutOfRangeException(nameof(affectedTargetStat), "The provided Stat does not have a name assigned to it."); } this.AffectedStat = affectedTargetStat; }
public override void Bind(IStat item, StatsRecyclerAdapter adapter) { if (item is ActivatableStat model) { //if (TitleTextView != null) //{ // TitleTextView.Text = model.Name; //} if (TimeActivatedTextView != null) { ClearDisposable(); TimeActivatedTextView.Text = model.TimeElapsed.ToFormattedString(); Disposable = Observable.Interval(TimeSpan.FromSeconds(1)) .Select(p => model.TimeElapsed) .TakeUntil(time => TimeActivatedTextView == null) .RunOnUI() .Subscribe(time => { #if DEBUG Log.Info($"{GetType().Name}", $"{model.StatType} -> {time.ToFormattedString()}"); #endif TimeActivatedTextView.Text = time.ToFormattedString(); }, () => { if (TimeActivatedTextView != null) { TimeActivatedTextView.Text = "EXPIRED"; } }); adapter.AddTimeSubscription(Disposable); } } }
private void InitReports() { logger.Info("Initialize reports"); recentMatches = new DataIdentity <MatchInfo>() .Report(MaxReportSize, m => m.EndTime, (m1, m2) => m1.GetIndex().CompareTo(m2.GetIndex())); popularServers = new DataIdentity <ServerInfo>() .Select(s => new ServerReportResult { Server = s, TotalMatchesPlayed = serverStatisticStorage.GetStatistics(s.Id)?.TotalMatchesPlayed ?? 0 }) .Report(MaxReportSize, s => s.TotalMatchesPlayed, (s1, s2) => string.Compare(s1.Server.Id, s2.Server.Id, StringComparison.Ordinal)); allServers = new DataIdentity <ServerInfo>() .Report(s => s.Id, (s1, s2) => string.Compare(s1.Id, s2.Id, StringComparison.Ordinal)); bestPlayers = new DataIdentity <PlayerInfo>().Where(p => { var playerStat = playerStatisticStorage.GetStatistics(p.Name); return(playerStat.KillToDeathRatio != null && playerStat.TotalMatchesPlayed >= 10); }) .Select(p => new PlayerReportResult { Player = p, KillToDeathRatio = playerStatisticStorage.GetStatistics(p.Name).KillToDeathRatio }) .Report(MaxReportSize, p => { if (p.KillToDeathRatio != null) { return(p.KillToDeathRatio.Value); } throw new ArgumentException($"{nameof(p.KillToDeathRatio)} must be not null"); }, (p1, p2) => p1.Player.GetIndex().CompareTo(p2.Player.GetIndex())); }
public void ExplicitlyRegistered() { var sut = Calculator.Create(); var modifierStat = new Stat("m"); var registeredStat = new Stat("r", explicitRegistrationType: ExplicitRegistrationTypes.UserSpecifiedValue(0)); var value = new StatValue(registeredStat); IStat actual = null; sut.ExplicitlyRegisteredStats.CollectionChanged += (sender, args) => { Assert.IsNull(actual); Assert.AreEqual(1, args.AddedItems.Count); Assert.IsEmpty(args.RemovedItems); actual = args.AddedItems.First().Item2; }; sut.NewBatchUpdate().AddModifier(modifierStat, Form.BaseAdd, value).DoUpdate(); Assert.IsNull(actual); var _ = sut.NodeRepository.GetNode(modifierStat).Value; Assert.AreEqual(registeredStat, actual); }
/// <summary> /// Reads a <see cref="IStat"/> instance. /// </summary> /// <param name="s">The IO session.</param> /// <param name="stat">Out parameter; the read <see cref="IStat"/> instance.</param> public static void Read(IoSession s, out IStat stat) { int theint; long thelong; Stat tmpStat = new Stat(); stat = tmpStat; Read(s, out thelong); tmpStat.Czxid = thelong; Read(s, out thelong); tmpStat.Mzxid = thelong; Read(s, out thelong); tmpStat.Pzxid = thelong; Read(s, out theint); tmpStat.Version = theint; Read(s, out theint); tmpStat.Aversion = theint; Read(s, out theint); tmpStat.Cversion = theint; Read(s, out thelong); tmpStat.Ctime = thelong; Read(s, out thelong); tmpStat.Mtime = thelong; Read(s, out theint); tmpStat.DataLength = theint; Read(s, out theint); tmpStat.NumChildren = theint; }
public override void Bind(IStat item, StatsRecyclerAdapter adapter) { if (item is ExpirableStat model) { //if (TitleTextView != null) //{ // TitleTextView.Text = model.Name; //} if (TimeLeftTextView != null) { ClearDisposable(); UpdateTimeLeftText(TimeLeftTextView, model.TimeLeft); Disposable = Observable .Interval(TimeSpan.FromSeconds(1)) .Select(p => model.TimeLeft) .TakeUntil(time => time < TimeSpan.Zero || TimeLeftTextView == null) .RunOnUI() .Subscribe(timeLeft => { #if DEBUG Log.Info($"{GetType().Name}", $"{model.StatType} -> {timeLeft.ToFormattedString()}"); #endif UpdateTimeLeftText(TimeLeftTextView, model.TimeLeft); }, () => { ClearDisposable(); }); adapter.AddTimeSubscription(Disposable); } } }
protected abstract T CreateViewModel(ICalculationNode node, IStat stat);
private bool TryGetStatViewModel(IStat stat, out T statVm) { statVm = Stats.FirstOrDefault(s => SelectStat(s).Equals(stat)); return(statVm != null); }
private IReadOnlyCollection <PathDefinition> GetPaths(IValueCalculationContext context, IStat stat) { var originalPaths = context.GetPaths(stat); if (!_ailmentDamage.Equals(stat)) { return(originalPaths); } var skillPaths = context.GetPaths(_skillDamage) .Select(p => new PathDefinition(p.ModifierSource)); var paths = new HashSet <PathDefinition>(originalPaths); paths.UnionWith(skillPaths); return(paths); }
public RequirementUncappedSubtotalValue(IStat transformedStat, IValue transformedValue) => (_transformedStat, _transformedValue) = (transformedStat, transformedValue);
public StatController(IStat _stat, IWorkersRepo _Repo) { stat = _stat; workersRepo = _Repo; }
public CalculationNodeViewModel(IStat stat, NodeType nodeType = NodeType.Total) => (Stat, NodeType) = (stat, nodeType);
private static AilmentDamageUncappedSubtotalValue CreateSut(IStat ailmentDamage, IStat skillDamage) { var transformedValue = new FunctionalValue(c => c.GetValues(ailmentDamage, NodeType.PathTotal).Sum(), ""); return(new AilmentDamageUncappedSubtotalValue(ailmentDamage, skillDamage, transformedValue)); }
/// <summary> /// Adds the specified stat to the character /// </summary> /// <param name="stat"></param> public void AddStat(IStat stat) { if (stat == null) return; if (Stats.Contains(stat)) return; else Stats.Add(stat); }
public void RemoveStat(IStat stat) { m_stats.Remove(stat.ID); }
public void AddStat(IStat stat) { m_stats.Add(stat.ID, stat); }
public void SetUp() { _testObject = new EnduranceStat(); }
public ModificationModifiedEventArgs(ModificationType type, IStat sender) { this.type = type; this.sender = sender; }
private void Warn(string msg, IStat stat) { Warnings++; stat.Dump(); RosterLib.Utility.Announce(string.Format(" Warning : {0} - {1} - {2}", NflWeek.WeekKey(":"), msg, stat.PlayerId)); }
private void Error(IStat stat) { Errors++; stat.Dump(); RosterLib.Utility.Announce(string.Format(" Error : {0} - {1} - {2}", NflWeek.WeekKey(":"), stat.Error, stat.PlayerId)); }
public void Init() { _statImpl = new StatImpl(); }
/// <inheritdoc /> protected override void NotifyComplete(int resultCode, byte[] data, IStat stat, string responsePath) { this.callback?.Invoke(resultCode, this.Path, this.Context, data, stat); }
public void SetUp() { _testObject = new StrengthStat(); }
private static UncappedSubtotalValue CreateSut(IStat stat = null) => new UncappedSubtotalValue(stat);
public void SetUp() { _testObject = new AccuracyStat(); }
//unlocked all quests //built all buildings - have ever built x //hired vendors //cash magnitude //craft all enchantments - have ever crafted x //relic notoriety //relic antiquity //find/identify a relic //resource value given to quests //days played public static void register(IStat stat) { stat.ID = allStatistics.Count; allStatistics.Add(stat); }
public IReadOnlyStatGraph GetOrAdd(IStat stat) => GetOrAddStatGraph(stat);
public IndexModel(IMatch match, IStat stat) { _match = match; _stat = stat; Matches = new List <MatchDetail>(); }
public bool Equals(IStat other) { return(this.Name.Equals(other.Name)); }
public AilmentDamageUncappedSubtotalValue(IStat ailmentDamage, IStat skillDamage, IValue transformedValue) { _ailmentDamage = ailmentDamage; _skillDamage = skillDamage; _transformedValue = transformedValue; }
public void SetUp() { stat = new PopularStat <string>(3); }
public void SetUp() { _testObject = new CatchStat(); }
public void ApplyEffect(IStat target) { target.DurationEffectStep(this); }
protected abstract bool IsResponsibleFor(IStat stat);
public void SetUp() { _testObject = new SpeedStat(); }
private IStatGraph GetOrAddStatGraph(IStat stat) => _statGraphs.GetOrAdd(stat, _statGraphFactory);
/// <summary> /// Removes the specified stat from the character /// </summary> /// <param name="stat"></param> public void RemoveStat(IStat stat) { if (Stats == null) return; if (Stats.Contains(stat)) Stats.Remove(stat); }
public void Remove(IStat stat) => _statGraphs.Remove(stat);
public void SetUp() { _testObject = new DodgeStat(); }
public int CompareTo(IStat other) { return(string.Compare(this.Name, other.Name, StringComparison.OrdinalIgnoreCase)); }
public ConversionPathsWithSpecificSourceRule(IStat conversionSource) => _conversionSource = conversionSource;
private static AilmentDamageBaseValue CreateSut(IStat ailmentDamage, IStat skillDamage) { var transformedValue = new FunctionalValue(c => c.GetValue(ailmentDamage, NodeType.BaseSet), ""); return(new AilmentDamageBaseValue(skillDamage, transformedValue)); }
public IReadOnlyCollection <PathDefinition> GetPaths(IStat stat) => throw CreateException();
public StatNodeFactory(INodeFactory nodeFactory, IStat stat) { _nodeFactory = nodeFactory; _stat = stat; }
public NodeValue?GetValue(IStat stat, NodeType nodeType, PathDefinition path) => throw CreateException();