public void RuleEventEnded(ref PrepareDamageEvent context) { if (context.CurrentTotal() > 0) { World.Get <RulesSystem>().Post(new TakeDamageEvent(ref context)); } }
public TakeDamageEvent(ref PrepareDamageEvent prepareEvent) { Action = prepareEvent.Action; Origin = prepareEvent.Origin; Target = prepareEvent.Target; Hit = prepareEvent.Hit; Entries = prepareEvent.Entries; Amount = prepareEvent.CurrentTotal(); prepareEvent.Entries = null; }
public static void OnUsage(ActionEvent ae, ActionCommand cmd, string stat) { var prepareDamage = new PrepareDamageEvent(ae.Origin, ae.Target, cmd.Action, cmd.HitResult); var damageStat = cmd.Owner.Stats.Get <DiceStat>(stat); if (damageStat == null) { return; } var total = cmd.HitResult.Result == CollisionResult.CriticalHit ? damageStat.GetMax() : damageStat.Value; prepareDamage.Entries.Add(new DamageEntry(total, cmd.Action.Data.GetString(AbilityDataEntries.DamageType), Stats.Health, "Weapon Attack")); World.Get <RulesSystem>().Post(prepareDamage); }