public ConvertVitalEvent(ImpactEvent impactEvent, ConvertVitalImpact convertVital)
 {
     Action       = impactEvent.Action;
     Origin       = impactEvent.Origin;
     Target       = impactEvent.Target;
     ConvertVital = convertVital;
 }
 public PrepareDamageEvent(ImpactEvent impact)
 {
     Entries = GenericPools.New <List <DamageEntry> >();
     Origin  = impact.Origin;
     Target  = impact.Target;
     Action  = impact.Action;
     Hit     = impact.Hit;
 }
Beispiel #3
0
 public PrepareDamageEvent(ImpactEvent impact, CharacterTemplate origin, CharacterTemplate target)
 {
     Entries = GenericPools.New <List <DamageEntry> >();
     Impact  = impact;
     Origin  = origin;
     Target  = target;
     Action  = impact.Action;
 }
Beispiel #4
0
 public DeathEvent(CharacterTemplate caused, CharacterTemplate target, ImpactEvent impact, float overKill)
 {
     Action   = impact.Action;
     Origin   = caused;
     Target   = target;
     OverKill = overKill;
     Impact   = impact;
 }
Beispiel #5
0
 public TakeDamageEvent(float amount, ImpactEvent impact, string damageType, string targetVital)
 {
     Amount      = amount;
     Impact      = impact;
     Origin      = impact.Origin;
     Target      = impact.Target;
     DamageType  = damageType;
     TargetVital = targetVital;
 }
Beispiel #6
0
 public TryApplyEntityTag(ImpactEvent impactEvent, ApplyTagImpact component)
 {
     Action      = impactEvent.Action;
     Origin      = impactEvent.Origin;
     Target      = impactEvent.Target;
     Tag         = component.Tag;
     Chance      = component.Chance;
     Length      = component.Length;
     Description = component.Description;
     Defense     = component.Defense;
 }
Beispiel #7
0
 public TryApplyMod(ImpactEvent impactEvent, AddModImpact component)
 {
     Action            = impactEvent.Action;
     Origin            = impactEvent.Origin;
     Target            = impactEvent.Target;
     TargetStat        = component.TargetStat;
     NormalizedPercent = component.NormalizedPercent;
     Length            = component.Length;
     Icon = component.Icon;
     ID   = component.ID;
 }
Beispiel #8
0
        /*
         * var amt = arg.Amount;
         *  bool isCritical = false;
         *  string source = arg.Origin.Get<LabelComponent>()?.Text;
         *  if (string.IsNullOrEmpty(source)) {
         *      var msg = isCritical ? CombatMessages.DamagedCritNoActor : CombatMessages.DamagedNoActor;
         *      msg.Show(UIStyle.Damage.ToHex(), Name, amt.ToString("F0"));
         *  }
         *  else {
         *      var msg = isCritical ? CombatMessages.DamagedCritActor : CombatMessages.DamageFromActor;
         *      msg.Show(UIStyle.Damage.ToHex(), source, Name, amt.ToString("F0"));
         *  }
         */

        public void Handle(ImpactEvent arg)
        {
            if (arg.Hit <= 0)
            {
                return;
            }
            var component    = arg.Source.Find <DamageImpact>();
            var sourceEntity = component.GetEntity();
            var stats        = sourceEntity.Get <StatsContainer>();

            if (component == null || stats == null)
            {
                return;
            }
            var targetStat = arg.Target.Stats.GetVital(component.TargetVital);

            if (targetStat == null)
            {
                return;
            }
            var power     = RulesSystem.CalculateTotal(stats, Stats.Power, component.NormalizedPercent);
            var logSystem = World.Get <GameLogSystem>();

            logSystem.StartNewMessage(out var logMsg, out var hoverMsg);
            logMsg.Append(arg.Origin.GetName());
            logMsg.Append(" hit ");
            logMsg.Append(power.ToString("F0"));
            logMsg.Append(" ");
            logMsg.Append(targetStat.Label);
            logMsg.Append(" for ");
            logMsg.Append(arg.Target.GetName());
            hoverMsg.Append(RulesSystem.LastQueryString);
            logSystem.PostCurrentStrings(GameLogSystem.DamageColor);
            //CollisionExtensions.GetHitMultiplier(impact.Hit, impact.Target)
            arg.Target.Post(new TakeDamageEvent(power, arg, component.DamageType, component.TargetVital));
        }
Beispiel #9
0
 public void Handle(ImpactEvent arg) {
     if (arg.Hit <= 0) {
         return;
     }
     var component = arg.Source.Find<ApplyTagImpact>();
     if (component == null) {
         return;
     }
     var success = RulesSystem.DiceRollSuccess(component.Chance);
     var logSystem = World.Get<GameLogSystem>();
     logSystem.StartNewMessage(out var logMsg, out var hoverMsg);
     logMsg.Append(arg.Origin.GetName());
     logMsg.Append(!success ? " failed to apply " : " applied ");
     logMsg.Append(component.Description);
     logMsg.Append(" on ");
     logMsg.Append(arg.Target.GetName());
     hoverMsg.AppendNewLine(RulesSystem.LastQueryString.ToString());
     if (success) {
         hoverMsg.Append(arg.Target.GetName());
         hoverMsg.Append(" has ");
         hoverMsg.Append(component.Description);
         hoverMsg.Append(" for ");
         hoverMsg.Append(component.Length);
         hoverMsg.Append(" ");
         hoverMsg.Append(StringConst.TimeUnits);
     }
     logSystem.PostCurrentStrings(!success ? GameLogSystem.NormalColor : GameLogSystem.DamageColor);
     if (success) {
         arg.Target.Tags.Add(component.Tag);
         if (component.Length > 0) {
             _timerArray.Add(new TagTimerEvent(arg.Target, TimeManager.Time + component.Length,
                 component.Tag));
         }
         arg.Target.Post(new TagChangeEvent(arg.Target.Entity, component.Tag, true));
     }
 }
Beispiel #10
0
 public void RuleEventEnded(ref ImpactEvent context)
 {
     World.Get <RulesSystem>().Post(new PrepareDamageEvent(context, context.Origin, context.Target));
 }
Beispiel #11
0
 public InstantKillEvent(ImpactEvent impactEvent, InstantKillImpact instantKill)
 {
     ImpactEvent = impactEvent;
     InstantKill = instantKill;
 }