Exemple #1
0
enum brq_code get_kbyte_brq_for_me(struct aps_controller *aps, enum side side) {
    if (!is_kbyte_for_me(aps, side))
        return NR;
    if (is_cut(aps, side))
        return NR;
    return DRV_KBYTES_BRCODE(side);
}
Exemple #2
0
enum brq_code get_dq_brq(struct aps_controller *aps, enum side side) {
    if (DQ_SF == DRV_DQ(side) || is_cut(aps, side))
        return SF;
    if (DQ_SD == DRV_DQ(side))
        return SD;
    return NR;
}
std::string get_name( t_artifact_type artifact, bool include_article )
{
	assert( !is_cut( artifact ) );
	if (include_article)
		return get_properties( artifact ).name_with_article;
	return get_properties( artifact ).name;
}
std::string get_artifact_type_name( t_artifact_type artifact_type )
{
	assert( !is_cut( artifact_type ) );
	if ( artifact_type == k_artifact_scroll )
		return k_text_scroll;
	if ( artifact_type == k_artifact_parchment )
		return k_text_parchment;
	return get_name( artifact_type );
}
Exemple #5
0
/*
** Return a vector of all potions
*/
static std::vector< t_artifact_type > get_potion_vector()
{
	std::vector< t_artifact_type > result;

	result.reserve(22); // Current count, won't break anything if it changes

	for ( t_artifact_type type = t_artifact_type(0); type < k_artifact_type_count; enum_incr( type ) ) 
	{
		if ( !is_cut( type ) && get_slot( type ) == k_artifact_slot_potion )
		{
			result.push_back( type );
		}
	}

	return result;
}
t_spell get_potion_effect( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );

	static t_spell effect[k_artifact_type_count];
	static bool    initialized = false;

	if (!initialized)
	{
		int const k_effects[][2] = 
		{
			{ k_artifact_vial_of_acid,		k_spell_effect_potion_of_acid },
			{ k_artifact_binding_liquid,	k_spell_effect_potion_of_binding },
			{ k_artifact_potion_of_cold,	k_spell_effect_potion_of_cold },
			{ k_artifact_cloud_of_despair,	k_spell_effect_potion_of_despair },
			{ k_artifact_potion_of_endurance,	k_spell_effect_potion_of_endurance },
			{ k_artifact_kreegan_fire,			k_spell_effect_potion_of_fire },
			{ k_artifact_potion_of_fire_resistance,	k_spell_effect_potion_of_fire_resistance },
			{ k_artifact_vial_of_choking_gas,		k_spell_effect_potion_of_gas },
			{ k_artifact_potion_of_healing,			k_spell_effect_potion_of_healing },
			{ k_artifact_potion_of_health,			k_spell_effect_potion_of_health },
			{ k_artifact_holy_water,				k_spell_effect_potion_of_holy_water },
			{ k_artifact_potion_of_luck,			k_spell_effect_potion_of_luck },
			{ k_artifact_potion_of_mana,			k_spell_effect_potion_of_mana },
			{ k_artifact_potion_of_mirth,			k_spell_effect_potion_of_mirth },
			{ k_artifact_vial_of_poison,			k_spell_effect_potion_of_poison },
			{ k_artifact_potion_of_quickness,		k_spell_effect_potion_of_quickness },
			{ k_artifact_potion_of_resistance,		k_spell_effect_potion_of_resistance },
			{ k_artifact_potion_of_restoration,		k_spell_effect_potion_of_restoration },
			{ k_artifact_vial_of_blinding_smoke,	k_spell_effect_potion_of_smoke },
			{ k_artifact_potion_of_speed,			k_spell_effect_potion_of_speed },
			{ k_artifact_potion_of_strength,		k_spell_effect_potion_of_strength }
		};
		int i;

		initialized = true;
		for (i = 0; i < k_artifact_type_count; i++)
			effect[i] = k_spell_effect_potion_of_acid;
		for (i = 0; i < ELEMENTS_OF( k_effects ); i++)
			effect[k_effects[i][0]] = t_spell(k_effects[i][1]);
	}
	return effect[artifact];
}
// -------------------------------------------------------------------------
// get properties for a given artifact image
// -------------------------------------------------------------------------
t_bitmap_layer_ptr get_icon( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );

	static bool					initialized = false;
	static t_bitmap_pool		k_artifact_icons;
	static int                  icon_ids[ k_artifact_type_count ];
	static t_bitmap_group_cache caches[] = 
	{
		"icons.artifacts.armor",
		"icons.artifacts.item",
		"icons.artifacts.special",
		"icons.artifacts.weapon"
	};

	if (!initialized)
	{
		std::vector<t_string_pair> layer_names( k_artifact_type_count );
		t_artifact_type            artifact;

		initialized = true;
		for (artifact = t_artifact_type(0); artifact < k_artifact_type_count; enum_incr(artifact))
		{
			t_string_pair & layer_name = layer_names[ artifact ];
			t_artifact_properties const & properties = get_properties( artifact );
			if ( !properties.cut )
			{
				layer_name.value = get_properties( artifact ).file_id;
				layer_name.keyword = get_keyword( artifact );
			}
			else
				layer_name.value = 0;
		}

		k_artifact_icons = t_bitmap_pool( caches, &(*layer_names.begin()), layer_names.size() );
	}
	return k_artifact_icons.get( artifact );
}
bool allowed_by_default( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );
	return get_properties( artifact ).allowed_by_default;
}
std::string get_history_text( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );
	return get_properties( artifact ).history_text;
}
std::string get_pickup_text( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );
	return get_properties( artifact ).pickup_text;
}
t_artifact_level get_level( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );
	return get_properties( artifact ).level;
}
int get_cost( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );
	return get_properties( artifact ).cost;
}
// -------------------------------------------------------------------------
// artifact slot for a given artifact image
// -------------------------------------------------------------------------
t_artifact_slot get_slot( t_artifact_type artifact )
{
	assert( !is_cut( artifact ) );
	return get_properties( artifact ).slot;
}