Example #1
0
    private PlayInfo GetHeaderRolls(PlayInfo _currentPlay)
    {
        PlayerData attacker = _currentPlay.Attacker;
        PlayerData defender = _currentPlay.Defender;

        if (defender != null)
        {
            _currentPlay.DefensiveAction      = PlayerAction.Block;
            _currentPlay.DefenderRoll         = ActionRoll.HeaderBlock(defender);
            _currentPlay.DefendingBonusChance = GetPlayerAttributeBonus(defender.Blocking);
        }

        _currentPlay.AttackerRoll         = ActionRoll.Header(attacker);
        _currentPlay.AttackingBonusChance = GetPlayerAttributeBonus(attacker.Heading);

        if (_currentPlay.Marking == MarkingType.Close)
        {
            _currentPlay.AttackerRoll *= 0.75f;
        }

        return(ApplyBuffs(_currentPlay));
    }
Example #2
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));
    }