def __init__(self): super(PoolOfBlood, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.DUNGEON_TRASH)) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(Description("A pool of blood.", "A pool of blood.")) self.set_child(GraphicChar(None, colors.RED, random.choice(icon.BLOOD_ICONS))) self.set_child(CharPrinter()) self.set_child(Mover())
def __init__(self): super(GlassWall, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(GraphicChar(colors.FLOOR_BG, colors.WHITE, icon.GLASS_WALL)) self.set_child(CharPrinter()) self.set_child(Flag("is_solid"))
def __init__(self): super(Water, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(GraphicChar(colors.BLUE_D, colors.BLUE, icon.WATER)) self.set_child(CharPrinter())
def set_dungeon_feature_components(dungeon_feature): dungeon_feature.set_child( DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.DUNGEON_FEATURE)) dungeon_feature.set_child(Position()) dungeon_feature.set_child(DungeonLevel()) dungeon_feature.set_child(GraphicChar(None, colors.RED, icon.FOUNTAIN_FULL)) dungeon_feature.set_child(CharPrinter()) dungeon_feature.set_child(Mover()) dungeon_feature.set_child(IsDungeonFeature())
def __init__(self): super(Floor, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(GraphicChar(colors.FLOOR_BG, colors.FLOOR_FG, icon.CENTER_DOT)) self.set_child(CharPrinter()) self.set_child(Flag(Floor.FLOOR_FLAG))
def _copy_add_children_helper(self, old_piece): new_piece = compositecore.Composite() if old_piece.has("game_piece_type"): new_piece.set_child( DataPoint(DataTypes.GAME_PIECE_TYPE, old_piece.game_piece_type.value)) if old_piece.has("graphic_char"): new_piece.set_child(old_piece.graphic_char.copy()) if old_piece.has("description"): new_piece.set_child(old_piece.description.copy()) new_piece.set_child(CharPrinter()) return new_piece
def __init__(self): super(Unknown, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(CharPrinter()) self.set_child(GraphicChar(colors.BLACK, colors.BLACK, ' ')) self.set_child(Flag("is_unknown")) self.set_child(Flag("is_solid"))
def set_cloud_components(game_state, cloud, density): cloud.set_child(DataPoint(DataTypes.ENERGY, -gametime.single_turn)) cloud.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.CLOUD)) cloud.set_child(DataPoint(DataTypes.GAME_STATE, game_state)) cloud.set_child(CharPrinter()) cloud.set_child(Position()) cloud.set_child(DungeonLevel()) cloud.set_child(Mover()) cloud.set_child(GraphicChar(None, None, 178)) cloud.set_child(DataPoint(DataTypes.DENSITY, density)) cloud.set_child(DataPoint(DataTypes.MOVEMENT_SPEED, gametime.single_turn)) cloud.set_child(StatusFlags([StatusFlags.FLYING])) cloud.set_child(CloudChangeAppearanceShareTileEffect())
def __init__(self): super(Chasm, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(GraphicChar(colors.BLACK, colors.DARKNESS, icon.CHASM2)) self.set_child(CharPrinter()) self.set_child(Flag("is_chasm")) self.set_child(PlayerFallDownChasmAction()) self.set_child(FallRemoveNonPlayerNonFlying()) self.set_child(PromptPlayerChasm())
def set_corpse_components(corpse, game_state): corpse.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.DUNGEON_TRASH)) corpse.set_child(Position()) corpse.set_child(DungeonLevel()) corpse.set_child(Description("A rotting corpse.", "A rotting corpse.")) corpse.set_child(GraphicChar(None, colors.WHITE, icon.CORPSE)) corpse.set_child(CharPrinter()) corpse.set_child(DataPoint(DataTypes.ENERGY, -gametime.single_turn)) corpse.set_child(DoNothingActor()) corpse.set_child(Mover()) corpse.set_child(DataPoint(DataTypes.GAME_STATE, game_state))
def __init__(self): super(Wall, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(CharPrinter()) self.set_child(GraphicCharTerrainCorners(colors.FLOOR_BG, colors.WALL_FG, icon.CAVE_WALLS_ROW2, [Wall, Door, Chasm])) self.set_child(Flag("is_solid")) self.set_child(Flag("is_opaque")) self.set_child(Flag("is_wall"))
def __init__(self): super(Door, self).__init__() self.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) self.set_child(Mover()) self.set_child(Position()) self.set_child(DungeonLevel()) self.set_child(CharPrinter()) self.set_child(GraphicChar(colors.FLOOR_BG, colors.ORANGE_D, icon.DOOR)) self.set_child(Flag("is_solid")) self.set_child(Flag("is_opaque")) self.set_child(OpenDoorAction()) self.set_child(OpenDoorBumpAction()) self.set_child(Flag("is_door"))
def set_monster_components(monster, game_state): monster.set_child(DataPoint(DataTypes.ENERGY, -gametime.single_turn)) monster.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.ENTITY)) #monster.set_child(DataPoint(DataTypes.CRIT_CHANCE, 0.15)) monster.set_child(DataPoint(DataTypes.UNARMED_CRIT_CHANCE, 0.15)) monster.set_child(DataPoint(DataTypes.MOVEMENT_SPEED, gametime.single_turn)) monster.set_child(DataPoint(DataTypes.MELEE_SPEED, gametime.single_turn)) monster.set_child(DataPoint(DataTypes.THROW_SPEED, gametime.single_turn)) monster.set_child(DataPoint(DataTypes.SHOOT_SPEED, gametime.single_turn)) monster.set_child(DataPoint(DataTypes.SIGHT_RADIUS, constants.COMMON_SIGHT_RADIUS)) monster.set_child(DataPoint(DataTypes.FACTION, Factions.MONSTER)) monster.set_child(DataPoint(DataTypes.GAME_STATE, game_state)) monster.set_child(DataPoint(DataTypes.INTELLIGENCE, IntelligenceLevel.NORMAL)) monster.set_child(DataPoint(DataTypes.SKIP_ACTION_CHANCE, IntelligenceLevel.NORMAL)) monster.set_child(Position()) monster.set_child(CharPrinter()) monster.set_child(DungeonLevel()) monster.set_child(StatusDescriptionBar()) monster.set_child(Mover()) monster.set_child(CautiousStepper()) monster.set_child(HealthModifier()) monster.set_child(Dodger()) monster.set_child(ArmorChecker()) monster.set_child(ResistanceChecker()) monster.set_child(AwarenessChecker()) monster.set_child(DungeonMask()) monster.set_child(Vision()) monster.set_child(Path()) monster.set_child(ChasePlayerActor()) monster.set_child(MonsterActorState()) monster.set_child(HuntPlayerIfHurtMe()) monster.set_child(StartHuntOnAttack()) monster.set_child(Equipment()) monster.set_child(Inventory()) monster.set_child(EffectQueue()) monster.set_child(UnarmedAttacker()) monster.set_child(RemoveEntityOnDeath()) monster.set_child(PrintDeathMessageOnDeath()) monster.set_child(MonsterWeightedStepAction(100)) monster.set_child(StatusFlags([]))
def set_item_components(item, game_state): item.set_child(DataPoint(DataTypes.ENERGY, -gametime.single_turn)) item.set_child(Position()) item.set_child(DoNothingActor()) item.set_child(DungeonLevel()) item.set_child(Mover()) item.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.ITEM)) item.set_child(DataPoint(DataTypes.GAME_STATE, game_state)) item.set_child(CharPrinter()) new_drop_action(DROP_ACTION_TAG, item) item.set_child(PlayerThrowItemAction()) set_thrown_item_hit_floor_action(item, [ MoveTriggeredEffect(), LocalMessageEffect(messenger.ITEM_HITS_THE_GROUND_HEAVY) ]) set_thrown_item_hit_chasm_action(item, [ MoveTriggeredEffect(), LocalMessageEffect(messenger.ITEM_FALLS_DOWN_CHASM) ]) return item
def set_terrain_components(terrain): terrain.set_child(DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.TERRAIN)) terrain.set_child(Mover()) terrain.set_child(Position()) terrain.set_child(DungeonLevel()) terrain.set_child(CharPrinter())
def new_player(game_state): """ A composite component representing the player character. """ player = Composite() player.set_child(DataPoint(DataTypes.GAME_STATE, game_state)) player.set_child(DataPoint(DataTypes.RACE, Races.HUMAN)) player.set_child(DataPoint(DataTypes.ENERGY, -gametime.single_turn)) player.set_child(DataPoint(DataTypes.UNARMED_CRIT_CHANCE, 0.15)) player.set_child(DataPoint(DataTypes.CRIT_CHANCE, 0.0)) player.set_child(DataPoint(DataTypes.ACCURACY, 10)) player.set_child(DataPoint(DataTypes.STRENGTH, 5)) player.set_child(DataPoint(DataTypes.EVASION, 10)) player.set_child(DataPoint(DataTypes.ARMOR, 4)) player.set_child(DataPoint(DataTypes.STEALTH, 6)) player.set_child(DataPoint(DataTypes.COUNTER_ATTACK_CHANCE, 0.0)) player.set_child(DataPoint(DataTypes.DEFENCIVE_ATTACK_CHANCE, 0.0)) player.set_child(DataPoint(DataTypes.OFFENCIVE_ATTACK_CHANCE, 0.0)) player.set_child(Flag("is_player")) player.set_child(Flag("is_named")) player.set_child( StatusFlags([StatusFlags.CAN_OPEN_DOORS, StatusFlags.IS_ALIVE])) player.set_child( DataPoint(DataTypes.GAME_PIECE_TYPE, GamePieceTypes.ENTITY)) player.set_child(DataPoint(DataTypes.MOVEMENT_SPEED, gametime.single_turn)) player.set_child(DataPoint(DataTypes.MELEE_SPEED, gametime.single_turn)) player.set_child(DataPoint(DataTypes.THROW_SPEED, gametime.double_turn)) player.set_child(DataPoint(DataTypes.SHOOT_SPEED, gametime.single_turn)) player.set_child( DataPoint(DataTypes.THROW_ITEM_SPEED, gametime.single_turn)) player.set_child(DataPoint(DataTypes.CAST_SPEED, gametime.single_turn)) player.set_child( DataPoint(DataTypes.SIGHT_RADIUS, constants.COMMON_SIGHT_RADIUS)) player.set_child(DataPoint(DataTypes.FACTION, Factions.PLAYER)) player.set_child( DataPoint(DataTypes.INTELLIGENCE, IntelligenceLevel.NORMAL)) player.set_child(DungeonLevel()) player.set_child(Position()) player.set_child(Mover()) player.set_child(PlayerStepper()) player.set_child(UnarmedAttacker()) player.set_child(ThrowRockAttacker()) player.set_child(Dodger()) player.set_child(ArmorChecker()) player.set_child(ResistanceChecker()) player.set_child(Description("CO", "The Brave")) player.set_child(GraphicChar(None, colors.WHITE, icon.GUNSLINGER_THIN)) player.set_child(StatusDescriptionBar()) player.set_child(CharPrinter()) player.set_child(HealthModifier()) player.set_child(BleedWhenDamaged()) player.set_child(LoseParalyzeWhenDamaged()) set_counter_attack(player) set_attack_enemy_i_step_next_to(player) set_attack_enemy_stepping_next_to_me(player) player.set_child(PlayerThrowStoneAction()) player.set_child(DungeonMask()) player.set_child(Vision()) player.set_child(AwarenessChecker()) player.set_child(MemoryMap()) player.set_child(Inventory()) player.set_child(InputActor()) player.set_child(Path()) player.set_child(Equipment()) player.set_child(EffectQueue()) player.set_child(PickUpItemAction()) player.set_child(LeaveCorpseOnDeath()) return player