def __init__(self, json_object): _, _, max_hit_points = dice.roll(json_object["max_hit_points"]) Creature.__init__(self, max_hit_points, json_object["actions"], json_object) self.current_hit_points = self.max_hit_points
def __init__(self, ID, path, console): """Initialize the Player object and attach a console""" Creature.__init__(self, ID, path) self.cons = console self.start_loc_id = None self.set_weight(175 / 2.2) self.set_volume(66) self.actions.append(Action(self.inventory, "inventory", False, True)) self.actions.append(Action(self.toggle_terse, "terse", False, True)) self.actions.append(Action(self.execute, "execute", True, True)) self.actions.append(Action(self.fetch, "fetch", True, True)) self.actions.append(Action(self.clone, "clone", True, True)) self.actions.append(Action(self.apparate, "apparate", True, True)) self.actions.append(Action(self.reload, "reload", True, True)) self.actions.append( Action(self.say, ["say", "shout", "mutter", "whisper"], True, True)) self.actions.append(Action(self.introduce, "introduce", True, True)) self.actions.append(Action(self.engage, "engage", True, False)) self.actions.append(Action(self.disengage, "disengage", False, True)) self.aggressive = 1 #TODO: Specilized individual stats self.armor_class = 10 self.combat_skill = 40 self.strength = 20 self.dexterity = 60 self.attack_now = 0 self.auto_attack = True self.wizardry_skill = 0 self.wizardry_element = None self.attacking = False self.reading = False self.hitpoints = 20 self.health = 20 self.terse = False # True -> show short description when entering room self.game.register_heartbeat(self)
def __init__(self): Creature.__init__(self) self.wandf = 0 self.hp = hp self.friendly = 0 self.anger = 0 self.morale = 2 self.faction = mfaction_id( 0 ) self.mission_id = -1 self.no_extra_death_drops = False self.dead = False self.made_footstep = False self.unique_name = "" self.hallucination = False self.ignoring = 0 self.upgrades = False self.upgrade_time = -1 self.last_updated = 0 type = id.obj() self.moves = self.speed Creature.set_speed_base(self.speed) hp = self.hp for sa in self.special_attacks: entry = special_attacks[sa.first] entry.cooldown = sa.second.cooldown
def __init__(self, position, rotation=90, scale=1, size=50, speed=300, turn_speed=5): Creature.__init__(self, position, rotation, scale, size, speed, turn_speed) self.head = Body(self, self.position, self.rotation, self.size, self.size, Categories.PLAYER, head=True, speed=speed) self.bodies.append(self.head) for i in range(0): size = self.size b = Body(self, self.position, self.rotation, size, size, Categories.PLAYER, speed=10) b.attach_to(self.bodies[i]) self.bodies.append(b) #arm1 = Leg(self.head, 10, 90, 30, offset=(self.head.width/2, 0), foot_size=10, walk=False) #self.head.add_leg(arm1) #arm2 = Leg(self.head, 10, -90, 30, offset=(-self.head.width/2, 0), foot_size=10, walk=False) #self.head.add_leg(arm2) #self.arms.append(arm1) #self.arms.append(arm2) for body in self.bodies: body.add_leg(Leg(body, self.size*2, 15, 15, offset=(body.width/2 + 1, 0), foot_size=3)) body.add_leg(Leg(body, self.size*2, -15, 15, offset=(-body.width/2 - 1, 0), foot_size=3)) self.arm_counter = 0
def __init__(self, name): Creature.__init__(self, name, 11, 20, 1, 1, 1) self.inventory = [] self._equipped = {"Sword": None, "Shield": None} self.xp = 0 self.max_hp = 11 self.level = 1 self._core_strength = 1 self._core_intelligence = 1 self._core_dexterity = 1
def __init__(self, **kwargs): Creature.__init__(self, movable = True, **kwargs) self.moves = { 'Stop': self.set_velocity_xy, 'Jump': self.set_vertical_velocity, 'Fall': self.set_vertical_velocity, 'Left': self.set_horizontal_velocity, 'Right': self.set_horizontal_velocity, 'Stop_horizontaly':self.set_horizontal_velocity }
def __init__(self): Creature.__init__(self) self.wanted_item_pos = None # Position(x,y,z) self.guard_pos = None self.goal = None self.fetching_item = False self.my_fac = None self.fac_id = None self.miss_id = None self.marked_for_death = False self.dead = False self.mission = None
def __init__(self, x, y): stat_sheet = StatSheet(hp=30, defense=2, power=5, max_volume=10, max_carry_weight=100) Creature.__init__(self, x, y, '@', libtcod.white, c.player_name, stats=stat_sheet, death_function=self.player_death)
def __init__( self, x, y, ): stat_sheet = StatSheet(hp=15, defense=1, power=4) Creature.__init__(self, x, y, 't', libtcod.darker_green, 'Troll', stats=stat_sheet, ai=FighterAI())
def __init__( self, x, y, ): stat_sheet = StatSheet(hp=10, defense=0, power=3) Creature.__init__(self, x, y, 'o', libtcod.light_green, name='Orc', stats=stat_sheet, ai=FighterAI())
def __init__(self, health, speed, coords, dna): Creature.__init__(self, health, speed, coords) self.actions = [] self.lifespan = 0 self.score = 0 self.action_nn = NN(2, 2, 2) self.move_nn = NN(2, 1, 2) if (dna is None): self.move_nn.set_random_NN_weights() self.dna = self.move_nn.get_weights() else: print(dna, end="\n") print(dna) self.move_nn.set_NN_weights() self.dna = dna
def __init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints = 8): """ Creates a new scout creature (including the libAVG nodes). g_player: the global player instance. team: the team, the creature should belong to. pos: the initial position. layer: the layer to put the creature on. when: the moment, the creation has been started. """ Creature.__init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints) self.speed = self.speed * 2 if self.team.name == "Team2": self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "triangleEvil.png") else: self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "triangleGood.png")
def __init__(self, position, rotation=90, scale=1, size=50, speed=100, turn_speed=5): Creature.__init__(self, position, rotation, scale, size, speed, turn_speed) self.head = Body(self, self.position, self.rotation, self.size * 2, self.size * 2, Categories.ENEMY, head=True, speed=speed) self.bodies.append(self.head) for i in range(4): b = Body(self, self.position, self.rotation, self.size, self.size, Categories.ENEMY, speed=30) b.attach_to(self.bodies[i]) self.bodies.append(b) for body in self.bodies: leg = Leg(body, self.size * 2, 15, 40, (body.width / 2, 0), 3) body.add_leg(leg) leg = Leg(body, self.size * 2, -15, 40, (-body.width / 2, 0), 3) body.add_leg(leg) self.wander_time = 2 self.timer = random.random() * self.wander_time self.displacement = Vector2(0, 0)
def __init__(self, base, position, cid=None): Creature.__init__(self, base.data.copy(), position, cid) self.base = base self.creatureType = 1 self.spawnPosition = position.copy() self.lastStep = 0 self.speed = float(base.speed) self.lastMelee = 0 self.lastDistance = 0 self.walkPer = base.walkPer self.brainEvent = None self.spawnTime = None self.radius = 5 self.master = None self.respawn = True self.skull = base.skull # We make a copy of the int so we might set a skull in scripts later. self.canWalk = base.walkable self.intervals = {} self.defaultSpeakType = MSG_SPEAK_MONSTER_SAY self.defaultYellType = MSG_SPEAK_MONSTER_YELL self.lastRetarget = 0
def __init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints = 8): """ Creates a new wizard creature (including the libAVG nodes). g_player: the global player instance. team: the team, the creature should belong to. pos: the initial position. layer: the layer to put the creature on. when: the moment, the creation has been started. """ self.maxJumpDistance = util.halfwidth // 2 self.goalXPos = self.maxJumpDistance self.freezed = False self.shouldDie = False self.firstJump = True self.appearAnim = None self.disappearAnim = None Creature.__init__(self, g_player, team, enemy, pos, layer, when, main, inActiveLayer, maxHitPoints) if self.team.name == "Team2": self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "circleEvil.png") else: self.creature.filltexhref = os.path.join(getMediaDir(__file__, "resources"), "circleGood.png")
def __init__(self, name): Creature.__init__(self) self.name = name
def __init__(self, json_object): Creature.__init__(self, json_object["max_hit_points"], {}, json_object) self.json_object = json_object self.level = json_object["level"] self.class_ = json_object["class"] self.hit_die = constants.HIT_DICE[self.class_] self.current_hit_dice = json_object["current_hit_dice"] self.current_hit_points = json_object["current_hit_points"] # Skill proficiencies proficiency_bonus = constants.PROFICIENCY_BONUSES[self.level] self.skills = {} for skill, ability in constants.SKILLS.items(): self.skills[skill] = self.ability_modifiers[ability] for skill, proficiency in json_object["skill_proficiencies"].items(): self.skills[skill] += proficiency * proficiency_bonus self.features = loader.get_class_features(self.class_, self.level) # Compiling actions from weapon proficiencies and weapon properties weapon_proficiencies = json_object["weapon_proficiencies"] self.weapons = json_object["weapons"] actions = {} for weapon in self.weapons: weapon_stats = loader.get_weapon(weapon) # Relevant ability bonus if "finesse" in weapon_stats["properties"]: if self.ability_modifiers["STR"] >= self.ability_modifiers[ "DEX"]: relevant_ability = "STR" else: relevant_ability = "DEX" elif weapon_stats["range"] == "melee": relevant_ability = "STR" else: relevant_ability = "DEX" relevant_ability_bonus = self.ability_modifiers[relevant_ability] # To hit modifier to_hit = relevant_ability_bonus if weapon in weapon_proficiencies or weapon_stats[ "type"] in weapon_proficiencies: to_hit += proficiency_bonus if to_hit > 0: to_hit = "+" + str(to_hit) else: to_hit = str(to_hit) # Damage damage = weapon_stats["damage_dice"] if damage != "0" and relevant_ability_bonus > 0: damage += "+" + str(relevant_ability_bonus) elif relevant_ability_bonus < 0: damage += str(relevant_ability_bonus) # Convert to action dictionary action_name = weapon try: formatted_name = weapon_stats["name"] except: formatted_name = weapon.capitalize() versatile = False if "versatile" in weapon_stats["properties"]: action_name += " 1" formatted_name += ", One-Handed" versatile = True range = weapon_stats["range"] if "reach" in weapon_stats["properties"]: range += " + 5ft" actions[action_name] = loader.get_simple_action_dictionary( formatted_name, range, to_hit, damage, weapon_stats["damage_type"]) if "special" in weapon_stats["properties"]: actions[action_name]["effects"] = weapon_stats["effects"] # Add commands try: if versatile: actions[action_name]["commands"] = [] for command in weapon_stats["commands"]: actions[action_name]["commands"].append(command + " 1") else: actions[action_name]["commands"] = weapon_stats["commands"] except: pass # If versatile, add another action with alt damage dice and different commands if versatile: action_name = weapon + " 2" try: formatted_name = weapon_stats["name"] + ", Two-Handed" except: formatted_name = weapon.capitalize() + ", Two-Handed" alternate_damage = weapon_stats["alternate_damage_dice"] if relevant_ability_bonus > 0: alternate_damage += "+" + str(relevant_ability_bonus) elif relevant_ability_bonus < 0: alternate_damage += str(relevant_ability_bonus) actions[action_name] = loader.get_simple_action_dictionary( formatted_name, range, to_hit, alternate_damage, weapon_stats["damage_type"]) try: actions[action_name]["commands"] = [] for command in weapon_stats["commands"]: actions[action_name]["commands"].append(command + " 2") except: pass if "thrown" in weapon_stats["properties"]: action_name = weapon + " thrown" formatted_name += ", Thrown" actions[action_name] = loader.get_simple_action_dictionary( formatted_name, weapon_stats["thrown_range"], to_hit, damage, weapon_stats["damage_type"]) self.set_actions(actions)
def __init__ (self, *args, **kwargs): Creature.__init__(self, *args, **kwargs)
def __init__(self, health, speed, coords): Creature.__init__(self, health, speed, coords)
def __init__ (self): Creature.__init__(self, '@', libtcod.red)
def __init__(self, x, y,): stat_sheet = StatSheet(hp=15, defense=1, power=4) Creature.__init__(self, x, y, 't', libtcod.darker_green, 'Troll', stats=stat_sheet, ai=FighterAI())
def __init__(self, hp, atk, deff, name): Creature.__init__(self, hp, atk, deff, name)