|
|
@@ -0,0 +1,85 @@
|
|
|
+import numpy as np
|
|
|
+import math
|
|
|
+
|
|
|
+
|
|
|
+class Weapon:
|
|
|
+ def __init__(self, name, gpe, dammage, type, pene, range, mode, at, rch, attribute):
|
|
|
+ self.name = name
|
|
|
+ self.gpe = gpe
|
|
|
+ self.dammage = dammage
|
|
|
+ self.type = type
|
|
|
+ self.pene = pene
|
|
|
+ self.range = range
|
|
|
+ self.mode = mode
|
|
|
+ self.at = at
|
|
|
+ self.rch = rch
|
|
|
+ self.attribute = attribute
|
|
|
+
|
|
|
+
|
|
|
+class MyPerso:
|
|
|
+ def __init__(self):
|
|
|
+ self.experience = 17400
|
|
|
+ self.CC = 52
|
|
|
+ self.CT = 40
|
|
|
+ self.F = 46
|
|
|
+ self.E = 45
|
|
|
+ self.AG = 50
|
|
|
+ self.INT = 34
|
|
|
+ self.PER = 43
|
|
|
+ self.FM = 43
|
|
|
+ self.SOC = 40
|
|
|
+ self.MF = 2 * math.floor((self.F + 2 * 5) / 10) + 30 / 10
|
|
|
+ self.weapons = [
|
|
|
+ Weapon("Flamethrower", "Base", "2d10+5", "", 3, 20, None, None, None, None)
|
|
|
+ ]
|
|
|
+
|
|
|
+ def bonus(self, int):
|
|
|
+ return np.round(int / 10)
|
|
|
+
|
|
|
+ def dices(self, number_of_dice, int):
|
|
|
+ dice = np.random.random_integers(1, int, number_of_dice)
|
|
|
+ print("rolled %s dice of %s and got %s" % (number_of_dice, int, dice))
|
|
|
+ return dice
|
|
|
+
|
|
|
+ def initiative(self):
|
|
|
+ return self.dices(1, 10) + self.bonus(self.AG)
|
|
|
+
|
|
|
+ def perception(self, bonus=0):
|
|
|
+ return (self.dices(1, 100) - self.PER - bonus - 20) < 0
|
|
|
+
|
|
|
+ def flamethrower(self, hord=True):
|
|
|
+ if hord:
|
|
|
+ return np.ceil(self.weapons[0].range / 4) + self.dices(1, 5)
|
|
|
+
|
|
|
+ def bolter_damage(self, success_degree):
|
|
|
+ throw = []
|
|
|
+
|
|
|
+ for degree in range(success_degree):
|
|
|
+ current_throw = self.dices(3, 10)
|
|
|
+ throw.append(current_throw[np.argsort(current_throw)[-2:]])
|
|
|
+ print(throw)
|
|
|
+ return np.sum(throw) + 5 * success_degree
|
|
|
+
|
|
|
+ def bolter(self, bonus_ct=0):
|
|
|
+ ct_dice = self.CT - self.dices(1, 100) + bonus_ct
|
|
|
+ print("ct_dice_roll %i" % ct_dice)
|
|
|
+ if ct_dice > 0:
|
|
|
+ success_degree = 1 + int(math.floor(ct_dice / 10))
|
|
|
+ print(success_degree)
|
|
|
+ else:
|
|
|
+ success_degree = 0
|
|
|
+ return self.bolter_damage(success_degree)
|
|
|
+
|
|
|
+ def sword_damage(self):
|
|
|
+ return self.dices(1, 10) + 3 + self.MF
|
|
|
+
|
|
|
+ def test_cc(self, bonus=0):
|
|
|
+ return self.CC + bonus - self.dices(1, 100) > 0
|
|
|
+
|
|
|
+ def fast_attack(self):
|
|
|
+ damage = 0
|
|
|
+ for i in range(2):
|
|
|
+ if self.test_cc():
|
|
|
+ damage += self.sword_damage()
|
|
|
+ print("Sword damage % i penetration 4" % damage)
|
|
|
+ return damage
|