Exemplo n.º 1
0
 public void Simulate(ref MatchState state, MatchInputContext input)
 {
     SimulationComponents.Simulate(ref state, input);
 }
Exemplo n.º 2
0
 public MatchState ResetState(MatchState state) => state;
Exemplo n.º 3
0
 public void Simulate(ref MatchState state, MatchInputContext input)
 {
     Simulations[state.StateID].Simulate(ref state, input);
 }
        // TODO(james7132): Split and generalize this... somehow.
        public void ApplyCollisions(List <HitboxCollision> collisions, ref PlayerState state, MatchState match)
        {
            if (collisions.Count <= 0 || IsPlayerInvincible(state))
            {
                return;
            }
            bool isShielded = false;
            bool isHit      = false;

            foreach (var collision in collisions)
            {
                var source      = collision.Source;
                int srcPlayerId = (int)collision.Source.PlayerID;
                int dstPlayerId = (int)collision.Destination.PlayerID;
                switch (collision.Destination.Type)
                {
                case HurtboxType.Damageable:
                    ref PlayerState sourceState = ref match[srcPlayerId];

                    // Check if hit is valid.
                    if (isShielded || isHit || sourceState.HasHit(dstPlayerId))
                    {
                        continue;
                    }

                    // Deal damage, knockback, and hitstun to the target
                    var hitDamage    = source.BaseDamage;
                    var hitKnockback = source.GetKnocback(state.Damage, sourceState.Direction);

                    state.Damage  += hitDamage;
                    state.Velocity = hitKnockback;
                    state.Hitstun  = source.GetHitstun(state.Damage);

                    // Apply hitlag
                    state.Hitlag       = source.Hitlag;
                    sourceState.Hitlag = source.Hitlag;

                    // Mark the source as having hit the destination.
                    sourceState.HitPlayer(dstPlayerId);

                    collision.PlayEffect(new HitInfo {
                        Source      = collision.Source,
                        Destination = collision.Destination,
                        MatchState  = match,
                    });

                    isHit = true;
                    break;

                case HurtboxType.Shield:
                    isShielded          = true;
                    state.ShieldDamage += (uint)(source.BaseDamage * 100);
                    break;

                case HurtboxType.Invincible:
                    collision.PlayEffect(new HitInfo {
                        Source      = collision.Source,
                        Destination = collision.Destination,
                        MatchState  = match,
                    });
                    break;
                }
            }
        }
Exemplo n.º 5
0
 public void ApplyState(ref MatchState state)
 {
     ApplyPlayerStates(state);
     ApplyOtherStates(state);
 }
 public MatchState Simulate(MatchState state, MatchInputContext input)
 {
     return(SimulationComponents.Simulate(state, input));
 }
Exemplo n.º 7
0
 MatchResult CreateResult(MatchState state)
 {
     return(new MatchResult {
         PlayerStats = MatchResultUtil.CreateMatchStatsFromConfig(MatchConfig)
     });
 }