View Single Post
Old March 16, 2020, 05:54   #4
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,532
wobbly will become famous soon enough
Originally Posted by DavidMedley View Post
Where do things like PLAYER_LEVEL from class.txt get interpreted? I only find that string in text files and player-spell.c.
expression_base_value_f spell_value_base_by_name(const char *name)
	static const struct value_base_s {
		const char *name;
		expression_base_value_f function;
	} value_bases[] = {
		{ "SPELL_POWER", spell_value_base_spell_power },
		{ "PLAYER_LEVEL", spell_value_base_player_level },
		{ "DUNGEON_LEVEL", spell_value_base_dungeon_level },
		{ "MAX_SIGHT", spell_value_base_max_sight },
		{ "WEAPON_DAMAGE", spell_value_base_weapon_damage },
		{ "PLAYER_HP", spell_value_base_player_hp },
		{ "MONSTER_PERCENT_HP_GONE", spell_value_base_monster_percent_hp_gone },
		{ NULL, NULL },
	const struct value_base_s *current = value_bases;

	while (current->name != NULL && current->function != NULL) {
		if (my_stricmp(name, current->name) == 0)
			return current->function;


	return NULL;
When I saw this I thought "Jackpot!" But when I try to put in things like WEAPON_DAMAGE into class.txt, angband gives me a parse error when I run it. I tried PLAYER_HP and DUNGEON_LEVEL as well and they give the same error, though MONSTER_PERCENT_HP_GONE obviously works since it's part of the Necro class.

So where are these codes, such as PLAYER_LEVEL and MONSTER_PERCENT_HP_GONE interpretted?
look in init.c for Initialize player classes
wobbly is online now   Reply With Quote