Example #1
0
	def init_parser(self):
		parser = libtcod.parser_new()
		suffix_type_struct = libtcod.parser_new_struct(parser, 'suffix_type')
		libtcod.struct_add_property(suffix_type_struct, 'icon_color', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(suffix_type_struct, 'cost_multiplier', libtcod.TYPE_FLOAT, True)
		libtcod.struct_add_property(suffix_type_struct, 'level', libtcod.TYPE_INT, True)
		libtcod.struct_add_property(suffix_type_struct, 'dices', libtcod.TYPE_DICE, False)
		libtcod.struct_add_property(suffix_type_struct, 'bonus', libtcod.TYPE_INT, False)
		libtcod.struct_add_flag(suffix_type_struct, 'armor')
		libtcod.struct_add_flag(suffix_type_struct, 'robe')
		libtcod.struct_add_flag(suffix_type_struct, 'cloak')
		libtcod.struct_add_flag(suffix_type_struct, 'shield')
		libtcod.struct_add_flag(suffix_type_struct, 'weapon')
		libtcod.struct_add_flag(suffix_type_struct, 'ring')
		libtcod.struct_add_flag(suffix_type_struct, 'potion')
		libtcod.struct_add_flag(suffix_type_struct, 'heal_health')
		libtcod.struct_add_flag(suffix_type_struct, 'heal_mana')
		libtcod.struct_add_flag(suffix_type_struct, 'heal_stamina')
		libtcod.struct_add_flag(suffix_type_struct, 'protect')
		libtcod.struct_add_flag(suffix_type_struct, 'regenerate')
		libtcod.struct_add_flag(suffix_type_struct, 'resist_fire')
		libtcod.struct_add_flag(suffix_type_struct, 'resist_ice')
		libtcod.struct_add_flag(suffix_type_struct, 'resist_poison')
		libtcod.struct_add_flag(suffix_type_struct, 'health_bonus1')
		libtcod.struct_add_flag(suffix_type_struct, 'mana_bonus1')
		libtcod.struct_add_flag(suffix_type_struct, 'stamina_bonus1')
		libtcod.struct_add_flag(suffix_type_struct, 'str_bonus')
		libtcod.struct_add_flag(suffix_type_struct, 'dex_bonus')
		libtcod.struct_add_flag(suffix_type_struct, 'int_bonus')
		libtcod.struct_add_flag(suffix_type_struct, 'wis_bonus')
		libtcod.struct_add_flag(suffix_type_struct, 'end_bonus')
		libtcod.parser_run(parser, 'data/suffix.txt', SuffixListener())
Example #2
0
	def init_parser(self):
		parser = libtcod.parser_new()
		prefix_type_struct = libtcod.parser_new_struct(parser, 'prefix_type')
		libtcod.struct_add_property(prefix_type_struct, 'type', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(prefix_type_struct, 'cost_multiplier', libtcod.TYPE_FLOAT, True)
		libtcod.struct_add_property(prefix_type_struct, 'level', libtcod.TYPE_INT, True)
		libtcod.struct_add_property(prefix_type_struct, 'quality', libtcod.TYPE_INT, False)
		libtcod.struct_add_flag(prefix_type_struct, 'armor')
		libtcod.struct_add_flag(prefix_type_struct, 'robe')
		libtcod.struct_add_flag(prefix_type_struct, 'cloak')
		libtcod.struct_add_flag(prefix_type_struct, 'shield')
		libtcod.struct_add_flag(prefix_type_struct, 'weapon')
		libtcod.struct_add_flag(prefix_type_struct, 'ring')
		libtcod.struct_add_flag(prefix_type_struct, 'potion')
		libtcod.struct_add_flag(prefix_type_struct, 'leather')
		libtcod.struct_add_flag(prefix_type_struct, 'metal')
		libtcod.struct_add_flag(prefix_type_struct, 'damage_bonus1')
		libtcod.struct_add_flag(prefix_type_struct, 'damage_bonus2')
		libtcod.struct_add_flag(prefix_type_struct, 'damage_bonus3')
		libtcod.struct_add_flag(prefix_type_struct, 'ar_bonus1')
		libtcod.struct_add_flag(prefix_type_struct, 'ar_bonus2')
		libtcod.struct_add_flag(prefix_type_struct, 'ar_bonus3')
		libtcod.struct_add_flag(prefix_type_struct, 'fire_bonus1')
		libtcod.struct_add_flag(prefix_type_struct, 'fire_bonus2')
		libtcod.struct_add_flag(prefix_type_struct, 'fire_bonus3')
		libtcod.struct_add_flag(prefix_type_struct, 'cold_bonus1')
		libtcod.struct_add_flag(prefix_type_struct, 'cold_bonus2')
		libtcod.struct_add_flag(prefix_type_struct, 'cold_bonus3')
		libtcod.parser_run(parser, 'data/prefix.txt', PrefixListener())
Example #3
0
	def init_parser(self):
		parser = libtcod.parser_new()
		item_type_struct = libtcod.parser_new_struct(parser, 'item_type')
		libtcod.struct_add_property(item_type_struct, 'type', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(item_type_struct, 'plural', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(item_type_struct, 'icon', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(item_type_struct, 'icon_color', libtcod.TYPE_COLOR, True)
		libtcod.struct_add_property(item_type_struct, 'dark_color', libtcod.TYPE_COLOR, True)
		libtcod.struct_add_property(item_type_struct, 'level', libtcod.TYPE_INT, True)
		libtcod.struct_add_property(item_type_struct, 'weight', libtcod.TYPE_FLOAT, False)
		libtcod.struct_add_property(item_type_struct, 'cost', libtcod.TYPE_INT, False)
		libtcod.struct_add_property(item_type_struct, 'dices', libtcod.TYPE_DICE, False)
		libtcod.struct_add_property(item_type_struct, 'article', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(item_type_struct, 'charge', libtcod.TYPE_INT, False)
		libtcod.struct_add_property(item_type_struct, 'duration', libtcod.TYPE_INT, False)
		libtcod.struct_add_property(item_type_struct, 'expiration', libtcod.TYPE_INT, False)
		libtcod.struct_add_property(item_type_struct, 'hunger', libtcod.TYPE_INT, False)
		libtcod.struct_add_flag(item_type_struct, 'healing')
		libtcod.struct_add_flag(item_type_struct, 'mana_healing')
		libtcod.struct_add_flag(item_type_struct, 'stamina_healing')
		libtcod.struct_add_flag(item_type_struct, 'usable')
		libtcod.struct_add_flag(item_type_struct, 'equippable')
		libtcod.struct_add_flag(item_type_struct, 'consumable')
		libtcod.struct_add_flag(item_type_struct, 'torchlight')
		libtcod.struct_add_flag(item_type_struct, 'identified')
		libtcod.struct_add_flag(item_type_struct, 'ranged')
		libtcod.struct_add_flag(item_type_struct, 'weapon_dagger')
		libtcod.struct_add_flag(item_type_struct, 'weapon_sword')
		libtcod.struct_add_flag(item_type_struct, 'weapon_mace')
		libtcod.struct_add_flag(item_type_struct, 'weapon_axe')
		libtcod.struct_add_flag(item_type_struct, 'weapon_staff')
		libtcod.struct_add_flag(item_type_struct, 'weapon_polearm')
		libtcod.struct_add_flag(item_type_struct, 'weapon_bow')
		libtcod.struct_add_flag(item_type_struct, 'weapon_missile')
		libtcod.struct_add_flag(item_type_struct, 'armor_shield')
		libtcod.struct_add_flag(item_type_struct, 'armor_head')
		libtcod.struct_add_flag(item_type_struct, 'armor_cloak')
		libtcod.struct_add_flag(item_type_struct, 'armor_body')
		libtcod.struct_add_flag(item_type_struct, 'armor_hands')
		libtcod.struct_add_flag(item_type_struct, 'armor_feet')
		libtcod.struct_add_flag(item_type_struct, 'armor_ring')
		libtcod.struct_add_flag(item_type_struct, 'missile_arrow')
		libtcod.struct_add_flag(item_type_struct, 'missile_stone')
		libtcod.struct_add_flag(item_type_struct, 'corpse')
		libtcod.parser_run(parser, 'data/items.txt', BaseItemListener())
Example #4
0
	def init_parser(self):
		parser = libtcod.parser_new()
		tile_type_struct = libtcod.parser_new_struct(parser, 'tile_type')
		libtcod.struct_add_property(tile_type_struct, 'type', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(tile_type_struct, 'icon', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(tile_type_struct, 'icon_color_h', libtcod.TYPE_COLOR, True)
		libtcod.struct_add_property(tile_type_struct, 'icon_color_l', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(tile_type_struct, 'back_color_h', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(tile_type_struct, 'back_color_l', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(tile_type_struct, 'article', libtcod.TYPE_STRING, True)
		libtcod.struct_add_flag(tile_type_struct, 'blocked')
		libtcod.struct_add_flag(tile_type_struct, 'block_sight')
		libtcod.struct_add_flag(tile_type_struct, 'animate')
		libtcod.struct_add_flag(tile_type_struct, 'invisible')
		libtcod.struct_add_flag(tile_type_struct, 'locked')
		libtcod.struct_add_flag(tile_type_struct, 'trapped')
		libtcod.struct_add_flag(tile_type_struct, 'fx_teleport')
		libtcod.struct_add_flag(tile_type_struct, 'fx_stuck')
		libtcod.struct_add_flag(tile_type_struct, 'fx_poison_gas')
		libtcod.struct_add_flag(tile_type_struct, 'fx_sleep_gas')
		libtcod.struct_add_flag(tile_type_struct, 'fx_fireball')
		libtcod.struct_add_flag(tile_type_struct, 'fx_arrow')
		libtcod.struct_add_flag(tile_type_struct, 'fx_needle')
		libtcod.parser_run(parser, 'data/tiles.txt', TileListener())
Example #5
0
	def init_parser(self):
		parser = libtcod.parser_new()
		monster_type_struct = libtcod.parser_new_struct(parser, 'monster_type')
		libtcod.struct_add_property(monster_type_struct, 'type', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(monster_type_struct, 'unidentified_name', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(monster_type_struct, 'icon', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(monster_type_struct, 'icon_color', libtcod.TYPE_COLOR, True)
		libtcod.struct_add_property(monster_type_struct, 'icon_color2', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(monster_type_struct, 'icon_color3', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(monster_type_struct, 'icon_color4', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(monster_type_struct, 'icon_color5', libtcod.TYPE_COLOR, False)
		libtcod.struct_add_property(monster_type_struct, 'dark_color', libtcod.TYPE_COLOR, True)
		libtcod.struct_add_property(monster_type_struct, 'level', libtcod.TYPE_INT, True)
		libtcod.struct_add_property(monster_type_struct, 'health', libtcod.TYPE_DICE, True)
		libtcod.struct_add_property(monster_type_struct, 'attack_rating', libtcod.TYPE_INT, True)
		libtcod.struct_add_property(monster_type_struct, 'defense_rating', libtcod.TYPE_INT, True)
		libtcod.struct_add_property(monster_type_struct, 'damage', libtcod.TYPE_DICE, True)
		libtcod.struct_add_property(monster_type_struct, 'article', libtcod.TYPE_STRING, True)
		libtcod.struct_add_property(monster_type_struct, 'weight', libtcod.TYPE_INT, False)
		libtcod.struct_add_property(monster_type_struct, 'corpse', libtcod.TYPE_INT, False)
		libtcod.struct_add_flag(monster_type_struct, 'ai_friendly')
		libtcod.struct_add_flag(monster_type_struct, 'ai_neutral')
		libtcod.struct_add_flag(monster_type_struct, 'ai_hostile')
		libtcod.struct_add_flag(monster_type_struct, 'identified')
		libtcod.struct_add_flag(monster_type_struct, 'all')
		libtcod.struct_add_flag(monster_type_struct, 'overworld')
		libtcod.struct_add_flag(monster_type_struct, 'underground')
		libtcod.struct_add_flag(monster_type_struct, 'dungeon')
		libtcod.struct_add_flag(monster_type_struct, 'cave')
		libtcod.struct_add_flag(monster_type_struct, 'maze')
		libtcod.struct_add_flag(monster_type_struct, 'land')
		libtcod.struct_add_flag(monster_type_struct, 'flying')
		libtcod.struct_add_flag(monster_type_struct, 'aquatic')
		libtcod.parser_run(parser, 'data/monsters.txt', MonsterListener())
Example #6
0
# Create parser.
parser = lib.parser_new()

# Create structs
tile_type_struct = lib.parser_new_struct(parser, 'tile')
item_type_struct = lib.parser_new_struct(parser, 'item')
npc_type_struct = lib.parser_new_struct(parser, 'npc')
spell_type_struct = lib.parser_new_struct(parser, 'spell')
race_type_struct = lib.parser_new_struct(parser, 'race')
history_type_struct = lib.parser_new_struct(parser, 'history')
gender_type_struct = lib.parser_new_struct(parser, 'gender')
names_type_struct = lib.parser_new_struct(parser, 'names')
player_type_struct = lib.parser_new_struct(parser, 'player')

# Add flags.
lib.struct_add_flag(tile_type_struct, 'abstract')

# Add properties.
# Tile properties.
lib.struct_add_property(tile_type_struct, 'IMAGE', lib.TYPE_CHAR, True)
lib.struct_add_property(tile_type_struct, 'SOLID', lib.TYPE_BOOL, True)
lib.struct_add_property(tile_type_struct, 'BLOCKS_SIGHT', lib.TYPE_BOOL, True)
lib.struct_add_property(tile_type_struct, 'ALWAYS_VISIBLE', lib.TYPE_BOOL, True)
lib.struct_add_property(tile_type_struct, 'COLOR', lib.TYPE_STRING, True)
lib.struct_add_property(tile_type_struct, 'DESCRIPTION', lib.TYPE_STRING, True)

# Item properties.
lib.struct_add_property(item_type_struct, 'IMAGE', lib.TYPE_CHAR, True)
lib.struct_add_property(item_type_struct, 'SOLID', lib.TYPE_BOOL, True)
lib.struct_add_property(item_type_struct, 'BLOCKS_SIGHT', lib.TYPE_BOOL, True)
lib.struct_add_property(item_type_struct, 'ALWAYS_VISIBLE', lib.TYPE_BOOL, True)