From a753bdc6027688c12ad6c27a6952947713c8c7c0 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Mon, 8 Oct 2007 18:18:10 +0000 Subject: Adjust piety costs for various god powers. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2382 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abl-show.cc | 29 +++++++++++++++++++++-------- crawl-ref/source/abl-show.h | 28 +++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 77ebf6ab4a..05e698dcd2 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -275,7 +275,8 @@ static const ability_def Ability_List[] = { ABIL_TROG_BURN_BOOKS, "Burn Books", 0, 0, 10, 0, ABFLAG_NONE }, { ABIL_TROG_BERSERK, "Berserk", 0, 0, 200, 0, ABFLAG_NONE }, { ABIL_TROG_REGENERATION, "Trog's Hand", 0, 0, 50, 1, ABFLAG_NONE }, - { ABIL_TROG_BROTHERS_IN_ARMS, "Brothers in Arms", 0, 0, 100, 6, ABFLAG_NONE }, + { ABIL_TROG_BROTHERS_IN_ARMS, "Brothers in Arms", + 0, 0, 100, generic_cost::range(5, 6), ABFLAG_NONE }, // Elyvilon { ABIL_ELYVILON_DESTROY_WEAPONS, "Destroy Weapons", 0, 0, 0, 0, ABFLAG_NONE }, @@ -291,9 +292,12 @@ static const ability_def Ability_List[] = // Lugonu { ABIL_LUGONU_ABYSS_EXIT, "Depart the Abyss", 0, 0, 100, 10, ABFLAG_PAIN }, { ABIL_LUGONU_BEND_SPACE, "Bend Space", 1, 0, 50, 0, ABFLAG_PAIN }, - { ABIL_LUGONU_BANISH, "Banish", 4, 0, 200, 5, ABFLAG_NONE }, - { ABIL_LUGONU_CORRUPT, "Corrupt", 7, 5, 500, 20, ABFLAG_NONE }, - { ABIL_LUGONU_ABYSS_ENTER, "Enter the Abyss", 9, 0, 500, 40, ABFLAG_NONE }, + { ABIL_LUGONU_BANISH, "Banish", + 4, 0, 200, generic_cost::range(3, 4), ABFLAG_NONE }, + { ABIL_LUGONU_CORRUPT, "Corrupt", + 7, 5, 500, generic_cost::fixed(10), ABFLAG_NONE }, + { ABIL_LUGONU_ABYSS_ENTER, "Enter the Abyss", + 9, 0, 500, generic_cost::fixed(35), ABFLAG_NONE }, // Nemelex { ABIL_NEMELEX_PEEK_DECK, "Deck Peek", 3, 0, 0, 1, ABFLAG_INSTANT }, @@ -303,8 +307,10 @@ static const ability_def Ability_List[] = { ABIL_NEMELEX_STACK_DECK, "Stack Deck", 5, 0, 150, 6, ABFLAG_NONE }, // Beogh - { ABIL_BEOGH_SMITING, "Smiting", 3, 0, 80, 3, ABFLAG_NONE }, - { ABIL_BEOGH_RECALL_ORCISH_FOLLOWERS, "Recall Orcish Followers", 2, 0, 50, 0, ABFLAG_NONE }, + { ABIL_BEOGH_SMITING, "Smiting", + 3, 0, 80, generic_cost::fixed(3), ABFLAG_NONE }, + { ABIL_BEOGH_RECALL_ORCISH_FOLLOWERS, "Recall Orcish Followers", + 2, 0, 50, 0, ABFLAG_NONE }, // These six are unused "evil" god abilities: { ABIL_CHARM_SNAKE, "Charm Snake", 6, 0, 200, 5, ABFLAG_NONE }, @@ -1792,8 +1798,7 @@ static void pay_ability_costs(const ability_def& abil) you.turn_is_over = !(abil.flags & ABFLAG_INSTANT); const int food_cost = abil.food_cost + random2avg(abil.food_cost, 2); - const int piety_cost = abil.piety_cost + - random2((abil.piety_cost + 1) / 2 + 1); + const int piety_cost = abil.piety_cost.cost(); #if DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Cost: mp=%d; hp=%d; food=%d; piety=%d", @@ -2305,3 +2310,11 @@ static void lugonu_bends_space() const int damage = roll_dice(1, 4); ouch(damage, 0, KILLED_BY_WILD_MAGIC, "a spatial distortion"); } + +//////////////////////////////////////////////////////////////////////// +// generic_cost + +int generic_cost::cost() const +{ + return base + (add > 0? random2avg(add, rolls) : 0); +} diff --git a/crawl-ref/source/abl-show.h b/crawl-ref/source/abl-show.h index 861dfae146..db4a1f5aa3 100644 --- a/crawl-ref/source/abl-show.h +++ b/crawl-ref/source/abl-show.h @@ -19,6 +19,32 @@ #include #include +struct generic_cost +{ + int base, add, rolls; + + generic_cost(int num) + : base(num), add((num + 1) / 2 + 1), rolls(1) + { + } + generic_cost(int num, int _add, int _rolls = 1) + : base(num), add(_add), rolls(_rolls) + { + } + static generic_cost fixed(int fixed) + { + return generic_cost(fixed, 0, 1); + } + static generic_cost range(int low, int high, int rolls = 1) + { + return generic_cost(low, high - low + 1, rolls); + } + + int cost() const; + + operator bool () const { return base > 0 || add > 0; } +}; + // Structure for representing an ability: struct ability_def { @@ -27,7 +53,7 @@ struct ability_def unsigned int mp_cost; // magic cost of ability unsigned int hp_cost; // hit point cost of ability unsigned int food_cost; // + rand2avg( food_cost, 2 ) - unsigned int piety_cost; // + random2( (piety_cost + 1) / 2 + 1 ) + generic_cost piety_cost; // + random2( (piety_cost + 1) / 2 + 1 ) unsigned int flags; // used for additonal cost notices }; -- cgit v1.2.3-54-g00ecf