%def name="accuracy(weapon_stats)"> ## Parameters: ## weapon_stats is an array containing what we'll call "weapon_stat" ## objects. These objects have the following attributes: ## ## [0] = Weapon description ## [1] = Weapon code ## [2] = Actual damage ## [3] = Max damage ## [4] = Hit ## [5] = Fired
Weapon | Hit | Fired | Hit % | Actual Damage | Potential Damage | Damage % | % for weapon_stat in weapon_stats: <% if weapon_stat[3] > 0: damage_pct = round(float(weapon_stat[2])/weapon_stat[3]*100, 2) else: damage_pct = 0 if weapon_stat[5] > 0: hit_pct = round(float(weapon_stat[4])/weapon_stat[5]*100, 2) else: hit_pct = 0 %>|
---|---|---|---|---|---|---|---|
${weapon_stat[0]} | ${weapon_stat[4]} | ${weapon_stat[5]} | ${hit_pct}% | ${weapon_stat[2]} | ${weapon_stat[3]} | ${damage_pct}% |