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

Function get_ability_desc

crawl-ref/source/ability.cc:1560–1625  ·  view source on GitHub ↗

XXX: should this be in describe.cc?

Source from the content-addressed store, hash-verified

1558
1559// XXX: should this be in describe.cc?
1560string get_ability_desc(const ability_type ability, bool need_title)
1561{
1562 const string& name = ability_name(ability, true);
1563
1564 string lookup;
1565
1566 if (testbits(get_ability_def(ability).flags, abflag::card))
1567 lookup = _nemelex_desc(ability);
1568 else
1569 lookup = getLongDescription(name + " ability");
1570
1571 if (lookup.empty()) // Nothing found?
1572 lookup = "No description found.\n";
1573
1574 switch (ability)
1575 {
1576 case ABIL_ASHENZARI_CURSE:
1577 lookup += _curse_desc();
1578 break;
1579
1580 case ABIL_BEOGH_DISMISS_APOSTLE_1:
1581 case ABIL_BEOGH_DISMISS_APOSTLE_2:
1582 case ABIL_BEOGH_DISMISS_APOSTLE_3:
1583 {
1584 const int index = ability - ABIL_BEOGH_DISMISS_APOSTLE_1 + 1;
1585 lookup += "\n" + apostle_short_description(index) + "\n";
1586 }
1587 break;
1588
1589 case ABIL_MAKHLEB_BRAND_SELF_1:
1590 case ABIL_MAKHLEB_BRAND_SELF_2:
1591 case ABIL_MAKHLEB_BRAND_SELF_3:
1592 {
1593 const mutation_type mut = makhleb_ability_to_mutation(ability);
1594 lookup += "\n" + get_mutation_desc(mut);
1595 }
1596 break;
1597
1598 default:
1599 break;
1600 }
1601
1602 if (testbits(get_ability_def(ability).flags, abflag::sacrifice))
1603 lookup += _sacrifice_desc(ability);
1604
1605 const string damage_str = _ability_damage_string(ability);
1606
1607 const string range_str = range_string(ability_range(ability));
1608
1609 lookup += "\n";
1610
1611 if (damage_str != "")
1612 lookup += make_stringf("Damage: %s\n ", damage_str.c_str());
1613 lookup += make_stringf("Range: %s\n", range_str.c_str());
1614
1615 ostringstream res;
1616 if (need_title)
1617 res << name << "\n\n";

Callers 2

update_alt_textMethod · 0.85
describe_abilityFunction · 0.85

Calls 15

ability_nameFunction · 0.85
testbitsFunction · 0.85
_nemelex_descFunction · 0.85
getLongDescriptionFunction · 0.85
_curse_descFunction · 0.85
get_mutation_descFunction · 0.85
_sacrifice_descFunction · 0.85
_ability_damage_stringFunction · 0.85
range_stringFunction · 0.85
ability_rangeFunction · 0.85

Tested by

no test coverage detected