MCPcopy Create free account
hub / github.com/crawl/crawl / player_has_ability

Function player_has_ability

crawl-ref/source/ability.cc:4314–4414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4312}
4313
4314bool player_has_ability(ability_type abil, bool include_unusable)
4315{
4316#ifdef WIZARD
4317 if (abil >= ABIL_FIRST_WIZ)
4318 return you.wizard;
4319#endif
4320
4321 // TODO: consolidate fixup checks into here?
4322 abil = fixup_ability(abil);
4323 if (abil == ABIL_NON_ABILITY || abil == NUM_ABILITIES)
4324 return false;
4325
4326 if (is_religious_ability(abil))
4327 {
4328 // TODO: something less dumb than this?
4329 auto god_abils = get_god_abilities(include_unusable, false,
4330 include_unusable);
4331 return count(god_abils.begin(), god_abils.end(), abil);
4332 }
4333
4334 if (species::draconian_breath(you.species) == abil)
4335 return !form_changes_anatomy() || you.form == transformation::dragon;
4336
4337 switch (abil)
4338 {
4339#if TAG_MAJOR_VERSION == 34
4340 case ABIL_HEAL_WOUNDS:
4341 return you.species == SP_DEEP_DWARF;
4342#endif
4343 case ABIL_SHAFT_SELF:
4344 if (crawl_state.game_is_sprint() || brdepth[you.where_are_you] == 1)
4345 return false;
4346 // fallthrough
4347 case ABIL_DIG:
4348 return you.can_burrow()
4349 && (!form_changes_anatomy() || include_unusable);
4350 case ABIL_HOP:
4351 return you.get_mutation_level(MUT_FROG_LEGS);
4352 case ABIL_BREATHE_POISON:
4353 return you.get_mutation_level(MUT_SPIT_POISON) >= 2;
4354 case ABIL_SPIT_POISON:
4355 return you.get_mutation_level(MUT_SPIT_POISON) == 1;
4356 case ABIL_GOLDEN_BREATH:
4357 return you.form == transformation::dragon
4358 && !species::is_draconian(you.species);
4359 case ABIL_SPIDER_JUMP:
4360 return you.form == transformation::spider;
4361 case ABIL_WATERY_GRAVE:
4362 return you.form == transformation::aqua;
4363 case ABIL_BESTIAL_TAKEDOWN:
4364 return you.form == transformation::werewolf;
4365 case ABIL_BREATHE_RUST:
4366 return you.form == transformation::fortress_crab;
4367 case ABIL_BLINKBOLT:
4368 return you.form == transformation::storm;
4369 case ABIL_SIPHON_ESSENCE:
4370 return you.form == transformation::death;
4371 case ABIL_INVENT_GIZMO:

Callers 5

floor_transitionFunction · 0.85
yred_feed_torchFunction · 0.85
fill_status_infoFunction · 0.85
is_validMethod · 0.85
your_talentsFunction · 0.85

Calls 15

fixup_abilityFunction · 0.85
is_religious_abilityFunction · 0.85
get_god_abilitiesFunction · 0.85
draconian_breathFunction · 0.85
form_changes_anatomyFunction · 0.85
is_draconianFunction · 0.85
you_worshipFunction · 0.85
can_convert_to_beoghFunction · 0.85
game_is_sprintMethod · 0.80
get_mutation_levelMethod · 0.80
existsMethod · 0.80
has_mutationMethod · 0.80

Tested by

no test coverage detected