Exemple #1
0
    private PlayInfo GetPassRolls(PlayInfo _currentPlay, PlayInfo _lastPlay)
    {
        PlayerData attacker = _currentPlay.Attacker;
        PlayerData defender = _currentPlay.Defender;

        if (_lastPlay != null && _lastPlay.OffensiveAction == PlayerAction.Cross && _lastPlay.IsActionSuccessful)
        {
            _currentPlay.AttackerRoll = ActionRoll.HeaderPass(attacker);
            if (defender != null)
            {
                _currentPlay.DefensiveAction = PlayerAction.Block;
                _currentPlay.DefenderRoll    = ActionRoll.HeaderBlock(defender);
            }
        }
        else
        {
            _currentPlay.AttackerRoll = ActionRoll.Pass(attacker);
            if (defender != null)
            {
                _currentPlay.DefensiveAction = PlayerAction.Block;
                _currentPlay.DefenderRoll    = ActionRoll.Block(defender);
            }
        }

        _currentPlay.AttackingBonusChance = GetPlayerAttributeBonus(attacker.Passing);

        if (_currentPlay.Marking == MarkingType.Close)
        {
            _currentPlay.AttackingBonusChance = Mathf.FloorToInt(_currentPlay.AttackingBonusChance * 0.9f);
        }
        if (defender != null)
        {
            _currentPlay.DefendingBonusChance = GetPlayerAttributeBonus(defender.Blocking);
        }

        return(ApplyBuffs(_currentPlay));
    }