示例#1
0
文件: skills.c 项目: jcubic/ToME
/*
 * Print the abilities list
 */
void dump_abilities(PHYSFS_file *fff)
{
	s32b i, j;
	s32b *table;
	s32b max = 0;

	C_MAKE(table, max_ab_idx, s32b);

	/* Initialise the abilities list */
	for (i = 0; i < max_ab_idx; i++)
	{
		if (ab_info[i].name && has_ability(i))
			add_sorted_ability(table, &max, i);
	}

	if (max)
	{
		fprintf(fff, "\nAbilities");

		for (j = 0; j < max; j++)
		{
			i = table[j];

			fprintf(fff, "\n * %s", ab_info[i].name);
		}

		fprintf(fff, "\n");
	}
}
示例#2
0
const char* Card::can_attack(Game* g, Player* p) const {
    CHECK_RETURN(controller == p);
    CHECK_RETURN(!tapped);
    CHECK_RETURN(has_text("creature"));
    CHECK_RETURN(!sick || has_ability("haste"));
    return nullptr;
}
示例#3
0
文件: unit_type.cpp 项目: x2f/wesciv
unit_type::unit_type(wml::const_node_ptr node)
  : description_(node->attr("description")),
    texture_(graphics::texture::get(node->attr("image"))),
	movement_(wml::get_int(node, "movement", 10)),
	cost_(wml::get_int(node, "cost", 1))
{
	abilities_ = util::split(node->attr("abilities"));
	ability_build_city_ = has_ability("settle");
}
示例#4
0
const char* Card::can_tap(Game* g, Player* p) const {
    // Does the player control it?
    CHECK_RETURN(controller == p);
    // Is it not tapped?
    CHECK_RETURN(!tapped);
    // Is it in play?
    CHECK_RETURN(g->is_in_play(this));
    // If it's a creature, is it sick?
    CHECK_RETURN(!has_text("creature") || !sick || has_ability("haste"));

    return nullptr;
}
示例#5
0
文件: cmd4.c 项目: jcubic/ToME
/*
 * Display current pets
 */
static void do_cmd_knowledge_pets(void)
{
	s32b i;

	PHYSFS_file *fff;

	monster_type *m_ptr;

	monster_race *r_ptr;

	s32b t_friends = 0;

	s32b t_levels = 0;

	s32b show_upkeep = 0;

	s32b upkeep_divider = 20;

	char file_name[1024];


	/* Temporary file */
	if (path_temp(file_name, 1024)) return;

	/* Open a new file */
	fff = my_fopen(file_name, "w");

	if (has_ability(AB_PERFECT_CASTING)) upkeep_divider = 15;

	/* Process the monsters (backwards) */
	for_flags(&monst_list);
	{
		i = __key;
		/* Access the monster */
		m_ptr = get_monster(i);
		r_ptr = &r_info[m_ptr->r_idx];

		/* Ignore "dead" monsters */
		if (!m_ptr->r_idx) continue;

		/* Calculate "upkeep" for friendly monsters */
		if (is_friend(m_ptr) == 1)
		{
			char pet_name[80];

			t_friends++;
			t_levels += m_ptr->level;
			monster_desc(pet_name, m_ptr, 0x88);
			fprintf(fff, "%s%s (%s)\n",
			        ((has_flag(m_ptr, FLAG_UNIQUE))) ? "#####G" : "",
			        pet_name,
			        (has_flag(m_ptr, FLAG_PERMANENT)) ? "friend" : "companion");
		}
	}
	end_for_flags();

	if (t_friends > 1 + (p_ptr->lev / (upkeep_divider)))
	{
		show_upkeep = (t_levels);

		if (show_upkeep > 100) show_upkeep = 100;
		else if (show_upkeep < 10) show_upkeep = 10;
	}


	fprintf(fff, "----------------------------------------------\n");
	fprintf(fff, "   Total: %d pet%s.\n", t_friends, (t_friends == 1 ? "" : "s"));
	fprintf(fff, "   Upkeep: %d%% mana.\n", show_upkeep);


	/* Close the file */
	my_fclose(fff);

	/* Display the file contents */
	show_file(file_name, "Current Pets", 0, 0);

	/* Remove the file */
	fd_kill(file_name);
}