summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ability.cc
diff options
context:
space:
mode:
authorelliptic <hyperelliptical@gmail.com>2014-05-08 01:07:08 -0400
committerelliptic <hyperelliptical@gmail.com>2014-05-08 01:46:38 -0400
commit203b2536c6f5c1b6223d217e13defcf8a8eac367 (patch)
treee9865cb53c9fc0395dd431736e15edb49c4eb01a /crawl-ref/source/ability.cc
parent1538c8704789fcebe04bfc13e026c66738592391 (diff)
downloadcrawl-ref-203b2536c6f5c1b6223d217e13defcf8a8eac367.tar.gz
crawl-ref-203b2536c6f5c1b6223d217e13defcf8a8eac367.zip
Gozag ability tweaks and interface improvements.
This commit has the following effects, which are sufficiently interconnected that separating this into multiple commits seemed hard: * Don't allow players to invoke potion petition unless they have enough gold for the guaranteed porridge/blood potion. * Don't allow players to invoke call merchant unless they have enough gold to pay for any shop that might be offered. * Tweak the formula for shop prices; now it really doesn't depend on the shop type at all, and the maximum price will always be a nice round number. * Display gold requirements in the ability screen. These numbers are slightly misleading because the actual gold cost for potion petition or call merchant will be a bit different from the displayed cost, but these numbers give the player a way to tell whether an ability can be used without committing to using it.
Diffstat (limited to 'crawl-ref/source/ability.cc')
-rw-r--r--crawl-ref/source/ability.cc32
1 files changed, 28 insertions, 4 deletions
diff --git a/crawl-ref/source/ability.cc b/crawl-ref/source/ability.cc
index 9ae2f8a969..7947877407 100644
--- a/crawl-ref/source/ability.cc
+++ b/crawl-ref/source/ability.cc
@@ -673,6 +673,21 @@ static int _zp_cost(const ability_def& abil)
return c;
}
+static int _get_gold_cost(ability_type ability)
+{
+ switch (ability)
+ {
+ case ABIL_GOZAG_CALL_MERCHANT:
+ return gozag_price_for_shop(true);
+ case ABIL_GOZAG_POTION_PETITION:
+ return gozag_porridge_price();
+ case ABIL_GOZAG_BRIBE_BRANCH:
+ return GOZAG_BRIBE_AMOUNT;
+ default:
+ return 0;
+ }
+}
+
const string make_cost_description(ability_type ability)
{
const ability_def& abil = get_ability_def(ability);
@@ -728,7 +743,13 @@ const string make_cost_description(ability_type ability)
ret += ", Skill drain";
if (abil.flags & ABFLAG_GOLD)
- ret += ", Gold";
+ {
+ const int amount = _get_gold_cost(ability);
+ if (amount)
+ ret += make_stringf(", %d Gold", amount);
+ else
+ ret += ", Gold";
+ }
// If we haven't output anything so far, then the effect has no cost
if (ret.empty())
@@ -804,10 +825,13 @@ static const string _detailed_cost_description(ability_type ability)
if (abil.flags & ABFLAG_GOLD)
{
- // TODO: make this more of a field so we can display "variable" or
- // "3000" or similar?
have_cost = true;
- ret << "\nGold";
+ ret << "\nGold : ";
+ int gold_amount = _get_gold_cost(ability);
+ if (gold_amount)
+ ret << gold_amount;
+ else
+ ret << "variable";
}
if (!have_cost)