def __init__(self, cr, race=None, pc_class=None): super().__init__(cr, race) self.profession = "Mercenary" if pc_class is None: self.npc_class = self.pc_classes() else: self.npc_class = pc_class self.level = smart_clamp(cr - 1, 1, 20) self.player = Player(self.npc_class, self.level) self.stats = self.player.stats self.stat_mod = self.player.stat_mod self.fav_stat_mod = self.stat_mod[self.npc_class.fav_stat] self.magic_bonus = self.player.magic_bonus x = self.player.level y = self.class_price_multi(self.player.cls.name) z = self.fav_stat_mod + self.magic_bonus self.price = smart_clamp(x * y * z, x, 99999) self.name = f"NPC {self.player.cls.name}" self.damage_bonus = self.stat_mod[ self.npc_class.fav_stat] + self.player.magic_bonus self.damage_type = self.player.damage_type self.special_dam_type = self.player.cls.damage_type self.damage_formula = self.player.damage_formula self.special_dam = f"{Monster(self.level).damage}" self.skills = SkillSet(self.level, self.player.prof_bonus, self.stats, self.background) self.inventory = Loot() while len(self.inventory.magic_items) < CR(self.cr).tier: self.inventory.magic_items = career_loot(1, self.level - 1, self.level).magic_items if len(self.inventory.magic_items) > self.level: self.inventory.magic_items = self.inventory.magic_items[:self. level] self.treasure = Loot()
def __init__(self, cr, name=None, num_people=10): self.cr = CR(cr) self.num_people = num_people self.name = name if name else f"{self.random_name()}" self.rooms = [] self.threats = [] for room_num in range(1, self.num_people + 1): this_room = random_city_npc(self.cr.value) self.rooms.append( f"Area {room_num}, {self.name.split(', ')[0]}\n{this_room}") self.threats.append(this_room) self.total_treasure = self.get_treasures()
def __init__(self, cr, dungeon_name=None, dungeon_levels=1, rooms_per_level=10, make_traps=True): self.rooms = [] self.rooms_per_level = rooms_per_level self.cr = CR(cr) self.name = dungeon_name if dungeon_name else f"{self.random_name()}" self.total_xp = 0 self.dungeon_levels = dungeon_levels self.total_rooms = dungeon_levels * self.rooms_per_level room_number = 1 first_room = MinionRoom( cr, room_name="Dungeon Entrance", ) self.first_room_cr = first_room.threat.cr self.boss_cr = 0 self.rooms.append(f'{first_room}') self.threats = [first_room] my_room = Room() for dun_level in range(dungeon_levels): for _ in range(self.rooms_per_level): room_number += 1 if room_number == self.total_rooms: my_room = BossRoom(dun_level + self.cr.value + 2, "Dungeon Heart") self.boss_cr = my_room.threat.cr elif room_number < self.total_rooms: if room_number % self.rooms_per_level == 0: my_room = VillainRoom(dun_level + self.cr.value + 1) elif room_number % self.rooms_per_level == 1: my_room = MinionRoom(dun_level + self.cr.value) elif room_number < self.total_rooms: my_room = Room(dun_level + self.cr.value, make_traps=False) else: break self.rooms.append(f'Room {room_number}, {my_room}') self.threats.append(my_room) self.total_xp += my_room.xp self.total_treasure = self.get_treasures()
def __init__(self, cr, name=None, num_levels=1, areas_per_level=10): self.cr = CR(cr) self.name = name if name else f"{self.random_name()}" self.total_xp = 0 rooms_per_level = areas_per_level self.total_rooms = num_levels * rooms_per_level room_number = 1 self.rooms = [] self.threats = [] self.total_treasure = self.get_treasures() for dun_level in range(num_levels): for _ in range(rooms_per_level): my_room = WildArea(dun_level + self.cr.value, self.name) self.rooms.append( f"Area {room_number}, {self.name}\n{my_room}") self.threats.append(my_room) if my_room.xp: self.total_xp += my_room.xp room_number += 1
def __init__(self, cr, room_name="Any", name=None): self.name = random_monster('monster') if not name else name self.cr = CR(cr) self.cr_val = self.cr.val self.tier = self.cr.tier self.cr_key = self.cr.key self.total_hp = self.set_hit_points(self.cr_val) self.current_hp = self.total_hp self.damage = ( "1d2", "1d2 + 1", "1d2 + 2", "1d2 + 3", "1d6 + 8", "1d6 + 14", "1d6 + 20", "1d6 + 26", "1d6 + 32", "1d6 + 40", "1d6 + 45", "1d6 + 50", "1d6 + 65", "1d6 + 70", "1d8 + 75", "1d8 + 80", "1d8 + 85", "1d8 + 90", "1d8 + 95", "1d10 + 100", "1d10 + 105", "1d10 + 110", "1d10 + 115", "1d10 + 120", "1d12 + 140", "1d12 + 150", "1d12 + 160", "1d12 + 180", "1d12 + 200", "1d20 + 260", "1d20 + 270", "1d20 + 280", "1d20 + 290", "1d20 + 300", )[self.cr_key] self.xp = self.set_xp_by_cr(self.cr_val) self.motive = motivation() self.treasure = get_loot(self.cr_val, monster_name=self.name, room_name=room_name, is_villain=False) self.prof_bonus = self.set_prof_bonus(self.cr_val) variance = plus_or_minus_gauss(3) self.ac = self.set_ac(self.cr_val) + variance self.att_bonus = self.set_att_bonus(self.cr_val) + -variance self.save_dc = self.set_save_dc(self.cr_val) self.num_appearing = 1 self.dam_type = self.find_dam_type() self.at_will_dam = f"{smart_clamp(self.cr_val // 3, 1, 10)}d6 + {self.prof_bonus} {self.dam_type}" self.rank_by_cr = tuple(x // 5 for x in range(34)) self.abilities = ["STR", "DEX", "INT", "WIS", "CHA", "CON"] self.rank = self.rank_by_cr[self.cr.key] self.stats = { ability: ability_dice(4) for ability in self.abilities } self.stat_mod = {} self.stat_mod_str = {} self.set_stat_mods() self.special_damage = f"{self.damage} {damage_types()}"
def __init__(self, cr): tier = d(CR(cr).tier) self.name = self.random_potion(str(tier)) self.price = f"{dice(5, 100)} {('Silver', 'Electrum', 'Gold', 'Platinum')[tier - 1]}"
def random_trap(cr, dam_type=None, room_name="Any"): _ = room_name tier = str(CR(cr).tier) return random_trap_by_tier(tier, cr, dam_type)