예제 #1
0
 public void ProcessAction(CollisionEvent collisionEvent, ActionStateEvent stateEvent, Entity owner, Entity target)
 {
     if (collisionEvent.Hit <= 0)
     {
         return;
     }
     if (_actionFx != null)
     {
         _actionFx.TriggerEvent(stateEvent);
     }
     target.AddObserver(this);
     target.Post(new DamageEvent(owner.Stats.GetValue(Stats.Power) * _damagePercent * CollisionExtensions.GetHitMultiplier(collisionEvent.Hit, owner), owner, target, _damageType, _targetVital));
 }
예제 #2
0
        private int EvadeDamageWithStats(CollisionEvent arg)
        {
            if (_vitalStat == null)
            {
                return(arg.Hit);
            }
            if (_fxComponent != null)
            {
                _fxComponent.TriggerEvent(
                    new ActionStateEvent(arg.Origin, arg.Target, arg.HitPoint, Quaternion.LookRotation(arg.HitNormal),
                                         ActionStateEvents.Collision));
            }

            _vitalStat.Current -= _finalCost;
            return(CollisionResult.Miss);
        }
예제 #3
0
 public bool CanRuleEventStart(ref PrepareDamageEvent arg)
 {
     if (_vitalStat == null)
     {
         return(true);
     }
     if (_fxComponent != null)
     {
         _fxComponent.TriggerEvent(
             new ActionEvent(arg.Origin, arg.Target, arg.Hit.Point, Quaternion.LookRotation(arg.Hit.Normal),
                             ActionState.Collision));
     }
     _vitalStat.Current -= _finalCost;
     World.Get <GameLogSystem>().StartNewMessage(out var log, out var hover);
     log.Append(arg.Target.GetName());
     log.Append(" completely blocked damage from ");
     log.Append(arg.Origin.GetName());
     World.Get <GameLogSystem>().PostCurrentStrings(GameLogSystem.DamageColor);
     return(false);
 }
예제 #4
0
 private void TriggerCollisionEvent(ActionFx data, Vector3 hitPoint, Vector3 hitNormal, Entity target)
 {
     data.TriggerEvent(
         ActionState.Collision, hitPoint + (hitNormal * 0.1f), Quaternion.LookRotation(hitNormal),
         target?.GetTemplate <CharacterTemplate>());
 }