1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Nerf spell accuracy

This commit is contained in:
Steffo 2019-02-17 22:22:09 +01:00
parent 1b848cb5ea
commit defc6d5a64

View file

@ -6,23 +6,25 @@ s = strings.safely_format_string
class Spell: class Spell:
version = "3.0" version = "3.1"
dice_type_distribution = ([4] * 1) +\ dice_type_distribution = ([4] * 7) +\
([6] * 6) +\ ([6] * 12) +\
([8] * 24) +\ ([8] * 32) +\
([10] * 38) +\ ([10] * 30) +\
([12] * 24) +\ ([12] * 12) +\
([20] * 6) +\ ([20] * 6) +\
([100] * 1) ([100] * 1)
all_damage_types = ["da fuoco", "da freddo", "elettrici", "sonici", "necrotici", "magici", all_damage_types = ["da fuoco", "da freddo", "elettrici", "sonici", "necrotici", "magici",
"da acido", "divini", "nucleari", "psichici", "fisici", "puri", "da taglio", "da acido", "divini", "nucleari", "psichici", "fisici", "puri", "da taglio",
"da perforazione", "da impatto", "da caduta", "gelato", "onnipotenti", "oscuri", "da perforazione", "da impatto", "da caduta", "gelato", "onnipotenti", "oscuri",
"di luce", "da velocità", "da cactus", "meta", "dannosi", "da radiazione", "di luce", "da velocità", "da cactus", "dannosi", "da radiazione",
"tuamammici", "da maledizione", "pesanti", "leggeri", "immaginari", "da laser", "tuamammici", "da maledizione", "pesanti", "leggeri", "immaginari", "da laser",
"da neutrini", "galattici", "cerebrali", "ritardati", "ritardanti", "morali", "materiali", "da neutrini", "galattici", "cerebrali", "ritardati", "ritardanti", "morali", "materiali",
"energetici", "esplosivi"] "energetici", "esplosivi", "energetici", "finanziari", "radianti", "sonori", "spaggiaritici",
"interiori", "endocrini", "invisibili", "inesistenti", "eccellenti", "bosonici",
"gellificanti", "terminali"]
repeat_distribution = ([1] * 8) +\ repeat_distribution = ([1] * 8) +\
([2] * 1) +\ ([2] * 1) +\
@ -40,7 +42,7 @@ class Spell:
self.dice_number = random.randrange(1, 21) self.dice_number = random.randrange(1, 21)
self.dice_type = random.sample(self.dice_type_distribution, 1)[0] self.dice_type = random.sample(self.dice_type_distribution, 1)[0]
self.constant = random.randrange(math.floor(-self.dice_type / 4), math.ceil(self.dice_type / 4) + 1) self.constant = random.randrange(math.floor(-self.dice_type / 4), math.ceil(self.dice_type / 4) + 1)
self.miss_chance = random.randrange(80, 101) self.miss_chance = random.randrange(50, 101)
self.repeat = random.sample(self.repeat_distribution, 1)[0] self.repeat = random.sample(self.repeat_distribution, 1)[0]
self.damage_types_qty = random.sample(self.damage_types_distribution, 1)[0] self.damage_types_qty = random.sample(self.damage_types_distribution, 1)[0]
self.damage_types = random.sample(self.all_damage_types, self.damage_types_qty) self.damage_types = random.sample(self.all_damage_types, self.damage_types_qty)
@ -63,32 +65,3 @@ class Spell:
if self.repeat > 1: if self.repeat > 1:
string += s(strings.SPELL.REPEAT, words={"repeat": str(self.repeat)}) string += s(strings.SPELL.REPEAT, words={"repeat": str(self.repeat)})
return string return string
class Hit:
def __init__(self, spell: Spell):
random.seed()
self.hit_roll = random.randrange(0, 101)
self.damage = 0
self.crit_multiplier = 1
self.damage_type = random.sample(spell.damage_types, 1)[0]
if self.hit_roll > spell.miss_chance:
return
for _ in range(spell.dice_number):
self.damage += random.randrange(1, spell.dice_type + 1)
self.damage += spell.constant
if self.damage < 0:
self.damage = 0
while random.randrange(1, 21) == 20:
self.crit_multiplier *= 2
@property
def total_damage(self):
return self.damage * self.crit_multiplier
class Cast:
def __init__(self, spell: Spell):
self.hits = []
for _ in spell.repeat:
self.hits.append(Hit(spell))