summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-19 02:50:40 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-19 02:50:40 +0000
commit5263fe73e09aa458e71d9ff306b4145567c7d8e1 (patch)
tree3ab7a4918b7f0d58a97fb6f76feff681219fea96 /crawl-ref
parenta6644476faab50f5752fd4127b27f306e958a250 (diff)
downloadcrawl-ref-5263fe73e09aa458e71d9ff306b4145567c7d8e1.tar.gz
crawl-ref-5263fe73e09aa458e71d9ff306b4145567c7d8e1.zip
Rework Zin's Vitalisation to be simpler, based mostly on dploog's
suggestions. Note that divine robustness is no longer available from Zin, but the code for it is still in place, since it can be adopted later for Elyvilon. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6839 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/abl-show.cc24
-rw-r--r--crawl-ref/source/acr.cc2
-rw-r--r--crawl-ref/source/dat/descript/ability.txt9
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/religion.cc21
-rw-r--r--crawl-ref/source/spells1.cc408
-rw-r--r--crawl-ref/source/spells1.h4
7 files changed, 111 insertions, 358 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 85e255784c..0c04c4a3a5 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -82,13 +82,12 @@ enum ability_flag_type
ABFLAG_NONE = 0x00000000,
ABFLAG_BREATH = 0x00000001, // ability uses DUR_BREATH_WEAPON
ABFLAG_DELAY = 0x00000002, // ability has its own delay (ie recite)
- ABFLAG_PIETY = 0x00000004, // ability has its own piety (ie vitalise)
- ABFLAG_PAIN = 0x00000008, // ability must hurt player (ie torment)
- ABFLAG_EXHAUSTION = 0x00000010, // fails if you.exhausted
- ABFLAG_INSTANT = 0x00000020, // doesn't take time to use
- ABFLAG_PERMANENT_HP = 0x00000040, // costs permanent HPs
- ABFLAG_PERMANENT_MP = 0x00000080, // costs permanent MPs
- ABFLAG_CONF_OK = 0x00000100 // can use even if confused
+ ABFLAG_PAIN = 0x00000004, // ability must hurt player (ie torment)
+ ABFLAG_EXHAUSTION = 0x00000008, // fails if you.exhausted
+ ABFLAG_INSTANT = 0x00000010, // doesn't take time to use
+ ABFLAG_PERMANENT_HP = 0x00000020, // costs permanent HPs
+ ABFLAG_PERMANENT_MP = 0x00000040, // costs permanent MPs
+ ABFLAG_CONF_OK = 0x00000080 // can use even if confused
};
static void _lugonu_bends_space();
@@ -236,7 +235,7 @@ static const ability_def Ability_List[] =
// INVOCATIONS:
// Zin
{ ABIL_ZIN_RECITE, "Recite", 3, 0, 120, 0, ABFLAG_DELAY },
- { ABIL_ZIN_VITALISATION, "Vitalisation", 0, 0, 100, 0, ABFLAG_PIETY | ABFLAG_CONF_OK },
+ { ABIL_ZIN_VITALISATION, "Vitalisation", 0, 0, 100, 2, ABFLAG_CONF_OK },
{ ABIL_ZIN_SANCTUARY, "Sanctuary", 7, 0, 150, 15, ABFLAG_NONE },
// The Shining One
@@ -388,7 +387,7 @@ const std::string make_cost_description( ability_type ability )
ret << "Food"; // randomized and amount hidden from player
}
- if (abil.piety_cost || abil.flags & ABFLAG_PIETY)
+ if (abil.piety_cost)
{
if (!ret.str().empty())
ret << ", ";
@@ -1456,12 +1455,9 @@ static bool _do_ability(const ability_def& abil)
}
case ABIL_ZIN_VITALISATION:
- {
- int result = cast_vitalisation(1 + (you.skills[SK_INVOCATIONS] / 4));
- if (result > 0)
- exercise(SK_INVOCATIONS, 2 + random2(result));
+ if (cast_vitalisation())
+ exercise(SK_INVOCATIONS, (coinflip() ? 3 : 2));
break;
- }
case ABIL_ZIN_SANCTUARY:
if (cast_sanctuary(you.skills[SK_INVOCATIONS] * 4))
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index cb9454e8c8..f7baf679fa 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3022,8 +3022,6 @@ static void _decrement_durations()
}
}
- reduce_vitalisation_chain(1);
-
if (_decrement_a_duration(DUR_DIVINE_ROBUSTNESS))
remove_divine_robustness();
diff --git a/crawl-ref/source/dat/descript/ability.txt b/crawl-ref/source/dat/descript/ability.txt
index a0969f8cf1..91a0b0a0fa 100644
--- a/crawl-ref/source/dat/descript/ability.txt
+++ b/crawl-ref/source/dat/descript/ability.txt
@@ -178,11 +178,10 @@ works best on humanoids, worse on demons and not at all on beasts.
%%%%
Vitalisation
-If Zin is most pleased with you, you can Vitalise yourself. This will
-restore Health, Magic, attribute points, or unrot you. In case none of
-these is necessary, you gain temporary boosts to your attributes
-instead. It is possible to Vitalise several times in succession for
-greater effect.
+If Zin is most pleased with you, you can Vitalise yourself. This will
+remove a negative affliction from you, or restore one of your
+attributes. In case neither of these is necessary, it will give you
+temporary boosts to your attributes instead.
%%%%
Sanctuary
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index d9015d07f7..70e7ca616f 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1144,7 +1144,6 @@ enum duration_type
DUR_SLEEP,
DUR_SAGE,
DUR_TELEPATHY,
- DUR_VITALISATION_CHAIN,
DUR_PETRIFIED,
NUM_DURATIONS
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index e80b7ec868..bbf6fc2972 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -768,19 +768,9 @@ static void _inc_penance(god_type god, int val)
// Orcish bonuses don't apply under penance.
if (god == GOD_BEOGH)
you.redraw_armour_class = true;
- // Neither does Zin's vitalisation chaining, divine robustness,
- // or divine stamina.
+ // Neither does Zin's divine stamina.
else if (god == GOD_ZIN)
{
- if (you.duration[DUR_VITALISATION_CHAIN])
- {
- mpr("Your power of vitalisation disappears!");
- you.duration[DUR_VITALISATION_CHAIN] = 0;
- }
-
- if (you.duration[DUR_DIVINE_ROBUSTNESS])
- remove_divine_robustness();
-
if (you.duration[DUR_DIVINE_STAMINA])
remove_divine_stamina();
}
@@ -4863,15 +4853,6 @@ void excommunication(god_type new_god)
break;
case GOD_ZIN:
- if (you.duration[DUR_VITALISATION_CHAIN])
- {
- mpr("Your power of vitalisation disappears!");
- you.duration[DUR_VITALISATION_CHAIN] = 0;
- }
-
- if (you.duration[DUR_DIVINE_ROBUSTNESS])
- remove_divine_robustness();
-
if (you.duration[DUR_DIVINE_STAMINA])
remove_divine_stamina();
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index b286417d6d..f045fd14ee 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -807,35 +807,6 @@ int cast_healing(int pow, const coord_def& where)
return (_healing_spell(pow + roll_dice(2, pow) - 2, where));
}
-void vitalisation_chain(int amount)
-{
- if (amount <= 0)
- return;
-
- const int old_value = you.duration[DUR_VITALISATION_CHAIN];
- you.duration[DUR_VITALISATION_CHAIN] += amount;
-
- if (you.duration[DUR_VITALISATION_CHAIN] > 30)
- you.duration[DUR_VITALISATION_CHAIN] = 30;
-
- if (old_value == 0)
- mpr("Zin amplifies your power of vitalisation!", MSGCH_DURATION);
-}
-
-void reduce_vitalisation_chain(int amount)
-{
- if (you.duration[DUR_VITALISATION_CHAIN] == 0 || amount <= 0)
- return;
-
- you.duration[DUR_VITALISATION_CHAIN] -= amount;
-
- if (you.duration[DUR_VITALISATION_CHAIN] <= 0)
- {
- you.duration[DUR_VITALISATION_CHAIN] = 0;
- mpr("Your power of vitalisation returns to normal.", MSGCH_DURATION);
- }
-}
-
void remove_divine_robustness()
{
mpr("Your divine robustness fades.", MSGCH_DURATION);
@@ -856,324 +827,135 @@ void remove_divine_stamina()
you.attribute[ATTR_DIVINE_STAMINA] = 0;
}
-int cast_vitalisation(int pow)
+bool cast_vitalisation()
{
- const int step_max_chain = 6;
- const int type_max_chain = 4;
-
- static int step;
- static int step_max;
- static int type;
- static int hp_amt;
- static int mp_amt;
- static bool need_chain;
-
- // If vitalisation chaining is turned off, start from the beginning.
- if (you.duration[DUR_VITALISATION_CHAIN] == 0)
- {
- step = 0;
- step_max = std::min(pow, step_max_chain);
- type = random2(type_max_chain * 3 / 2);
- hp_amt = 3;
- mp_amt = 1;
- need_chain = false;
- }
-
bool success = false;
+ int type = 0;
- switch (type)
+ // Remove negative afflictions.
+ if (you.disease || you.rotting || you.duration[DUR_CONF]
+ || you.duration[DUR_PARALYSIS] || you.duration[DUR_POISONING]
+ || you.duration[DUR_PETRIFIED])
{
- case 0:
- // Restore HP and MP.
- if (you.hp < you.hp_max || you.magic_points < you.max_magic_points)
- {
- success = true;
- inc_hp(hp_amt, false);
- inc_mp(mp_amt, false);
- hp_amt *= 2;
- mp_amt *= 2;
- need_chain =
- (you.hp < you.hp_max
- || you.magic_points < you.max_magic_points);
- break;
- }
-
- need_chain = false;
- step = 0;
- type = 1;
- // Deliberate fall through, resetting the vitalisation chaining
- // indicator and the step counter.
-
- case 1:
- switch (step)
+ do
{
- case 0:
- case 1:
- case 2:
- // Restore stats.
- if (you.strength < you.max_strength
- || you.intel < you.max_intel
- || you.dex < you.max_dex)
+ switch (random2(6))
{
- success = true;
- restore_stat(STAT_STRENGTH, step + 1, true);
- restore_stat(STAT_INTELLIGENCE, step + 1, true);
- restore_stat(STAT_DEXTERITY, step + 1, true);
- need_chain =
- (you.strength < you.max_strength
- || you.intel < you.max_intel
- || you.dex < you.max_dex);
- break;
- }
-
- step = 3;
- // Deliberate fall through.
-
- if (step >= step_max)
+ case 0:
+ if (you.disease)
+ {
+ success = true;
+ you.disease = 0;
+ }
break;
-
- default:
- break;
- }
-
- if (success)
- break;
-
- need_chain = false;
- step = 0;
- type = 2;
- // Deliberate fall through, resetting the vitalisation chaining
- // indicator and the step counter.
-
- case 2:
- // Remove negative afflictions.
- switch (step)
- {
- // Remove confusion and poisoning.
- case 0:
- if (you.duration[DUR_CONF] || you.duration[DUR_POISONING])
- {
- success = true;
- you.duration[DUR_CONF] = 0;
- you.duration[DUR_POISONING] = 0;
- need_chain = false;
+ case 1:
+ if (you.rotting)
+ {
+ success = true;
+ you.rotting = 0;
+ }
break;
- }
-
- step = 1;
- // Deliberate fall through.
-
- if (step >= step_max)
+ case 2:
+ if (you.duration[DUR_CONF])
+ {
+ success = true;
+ you.duration[DUR_CONF] = 0;
+ }
break;
-
- // Remove sickness and rotting.
- case 1:
- if (you.disease || you.rotting)
- {
- success = true;
- you.disease = 0;
- you.rotting = 0;
- need_chain = false;
+ case 3:
+ if (you.duration[DUR_PARALYSIS])
+ {
+ success = true;
+ you.duration[DUR_PARALYSIS] = 0;
+ }
break;
- }
-
- step = 2;
- // Deliberate fall through.
-
- if (step >= step_max)
+ case 4:
+ if (you.duration[DUR_POISONING])
+ {
+ success = true;
+ you.duration[DUR_POISONING] = 0;
+ }
break;
-
- // Restore rotted HP.
- case 2:
- if (player_rotted())
- {
- success = true;
- unrot_hp(3 + random2(9));
- need_chain = false;
+ case 5:
+ if (you.duration[DUR_PETRIFIED])
+ {
+ success = true;
+ you.duration[DUR_PETRIFIED] = 0;
+ }
break;
}
-
- step = 3;
- // Deliberate fall through.
-
- if (step >= step_max)
- break;
-
- default:
- break;
}
-
- if (success)
- break;
-
- need_chain = false;
- step = 0;
- type = 3;
- // Deliberate fall through, resetting the vitalisation chaining
- // indicator and the step counter.
-
- case 3:
+ while (!success);
+ }
+ // Restore stats.
+ else if (you.strength < you.max_strength
+ || you.intel < you.max_intel
+ || you.dex < you.max_dex)
{
-stamina_robustness:
- int estep = step / 2;
+ type = 1;
- // Add divine stamina and divine robustness.
- switch (step)
+ do
{
- // Divine stamina.
- case 0:
- case 2:
- case 4:
- if ((estep == 0 || you.duration[DUR_VITALISATION_CHAIN] > 0)
- && ((you.attribute[ATTR_DIVINE_STAMINA] + 1) / 2) == estep
- && ((player_mutation_level(MUT_STRONG) + 1) / 5) < (3 - estep)
- && ((player_mutation_level(MUT_CLEVER) + 1) / 5) < (3 - estep)
- && ((player_mutation_level(MUT_AGILE) + 1) / 5) < (3 - estep))
+ switch (random2(3))
{
- success = true;
- mprf(MSGCH_DURATION, "Zin %s divine stamina.",
- (estep == 0) ? "grants you" :
- (estep == 1) ? "strengthens your"
- : "maximises your");
-
- const int stamina_amt = step + 1;
- you.attribute[ATTR_DIVINE_STAMINA] += stamina_amt;
- you.duration[DUR_DIVINE_STAMINA] +=
- (estep == 0) ? (you.skills[SK_INVOCATIONS] * 2) :
- (estep == 1) ? (you.skills[SK_INVOCATIONS])
- : (you.skills[SK_INVOCATIONS] / 2);
-
- modify_stat(STAT_STRENGTH, stamina_amt, true, "");
- modify_stat(STAT_INTELLIGENCE, stamina_amt, true, "");
- modify_stat(STAT_DEXTERITY, stamina_amt, true, "");
-
- // Keep vitalisation chaining on if divine stamina can
- // be increased two vitalisation attempts from now, or
- // if divine robustness can be increased one
- // vitalisation attempt from now.
- need_chain =
- (((player_mutation_level(MUT_STRONG) + 1) / 5) < (2 - estep)
- && ((player_mutation_level(MUT_CLEVER) + 1) / 5) < (2 - estep)
- && ((player_mutation_level(MUT_AGILE) + 1) / 5) < (2 - estep))
- || (player_mutation_level(MUT_ROBUST) < (3 - estep));
+ case 0:
+ if (you.strength < you.max_strength)
+ {
+ success = true;
+ restore_stat(STAT_STRENGTH, 0, true);
+ }
break;
- }
-
- step++;
- goto stamina_robustness;
- // Deliberate fall through.
-
- // Divine robustness.
- case 1:
- case 3:
- case 5:
- if ((estep == 0 || you.duration[DUR_VITALISATION_CHAIN] > 0)
- && you.attribute[ATTR_DIVINE_ROBUSTNESS] == estep
- && player_mutation_level(MUT_ROBUST) < (3 - estep))
- {
- success = true;
- mprf(MSGCH_DURATION, "Zin %s divine robustness.",
- (estep == 0) ? "grants you" :
- (estep == 1) ? "strengthens your"
- : "maximises your");
-
- you.attribute[ATTR_DIVINE_ROBUSTNESS]++;
- you.duration[DUR_DIVINE_ROBUSTNESS] +=
- (estep == 0) ? (you.skills[SK_INVOCATIONS] * 2) :
- (estep == 1) ? (you.skills[SK_INVOCATIONS])
- : (you.skills[SK_INVOCATIONS] / 2);
-
- const int old_hp_max = you.hp_max;
- calc_hp();
- set_hp(you.hp * you.hp_max / old_hp_max, false);
-
- // Keep vitalisation chaining on if divine robustness
- // can be increased two vitalisation attempts from now,
- // or if divine stamina can be increased one
- // vitalisation attempt from now.
- need_chain =
- (player_mutation_level(MUT_ROBUST) < (2 - estep))
- || (((player_mutation_level(MUT_STRONG) + 1) / 5) < (3 - estep)
- && ((player_mutation_level(MUT_CLEVER) + 1) / 5) < (3 - estep)
- && ((player_mutation_level(MUT_AGILE) + 1) / 5) < (3 - estep));
+ case 1:
+ if (you.intel < you.max_intel)
+ {
+ success = true;
+ restore_stat(STAT_INTELLIGENCE, 0, true);
+ }
+ break;
+ case 2:
+ if (you.dex < you.max_dex)
+ {
+ success = true;
+ restore_stat(STAT_DEXTERITY, 0, true);
+ }
break;
}
-
- step++;
- goto stamina_robustness;
- // Deliberate fall through.
-
- default:
- break;
}
+ while (!success);
+ }
+ else
+ {
+ // Add divine stamina.
+ if (!you.duration[DUR_DIVINE_STAMINA])
+ {
+ success = true;
+ type = 2;
- if (success)
- break;
+ mprf("%s grants you divine stamina.",
+ god_name(you.religion).c_str());
- need_chain = false;
- step = 0;
- type = 4;
- // Deliberate fall through, resetting the vitalisation chaining
- // indicator and the step counter.
- }
+ const int stamina_amt = 3;
+ you.attribute[ATTR_DIVINE_STAMINA] += stamina_amt;
+ you.duration[DUR_DIVINE_STAMINA]
+ = 35 + (you.skills[SK_INVOCATIONS]*5)/3;
- default:
- // Do nothing.
- break;
+ modify_stat(STAT_STRENGTH, stamina_amt, true, "");
+ modify_stat(STAT_INTELLIGENCE, stamina_amt, true, "");
+ modify_stat(STAT_DEXTERITY, stamina_amt, true, "");
+ }
}
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "vitalising: step = %d, type = %d, step_max = %d",
- step, type, step_max);
-#endif
-
// If vitalisation has succeeded, display an appropriate message.
if (success)
{
- mprf("You feel %s %s.", (step == 0) ? "only nominally" :
- (step == 1) ? "very slightly" :
- (step == 2) ? "slightly" :
- (step == 3) ? "somewhat" :
- (step == 4) ? "appropriately"
- : "impressively",
- (type == 0) ? "invigorated" :
- (type == 1) ? "renewed" :
- (type == 2) ? "better"
- : "powerful");
-
- // If vitalisation has succeeded, pay the extended piety cost,
- // based on how far the step counter has advanced.
- int loss_amt = step + 1 + (random2(3) - 1);
-
- if (loss_amt > 0)
- lose_piety(loss_amt);
-
- // Increment the step counter.
- step++;
+ mprf("You feel %s.", (type == 0) ? "better" :
+ (type == 1) ? "renewed"
+ : "powerful");
}
else
canned_msg(MSG_NOTHING_HAPPENS);
- // Whether vitalisation has succeeded or failed, pay the minimum
- // piety cost.
- lose_piety(2);
-
- // If there's not enough piety left to vitalise again, turn off
- // vitalisation chaining.
- if (you.piety < piety_breakpoint(1))
- need_chain = false;
-
- // If vitalisation has succeeded, it hasn't succeeded as far as
- // possible, and vitalisation chaining is needed, turn on
- // vitalisation chaining for several turns.
- if (success && step < step_max && need_chain)
- vitalisation_chain(6);
- // Otherwise, turn off vitalisation chaining.
- else
- reduce_vitalisation_chain(30);
-
- return (success) ? (step + 1) : 0;
+ return (success);
}
bool cast_revivification(int pow)
diff --git a/crawl-ref/source/spells1.h b/crawl-ref/source/spells1.h
index 8c8a0f6a6c..09040e71f0 100644
--- a/crawl-ref/source/spells1.h
+++ b/crawl-ref/source/spells1.h
@@ -32,11 +32,9 @@ bool cast_sure_blade(int power);
* *********************************************************************** */
int cast_healing(int pow, const coord_def& where = coord_def(0,0));
-void vitalisation_chain(int amount);
-void reduce_vitalisation_chain(int amount);
void remove_divine_robustness();
void remove_divine_stamina();
-int cast_vitalisation(int pow);
+bool cast_vitalisation();
void big_cloud(cloud_type cl_type, kill_category whose, const coord_def& where,
int pow, int size, int spread_rate = -1);