@@ -0,0 +1,2823 @@
+#!/usr/bin/env python%0A%0Aimport optparse%0Afrom lib.damage import DamageValue%0Afrom lib.shooting import *%0A%0Adef parse_cmd_line():%0A    usage = %22%22%22%25prog %5Boptions%5D%0A%0AThis program resolves a shooting event in shadowrun 5e. %0A%0A%22%22%22%0A    parser = optparse.OptionParser(usage = usage)%0A%0A    shooter = optparse.OptionGroup(parser, 'Attacker options')%0A    shooter.add_option(%22-A%22, %22--accuracy%22, help = %22Accuracy of weapon (default = 7)%22,%0A                      default = %227%22)%0A    shooter.add_option(%22-d%22, %22--damage%22, help = %22Base damage value of weapon %22 +%0A                      %22(default = 7P)%22, default = %227P%22)%0A    shooter.add_option(%22-M%22, %22--attack_modifier%22, default = %220%22,%0A                       help = %22Modifiers to the attack roll (default = 0)%22)%0A    shooter.add_option(%22-p%22, %22--attack_pool%22, help = %22Attack pool starting size %22 +%0A                      %22(default = 6)%22, default = %226%22)%0A    shooter.add_option(%22-P%22, %22--armor_piercing%22, help = %22Armor piercing value for %22 +%0A                      %22firearm (default = 0)%22, default = %220%22)%0A    parser.add_option_group(shooter)%0A%0A    target = optparse.OptionGroup(parser, %22Defender options%22)%0A    target.add_option(%22-a%22, %22--armor%22, help = %22Defender armor value (default = 12)%22,%0A                      default = %2212%22)%0A    target.add_option(%22-b%22, %22--body%22, help = %22Defender body (default = 4)%22,%0A                      default = %224%22)%0A    target.add_option(%22-i%22, %22--intuition%22, help = %22Defender intuition (default = 4)%22,%0A                      default = %224%22)%0A    target.add_option(%22-m%22, %22--defensive_modifier%22, default = %220%22,%0A                      help = %22Defensive modifier (default = 0)%22)%0A    target.add_option(%22-r%22, %22--reaction%22, help = %22Defender reaction (default = 7)%22,%0A                      default = %227%22)%0A    parser.add_option_group(target)%0A%0A    (options, args) = parser.parse_args()%0A%0A    try:%0A        DamageValue(options.damage)%0A    except Exception as e:%0A        parser.error(%22Invalid damage value %5B%25s%5D (%25s)%22 %25 (options.damage, str(e)))%0A%0A    return options%0A%0Adef main():%0A    options = parse_cmd_line()%0A%0A    shooter = ShootingCharacter(agility = 0, firearm = int(options.attack_pool))%0A%0A    target = ShootingCharacter(intuition = int(options.intuition),%0A                               reaction = int(options.reaction),%0A                               armor = int(options.armor),%0A                               body = int(options.body))%0A%0A    accuracy = int(options.accuracy)%0A    ap = int(options.armor_piercing)%0A    damage_value = DamageValue(options.damage)%0A%0A    attack_modifier = int(options.attack_modifier)%0A    defensive_modifier = int(options.defensive_modifier)%0A%0A    result = shoot(shooter, target, damage_value, accuracy, ap,%0A                   defense_modifier = defensive_modifier, verbose = True,%0A                   attack_modifier = attack_modifier)%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add simulation of a single shooting event