shot: Perform a Ranged Attack

Description Usage Arguments Value Examples

View source: R/shot.R

Description

Perform a Ranged Attack

Usage

1
2
3
4
shot(warjack, which = 1, target = list(stats = c(DEF = 12, ARM = 18, BASE =
  50)), boost_hit = TRUE, boost_damage = TRUE, foc = 0, kd = FALSE,
  dist = 6, dice = sample(1:6, size = 20, replace = TRUE), pos = 1,
  recycle = FALSE)

Arguments

warjack

list attacker warjack object with elements stats, range and melee and special

which

single integer specify ranged weapon to use

target

list target warjack object with elements stats and special stats has elements

  1. DEF single numeric NB should include effect of being knocked down (no adjustment here due to possible effect of other modifiers)

  2. ARM single numeric armour value

  3. BASE single numeric diameter of base (mm)

boost_hit

single logical

boost_damage

single logical

foc

single numeric number of focus

kd

single logical is the target knocked down? (default FALSE)

dist

numeric vector distance between bases (default 6)

dice

numeric vector (default sample(1:6))

pos

single numeric

recycle

single logical should dice be recycled for each value of dist? (default FALSE)

Value

named vector with elements

  1. damage amount of damage inflicted

  2. focus remaining focus following attack

  3. knocked down is the target knocked down? 0: No, 1: Yes

  4. position which die to use next

  5. hit was the target hit? 0: No, 1: Yes

Examples

1
2
3
4
5
6
7
8
9
redbandit <- list(stats = c(SPD = 4, MAT = 6, RAT = 4, DEF = 10, ARM = 20, BASE = 50),
        range = list(bombard = list(
            stats = c(RNG = 14, POW = 14, AOE = 3),
            special = c("arcing"))),
        melee = list(axe = list(stats = c(RNG = 0.5, PAS = 12),
                special = c("crit amp"))))
    shot(redbandit, which = 1, target = redbandit,
        boost_hit = TRUE, boost_damage = TRUE, foc = 3, dist = 10,
        dice = c(1, 5, 4, 1, 1, 2))

CSJCampbell/WMTools documentation built on May 6, 2019, 9:26 a.m.