private PlayInfo ResolvePenaltyShot(PlayInfo currentPlay, PlayInfo lastPlay)
    {
        currentPlay       = PlayInfo.CopyPlay(lastPlay);
        currentPlay.Event = MatchEvent.None;

        return(actionManager.GetShotResults(currentPlay, lastPlay));
    }
    private PlayInfo ResolveFreekick(PlayInfo currentPlay, PlayInfo lastPlay)
    {
        if (lastPlay.Event != MatchEvent.Offside)
        {
            currentPlay = PlayInfo.CopyPlay(lastPlay);
        }
        else
        {
            currentPlay.Zone = lastPlay.Zone;
        }
        currentPlay.Attacker        = currentPlay.AttackingTeam.GetBestPlayerInArea(currentPlay.Zone, AttributeType.Freekick);
        currentPlay.Defender        = null;
        currentPlay.Marking         = MarkingType.None;
        currentPlay.DefensiveAction = PlayerAction.None;
        currentPlay.OffensiveAction = GetFreeKickAction(currentPlay);
        currentPlay.Event           = MatchEvent.None;
        if (currentPlay.OffensiveAction == PlayerAction.Shot)
        {
            currentPlay.Event = MatchEvent.ShotOnGoal;
        }
        else
        {
            currentPlay = actionManager.ResolveAction(currentPlay, lastPlay);
        }

        return(currentPlay);
    }
 private PlayInfo ResolveGoalAnnounced(PlayInfo currentPlay, PlayInfo lastPlay)
 {
     currentPlay       = PlayInfo.CopyPlay(lastPlay);
     currentPlay.Zone  = Zone.CM;
     currentPlay.Event = MatchEvent.ScorerAnnounced;
     return(currentPlay);
 }
 private PlayInfo ResolveSecondHalfKickOff(PlayInfo _currentPlay, PlayInfo _lastPlay)
 {
     _currentPlay                 = PlayInfo.CopyPlay(_lastPlay);
     _currentPlay.Attacker        = _currentPlay.AttackingTeam.GetAttackingPlayer(_currentPlay.Zone, null, true);
     _currentPlay.Defender        = null;
     _currentPlay.OffensiveAction = PlayerAction.Pass;
     _currentPlay.Event           = MatchEvent.None;
     _currentPlay                 = actionManager.ResolveAction(_currentPlay, null);
     return(_currentPlay);
 }
 private PlayInfo ResolvePenalty(PlayInfo currentPlay, PlayInfo lastPlay)
 {
     currentPlay                 = PlayInfo.CopyPlay(lastPlay);
     currentPlay.Attacker        = currentPlay.AttackingTeam.GetTopPlayerByAttribute(AttributeType.Penalty, currentPlay.AttackingTeam.Squad);
     currentPlay.Defender        = currentPlay.DefendingTeam.Squad[0];
     currentPlay.OffensiveAction = PlayerAction.Shot;
     currentPlay.DefensiveAction = PlayerAction.Save;
     currentPlay.Marking         = MarkingType.None;
     currentPlay.Event           = MatchEvent.PenaltyShot;
     currentPlay.Zone            = currentPlay.AttackingTeam.GetTeamZone(Zone.Box);
     return(currentPlay);
 }
 private PlayInfo ResolveKickOff(PlayInfo _currentPlay, PlayInfo _lastPlay)
 {
     if (_lastPlay != null)
     {
         _currentPlay = PlayInfo.CopyPlay(_lastPlay);
     }
     _currentPlay.Zone               = Zone.CM;
     _currentPlay.Attacker           = _currentPlay.AttackingTeam.GetAttackingPlayer(_currentPlay.Zone, null, true);
     _currentPlay.Defender           = null;
     _currentPlay.OffensiveAction    = PlayerAction.Pass;
     _currentPlay.Event              = MatchEvent.None;
     _currentPlay.IsActionSuccessful = true;
     _currentPlay.TargetZone         = Zone.LCM;
     return(_currentPlay);
 }
    private PlayInfo ResolveShotOnGoal(PlayInfo currentPlay, PlayInfo lastPlay)
    {
        currentPlay                 = PlayInfo.CopyPlay(lastPlay);
        currentPlay.Defender        = currentPlay.DefendingTeam.Squad[0];
        currentPlay.DefensiveAction = PlayerAction.Save;
        currentPlay.Event           = MatchEvent.None;

        if (currentPlay.OffensiveAction == PlayerAction.Shot)
        {
            currentPlay.Attacker.MatchStats.Shots++;
        }
        else if (currentPlay.OffensiveAction == PlayerAction.Header)
        {
            currentPlay.Attacker.MatchStats.Headers++;
        }

        return(actionManager.GetShotResults(currentPlay, lastPlay));
    }
    private PlayInfo ResolveGoal(PlayInfo currentPlay, PlayInfo lastPlay)
    {
        currentPlay = PlayInfo.CopyPlay(lastPlay);

        currentPlay.Attacker.MatchStats.Goals++;
        currentPlay.AttackingTeam.MatchStats.Goals++;
        currentPlay.AttackingTeam.MatchData.Scorers.Add(currentPlay.Attacker);

        if (lastPlay.OffensiveAction == PlayerAction.Header)
        {
            currentPlay.Attacker.MatchStats.GoalsByHeader++;
            currentPlay.AttackingTeam.MatchStats.GoalsByHeader++;
        }

        if (currentPlay.Assister != null)
        {
            currentPlay.Assister.MatchStats.Assists++;
        }

        currentPlay.Event = MatchEvent.GoalAnnounced;
        return(currentPlay);
    }
 private PlayInfo ResolveGoalkick(PlayInfo currentPlay, PlayInfo lastPlay)
 {
     currentPlay       = PlayInfo.CopyPlay(lastPlay);
     currentPlay.Event = MatchEvent.None;
     return(currentPlay);
 }