Attached Files |
ambrosia.patch [^] (10,653 bytes) 2014-11-28 05:25 [Show Content] [Hide Content]From fa7dfa4bd362f84341a1e9142fb86fc412915b7d Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Thu, 27 Nov 2014 22:06:56 -0600
Subject: [PATCH 1/1] Potion of Ambrosia: Confuses, grants Elixir-like regen
that ends at a timeout or when not confused, whichever comes first
---
crawl-ref/source/dat/descript/items.txt | 6 ++++++
crawl-ref/source/duration-data.h | 3 ++-
crawl-ref/source/enum.h | 3 +++
crawl-ref/source/itemname.cc | 1 +
crawl-ref/source/makeitem.cc | 1 +
crawl-ref/source/player-reacts.cc | 5 +++++
crawl-ref/source/player.cc | 20 ++++++++++++++++++++
crawl-ref/source/player.h | 1 +
crawl-ref/source/potion.cc | 11 +++++++++++
crawl-ref/source/rltiles/dc-item.txt | 3 ++-
crawl-ref/source/rltiles/item/potion/i-ambrosia.png | Bin 0 -> 1341 bytes
crawl-ref/source/shopping.cc | 1 +
12 files changed, 53 insertions(+), 2 deletions(-)
create mode 100644 crawl-ref/source/rltiles/item/potion/i-ambrosia.png
diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt
index 9132538..805d4f3 100644
--- a/crawl-ref/source/dat/descript/items.txt
+++ b/crawl-ref/source/dat/descript/items.txt
@@ -839,6 +839,12 @@ potion of agility
A magic potion which greatly increases the dexterity and evasiveness of one who
drinks it.
%%%%
+potion of ambrosia
+
+A strange substance, produced by ghost moths. Consuming it will cause regeneration
+of health and magic, at the expense of mental clarity. The two effects are
+linked, regeneration will end immediatly if the user regains their senses.
+%%%%
potion of beneficial mutation
A potion which gives you a supposedly good mutation.
diff --git a/crawl-ref/source/duration-data.h b/crawl-ref/source/duration-data.h
index 9972462..678a717 100644
--- a/crawl-ref/source/duration-data.h
+++ b/crawl-ref/source/duration-data.h
@@ -350,6 +350,8 @@ static const duration_def duration_data[] =
false, LIGHTBLUE, "Cleave",
"cleaving", "cleave",
"You are cleaving through your foes.", true },
+ { DUR_AMBROSIA, false, GREEN, "Ambros", "", "ambrosia",
+ "You are regenerating under the effects of ambrosia.", false },
// The following are visible in wizmode only, or are handled
// specially in the status lights and/or the % or @ screens.
@@ -403,7 +405,6 @@ static const duration_def duration_data[] =
{ DUR_SPIRIT_HOWL, false, 0, "", "", "old spirit howl", "", false },
{ DUR_SONG_OF_SHIELDING, false, 0, "", "", "old song of shielding", "", false },
{ DUR_ANTENNAE_EXTEND, false, 0, "", "", "old antennae extend", "", false },
- { DUR_AMBROSIA, false, 0, "", "", "old ambrosia", "", false },
{ DUR_BUILDING_RAGE, false, 0, "", "", "old building rage", "", false },
#endif
};
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 7f28971..276d1e3 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1638,7 +1638,9 @@ enum duration_type
DUR_TORNADO_COOLDOWN,
#if TAG_MAJOR_VERSION == 34
DUR_NAUSEA,
+#endif
DUR_AMBROSIA,
+#if TAG_MAJOR_VERSION == 34
DUR_TEMP_MUTATIONS,
#endif
DUR_DISJUNCTION,
@@ -3609,6 +3611,7 @@ enum potion_type
#endif
POT_LIGNIFY,
POT_BENEFICIAL_MUTATION,
+ POT_AMBROSIA,
NUM_POTIONS
};
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 9f799c1..189ac98 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -710,6 +710,7 @@ const char* potion_type_name(int potiontype)
case POT_RESISTANCE: return "resistance";
case POT_LIGNIFY: return "lignification";
case POT_BENEFICIAL_MUTATION: return "beneficial mutation";
+ case POT_AMBROSIA: return "ambrosia";
default: return "bugginess";
}
}
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index f0955f1..775dc8d 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1302,6 +1302,7 @@ static void _generate_potion_item(item_def& item, int force_type,
35, POT_LIGNIFY,
34, POT_CANCELLATION,
34, POT_CONFUSION,
+ 34, POT_AMBROSIA,
25, POT_DEGENERATION,
23, POT_CURE_MUTATION,
12, POT_BENEFICIAL_MUTATION,
diff --git a/crawl-ref/source/player-reacts.cc b/crawl-ref/source/player-reacts.cc
index 66434d2..99e76be 100644
--- a/crawl-ref/source/player-reacts.cc
+++ b/crawl-ref/source/player-reacts.cc
@@ -717,6 +717,11 @@ static void _decrement_durations()
you.attribute[ATTR_INVIS_UNCANCELLABLE] = 0;
}
+ // Decrement ambrosia before confusion, otherwise confusion ending
+ // will cancel ambrosia early. Might be a bad coupling, but ambrosia
+ // needs to use DUR_CONF otherwise it won't behave right if a player
+ // gets confused after eating ambrosia.
+ dec_ambrosia_player(delay);
_decrement_a_duration(DUR_CONF, delay, "You feel less confused.");
_decrement_a_duration(DUR_LOWERED_MR, delay, "You feel less vulnerable to hostile enchantments.");
_decrement_a_duration(DUR_SLIMIFY, delay, "You feel less slimy.",
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 9b89ee4..4a1f65f 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5368,6 +5368,26 @@ void dec_elixir_player(int delay)
_dec_elixir_mp(delay);
}
+void dec_ambrosia_player(int delay)
+{
+ if(!you.confused() && you.duration[DUR_AMBROSIA])
+ {
+ you.duration[DUR_AMBROSIA] = 0;
+ return;
+ }
+
+ you.duration[DUR_AMBROSIA] -= delay;
+ if(you.duration[DUR_AMBROSIA] < 0)
+ you.duration[DUR_AMBROSIA] = 0;
+
+ int heal_hp = (delay * you.hp_max / 10) / BASELINE_DELAY;
+ if (!you.duration[DUR_DEATHS_DOOR])
+ inc_hp(heal_hp);
+
+ int heal_mp = (delay * you.max_magic_points / 10) / BASELINE_DELAY;
+ inc_mp(heal_mp);
+}
+
bool flight_allowed(bool quiet)
{
if (get_form()->forbids_flight())
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index a3fc7d0..53a8b76 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -1050,6 +1050,7 @@ void dec_exhaust_player(int delay);
bool haste_player(int turns, bool rageext = false);
void dec_haste_player(int delay);
void dec_elixir_player(int delay);
+void dec_ambrosia_player(int delay);
bool flight_allowed(bool quiet = false);
void fly_player(int pow, bool already_flying = false);
void float_player();
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index 95ebc80..727df95 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -505,6 +505,17 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
else
mpr("You feel woody for a moment.");
break;
+
+ case POT_AMBROSIA:
+ {
+ int ambrosia_turns = 3+random2(8);
+ if (confuse_player(ambrosia_turns))
+ {
+ mpr("You feel invigorated.");
+ you.increase_duration(DUR_AMBROSIA, ambrosia_turns);
+ }
+ break;
+ }
}
if (potion && !was_known)
diff --git a/crawl-ref/source/rltiles/dc-item.txt b/crawl-ref/source/rltiles/dc-item.txt
index 3796a88..9035bec 100644
--- a/crawl-ref/source/rltiles/dc-item.txt
+++ b/crawl-ref/source/rltiles/dc-item.txt
@@ -853,7 +853,8 @@ i-resistance POT_RESISTANCE
i-blood POT_BLOOD
i-coagulated-blood POT_BLOOD_COAGULATED
i-lignify POT_LIGNIFY
-i-good-mutation POT_BENEFICIAL_MUTATION POT_ID_LAST
+i-good-mutation POT_BENEFICIAL_MUTATION
+i-ambrosia POT_AMBROSIA POT_ID_LAST
%back none
%rim 1
diff --git a/crawl-ref/source/rltiles/item/potion/i-ambrosia.png b/crawl-ref/source/rltiles/item/potion/i-ambrosia.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab9c04950f157a393b050eff844b505344a412f6
GIT binary patch
literal 1341
zcmV-D1;YA?P)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F8000B<X+uL$Nkc;*
zP;zf(X>4Tx062|}Ro!pfR1`mnZ(O7nKcKOW4i$^9Ra0BJ8yc;~21%2p=|UR0&DbiW
z$#rfTQ`a`O(`{9s_5yDV_yd5l2Of}kLK+Oj_Ok5(v`JGz71bo9J#^YYXp{DWs&KBa
zQ@dTpxRI}aIp=pi@6k0t$5)!;m`NF6-tt{FpOKHBn3g+MAqmexC-gw4rh87hTrL7G
z#)U`L!(So6-Zux@>;H3gR;i~0B%VTSS3P|m@o9jRsXML@Al^p#@G0Lx-0?i(9WEw_
zSYddU<1E8793KxjQ|c&UmW!m<wJPEz#Qifd`D_gH9D=nYPc7;iy3Be}cI}#B(pb7r
zQ2)<0Z#G)-dhzM<<|dEgyN}ggcgNHaf39n}NyINBzUKHDCVv(2y~bQ6jd(9W@|l`@
zq{8{hHx}zt?;zfZxN7)?sZhRX&6Fm%ZE|_eKB|VCYq~dzJ%bk!->TC>k>?{om1c9S
zUx<6_jj_<bFzzi(=30Ih>!T&^M{wWM#><F%5P#^}>IBbOSf*xP<^F{$j$aOQ5Y{cT
zROCL1M7^NKK<?M4#<(px;Nu~3TQXfUjub-vl4Az5h`EvTZbPkvoEw^(%X2^EKD8>L
z&(yA}mSw#iM0^;IB{ZO5!wl{^Sg-*ysE~&Yz8!E;Qv(A`lu*=Clo*MpVGd>OdF6n^
zam1Jntk;<}MrqIC5$=Q>n{*R}?8oOIDUw5En2dl--Xw34!z7E+5pr<Twj7JkV%^#F
z^FB1tE8`u5%(<RMUli}Gd(zOafAsejYx|L$X)B+22f)J)w3q|&`mZkiuq*PhLN2^}
zv+L>-OgyQ-soSab)C%saskMla`aQLVzg0+MZf20tJU&K{hZoBrUc+U4e9&<J19^6g
zw<TiDI@c3vSSRQQrH3Ur+aF1l-;_U<73B-%ymEJ2m)mwp_*D2-_)+*y_+I!KWZ{x<
zS@=n~B77rUjGfiv=VSBigL+%lGEKW)Q!u5Bv|D;f%1SRtuSmtnpVTc4Nn_F;)a>3o
zw|KmGEe4#xz17wBu{f`SS_4i66?j31EjY7n{zGfhONK~c+td!TS#B}JoR}5UAd7p&
z5phTyXSkK0xCeD3xaYP^o&J~#Xp9xFb0C;HHml5fA<%h1eR|qw7wxF+oN<lWx-aij
zl-K1neyXTku=K%xSu;&JP<gUTJ?bvd>L9T1Aits?sKNIwvGaN)^WO$I^cUV)HzL_|
z1K?{9p!>B*)`xfEv!4N6IG{J&h49W#Bz^(#YWw%`e_a{8n{G9m5AeR~_yl0%<7V@p
z<z{o^OZ2}6aLN1^Spac(61Cxm00039Nkl<ZSP5fb7zLvtFd71*Aut*OqaiRF0wX;H
z7-<jy|4A^Dk%a`sL@Ryr<Ox`<jEoEejE$}tBnJXa=n~Z8UkyErVid?in5D=PGzkG@
z3$R&=EKdyw;EeN~mK(u#xgYmOi3(&#Q6&mM@q9k*3fK}{aSrn}$a0Wc7@$T7FuZR1
z!0_twU4~boFk>-kWM3o8QY8dL>jaR^#L5PR47SjriUU9)KrWz46o4!j(^W=s11L(6
z0df?8Lu?jAmKr4?MlJv)GGqsU9A`L72iZL^HdRVObWdP72xc3QMpsL_k`T#KyiBU4
z0d!knX#$=@pmC0_4kJj=6_CLvDGJCipSoHA9kDx|b#lL*00000NkvXXu0mjfeb{i!
literal 0
HcmV?d00001
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 1e326c8..89a99d9 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1528,6 +1528,7 @@ unsigned int item_value(item_def item, bool ident)
case POT_MAGIC:
case POT_INVISIBILITY:
case POT_CANCELLATION:
+ case POT_AMBROSIA:
valued += 80;
break;
--
1.9.3 (Apple Git-50)
01-ambrosia.patch [^] (85,052 bytes) 2014-11-29 00:50 [Show Content] [Hide Content]From 4cdf87a1df78bfd6db090f660e66d0ef9ef15ea3 Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Fri, 28 Nov 2014 16:32:16 -0600
Subject: [PATCH 1/5] miscast potion like effects now don't actually behave
like quaffed poitions. This frees up POT_CONF and POT_SLOWING in the enum to
do potionythings only.
---
crawl-ref/source/spl-miscast.cc | 40 +++++++++++++++++-----------------------
crawl-ref/source/spl-miscast.h | 9 ++++++++-
crawl-ref/source/spl-other.cc | 2 +-
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc
index 62c74bb..7c63a22 100644
--- a/crawl-ref/source/spl-miscast.cc
+++ b/crawl-ref/source/spl-miscast.cc
@@ -537,27 +537,21 @@ bool MiscastEffect::_lose_stat(stat_type which_stat, int8_t stat_loss)
return lose_stat(which_stat, stat_loss, false, cause);
}
-void MiscastEffect::_potion_effect(potion_type pot_eff, int pot_pow)
+void MiscastEffect::_potion_effect(miscast_potion_type pot_eff, int pot_pow)
{
- if (target->is_player())
- {
- potion_effect(pot_eff, pot_pow, nullptr, false);
- return;
- }
-
switch (pot_eff)
{
- case POT_BERSERK_RAGE:
+ case MISCAST_BERSERK_RAGE:
if (target->can_go_berserk())
{
target->go_berserk(false);
break;
}
// Intentional fallthrough if that didn't work.
- case POT_SLOWING:
+ case MISCAST_SLOWING:
target->slow_down(act_source, pot_pow);
break;
- case POT_CONFUSION:
+ case MISCAST_CONFUSION:
target->confuse(act_source, pot_pow);
break;
@@ -1009,7 +1003,7 @@ void MiscastEffect::_hexes(int severity)
case 3:
case 4:
case 5:
- _potion_effect(POT_SLOWING, 10);
+ _potion_effect(MISCAST_SLOWING, 10);
break;
case 6:
// XXX: Monster silence shrinks awkwardly (i.e. very
@@ -1042,7 +1036,7 @@ void MiscastEffect::_hexes(int severity)
reroll = !_sleep(3 + random2(7));
break;
case 1:
- _potion_effect(POT_CONFUSION, 10);
+ _potion_effect(MISCAST_CONFUSION, 10);
reroll = false;
break;
case 2:
@@ -1163,10 +1157,10 @@ void MiscastEffect::_charms(int severity)
case 3:
case 4:
case 5:
- _potion_effect(POT_SLOWING, 10);
+ _potion_effect(MISCAST_SLOWING, 10);
break;
case 6:
- _potion_effect(POT_BERSERK_RAGE, 10);
+ _potion_effect(MISCAST_BERSERK_RAGE, 10);
break;
}
break;
@@ -1182,7 +1176,7 @@ void MiscastEffect::_charms(int severity)
reroll = !_paralyse(2 + random2(6));
break;
case 1:
- _potion_effect(POT_CONFUSION, 10);
+ _potion_effect(MISCAST_CONFUSION, 10);
reroll = false;
break;
case 2:
@@ -1334,7 +1328,7 @@ void MiscastEffect::_translocation(int severity)
target->blink(false);
}
if (target->alive())
- _potion_effect(POT_CONFUSION, 40);
+ _potion_effect(MISCAST_CONFUSION, 40);
}
break;
case 5:
@@ -1387,7 +1381,7 @@ void MiscastEffect::_translocation(int severity)
if (!target->no_tele())
target->teleport(true);
if (target->alive())
- _potion_effect(POT_CONFUSION, 60);
+ _potion_effect(MISCAST_CONFUSION, 60);
}
break;
case 2:
@@ -1648,7 +1642,7 @@ void MiscastEffect::_divination_you(int severity)
mpr("You feel a little dazed.");
break;
case 1:
- potion_effect(POT_CONFUSION, 10);
+ _potion_effect(MISCAST_CONFUSION, 10);
break;
}
break;
@@ -1681,7 +1675,7 @@ void MiscastEffect::_divination_you(int severity)
break;
}
- potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb}
+ _potion_effect(MISCAST_CONFUSION, 1); // common to all cases here {dlb}
break;
case 3: // nasty
@@ -1712,7 +1706,7 @@ void MiscastEffect::_divination_you(int severity)
break;
}
- potion_effect(POT_CONFUSION, 1); // common to all cases here {dlb}
+ _potion_effect(MISCAST_CONFUSION, 1); // common to all cases here {dlb}
break;
}
}
@@ -1875,7 +1869,7 @@ void MiscastEffect::_necromancy(int severity)
case 1:
you_msg = "You feel horribly lethargic.";
mon_msg_seen = "@The_monster@ looks incredibly listless.";
- _potion_effect(POT_SLOWING, 15);
+ _potion_effect(MISCAST_SLOWING, 15);
break;
case 2:
if (!target->res_rotting())
@@ -3230,9 +3224,9 @@ void MiscastEffect::_zot()
case 6:
roll = random2(3); // Give 2 of 3 effects.
if (roll != 0)
- _potion_effect(POT_CONFUSION, 15);
+ _potion_effect(MISCAST_CONFUSION, 15);
if (roll != 1)
- _potion_effect(POT_SLOWING, 15);
+ _potion_effect(MISCAST_SLOWING, 15);
if (roll != 2)
{
you_msg = "Space warps around you!";
diff --git a/crawl-ref/source/spl-miscast.h b/crawl-ref/source/spl-miscast.h
index 7002654..5c22d44 100644
--- a/crawl-ref/source/spl-miscast.h
+++ b/crawl-ref/source/spl-miscast.h
@@ -33,6 +33,13 @@ enum miscast_source
GOD_MISCAST
};
+enum miscast_potion_type
+{
+ MISCAST_BERSERK_RAGE,
+ MISCAST_CONFUSION,
+ MISCAST_SLOWING
+};
+
class actor;
// class monster;
@@ -118,7 +125,7 @@ private:
bool _big_cloud(cloud_type cl_type, int cloud_pow, int size,
int spread_rate = -1);
bool _lose_stat(stat_type which_stat, int8_t stat_loss);
- void _potion_effect(potion_type pot_eff, int pot_pow);
+ void _potion_effect(miscast_potion_type pot_eff, int pot_pow);
bool _paralyse(int dur);
bool _sleep(int dur);
bool _create_monster(monster_type what, int abj_deg, bool alert = false);
diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc
index 1ab3bde..2d3b4d4 100644
--- a/crawl-ref/source/spl-other.cc
+++ b/crawl-ref/source/spl-other.cc
@@ -370,7 +370,7 @@ spret_type cast_intoxicate(int pow, bool fail)
fail_check();
mpr("You radiate an intoxicating aura.");
if (x_chance_in_y(60 - pow/3, 100))
- potion_effect(POT_CONFUSION, 10 + (100 - pow) / 10);
+ confuse_player(3+random2(10 + (100 - pow) / 10));
if (one_chance_in(20)
&& lose_stat(STAT_INT, 1 + random2(3), false,
--
1.9.3 (Apple Git-50)
From 8034037798b91458f216420f33cc6526748d4101 Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Fri, 28 Nov 2014 16:36:27 -0600
Subject: [PATCH 2/5] refactor potion.cc to be a map from potion enum to potion
effects, adjust other files acordingly; banish many inappropriate uses of
potion_effect when not actually drinking potions
---
crawl-ref/source/ability.cc | 2 +-
crawl-ref/source/beam.cc | 24 +-
crawl-ref/source/decks.cc | 2 +-
crawl-ref/source/godabil.cc | 3 +-
crawl-ref/source/godwrath.cc | 2 +-
crawl-ref/source/item_use.cc | 2 +-
crawl-ref/source/ouch.cc | 4 +-
crawl-ref/source/player.cc | 4 +-
crawl-ref/source/player.h | 1 +
crawl-ref/source/potion.cc | 1119 +++++++++++++++++++++++++++++++++---------
crawl-ref/source/potion.h | 33 +-
crawl-ref/source/xom.cc | 22 +-
12 files changed, 937 insertions(+), 281 deletions(-)
diff --git a/crawl-ref/source/ability.cc b/crawl-ref/source/ability.cc
index e89f974..6157cf8 100644
--- a/crawl-ref/source/ability.cc
+++ b/crawl-ref/source/ability.cc
@@ -2363,7 +2363,7 @@ static spret_type _do_ability(const ability_def& abil, bool fail)
case ABIL_EVOKE_TURN_INVISIBLE: // ring, cloaks, randarts
fail_check();
- potion_effect(POT_INVISIBILITY, you.skill(SK_EVOCATIONS, 2) + 5);
+ get_potion_effect(POT_INVISIBILITY)->effect(you.skill(SK_EVOCATIONS, 2) + 5);
contaminate_player(1000 + random2(2000), true);
break;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index ad6f406..54a83cf 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3467,12 +3467,13 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_SLOW:
- potion_effect(POT_SLOWING, ench_power, nullptr, blame_player);
+ slow_player(10+random2(ench_power));
obvious_effect = true;
break;
case BEAM_HASTE:
- potion_effect(POT_HASTE, ench_power, nullptr, blame_player);
+ haste_player(40+random2(ench_power));
+ did_god_conduct(DID_HASTY, 10, blame_player);
contaminate_player(1000, blame_player);
obvious_effect = true;
nasty = false;
@@ -3480,14 +3481,14 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_HEALING:
- potion_effect(POT_HEAL_WOUNDS, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_HEAL_WOUNDS)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
break;
case BEAM_MIGHT:
- potion_effect(POT_MIGHT, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_MIGHT)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
@@ -3495,7 +3496,7 @@ void bolt::affect_player_enchantment(bool resistible)
case BEAM_INVISIBILITY:
you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
- potion_effect(POT_INVISIBILITY, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_INVISIBILITY)->effect(ench_power);
contaminate_player(1000 + random2(1000), blame_player);
obvious_effect = true;
nasty = false;
@@ -3513,7 +3514,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_CONFUSION:
- potion_effect(POT_CONFUSION, ench_power, nullptr, blame_player);
+ confuse_player(3+random2(ench_power));
obvious_effect = true;
break;
@@ -3540,7 +3541,7 @@ void bolt::affect_player_enchantment(bool resistible)
case BEAM_ENSLAVE:
mprf(MSGCH_WARN, "Your will is overpowered!");
- potion_effect(POT_CONFUSION, ench_power, nullptr, blame_player);
+ confuse_player(3+random2(ench_power));
obvious_effect = true;
break; // enslavement - confusion?
@@ -3642,7 +3643,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_BERSERK:
- potion_effect(POT_BERSERK_RAGE, ench_power, nullptr, blame_player);
+ you.go_berserk(true,true);
obvious_effect = true;
break;
@@ -3705,7 +3706,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_AGILITY:
- potion_effect(POT_AGILITY, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_AGILITY)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
@@ -3755,7 +3756,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_RESISTANCE:
- potion_effect(POT_RESISTANCE, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_RESISTANCE)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
@@ -3936,8 +3937,7 @@ void bolt::affect_player()
&& you.holiness() != MH_UNDEAD
&& !you.is_unbreathing())
{
- potion_effect(POT_CONFUSION, 1, nullptr,
- god_cares() && YOU_KILL(thrower));
+ confuse_player(3+random2(1));
}
// handling of missiles
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 94ce862..43f310e 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2052,7 +2052,7 @@ static void _potion_card(int power, deck_rarity_type rarity)
return;
}
- potion_effect(pot, random2(power/4));
+ potion_effect(pot,nullptr,true);
for (radius_iterator ri(you.pos(), LOS_NO_TRANS); ri; ++ri)
{
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 0a7c075..e15008b 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -3991,8 +3991,7 @@ bool gozag_potion_petition()
you.attribute[ATTR_GOZAG_GOLD_USED] += faith_price;
for (int j = 0; j < pots[keyin]->size(); j++)
{
- potion_effect(static_cast<potion_type>((*pots[keyin])[j].get_int()),
- 40);
+ potion_effect(static_cast<potion_type>((*pots[keyin])[j].get_int()),nullptr);
}
you.attribute[ATTR_GOZAG_POTIONS]++;
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index 9c7eb97..f2c54f5 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -845,7 +845,7 @@ static bool _trog_retribution()
switch (random2(6))
{
case 0:
- potion_effect(POT_DECAY, 100);
+ get_potion_effect(POT_DECAY)->effect(100);
break;
case 1:
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 2d129d3..0f8cd08 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2115,7 +2115,7 @@ void drink(int slot)
}
if (!potion_effect(static_cast<potion_type>(potion.sub_type),
- 40, &potion, alreadyknown))
+ &potion, alreadyknown))
{
return;
}
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 89ffdf5..c82f714 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -692,11 +692,11 @@ static void _powered_by_pain(int dam)
}
case 2:
mpr("You focus on the pain.");
- potion_effect(POT_MIGHT, level * 20);
+ get_potion_effect(POT_MIGHT)->effect(level * 20);
break;
case 3:
mpr("You focus on the pain.");
- potion_effect(POT_AGILITY, level * 20);
+ get_potion_effect(POT_AGILITY)->effect(level * 20);
break;
}
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 9b89ee4..a1bd796 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4815,7 +4815,7 @@ bool curare_hits_player(int death_source, int levels, string name,
}
}
- potion_effect(POT_SLOWING, levels + random2(3*levels));
+ slow_player(10+random2(levels + random2(3*levels)));
return hurted > 0;
}
@@ -5113,7 +5113,7 @@ bool miasma_player(actor *who, string source_aux)
if (one_chance_in(3))
{
- potion_effect(POT_SLOWING, 5);
+ slow_player(10+random2(5));
success = true;
}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index a3fc7d0..2434eb9 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -1043,6 +1043,7 @@ bool miasma_player(actor *who, string source_aux = "");
bool napalm_player(int amount, string source, string source_aux = "");
void dec_napalm_player(int delay);
+bool spell_slow_player(int pow);
bool slow_player(int turns);
void dec_slow_player(int delay);
void dec_exhaust_player(int delay);
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index 215ec73..c50e128 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -25,58 +25,58 @@
#include "transform.h"
#include "xom.h"
-/**
- * Apply the effect of a potion to the player.
- *
- * This is called when the player quaffs a potion, but also for some cards,
- * beams, god effects and miscasts.
- *
- * @param pot_eff The potion type.
- * @param pow The power of the effect. 40 for actual potions.
- * @param was_known Whether the potion was already identified.
- *
- * @return If the potion was used.
- */
-bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_known)
-{
- pow = min(pow, 150);
+int _xom_factor(bool was_known);
- // Reduced effect for healing potions.
- int mut_factor = 3 - you.mutation[MUT_NO_DEVICE_HEAL];
+PotionEffect::PotionEffect(const potion_type pot)
+ : potion_name(potion_type_name(pot)), kind(pot)
+{ }
- // Knowingly drinking bad potions is much less amusing.
- int xom_factor = 1;
- if (potion && was_known)
+bool PotionEffect::can_quaff() const
+{
+ return true;
+}
+
+bool PotionEffect::quaff(bool was_known) const
+{
+ if(was_known && !can_quaff())
{
- xom_factor *= 2;
- if (!player_in_a_dangerous_place())
- xom_factor *= 3;
+ mpr("You shouldn't drink that now.");
+ return false;
}
+ effect(40);
+ return true;
+}
- switch (pot_eff)
+class PotionCuring : public PotionEffect
+{
+private:
+ PotionCuring() : PotionEffect(POT_CURING) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionCuring);
+public:
+ static const PotionCuring &instance()
{
- case POT_CURING:
+ static PotionCuring inst; return inst;
+ }
+
+ bool can_quaff() const
{
const bool ddoor = you.duration[DUR_DEATHS_DOOR];
- if ((!you.can_device_heal() || ddoor)
- && potion && was_known
- && you.duration[DUR_CONF] == 0
- && you.duration[DUR_POISONING] == 0
- && you.rotting == 0
- && you.disease == 0
- // The potion won't heal us, so don't count rot unless at max HP.
- && (!player_rotted() || you.hp != you.hp_max))
- {
- mprf("You have no ailments to cure%s.",
- ddoor && you.can_device_heal()
- ? ", and can't heal while in Death's door"
- : "");
- return false;
- }
+ return (you.can_device_heal() && !ddoor)
+ || you.duration[DUR_CONF] != 0
+ || you.duration[DUR_POISONING] != 0
+ || you.rotting != 0
+ || you.disease != 0
+ || (player_rotted() && you.hp != you.hp_max);
+ }
+
+ bool effect(int pow=40) const
+ {
+ const bool ddoor = you.duration[DUR_DEATHS_DOOR];
if (you.can_device_heal() && !ddoor)
- inc_hp((5 + random2(7)) * mut_factor / 3);
+ inc_hp((5 + random2(7))
+ * (3 - you.mutation[MUT_NO_DEVICE_HEAL]) / 3);
mprf("You feel %s.", ddoor ? "queasy" : "better");
@@ -95,64 +95,108 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
you.rotting = 0;
you.disease = 0;
you.duration[DUR_CONF] = 0;
- break;
+
+ return true;
+ }
+
+ bool quaff(bool was_known) const
+ {
+ const bool ddoor = you.duration[DUR_DEATHS_DOOR];
+ if (was_known && !can_quaff())
+ {
+ mprf("You have no ailments to cure%s.",
+ ddoor && you.can_device_heal()
+ ? ", and can't heal while in Death's door"
+ : "");
+ return false;
+ }
+
+ effect();
+ return true;
+ }
+};
+
+class PotionHealWounds : public PotionEffect
+{
+private:
+ PotionHealWounds() : PotionEffect(POT_HEAL_WOUNDS) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionHealWounds);
+public:
+ static const PotionHealWounds &instance()
+ {
+ static PotionHealWounds inst; return inst;
+ }
+
+ bool can_quaff() const
+ {
+ const bool ddoor = you.duration[DUR_DEATHS_DOOR];
+
+ return !ddoor || you.can_device_heal();
+ }
+
+ bool effect(int pow=40) const
+ {
+ if (!can_quaff())
+ return false;
+
+ inc_hp((10 + random2avg(28, 3))
+ * (3 - you.mutation[MUT_NO_DEVICE_HEAL] ) / 3);
+ mpr("You feel much better.");
+
+ // only fix rot when healed to full
+ if (you.hp == you.hp_max)
+ {
+ unrot_hp(2 + random2avg(5, 2));
+ set_hp(you.hp_max);
+ }
+ return true;
}
- case POT_HEAL_WOUNDS:
+ bool quaff(bool was_known) const
+ {
if (you.duration[DUR_DEATHS_DOOR])
{
- if (potion && was_known)
+ if(was_known)
{
- mpr("You can't heal while in Death's door!");
+ mpr("You cannot heal while in Death's door!");
return false;
}
mpr("You feel queasy.");
- break;
+ return true;
}
-
- if (!you.can_device_heal())
+ else if (!you.can_device_heal())
{
- if (potion && was_known)
+ if(was_known)
{
mpr("That would not heal you.");
return false;
}
mpr("That seemed strangely inert.");
- break;
+ return true;
}
- inc_hp((10 + random2avg(28, 3)) * mut_factor / 3);
- mpr("You feel much better.");
+ effect();
+ return true;
+ }
+};
- // only fix rot when healed to full
- if (you.hp == you.hp_max)
- {
- unrot_hp(2 + random2avg(5, 2));
- set_hp(you.hp_max);
- }
- break;
+class PotionBlood : public PotionEffect
+{
+private:
+ PotionBlood() : PotionEffect(POT_BLOOD) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBlood);
+public:
+ static const PotionBlood &instance()
+ {
+ static PotionBlood inst; return inst;
+ }
- case POT_BLOOD:
-#if TAG_MAJOR_VERSION == 34
- case POT_BLOOD_COAGULATED:
-#endif
+ bool effect(int pow=40) const
+ {
if (you.species == SP_VAMPIRE)
{
- // No healing anymore! (jpeg)
- int value = 840;
-#if TAG_MAJOR_VERSION == 34
- if (pot_eff == POT_BLOOD)
- {
-#endif
- mpr("Yummy - fresh blood!");
- value += 200;
-#if TAG_MAJOR_VERSION == 34
- }
- else // Coagulated.
- mpr("This tastes delicious!");
-#endif
-
- lessen_hunger(value, true);
+ mpr("Yummy - fresh blood!");
+ lessen_hunger(pow, true);
}
else
{
@@ -163,21 +207,64 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
mpr("Yuck - this tastes like blood.");
// no actual effect, just 'flavour' ha ha ha
}
+ return true;
+ }
+
+ bool quaff(bool was_known) const
+ {
+ effect(1040);
did_god_conduct(DID_DRINK_BLOOD, 1 + random2(3), was_known);
- break;
+ return true;
+ }
+};
+
+
+class PotionHaste : public PotionEffect
+{
+private:
+ PotionHaste() : PotionEffect(POT_HASTE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionHaste);
+public:
+ static const PotionHaste &instance()
+ {
+ static PotionHaste inst; return inst;
+ }
- case POT_HASTE:
- if (potion && was_known && you.stasis(false))
+ bool can_quaff() const
+ {
+ return !you.stasis(false);
+ }
+
+ bool effect(int pow=40) const
+ {
+ return haste_player(40 + random2(pow));
+ }
+
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- mpr("This potion can't work under stasis.");
+ mpr("This potion cannot work under stasis.");
return false;
}
- if (haste_player(40 + random2(pow)))
+ if(effect())
did_god_conduct(DID_HASTY, 10, was_known);
- break;
+ return true;
+ }
+};
- case POT_MIGHT:
+class PotionMight : public PotionEffect
+{
+private:
+ PotionMight() : PotionEffect(POT_MIGHT) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionMight);
+public:
+ static const PotionMight &instance()
+ {
+ static PotionMight inst; return inst;
+ }
+ bool effect(int pow=40) const
{
const bool were_mighty = you.duration[DUR_MIGHT] > 0;
@@ -188,10 +275,21 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
if (!were_mighty)
notify_stat_change(STAT_STR, 5, true);
- break;
+ return true;
}
+};
- case POT_BRILLIANCE:
+class PotionBrilliance : public PotionEffect
+{
+private:
+ PotionBrilliance() : PotionEffect(POT_BRILLIANCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBrilliance);
+public:
+ static const PotionBrilliance &instance()
+ {
+ static PotionBrilliance inst; return inst;
+ }
+ bool effect(int pow=40) const
{
const bool were_brilliant = you.duration[DUR_BRILLIANCE] > 0;
@@ -202,10 +300,22 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
if (!were_brilliant)
notify_stat_change(STAT_INT, 5, true);
- break;
+
+ return true;
}
+};
- case POT_AGILITY:
+class PotionAgility : public PotionEffect
+{
+private:
+ PotionAgility() : PotionEffect(POT_AGILITY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionAgility);
+public:
+ static const PotionAgility &instance()
+ {
+ static PotionAgility inst; return inst;
+ }
+ bool effect(int pow=40) const
{
const bool were_agile = you.duration[DUR_AGILITY] > 0;
@@ -216,84 +326,150 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
if (!were_agile)
notify_stat_change(STAT_DEX, 5, true);
- break;
+ return true;
}
+};
-#if TAG_MAJOR_VERSION == 34
- case POT_GAIN_STRENGTH:
- if (mutate(MUT_STRONG, "potion of gain strength", true, false, false, true))
- learned_something_new(HINT_YOU_MUTATED);
- break;
- case POT_GAIN_DEXTERITY:
- if (mutate(MUT_AGILE, "potion of gain dexterity", true, false, false, true))
- learned_something_new(HINT_YOU_MUTATED);
- break;
+class PotionFlight : public PotionEffect
+{
+private:
+ PotionFlight() : PotionEffect(POT_FLIGHT) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionFlight);
+public:
+ static const PotionFlight &instance()
+ {
+ static PotionFlight inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return flight_allowed();
+ }
- case POT_GAIN_INTELLIGENCE:
- if (mutate(MUT_CLEVER, "potion of gain intelligence", true, false, false, true))
- learned_something_new(HINT_YOU_MUTATED);
- break;
-#endif
+ bool effect(int pow=40) const
+ {
+ you.attribute[ATTR_FLIGHT_UNCANCELLABLE] = 1;
+ fly_player(pow);
+ return you.airborne();
+ }
- case POT_FLIGHT:
- if (!flight_allowed())
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- if (potion && was_known)
- return false;
- break;
+ mpr("You cannot fly right now.");
+ return false;
}
- you.attribute[ATTR_FLIGHT_UNCANCELLABLE] = 1;
- fly_player(pow);
- break;
+ effect();
+ return true;
+ }
+};
- case POT_POISON:
-#if TAG_MAJOR_VERSION == 34
- case POT_STRONG_POISON:
-#endif
- if (player_res_poison() >= 1)
- mpr("You feel slightly nauseous.");
- else
- {
- mprf(MSGCH_WARN,
- "That liquid tasted very nasty...");
+class PotionPoison : public PotionEffect
+{
+private:
+ PotionPoison() : PotionEffect(POT_POISON) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionPoison);
+public:
+ static const PotionPoison &instance()
+ {
+ static PotionPoison inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ //Poison resistance is enough to not get poisoned by
+ // ingestion
+ return player_res_poison() >= 1;
+ }
- int amount = 10 + random2avg(15, 2);
- string msg = "a potion of poison";
+ bool effect(int pow=40) const
+ {
+ mprf(MSGCH_WARN,
+ "That liquid tasted very nasty...");
- poison_player(amount, "", msg);
- xom_is_stimulated(100 / xom_factor);
- }
- break;
+ int amount = 10 + random2avg(15, 2);
+ string msg = "a potion of poison";
- // Potions of slowing no longer exist, but tons of other effects use
- // potion_effect(POT_SLOWING) so this code stays in.
- case POT_SLOWING:
- if (slow_player(10 + random2(pow)))
- xom_is_stimulated(50 / xom_factor);
- break;
+ return poison_player(amount, "", msg);
+ }
+
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ xom_is_stimulated(100 / _xom_factor(was_known));
+ return true;
+ }
+};
- case POT_CANCELLATION:
+class PotionCancellation : public PotionEffect
+{
+private:
+ PotionCancellation() : PotionEffect(POT_CANCELLATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionCancellation);
+public:
+ static const PotionCancellation &instance()
+ {
+ static PotionCancellation inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
debuff_player();
mpr("You feel magically purged.");
- break;
+ return true;
+ }
+};
+
+class PotionConfusion : public PotionEffect
+{
+private:
+ PotionConfusion() : PotionEffect(POT_CONFUSION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionConfusion);
+public:
+ static const PotionConfusion &instance()
+ {
+ static PotionConfusion inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return !you.clarity() || you.duration[DUR_DIVINE_STAMINA] > 0;
+ }
- case POT_CONFUSION:
- if (confuse_player(3 + random2(8)))
- xom_is_stimulated(100 / xom_factor);
- break;
+ bool effect(int pow=40) const
+ {
+ return confuse_player(3+random2(pow));
+ }
- case POT_INVISIBILITY:
- if (you.backlit() || you.haloed())
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- // XXX: merge with item_use.cc:_dont_use_invis()
- if (potion && was_known && get_contamination_level() > 1)
- {
- mpr("You cannot become invisible while glowing.");
- return false;
- }
+ mpr("You cannot confuse yourself now.");
+ return false;
+ }
+
+ if(effect())
+ xom_is_stimulated(100 / _xom_factor(was_known));
+
+ return true;
+ }
+};
+
+class PotionInvisibility : public PotionEffect
+{
+private:
+ PotionInvisibility() : PotionEffect(POT_INVISIBILITY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionInvisibility);
+public:
+ static const PotionInvisibility &instance()
+ {
+ static PotionInvisibility inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ if (you.backlit() || you.haloed())
+ {
vector<const char *> afflictions;
if (you.haloed())
afflictions.push_back("halo");
@@ -326,54 +502,35 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
you.set_duration(DUR_INVIS, 15 + random2(pow), 100);
else
you.increase_duration(DUR_INVIS, random2(pow), 100);
+ return true;
+ }
- if (potion)
- you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
-
- break;
-
-#if TAG_MAJOR_VERSION == 34
- case POT_PORRIDGE:
- if (you.species == SP_VAMPIRE
- || player_mutation_level(MUT_CARNIVOROUS) == 3)
- {
- mpr("Blech - that potion was really gluggy!");
- }
- else
- {
- mpr("That potion was really gluggy!");
- lessen_hunger(6000, true);
- }
- break;
-#endif
-
- case POT_DEGENERATION:
- if (potion)
- mpr("There was something very wrong with that liquid!");
-
- if (lose_stat(STAT_RANDOM, 1 + random2avg(4, 2), false,
- "drinking a potion of degeneration"))
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- xom_is_stimulated(50 / xom_factor);
+ mpr("You cannot turn invisible while glowing.");
+ return false;
}
- break;
- case POT_DECAY:
- if (you.rot(&you, 0, 3 + random2(3)))
- xom_is_stimulated(50 / xom_factor);
- break;
-
-#if TAG_MAJOR_VERSION == 34
- case POT_WATER:
-#endif
- case NUM_POTIONS:
- if (you.species == SP_VAMPIRE)
- mpr("Blech - this tastes like water.");
- else
- mpr("This tastes like water.");
- break;
+ effect();
+ you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
+ return true;
+ }
+};
- case POT_EXPERIENCE:
+class PotionExperience : public PotionEffect
+{
+private:
+ PotionExperience() : PotionEffect(POT_EXPERIENCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionExperience);
+public:
+ static const PotionExperience &instance()
+ {
+ static PotionExperience inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
if (you.experience_level < 27)
{
mpr("You feel more experienced!");
@@ -387,20 +544,45 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
mpr("A flood of memories washes over you.");
more();
skill_menu(SKMF_EXPERIENCE_POTION, 750 * you.experience_level);
- break;
+ return true;
+ }
+};
- case POT_MAGIC:
+class PotionMagic : public PotionEffect
+{
+private:
+ PotionMagic() : PotionEffect(POT_MAGIC) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionMagic);
+public:
+ static const PotionMagic &instance()
+ {
+ static PotionMagic inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
// Allow repairing rot, disallow going through Death's Door.
#if TAG_MAJOR_VERSION == 34
- if (you.species == SP_DJINNI)
- return potion_effect(POT_HEAL_WOUNDS, pow, potion, was_known);
+ if (you.species == SP_DJINNI && PotionHealWounds::instance().can_quaff())
+ return PotionHealWounds::instance().effect(pow);
#endif
inc_mp(10 + random2avg(28, 3));
mpr("Magic courses through your body.");
- break;
+ return true;
+ }
+};
- case POT_RESTORE_ABILITIES:
+class PotionRestoreAbilities : public PotionEffect
+{
+private:
+ PotionRestoreAbilities() : PotionEffect(POT_RESTORE_ABILITIES) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionRestoreAbilities);
+public:
+ static const PotionRestoreAbilities &instance()
+ {
+ static PotionRestoreAbilities inst; return inst;
+ }
+ bool effect(int pow=40) const
{
bool nothing_happens = true;
if (you.duration[DUR_BREATH_WEAPON])
@@ -413,101 +595,541 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
// Give a message if no message otherwise.
if (!restore_stat(STAT_ALL, 0, false) && nothing_happens)
mpr("You feel refreshed.");
- break;
+ return nothing_happens;
}
+};
- case POT_BERSERK_RAGE:
- if (potion && was_known && !you.can_go_berserk(true, potion, false))
- return false;
-
+class PotionBerserk : public PotionEffect
+{
+private:
+ PotionBerserk() : PotionEffect(POT_BERSERK_RAGE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBerserk);
+public:
+ static const PotionBerserk &instance()
+ {
+ static PotionBerserk inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_go_berserk(true, true, false);
+ }
+ bool effect(int pow=40) const
+ {
if (you.species == SP_VAMPIRE && you.hunger_state <= HS_SATIATED)
{
mpr("You feel slightly irritated.");
make_hungry(100, false);
+ return false;
}
else
{
- if (you.go_berserk(was_known, true))
- xom_is_stimulated(50);
+ you.go_berserk(true, true);
+ return true;
}
- break;
-
- case POT_CURE_MUTATION:
- if (potion && was_known && undead_mutation_rot())
+ }
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
- : "You cannot mutate.");
+ mpr("You cannot go berserk now.");
return false;
}
+
+ if(effect())
+ xom_is_stimulated(50);
+
+ return true;
+ }
+};
+
+class PotionCureMutation : public PotionEffect
+{
+private:
+ PotionCureMutation() : PotionEffect(POT_CURE_MUTATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionCureMutation);
+public:
+ static const PotionCureMutation &instance()
+ {
+ static PotionCureMutation inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_safely_mutate();
+ }
+ bool effect(int pow=40) const
+ {
mpr("It has a very clean taste.");
+ bool mutated = false;
for (int i = 0; i < 7; i++)
if (random2(9) >= i)
- delete_mutation(RANDOM_MUTATION, "potion of cure mutation", false);
- break;
-
- case POT_MUTATION:
- if (potion && was_known && undead_mutation_rot())
+ mutated |= delete_mutation(RANDOM_MUTATION, "potion of cure mutation", false);
+ return mutated;
+ }
+ bool quaff(bool was_known) const
+ {
+ if (was_known && undead_mutation_rot())
{
mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
: "You cannot mutate.");
return false;
}
+ effect();
+ return true;
+ }
+};
+class PotionMutation : public PotionEffect
+{
+private:
+ PotionMutation() : PotionEffect(POT_MUTATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionMutation);
+public:
+ static const PotionMutation &instance()
+ {
+ static PotionMutation inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_safely_mutate();
+ }
+ bool effect(int pow=40) const
+ {
mpr("You feel extremely strange.");
+ bool mutated = false;
for (int i = 0; i < 3; i++)
- mutate(RANDOM_MUTATION, "potion of mutation", false);
+ mutated |= mutate(RANDOM_MUTATION, "potion of mutation", false);
learned_something_new(HINT_YOU_MUTATED);
- did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
- break;
-
- case POT_BENEFICIAL_MUTATION:
- if (undead_mutation_rot())
+ return mutated;
+ }
+ bool quaff(bool was_known) const
+ {
+ if (was_known && undead_mutation_rot())
{
- if (potion && was_known)
- {
- mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
- : "You cannot mutate.");
- return false;
- }
+ mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
+ : "You cannot mutate.");
+ return false;
+ }
+ effect();
+ // Zin conduct is violated even if you get lucky and don't mutate
+ did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
+ return true;
+ }
+};
+
+class PotionBeneficialMutation : public PotionEffect
+{
+private:
+ PotionBeneficialMutation() : PotionEffect(POT_BENEFICIAL_MUTATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBeneficialMutation);
+public:
+ static const PotionBeneficialMutation &instance()
+ {
+ static PotionBeneficialMutation inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_safely_mutate();
+ }
+ bool effect(int pow=40) const
+ {
+ if(undead_mutation_rot()) {
mpr("You feel dead inside.");
- mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
+ return mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
true, false, false, true);
- break;
}
- if (mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
- true, false, false, true))
- {
+ const bool mutated = mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
+ true, false, false, true);
+ if (mutated)
mpr("You feel fantastic!");
- }
else
mpr("You feel fantastic for a moment.");
learned_something_new(HINT_YOU_MUTATED);
+ return mutated;
+ }
+ bool quaff(bool was_known) const
+ {
+ if (was_known && undead_mutation_rot())
+ {
+ mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
+ : "You cannot mutate.");
+ return false;
+ }
+ effect();
+
+ // Zin conduct is violated even if you get lucky and don't mutate
did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
- break;
+ return true;
+ }
+};
- case POT_RESISTANCE:
+class PotionResistance : public PotionEffect
+{
+private:
+ PotionResistance() : PotionEffect(POT_RESISTANCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionResistance);
+public:
+ static const PotionResistance &instance()
+ {
+ static PotionResistance inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
mprf(MSGCH_DURATION, "You feel protected.");
you.increase_duration(DUR_RESISTANCE, random2(pow) + 35);
- break;
+ return true;
+ }
+};
+
+class PotionDegeneration : public PotionEffect
+{
+private:
+ PotionDegeneration() : PotionEffect(POT_DEGENERATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionDegeneration);
+public:
+ static const PotionDegeneration &instance()
+ {
+ static PotionDegeneration inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return lose_stat(STAT_RANDOM, 1 + random2avg(4, 2), false,
+ "drinking a potion of degeneration");
+ }
+ bool quaff(bool was_known) const
+ {
+ mpr("There was something very wrong with that liquid.");
+ if(effect())
+ xom_is_stimulated( 50 / _xom_factor(was_known));
+ return true;
+ }
+};
+
+class PotionDecay : public PotionEffect
+{
+private:
+ PotionDecay() : PotionEffect(POT_DECAY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionDecay);
+public:
+ static const PotionDecay &instance()
+ {
+ static PotionDecay inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return you.rot(&you, 0, 3 + random2(3));;
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ xom_is_stimulated( 50 / _xom_factor(was_known));
+ return true;
+ }
+};
- case POT_LIGNIFY:
- if (potion && was_known && !transform(0, TRAN_TREE, false, true))
+class PotionLignify : public PotionEffect
+{
+private:
+ PotionLignify() : PotionEffect(POT_LIGNIFY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionLignify);
+public:
+ static const PotionLignify &instance()
+ {
+ static PotionLignify inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return transform(0, TRAN_TREE, false, true);
+ }
+ bool effect(int pow=40) const
+ {
+ return transform(30, TRAN_TREE, false);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
+ {
+ mpr("You cannot become a tree right now.");
return false;
+ }
- if (transform(30, TRAN_TREE, !was_known))
+ if(effect())
{
you.transform_uncancellable = true;
did_god_conduct(DID_CHAOS, 10, was_known);
}
else
mpr("You feel woody for a moment.");
- break;
+ return true;
+ }
+};
+
+// Removed potions
+#if TAG_MAJOR_VERSION == 34
+class PotionBloodCoagulated : public PotionEffect
+{
+private:
+ PotionBloodCoagulated() : PotionEffect(POT_BLOOD_COAGULATED) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBloodCoagulated);
+public:
+ static const PotionBloodCoagulated &instance()
+ {
+ static PotionBloodCoagulated inst; return inst;
}
- if (potion && !was_known)
+ bool effect(int pow=40) const
+ {
+ if (you.species == SP_VAMPIRE)
+ {
+ mpr("This tastes delicious.");
+ lessen_hunger(pow, true);
+ }
+ else
+ {
+ const int herbivorous = player_mutation_level(MUT_HERBIVOROUS);
+ if (herbivorous < 3 && player_likes_chunks())
+ mpr("This tastes like blood.");
+ else
+ mpr("Yuck - this tastes like blood.");
+ // no actual effect, just 'flavour' ha ha ha
+ }
+ return true;
+ }
+
+ bool quaff(bool was_known) const
+ {
+ effect(840);
+ did_god_conduct(DID_DRINK_BLOOD, 1 + random2(3), was_known);
+ return true;
+ }
+};
+
+class PotionGainStrength : public PotionEffect
+{
+private:
+ PotionGainStrength() : PotionEffect(POT_GAIN_STRENGTH) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionGainStrength);
+public:
+ static const PotionGainStrength &instance()
+ {
+ static PotionGainStrength inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return mutate(MUT_STRONG, "potion of gain strength", true, false, false, true);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ learned_something_new(HINT_YOU_MUTATED);
+ return true;
+ }
+};
+
+class PotionGainDexterity : public PotionEffect
+{
+private:
+ PotionGainDexterity() : PotionEffect(POT_GAIN_DEXTERITY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionGainDexterity);
+public:
+ static const PotionGainDexterity &instance()
+ {
+ static PotionGainDexterity inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return mutate(MUT_STRONG, "potion of gain dexterity", true, false, false, true);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ learned_something_new(HINT_YOU_MUTATED);
+ return true;
+ }
+};
+
+class PotionGainIntelligence : public PotionEffect
+{
+private:
+ PotionGainIntelligence() : PotionEffect(POT_GAIN_INTELLIGENCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionGainIntelligence);
+public:
+ static const PotionGainIntelligence &instance()
+ {
+ static PotionGainIntelligence inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return mutate(MUT_STRONG, "potion of gain intelligence", true, false, false, true);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ learned_something_new(HINT_YOU_MUTATED);
+ return true;
+ }
+};
+
+class PotionPorridge : public PotionEffect
+{
+private:
+ PotionPorridge() : PotionEffect(POT_PORRIDGE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionPorridge);
+public:
+ static const PotionPorridge &instance()
+ {
+ static PotionPorridge inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ if (you.species == SP_VAMPIRE
+ || player_mutation_level(MUT_CARNIVOROUS) == 3)
+ {
+ mpr("Blech - that potion was really gluggy!");
+ }
+ else
+ {
+ mpr("That potion was really gluggy!");
+ lessen_hunger(6000, true);
+ }
+ return true;
+ }
+};
+
+class PotionWater : public PotionEffect
+{
+private:
+ PotionWater() : PotionEffect(POT_WATER) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionWater);
+public:
+ static const PotionWater &instance()
+ {
+ static PotionWater inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ if (you.species == SP_VAMPIRE)
+ mpr("Blech - this tastes like water.");
+ else
+ mpr("This tastes like water.");
+ return true;
+ }
+};
+#endif
+
+
+// Potion effects that do not come in potion form but are
+// still applied by other sources. XXX: this can
+// probably be refactored further.
+class PotionSlowing : public PotionEffect
+{
+private:
+ PotionSlowing() : PotionEffect(POT_SLOWING) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionSlowing);
+public:
+ static const PotionSlowing &instance()
+ {
+ static PotionSlowing inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.stasis(false);
+ }
+
+ bool effect(int pow=40) const
+ {
+ return slow_player(10 + random2(pow));
+ }
+};
+
+class PotionStale : public PotionEffect
+{
+private:
+ PotionStale() : PotionEffect(NUM_POTIONS) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionStale);
+public:
+ static const PotionStale &instance()
+ {
+ static PotionStale inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ mpr("That potion was far past its expiry date.");
+ return true;
+ }
+};
+
+static const PotionEffect* potion_effects[] =
+{
+ &PotionCuring::instance(),
+ &PotionHealWounds::instance(),
+ &PotionHaste::instance(),
+ &PotionMight::instance(),
+ &PotionBrilliance::instance(),
+ &PotionAgility::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionGainStrength::instance(),
+ &PotionGainDexterity::instance(),
+ &PotionGainIntelligence::instance(),
+#endif
+ &PotionFlight::instance(),
+ &PotionPoison::instance(),
+ &PotionSlowing::instance(),
+ &PotionCancellation::instance(),
+ &PotionConfusion::instance(),
+ &PotionInvisibility::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionPorridge::instance(),
+#endif
+ &PotionDegeneration::instance(),
+ &PotionDecay::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionWater::instance(),
+#endif
+ &PotionExperience::instance(),
+ &PotionMagic::instance(),
+ &PotionRestoreAbilities::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionPoison::instance(),
+#endif
+ &PotionBerserk::instance(),
+ &PotionCureMutation::instance(),
+ &PotionMutation::instance(),
+ &PotionResistance::instance(),
+ &PotionBlood::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionBloodCoagulated::instance(),
+#endif
+ &PotionLignify::instance(),
+ &PotionBeneficialMutation::instance(),
+ &PotionStale::instance()
+};
+
+const PotionEffect* get_potion_effect(potion_type pot)
+{
+ COMPILE_CHECK(ARRAYSZ(potion_effects) == NUM_POTIONS+1);
+ ASSERT_RANGE(pot, 0, NUM_POTIONS+1);
+ return potion_effects[pot];
+}
+
+/**
+ * Apply the effect of a potion to the player.
+ *
+ * This is called when the player quaffs a potion ONLY
+ * Beams, cards, miscasts, and god effects that need a potion effect should apply
+ * the effect method as appropriate, since these should not have the same Xom effects
+ * and don't deal with item identification.
+ * @param pot_eff The potion type.
+ * @param pow The power of the effect. 40 for actual potions.
+ * @param was_known Whether the potion was already identified.
+ *
+ * @return If the potion was used.
+ */
+bool potion_effect(potion_type pot_eff, item_def *potion, bool was_known)
+{
+ if (!was_known)
{
set_ident_flags(*potion, ISFLAG_IDENT_MASK);
set_ident_type(*potion, ID_KNOWN_TYPE);
@@ -515,5 +1137,18 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
identify_healing_pots();
}
- return true;
+ return get_potion_effect(pot_eff)->quaff(was_known);
+}
+
+int _xom_factor(bool was_known)
+{
+ // Knowingly drinking bad potions is much less amusing.
+ int xom_factor = 1;
+ if (was_known)
+ {
+ xom_factor *= 2;
+ if (!player_in_a_dangerous_place())
+ xom_factor *= 3;
+ }
+ return xom_factor;
}
diff --git a/crawl-ref/source/potion.h b/crawl-ref/source/potion.h
index d1f0320..add26d1 100644
--- a/crawl-ref/source/potion.h
+++ b/crawl-ref/source/potion.h
@@ -6,7 +6,36 @@
#ifndef POTION_H
#define POTION_H
-bool potion_effect(potion_type pot_eff, int pow,
- item_def *potion = nullptr, bool was_known = true);
+bool potion_effect(potion_type pot_eff,
+ item_def *potion, bool was_known = true);
+
+class PotionEffect
+{
+private:
+ PotionEffect() = delete;
+ DISALLOW_COPY_AND_ASSIGN(PotionEffect);
+protected:
+ PotionEffect(potion_type);
+public:
+ bool can_quaff() const;
+
+ // Elsewhere in the code there are things that can have the effect
+ // effect of a potion without actually being potions, there
+ // are even some legacy 'potions' around in this code that
+ // nowdays only provide the potion-like effect
+
+ // Returns whether or not the potion had an effect
+ virtual bool effect(int pow = 40) const { return false; }
+
+ // Quaff also handles god-conduct and potion-specific
+ // uncancellability
+ // Returns whether or not the potion was actually quaffed
+ bool quaff(bool was_known = true) const;
+
+ const string potion_name;
+ const potion_type kind;
+};
+
+const PotionEffect* get_potion_effect(potion_type pot);
#endif
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 35c8be8..26b142e 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1078,6 +1078,7 @@ static int _xom_do_potion(bool debug = false)
return XOM_GOOD_POTION;
potion_type pot = POT_CURING;
+ const PotionEffect * pot_eff = get_potion_effect(pot);
while (true)
{
pot = random_choose(POT_CURING, POT_HEAL_WOUNDS, POT_MAGIC, POT_HASTE,
@@ -1087,18 +1088,13 @@ static int _xom_do_potion(bool debug = false)
if (pot == POT_EXPERIENCE && !one_chance_in(6))
pot = POT_BERSERK_RAGE;
- bool has_effect = true;
- // Don't pick something that won't have an effect.
+ pot_eff = get_potion_effect(pot);
+
+ bool has_effect = pot_eff->can_quaff();
+ // Xom checks for some extra HW and Magic effects
// Extending an existing effect is okay, though.
switch (pot)
{
- case POT_CURING:
- if (you.duration[DUR_POISONING] || you.rotting || you.disease
- || you.duration[DUR_CONF])
- {
- break;
- }
- // else fall through
case POT_HEAL_WOUNDS:
if (you.hp == you.hp_max && player_rotted() == 0)
has_effect = false;
@@ -1107,10 +1103,6 @@ static int _xom_do_potion(bool debug = false)
if (you.magic_points == you.max_magic_points)
has_effect = false;
break;
- case POT_BERSERK_RAGE:
- if (!you.can_go_berserk(false))
- has_effect = false;
- break;
default:
break;
}
@@ -1128,9 +1120,9 @@ static int _xom_do_potion(bool debug = false)
_note_potion_effect(pot);
- potion_effect(pot, 150, nullptr, false);
+ pot_eff->effect(100);
- level_change(); // potion_effect() doesn't do this anymore
+ level_change(); // pot_eff->effect() for Experience doesn't do this
return XOM_GOOD_POTION;
}
--
1.9.3 (Apple Git-50)
From 6ba27735b125507fb5f673905ff2b13c324eeeab Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Thu, 27 Nov 2014 22:06:56 -0600
Subject: [PATCH 3/5] Potion of Ambrosia: Confuses, grants Elixir-like regen
that ends at a timeout or when not confused, whichever comes first
Conflicts:
crawl-ref/source/potion.cc
---
crawl-ref/source/dat/descript/items.txt | 6 ++
crawl-ref/source/duration-data.h | 3 +-
crawl-ref/source/enum.h | 3 +
crawl-ref/source/itemname.cc | 1 +
crawl-ref/source/makeitem.cc | 1 +
crawl-ref/source/player-reacts.cc | 5 ++
crawl-ref/source/player.cc | 20 ++++++
crawl-ref/source/player.h | 1 +
crawl-ref/source/potion.cc | 71 ++++++++++++++-------
crawl-ref/source/rltiles/dc-item.txt | 3 +-
.../source/rltiles/item/potion/i-ambrosia.png | Bin 0 -> 1341 bytes
crawl-ref/source/shopping.cc | 1 +
12 files changed, 89 insertions(+), 26 deletions(-)
create mode 100644 crawl-ref/source/rltiles/item/potion/i-ambrosia.png
diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt
index 9132538..805d4f3 100644
--- a/crawl-ref/source/dat/descript/items.txt
+++ b/crawl-ref/source/dat/descript/items.txt
@@ -839,6 +839,12 @@ potion of agility
A magic potion which greatly increases the dexterity and evasiveness of one who
drinks it.
%%%%
+potion of ambrosia
+
+A strange substance, produced by ghost moths. Consuming it will cause regeneration
+of health and magic, at the expense of mental clarity. The two effects are inexorably
+linked, regeneration will end immediatly if the user regains ther senses.
+%%%%
potion of beneficial mutation
A potion which gives you a supposedly good mutation.
diff --git a/crawl-ref/source/duration-data.h b/crawl-ref/source/duration-data.h
index 9972462..678a717 100644
--- a/crawl-ref/source/duration-data.h
+++ b/crawl-ref/source/duration-data.h
@@ -350,6 +350,8 @@ static const duration_def duration_data[] =
false, LIGHTBLUE, "Cleave",
"cleaving", "cleave",
"You are cleaving through your foes.", true },
+ { DUR_AMBROSIA, false, GREEN, "Ambros", "", "ambrosia",
+ "You are regenerating under the effects of ambrosia.", false },
// The following are visible in wizmode only, or are handled
// specially in the status lights and/or the % or @ screens.
@@ -403,7 +405,6 @@ static const duration_def duration_data[] =
{ DUR_SPIRIT_HOWL, false, 0, "", "", "old spirit howl", "", false },
{ DUR_SONG_OF_SHIELDING, false, 0, "", "", "old song of shielding", "", false },
{ DUR_ANTENNAE_EXTEND, false, 0, "", "", "old antennae extend", "", false },
- { DUR_AMBROSIA, false, 0, "", "", "old ambrosia", "", false },
{ DUR_BUILDING_RAGE, false, 0, "", "", "old building rage", "", false },
#endif
};
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index a3dd475..73e9c5f 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1638,7 +1638,9 @@ enum duration_type
DUR_TORNADO_COOLDOWN,
#if TAG_MAJOR_VERSION == 34
DUR_NAUSEA,
+#endif
DUR_AMBROSIA,
+#if TAG_MAJOR_VERSION == 34
DUR_TEMP_MUTATIONS,
#endif
DUR_DISJUNCTION,
@@ -3609,6 +3611,7 @@ enum potion_type
#endif
POT_LIGNIFY,
POT_BENEFICIAL_MUTATION,
+ POT_AMBROSIA,
NUM_POTIONS
};
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 813c2df..2c61007 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -710,6 +710,7 @@ const char* potion_type_name(int potiontype)
case POT_RESISTANCE: return "resistance";
case POT_LIGNIFY: return "lignification";
case POT_BENEFICIAL_MUTATION: return "beneficial mutation";
+ case POT_AMBROSIA: return "ambrosia";
default: return "bugginess";
}
}
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index f0955f1..775dc8d 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1302,6 +1302,7 @@ static void _generate_potion_item(item_def& item, int force_type,
35, POT_LIGNIFY,
34, POT_CANCELLATION,
34, POT_CONFUSION,
+ 34, POT_AMBROSIA,
25, POT_DEGENERATION,
23, POT_CURE_MUTATION,
12, POT_BENEFICIAL_MUTATION,
diff --git a/crawl-ref/source/player-reacts.cc b/crawl-ref/source/player-reacts.cc
index 66434d2..99e76be 100644
--- a/crawl-ref/source/player-reacts.cc
+++ b/crawl-ref/source/player-reacts.cc
@@ -717,6 +717,11 @@ static void _decrement_durations()
you.attribute[ATTR_INVIS_UNCANCELLABLE] = 0;
}
+ // Decrement ambrosia before confusion, otherwise confusion ending
+ // will cancel ambrosia early. Might be a bad coupling, but ambrosia
+ // needs to use DUR_CONF otherwise it won't behave right if a player
+ // gets confused after eating ambrosia.
+ dec_ambrosia_player(delay);
_decrement_a_duration(DUR_CONF, delay, "You feel less confused.");
_decrement_a_duration(DUR_LOWERED_MR, delay, "You feel less vulnerable to hostile enchantments.");
_decrement_a_duration(DUR_SLIMIFY, delay, "You feel less slimy.",
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index a1bd796..ab99f56 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5368,6 +5368,26 @@ void dec_elixir_player(int delay)
_dec_elixir_mp(delay);
}
+void dec_ambrosia_player(int delay)
+{
+ if(!you.confused() && you.duration[DUR_AMBROSIA])
+ {
+ you.duration[DUR_AMBROSIA] = 0;
+ return;
+ }
+
+ you.duration[DUR_AMBROSIA] -= delay;
+ if(you.duration[DUR_AMBROSIA] < 0)
+ you.duration[DUR_AMBROSIA] = 0;
+
+ int heal_hp = (delay * you.hp_max / 10) / BASELINE_DELAY;
+ if (!you.duration[DUR_DEATHS_DOOR])
+ inc_hp(heal_hp);
+
+ int heal_mp = (delay * you.max_magic_points / 10) / BASELINE_DELAY;
+ inc_mp(heal_mp);
+}
+
bool flight_allowed(bool quiet)
{
if (get_form()->forbids_flight())
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 2434eb9..dadc42e 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -1051,6 +1051,7 @@ void dec_exhaust_player(int delay);
bool haste_player(int turns, bool rageext = false);
void dec_haste_player(int delay);
void dec_elixir_player(int delay);
+void dec_ambrosia_player(int delay);
bool flight_allowed(bool quiet = false);
void fly_player(int pow, bool already_flying = false);
void float_player();
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index c50e128..4073140 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -420,38 +420,26 @@ public:
}
};
-class PotionConfusion : public PotionEffect
+class PotionAmbrosia : public PotionEffect
{
private:
- PotionConfusion() : PotionEffect(POT_CONFUSION) { }
- DISALLOW_COPY_AND_ASSIGN(PotionConfusion);
+ PotionAmbrosia() : PotionEffect(POT_AMBROSIA) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionAmbrosia);
public:
- static const PotionConfusion &instance()
+ static const PotionAmbrosia &instance()
{
- static PotionConfusion inst; return inst;
+ static PotionAmbrosia inst; return inst;
}
- bool can_quaff() const
- {
- return !you.clarity() || you.duration[DUR_DIVINE_STAMINA] > 0;
- }
-
bool effect(int pow=40) const
{
- return confuse_player(3+random2(pow));
- }
-
- bool quaff(bool was_known) const
- {
- if(was_known && !can_quaff())
+ int ambrosia_turns = 3+random2(8);
+ if (confuse_player(ambrosia_turns))
{
- mpr("You cannot confuse yourself now.");
- return false;
+ mpr("You feel invigorated.");
+ you.increase_duration(DUR_AMBROSIA, ambrosia_turns);
+ return true;
}
-
- if(effect())
- xom_is_stimulated(100 / _xom_factor(was_known));
-
- return true;
+ return fasle;
}
};
@@ -1019,7 +1007,6 @@ public:
};
#endif
-
// Potion effects that do not come in potion form but are
// still applied by other sources. XXX: this can
// probably be refactored further.
@@ -1044,6 +1031,41 @@ public:
}
};
+class PotionConfusion : public PotionEffect
+{
+private:
+ PotionConfusion() : PotionEffect(POT_CONFUSION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionConfusion);
+public:
+ static const PotionConfusion &instance()
+ {
+ static PotionConfusion inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return !you.clarity() || you.duration[DUR_DIVINE_STAMINA] > 0;
+ }
+
+ bool effect(int pow=40) const
+ {
+ return confuse_player(3+random2(pow));
+ }
+
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
+ {
+ mpr("You cannot confuse yourself now.");
+ return false;
+ }
+
+ if(effect())
+ xom_is_stimulated(100 / _xom_factor(was_known));
+
+ return true;
+ }
+};
+
class PotionStale : public PotionEffect
{
private:
@@ -1104,6 +1126,7 @@ static const PotionEffect* potion_effects[] =
#endif
&PotionLignify::instance(),
&PotionBeneficialMutation::instance(),
+ &PotionAmbrosia::instance(),
&PotionStale::instance()
};
diff --git a/crawl-ref/source/rltiles/dc-item.txt b/crawl-ref/source/rltiles/dc-item.txt
index 3796a88..9035bec 100644
--- a/crawl-ref/source/rltiles/dc-item.txt
+++ b/crawl-ref/source/rltiles/dc-item.txt
@@ -853,7 +853,8 @@ i-resistance POT_RESISTANCE
i-blood POT_BLOOD
i-coagulated-blood POT_BLOOD_COAGULATED
i-lignify POT_LIGNIFY
-i-good-mutation POT_BENEFICIAL_MUTATION POT_ID_LAST
+i-good-mutation POT_BENEFICIAL_MUTATION
+i-ambrosia POT_AMBROSIA POT_ID_LAST
%back none
%rim 1
diff --git a/crawl-ref/source/rltiles/item/potion/i-ambrosia.png b/crawl-ref/source/rltiles/item/potion/i-ambrosia.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab9c04950f157a393b050eff844b505344a412f6
GIT binary patch
literal 1341
zcmV-D1;YA?P)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F8000B<X+uL$Nkc;*
zP;zf(X>4Tx062|}Ro!pfR1`mnZ(O7nKcKOW4i$^9Ra0BJ8yc;~21%2p=|UR0&DbiW
z$#rfTQ`a`O(`{9s_5yDV_yd5l2Of}kLK+Oj_Ok5(v`JGz71bo9J#^YYXp{DWs&KBa
zQ@dTpxRI}aIp=pi@6k0t$5)!;m`NF6-tt{FpOKHBn3g+MAqmexC-gw4rh87hTrL7G
z#)U`L!(So6-Zux@>;H3gR;i~0B%VTSS3P|m@o9jRsXML@Al^p#@G0Lx-0?i(9WEw_
zSYddU<1E8793KxjQ|c&UmW!m<wJPEz#Qifd`D_gH9D=nYPc7;iy3Be}cI}#B(pb7r
zQ2)<0Z#G)-dhzM<<|dEgyN}ggcgNHaf39n}NyINBzUKHDCVv(2y~bQ6jd(9W@|l`@
zq{8{hHx}zt?;zfZxN7)?sZhRX&6Fm%ZE|_eKB|VCYq~dzJ%bk!->TC>k>?{om1c9S
zUx<6_jj_<bFzzi(=30Ih>!T&^M{wWM#><F%5P#^}>IBbOSf*xP<^F{$j$aOQ5Y{cT
zROCL1M7^NKK<?M4#<(px;Nu~3TQXfUjub-vl4Az5h`EvTZbPkvoEw^(%X2^EKD8>L
z&(yA}mSw#iM0^;IB{ZO5!wl{^Sg-*ysE~&Yz8!E;Qv(A`lu*=Clo*MpVGd>OdF6n^
zam1Jntk;<}MrqIC5$=Q>n{*R}?8oOIDUw5En2dl--Xw34!z7E+5pr<Twj7JkV%^#F
z^FB1tE8`u5%(<RMUli}Gd(zOafAsejYx|L$X)B+22f)J)w3q|&`mZkiuq*PhLN2^}
zv+L>-OgyQ-soSab)C%saskMla`aQLVzg0+MZf20tJU&K{hZoBrUc+U4e9&<J19^6g
zw<TiDI@c3vSSRQQrH3Ur+aF1l-;_U<73B-%ymEJ2m)mwp_*D2-_)+*y_+I!KWZ{x<
zS@=n~B77rUjGfiv=VSBigL+%lGEKW)Q!u5Bv|D;f%1SRtuSmtnpVTc4Nn_F;)a>3o
zw|KmGEe4#xz17wBu{f`SS_4i66?j31EjY7n{zGfhONK~c+td!TS#B}JoR}5UAd7p&
z5phTyXSkK0xCeD3xaYP^o&J~#Xp9xFb0C;HHml5fA<%h1eR|qw7wxF+oN<lWx-aij
zl-K1neyXTku=K%xSu;&JP<gUTJ?bvd>L9T1Aits?sKNIwvGaN)^WO$I^cUV)HzL_|
z1K?{9p!>B*)`xfEv!4N6IG{J&h49W#Bz^(#YWw%`e_a{8n{G9m5AeR~_yl0%<7V@p
z<z{o^OZ2}6aLN1^Spac(61Cxm00039Nkl<ZSP5fb7zLvtFd71*Aut*OqaiRF0wX;H
z7-<jy|4A^Dk%a`sL@Ryr<Ox`<jEoEejE$}tBnJXa=n~Z8UkyErVid?in5D=PGzkG@
z3$R&=EKdyw;EeN~mK(u#xgYmOi3(&#Q6&mM@q9k*3fK}{aSrn}$a0Wc7@$T7FuZR1
z!0_twU4~boFk>-kWM3o8QY8dL>jaR^#L5PR47SjriUU9)KrWz46o4!j(^W=s11L(6
z0df?8Lu?jAmKr4?MlJv)GGqsU9A`L72iZL^HdRVObWdP72xc3QMpsL_k`T#KyiBU4
z0d!knX#$=@pmC0_4kJj=6_CLvDGJCipSoHA9kDx|b#lL*00000NkvXXu0mjfeb{i!
literal 0
HcmV?d00001
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 1e326c8..89a99d9 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1528,6 +1528,7 @@ unsigned int item_value(item_def item, bool ident)
case POT_MAGIC:
case POT_INVISIBILITY:
case POT_CANCELLATION:
+ case POT_AMBROSIA:
valued += 80;
break;
--
1.9.3 (Apple Git-50)
From 17808b30e4e105bb8b25ebe73452f4e2e52b7ef3 Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Fri, 28 Nov 2014 17:28:22 -0600
Subject: [PATCH 4/5] On second thought replacing conf with ambrosia seems to
be a better idea. Do that, kill the dead code for POT_CONF
---
crawl-ref/source/enum.h | 3 +--
crawl-ref/source/itemname.cc | 4 +---
crawl-ref/source/makeitem.cc | 1 -
crawl-ref/source/potion.cc | 40 ++----------------------------------
crawl-ref/source/rltiles/dc-item.txt | 5 ++---
crawl-ref/source/shopping.cc | 2 --
crawl-ref/source/tags.cc | 2 +-
7 files changed, 7 insertions(+), 50 deletions(-)
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 73e9c5f..2e237ff 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -3585,7 +3585,7 @@ enum potion_type
POT_POISON,
POT_SLOWING,
POT_CANCELLATION,
- POT_CONFUSION,
+ POT_AMBROSIA,
POT_INVISIBILITY,
#if TAG_MAJOR_VERSION == 34
POT_PORRIDGE,
@@ -3611,7 +3611,6 @@ enum potion_type
#endif
POT_LIGNIFY,
POT_BENEFICIAL_MUTATION,
- POT_AMBROSIA,
NUM_POTIONS
};
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 2c61007..80c6ee3 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -693,7 +693,7 @@ const char* potion_type_name(int potiontype)
case POT_POISON: return "poison";
case POT_SLOWING: return "slowing";
case POT_CANCELLATION: return "cancellation";
- case POT_CONFUSION: return "confusion";
+ case POT_AMBROSIA: return "ambrosia";
case POT_INVISIBILITY: return "invisibility";
case POT_DEGENERATION: return "degeneration";
case POT_DECAY: return "decay";
@@ -710,7 +710,6 @@ const char* potion_type_name(int potiontype)
case POT_RESISTANCE: return "resistance";
case POT_LIGNIFY: return "lignification";
case POT_BENEFICIAL_MUTATION: return "beneficial mutation";
- case POT_AMBROSIA: return "ambrosia";
default: return "bugginess";
}
}
@@ -3108,7 +3107,6 @@ bool is_bad_item(const item_def &item, bool temp)
case POT_SLOWING:
if (you.species == SP_FORMICID)
return false;
- case POT_CONFUSION:
case POT_DEGENERATION:
return true;
case POT_DECAY:
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 775dc8d..dc6b178 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1301,7 +1301,6 @@ static void _generate_potion_item(item_def& item, int force_type,
35, POT_MUTATION,
35, POT_LIGNIFY,
34, POT_CANCELLATION,
- 34, POT_CONFUSION,
34, POT_AMBROSIA,
25, POT_DEGENERATION,
23, POT_CURE_MUTATION,
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index 4073140..9e820f7 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -439,7 +439,7 @@ public:
you.increase_duration(DUR_AMBROSIA, ambrosia_turns);
return true;
}
- return fasle;
+ return false;
}
};
@@ -1031,41 +1031,6 @@ public:
}
};
-class PotionConfusion : public PotionEffect
-{
-private:
- PotionConfusion() : PotionEffect(POT_CONFUSION) { }
- DISALLOW_COPY_AND_ASSIGN(PotionConfusion);
-public:
- static const PotionConfusion &instance()
- {
- static PotionConfusion inst; return inst;
- }
- bool can_quaff() const
- {
- return !you.clarity() || you.duration[DUR_DIVINE_STAMINA] > 0;
- }
-
- bool effect(int pow=40) const
- {
- return confuse_player(3+random2(pow));
- }
-
- bool quaff(bool was_known) const
- {
- if(was_known && !can_quaff())
- {
- mpr("You cannot confuse yourself now.");
- return false;
- }
-
- if(effect())
- xom_is_stimulated(100 / _xom_factor(was_known));
-
- return true;
- }
-};
-
class PotionStale : public PotionEffect
{
private:
@@ -1100,7 +1065,7 @@ static const PotionEffect* potion_effects[] =
&PotionPoison::instance(),
&PotionSlowing::instance(),
&PotionCancellation::instance(),
- &PotionConfusion::instance(),
+ &PotionAmbrosia::instance(),
&PotionInvisibility::instance(),
#if TAG_MAJOR_VERSION == 34
&PotionPorridge::instance(),
@@ -1126,7 +1091,6 @@ static const PotionEffect* potion_effects[] =
#endif
&PotionLignify::instance(),
&PotionBeneficialMutation::instance(),
- &PotionAmbrosia::instance(),
&PotionStale::instance()
};
diff --git a/crawl-ref/source/rltiles/dc-item.txt b/crawl-ref/source/rltiles/dc-item.txt
index 9035bec..8c80d54 100644
--- a/crawl-ref/source/rltiles/dc-item.txt
+++ b/crawl-ref/source/rltiles/dc-item.txt
@@ -834,7 +834,7 @@ i-flight POT_FLIGHT
i-poison POT_POISON
i-slowing POT_SLOWING
i-cancel POT_CANCELLATION
-i-confusion POT_CONFUSION
+i-ambrosia POT_AMBROSIA
i-invisibility POT_INVISIBILITY
i-porridge POT_PORRIDGE
i-degeneration POT_DEGENERATION
@@ -853,8 +853,7 @@ i-resistance POT_RESISTANCE
i-blood POT_BLOOD
i-coagulated-blood POT_BLOOD_COAGULATED
i-lignify POT_LIGNIFY
-i-good-mutation POT_BENEFICIAL_MUTATION
-i-ambrosia POT_AMBROSIA POT_ID_LAST
+i-good-mutation POT_BENEFICIAL_MUTATION POT_ID_LAST
%back none
%rim 1
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 89a99d9..3cb56fe 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1561,7 +1561,6 @@ unsigned int item_value(item_def item, bool ident)
case POT_PORRIDGE:
#endif
case POT_BLOOD:
- case POT_CONFUSION:
case POT_POISON:
case POT_SLOWING:
valued += 10;
@@ -1916,7 +1915,6 @@ bool is_worthless_consumable(const item_def &item)
#if TAG_MAJOR_VERSION == 34
case POT_BLOOD_COAGULATED:
#endif
- case POT_CONFUSION:
case POT_DECAY:
case POT_DEGENERATION:
case POT_POISON:
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index b4c2ae3..bd2d1d2 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -3781,7 +3781,7 @@ void unmarshallItem(reader &th, item_def &item)
}
if (item.base_type == OBJ_POTIONS && item.sub_type == POT_WATER)
- item.sub_type = POT_CONFUSION;
+ item.sub_type = POT_POISON;
if (item.base_type == OBJ_STAVES && item.sub_type == STAFF_CHANNELING)
item.sub_type = STAFF_ENERGY;
--
1.9.3 (Apple Git-50)
From 7ca698b308b26651a2be137d3a9fba07f4b8081d Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Fri, 28 Nov 2014 17:40:33 -0600
Subject: [PATCH 5/5] Replace confusion with ambrosia in vaults. This is in a
separate commit for possible balance and flavor reasons.
---
crawl-ref/source/dat/des/branches/orc.des | 6 +++---
crawl-ref/source/dat/des/branches/snake.des | 2 +-
crawl-ref/source/dat/des/branches/swamp.des | 2 +-
crawl-ref/source/dat/des/branches/vaults_rooms_standard.des | 2 +-
crawl-ref/source/dat/des/builder/food.des | 2 +-
crawl-ref/source/dat/des/portals/bailey.des | 2 +-
crawl-ref/source/dat/des/portals/ossuary.des | 4 ++--
crawl-ref/source/dat/des/portals/sewer.des | 2 +-
crawl-ref/source/dat/des/serial/magic_research.des | 2 +-
crawl-ref/source/dat/des/variable/grated_community.des | 2 +-
crawl-ref/source/dat/des/variable/lemuel_castle.des | 2 +-
11 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/crawl-ref/source/dat/des/branches/orc.des b/crawl-ref/source/dat/des/branches/orc.des
index d0b552c..5a7522a 100644
--- a/crawl-ref/source/dat/des/branches/orc.des
+++ b/crawl-ref/source/dat/des/branches/orc.des
@@ -189,11 +189,11 @@ ORIENT: float
MONS: orc, orc priest / orc wizard
MONS: w:50 orc warrior / ogre, swamp drake
# The drake's name is Bobby. Since you did ask.
-KITEM: 1 = beef jerky / nothing / animal skin / potion of confusion /\
+KITEM: 1 = beef jerky / nothing / animal skin / potion of ambrosia /\
potion of degeneration / w:2 potion of haste / w:2 potion of might
KFEAT: 1 = 1
-ITEM: club, potion of confusion, slice of pizza, beef jerky / weight:40 nothing
-ITEM: potion of confusion
+ITEM: club, potion of ambrosia, slice of pizza, beef jerky / weight:40 nothing
+ITEM: potion of ambrosia
SHUFFLE: defO
KFEAT: O = enter_orcish_mines
MAP
diff --git a/crawl-ref/source/dat/des/branches/snake.des b/crawl-ref/source/dat/des/branches/snake.des
index c8a299d..b0ad314 100644
--- a/crawl-ref/source/dat/des/branches/snake.des
+++ b/crawl-ref/source/dat/des/branches/snake.des
@@ -198,7 +198,7 @@ KMONS: 123 = water moccasin / black mamba / nothing
KMONS: 4 = guardian serpent
KMONS: 5 = naga mage / nothing
KITEM: 1235 = potion of poison w:20 / \
- potion of confusion / nothing w:20
+ potion of ambrosia / nothing w:20
KITEM: 4 = any weapon good_item ego:venom q:1 / \
any weapon good_item ego:venom q:2
KFEAT: 1234 = shallow_water
diff --git a/crawl-ref/source/dat/des/branches/swamp.des b/crawl-ref/source/dat/des/branches/swamp.des
index b6d48af..08adfc8 100644
--- a/crawl-ref/source/dat/des/branches/swamp.des
+++ b/crawl-ref/source/dat/des/branches/swamp.des
@@ -1218,7 +1218,7 @@ MONS: hydra
NSUBST: : = 5:W / *:.
SUBST: w = w:10 t:10
KFEAT: K = shallow_water
-KITEM: K = potion of confusion / potion of degeneration / \
+KITEM: K = potion of ambrosia / potion of degeneration / \
potion of decay / potion of mutation
KPROP: w = no_rtele_into
MARKER: K = lua:fog_machine { cloud_type="black smoke", \
diff --git a/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des b/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des
index 9497e58..0b626d8 100644
--- a/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des
+++ b/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des
@@ -249,7 +249,7 @@ MONS: deep elf fighter / w:5 deep elf knight / w:3 deep elf mage /\
MONS: Ijyb / Blork the orc / Urug / Erolcha / Snorg / Terence / Jessica /\
Sigmund / Psyche / Erica / Agnes / Maud / Louise / Rupert /\
Wiglaf / Norris / goblin
-KITEM: ! = any potion / potion of confusion, \
+KITEM: ! = any potion / potion of ambrosia, \
any potion / potion of poison, any potion
KITEM: $ = q:132 gold / q:66 gold / q:33 gold
MAP
diff --git a/crawl-ref/source/dat/des/builder/food.des b/crawl-ref/source/dat/des/builder/food.des
index 916a23a..08db2f5 100644
--- a/crawl-ref/source/dat/des/builder/food.des
+++ b/crawl-ref/source/dat/des/builder/food.des
@@ -126,7 +126,7 @@ TAGS: uniq_second_food extra chance_second_food
SUBVAULT: X : fruiting_plant
SUBVAULT: W : fruiting_plant
KITEM: p = potion of restore abilities w:2 / potion of poison w:3 / \
- potion of confusion w:1 / nothing
+ potion of ambrosia w:1 / nothing
MONS: big kobold ; wand of magic darts ident:type . short sword
MAP
XXXXX..WWWWW
diff --git a/crawl-ref/source/dat/des/portals/bailey.des b/crawl-ref/source/dat/des/portals/bailey.des
index 2f813ce..bd78bd6 100644
--- a/crawl-ref/source/dat/des/portals/bailey.des
+++ b/crawl-ref/source/dat/des/portals/bailey.des
@@ -277,7 +277,7 @@ MONS: gnoll ; spear / goblin ; spear
: end
SUBST: . = ...;!
COLOUR: ; = red
-KITEM: ! = potion of confusion q:2 ident:type
+KITEM: ! = potion of ambrosia q:2 ident:type
KFEAT: ! = floor
SUBST: ; = .
MAP
diff --git a/crawl-ref/source/dat/des/portals/ossuary.des b/crawl-ref/source/dat/des/portals/ossuary.des
index 5a22ce3..b4e744d 100644
--- a/crawl-ref/source/dat/des/portals/ossuary.des
+++ b/crawl-ref/source/dat/des/portals/ossuary.des
@@ -487,14 +487,14 @@ MONS: gnoll zombie / hobgoblin zombie / orc zombie / \
# mix of good items with useless ones
ITEM: scroll of random uselessness w:20 / scroll of immolation / \
scroll of identify / scroll of remove curse / \
- potion of mutation w:5 / potion of confusion w:5 / \
+ potion of mutation w:5 / potion of ambrosia w:5 / \
potion of degeneration / potion of lignification / \
potion of restore abilities / potion of curing w:15
# and sometimes mostly useless ones
ITEM: scroll of noise / scroll of random uselessness w:20 / \
scroll of immolation / potion of mutation w:5 / \
potion of poison / potion of degeneration / \
- potion of confusion w:20
+ potion of ambrosia w:20
# occasionally just use this
ITEM: any potion / any scroll w:5 / nothing
SHUFFLE: hjkl
diff --git a/crawl-ref/source/dat/des/portals/sewer.des b/crawl-ref/source/dat/des/portals/sewer.des
index 3e111f6..aae6150 100644
--- a/crawl-ref/source/dat/des/portals/sewer.des
+++ b/crawl-ref/source/dat/des/portals/sewer.des
@@ -862,7 +862,7 @@ ITEM: scroll of identify / scroll of recharging / \
buckler / nothing
KITEM: ' = scroll of random uselessness w:30 / \
scroll of identify / scroll of teleportation / \
- potion of confusion w:50 / potion of poison w:50 / \
+ potion of ambrosia w:50 / potion of poison w:50 / \
potion of mutation / potion of flight / \
hat / buckler / pair of gloves w:5 / pair of boots w:5
MAP
diff --git a/crawl-ref/source/dat/des/serial/magic_research.des b/crawl-ref/source/dat/des/serial/magic_research.des
index 65fd03e..dc2d2d5 100644
--- a/crawl-ref/source/dat/des/serial/magic_research.des
+++ b/crawl-ref/source/dat/des/serial/magic_research.des
@@ -139,7 +139,7 @@ MONS: sea snake / redback, red wasp / yellow wasp
MONS: mana viper / tarantella
KMONS: D = death drake
KITEM: E = potion of poison ident:type / \
- potion of confusion ident:type / \
+ potion of ambrosia ident:type / \
potion of decay ident:type
COLOUR: .012345DE = lightgreen
FTILE: .+n012345DE = floor_moss
diff --git a/crawl-ref/source/dat/des/variable/grated_community.des b/crawl-ref/source/dat/des/variable/grated_community.des
index 569e3e1..c744947 100644
--- a/crawl-ref/source/dat/des/variable/grated_community.des
+++ b/crawl-ref/source/dat/des/variable/grated_community.des
@@ -64,7 +64,7 @@ KFEAT: A = general shop type:Slaves suffix:and_Accessories count:10 ; \
KFEAT: B = food shop name:Jack type:Jerk-a-riffic suffix:Jerky count:10 ; \
q:5 beef jerky
KFEAT: C = distillery shop type:Miraculous suffix:Elixirs count:10 \
- greed:50 ; potion of confusion
+ greed:50 ; potion of ambrosia
: local smithy = string.gsub(crawl.make_name(), " ", "_")
: kfeat("D = armour shop name:The_Legendary_" .. smithy .. " \
: type:Legendary suffix:Smithy count:10 greed:40 ;\
diff --git a/crawl-ref/source/dat/des/variable/lemuel_castle.des b/crawl-ref/source/dat/des/variable/lemuel_castle.des
index 3065b3f..3fbef0a 100644
--- a/crawl-ref/source/dat/des/variable/lemuel_castle.des
+++ b/crawl-ref/source/dat/des/variable/lemuel_castle.des
@@ -144,7 +144,7 @@ NAME: lemuel_castle_interior_carwin_2
TAGS: lemuel_castle_interior
: castle_lemuel_subvault_setup(_G)
SUBST: $ = $:5 .
-ITEM: w:5 meat ration / beef jerky / potion of confusion ident:type
+ITEM: w:5 meat ration / beef jerky / potion of ambrosia ident:type
MAP
+c....+.......1.............$*c+
...1..cccccccccccccccccccccccXc.
--
1.9.3 (Apple Git-50)
02-ambrosia.patch [^] (74,358 bytes) 2014-11-30 18:13 [Show Content] [Hide Content]From 484082348463c0c8de5f5423e5990e877171c7de Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Fri, 28 Nov 2014 16:36:27 -0600
Subject: [PATCH 1/3] refactor potion.cc to be a map from potion enum to potion
effects
Adjust other files acordingly; banish many inappropriate uses of potion_effect
when not actually drinking potions.
---
crawl-ref/source/ability.cc | 2 +-
crawl-ref/source/beam.cc | 24 +-
crawl-ref/source/decks.cc | 2 +-
crawl-ref/source/godabil.cc | 3 +-
crawl-ref/source/godwrath.cc | 2 +-
crawl-ref/source/item_use.cc | 2 +-
crawl-ref/source/ouch.cc | 4 +-
crawl-ref/source/player.cc | 4 +-
crawl-ref/source/player.h | 1 +
crawl-ref/source/potion.cc | 1119 +++++++++++++++++++++++++++++++++---------
crawl-ref/source/potion.h | 33 +-
crawl-ref/source/xom.cc | 22 +-
12 files changed, 937 insertions(+), 281 deletions(-)
diff --git a/crawl-ref/source/ability.cc b/crawl-ref/source/ability.cc
index 38b7cb4..6b9f6e2 100644
--- a/crawl-ref/source/ability.cc
+++ b/crawl-ref/source/ability.cc
@@ -2364,7 +2364,7 @@ static spret_type _do_ability(const ability_def& abil, bool fail)
case ABIL_EVOKE_TURN_INVISIBLE: // ring, cloaks, randarts
fail_check();
- potion_effect(POT_INVISIBILITY, you.skill(SK_EVOCATIONS, 2) + 5);
+ get_potion_effect(POT_INVISIBILITY)->effect(you.skill(SK_EVOCATIONS, 2) + 5);
contaminate_player(1000 + random2(2000), true);
break;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index af09cf4..ef538c8 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3467,12 +3467,13 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_SLOW:
- potion_effect(POT_SLOWING, ench_power, nullptr, blame_player);
+ slow_player(10+random2(ench_power));
obvious_effect = true;
break;
case BEAM_HASTE:
- potion_effect(POT_HASTE, ench_power, nullptr, blame_player);
+ haste_player(40+random2(ench_power));
+ did_god_conduct(DID_HASTY, 10, blame_player);
contaminate_player(1000, blame_player);
obvious_effect = true;
nasty = false;
@@ -3480,14 +3481,14 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_HEALING:
- potion_effect(POT_HEAL_WOUNDS, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_HEAL_WOUNDS)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
break;
case BEAM_MIGHT:
- potion_effect(POT_MIGHT, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_MIGHT)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
@@ -3495,7 +3496,7 @@ void bolt::affect_player_enchantment(bool resistible)
case BEAM_INVISIBILITY:
you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
- potion_effect(POT_INVISIBILITY, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_INVISIBILITY)->effect(ench_power);
contaminate_player(1000 + random2(1000), blame_player);
obvious_effect = true;
nasty = false;
@@ -3513,7 +3514,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_CONFUSION:
- potion_effect(POT_CONFUSION, ench_power, nullptr, blame_player);
+ confuse_player(3+random2(ench_power));
obvious_effect = true;
break;
@@ -3540,7 +3541,7 @@ void bolt::affect_player_enchantment(bool resistible)
case BEAM_ENSLAVE:
mprf(MSGCH_WARN, "Your will is overpowered!");
- potion_effect(POT_CONFUSION, ench_power, nullptr, blame_player);
+ confuse_player(3+random2(ench_power));
obvious_effect = true;
break; // enslavement - confusion?
@@ -3642,7 +3643,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_BERSERK:
- potion_effect(POT_BERSERK_RAGE, ench_power, nullptr, blame_player);
+ you.go_berserk(true,true);
obvious_effect = true;
break;
@@ -3705,7 +3706,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_AGILITY:
- potion_effect(POT_AGILITY, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_AGILITY)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
@@ -3755,7 +3756,7 @@ void bolt::affect_player_enchantment(bool resistible)
break;
case BEAM_RESISTANCE:
- potion_effect(POT_RESISTANCE, ench_power, nullptr, blame_player);
+ get_potion_effect(POT_RESISTANCE)->effect(ench_power);
obvious_effect = true;
nasty = false;
nice = true;
@@ -3936,8 +3937,7 @@ void bolt::affect_player()
&& you.holiness() != MH_UNDEAD
&& !you.is_unbreathing())
{
- potion_effect(POT_CONFUSION, 1, nullptr,
- god_cares() && YOU_KILL(thrower));
+ confuse_player(3+random2(1));
}
// handling of missiles
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 1c5a2a0..871b101 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2052,7 +2052,7 @@ static void _potion_card(int power, deck_rarity_type rarity)
return;
}
- potion_effect(pot, random2(power/4));
+ potion_effect(pot,nullptr,true);
for (radius_iterator ri(you.pos(), LOS_NO_TRANS); ri; ++ri)
{
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 756a213..f922ccb 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -3993,8 +3993,7 @@ bool gozag_potion_petition()
you.attribute[ATTR_GOZAG_GOLD_USED] += faith_price;
for (int j = 0; j < pots[keyin]->size(); j++)
{
- potion_effect(static_cast<potion_type>((*pots[keyin])[j].get_int()),
- 40);
+ potion_effect(static_cast<potion_type>((*pots[keyin])[j].get_int()),nullptr);
}
you.attribute[ATTR_GOZAG_POTIONS]++;
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index 8b3498a..54c35d1 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -846,7 +846,7 @@ static bool _trog_retribution()
switch (random2(6))
{
case 0:
- potion_effect(POT_DECAY, 100);
+ get_potion_effect(POT_DECAY)->effect(100);
break;
case 1:
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index ded0576..1a6260a 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2115,7 +2115,7 @@ void drink(int slot)
}
if (!potion_effect(static_cast<potion_type>(potion.sub_type),
- 40, &potion, alreadyknown))
+ &potion, alreadyknown))
{
return;
}
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index d6b41db..253a277 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -692,11 +692,11 @@ static void _powered_by_pain(int dam)
}
case 2:
mpr("You focus on the pain.");
- potion_effect(POT_MIGHT, level * 20);
+ get_potion_effect(POT_MIGHT)->effect(level * 20);
break;
case 3:
mpr("You focus on the pain.");
- potion_effect(POT_AGILITY, level * 20);
+ get_potion_effect(POT_AGILITY)->effect(level * 20);
break;
}
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 30660b2..e5d9852 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4815,7 +4815,7 @@ bool curare_hits_player(int death_source, int levels, string name,
}
}
- potion_effect(POT_SLOWING, levels + random2(3*levels));
+ slow_player(10+random2(levels + random2(3*levels)));
return hurted > 0;
}
@@ -5113,7 +5113,7 @@ bool miasma_player(actor *who, string source_aux)
if (one_chance_in(3))
{
- potion_effect(POT_SLOWING, 5);
+ slow_player(10+random2(5));
success = true;
}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 8532681..ac3e60e 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -1044,6 +1044,7 @@ bool miasma_player(actor *who, string source_aux = "");
bool napalm_player(int amount, string source, string source_aux = "");
void dec_napalm_player(int delay);
+bool spell_slow_player(int pow);
bool slow_player(int turns);
void dec_slow_player(int delay);
void dec_exhaust_player(int delay);
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index 215ec73..c50e128 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -25,58 +25,58 @@
#include "transform.h"
#include "xom.h"
-/**
- * Apply the effect of a potion to the player.
- *
- * This is called when the player quaffs a potion, but also for some cards,
- * beams, god effects and miscasts.
- *
- * @param pot_eff The potion type.
- * @param pow The power of the effect. 40 for actual potions.
- * @param was_known Whether the potion was already identified.
- *
- * @return If the potion was used.
- */
-bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_known)
-{
- pow = min(pow, 150);
+int _xom_factor(bool was_known);
- // Reduced effect for healing potions.
- int mut_factor = 3 - you.mutation[MUT_NO_DEVICE_HEAL];
+PotionEffect::PotionEffect(const potion_type pot)
+ : potion_name(potion_type_name(pot)), kind(pot)
+{ }
- // Knowingly drinking bad potions is much less amusing.
- int xom_factor = 1;
- if (potion && was_known)
+bool PotionEffect::can_quaff() const
+{
+ return true;
+}
+
+bool PotionEffect::quaff(bool was_known) const
+{
+ if(was_known && !can_quaff())
{
- xom_factor *= 2;
- if (!player_in_a_dangerous_place())
- xom_factor *= 3;
+ mpr("You shouldn't drink that now.");
+ return false;
}
+ effect(40);
+ return true;
+}
- switch (pot_eff)
+class PotionCuring : public PotionEffect
+{
+private:
+ PotionCuring() : PotionEffect(POT_CURING) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionCuring);
+public:
+ static const PotionCuring &instance()
{
- case POT_CURING:
+ static PotionCuring inst; return inst;
+ }
+
+ bool can_quaff() const
{
const bool ddoor = you.duration[DUR_DEATHS_DOOR];
- if ((!you.can_device_heal() || ddoor)
- && potion && was_known
- && you.duration[DUR_CONF] == 0
- && you.duration[DUR_POISONING] == 0
- && you.rotting == 0
- && you.disease == 0
- // The potion won't heal us, so don't count rot unless at max HP.
- && (!player_rotted() || you.hp != you.hp_max))
- {
- mprf("You have no ailments to cure%s.",
- ddoor && you.can_device_heal()
- ? ", and can't heal while in Death's door"
- : "");
- return false;
- }
+ return (you.can_device_heal() && !ddoor)
+ || you.duration[DUR_CONF] != 0
+ || you.duration[DUR_POISONING] != 0
+ || you.rotting != 0
+ || you.disease != 0
+ || (player_rotted() && you.hp != you.hp_max);
+ }
+
+ bool effect(int pow=40) const
+ {
+ const bool ddoor = you.duration[DUR_DEATHS_DOOR];
if (you.can_device_heal() && !ddoor)
- inc_hp((5 + random2(7)) * mut_factor / 3);
+ inc_hp((5 + random2(7))
+ * (3 - you.mutation[MUT_NO_DEVICE_HEAL]) / 3);
mprf("You feel %s.", ddoor ? "queasy" : "better");
@@ -95,64 +95,108 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
you.rotting = 0;
you.disease = 0;
you.duration[DUR_CONF] = 0;
- break;
+
+ return true;
+ }
+
+ bool quaff(bool was_known) const
+ {
+ const bool ddoor = you.duration[DUR_DEATHS_DOOR];
+ if (was_known && !can_quaff())
+ {
+ mprf("You have no ailments to cure%s.",
+ ddoor && you.can_device_heal()
+ ? ", and can't heal while in Death's door"
+ : "");
+ return false;
+ }
+
+ effect();
+ return true;
+ }
+};
+
+class PotionHealWounds : public PotionEffect
+{
+private:
+ PotionHealWounds() : PotionEffect(POT_HEAL_WOUNDS) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionHealWounds);
+public:
+ static const PotionHealWounds &instance()
+ {
+ static PotionHealWounds inst; return inst;
+ }
+
+ bool can_quaff() const
+ {
+ const bool ddoor = you.duration[DUR_DEATHS_DOOR];
+
+ return !ddoor || you.can_device_heal();
+ }
+
+ bool effect(int pow=40) const
+ {
+ if (!can_quaff())
+ return false;
+
+ inc_hp((10 + random2avg(28, 3))
+ * (3 - you.mutation[MUT_NO_DEVICE_HEAL] ) / 3);
+ mpr("You feel much better.");
+
+ // only fix rot when healed to full
+ if (you.hp == you.hp_max)
+ {
+ unrot_hp(2 + random2avg(5, 2));
+ set_hp(you.hp_max);
+ }
+ return true;
}
- case POT_HEAL_WOUNDS:
+ bool quaff(bool was_known) const
+ {
if (you.duration[DUR_DEATHS_DOOR])
{
- if (potion && was_known)
+ if(was_known)
{
- mpr("You can't heal while in Death's door!");
+ mpr("You cannot heal while in Death's door!");
return false;
}
mpr("You feel queasy.");
- break;
+ return true;
}
-
- if (!you.can_device_heal())
+ else if (!you.can_device_heal())
{
- if (potion && was_known)
+ if(was_known)
{
mpr("That would not heal you.");
return false;
}
mpr("That seemed strangely inert.");
- break;
+ return true;
}
- inc_hp((10 + random2avg(28, 3)) * mut_factor / 3);
- mpr("You feel much better.");
+ effect();
+ return true;
+ }
+};
- // only fix rot when healed to full
- if (you.hp == you.hp_max)
- {
- unrot_hp(2 + random2avg(5, 2));
- set_hp(you.hp_max);
- }
- break;
+class PotionBlood : public PotionEffect
+{
+private:
+ PotionBlood() : PotionEffect(POT_BLOOD) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBlood);
+public:
+ static const PotionBlood &instance()
+ {
+ static PotionBlood inst; return inst;
+ }
- case POT_BLOOD:
-#if TAG_MAJOR_VERSION == 34
- case POT_BLOOD_COAGULATED:
-#endif
+ bool effect(int pow=40) const
+ {
if (you.species == SP_VAMPIRE)
{
- // No healing anymore! (jpeg)
- int value = 840;
-#if TAG_MAJOR_VERSION == 34
- if (pot_eff == POT_BLOOD)
- {
-#endif
- mpr("Yummy - fresh blood!");
- value += 200;
-#if TAG_MAJOR_VERSION == 34
- }
- else // Coagulated.
- mpr("This tastes delicious!");
-#endif
-
- lessen_hunger(value, true);
+ mpr("Yummy - fresh blood!");
+ lessen_hunger(pow, true);
}
else
{
@@ -163,21 +207,64 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
mpr("Yuck - this tastes like blood.");
// no actual effect, just 'flavour' ha ha ha
}
+ return true;
+ }
+
+ bool quaff(bool was_known) const
+ {
+ effect(1040);
did_god_conduct(DID_DRINK_BLOOD, 1 + random2(3), was_known);
- break;
+ return true;
+ }
+};
+
+
+class PotionHaste : public PotionEffect
+{
+private:
+ PotionHaste() : PotionEffect(POT_HASTE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionHaste);
+public:
+ static const PotionHaste &instance()
+ {
+ static PotionHaste inst; return inst;
+ }
- case POT_HASTE:
- if (potion && was_known && you.stasis(false))
+ bool can_quaff() const
+ {
+ return !you.stasis(false);
+ }
+
+ bool effect(int pow=40) const
+ {
+ return haste_player(40 + random2(pow));
+ }
+
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- mpr("This potion can't work under stasis.");
+ mpr("This potion cannot work under stasis.");
return false;
}
- if (haste_player(40 + random2(pow)))
+ if(effect())
did_god_conduct(DID_HASTY, 10, was_known);
- break;
+ return true;
+ }
+};
- case POT_MIGHT:
+class PotionMight : public PotionEffect
+{
+private:
+ PotionMight() : PotionEffect(POT_MIGHT) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionMight);
+public:
+ static const PotionMight &instance()
+ {
+ static PotionMight inst; return inst;
+ }
+ bool effect(int pow=40) const
{
const bool were_mighty = you.duration[DUR_MIGHT] > 0;
@@ -188,10 +275,21 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
if (!were_mighty)
notify_stat_change(STAT_STR, 5, true);
- break;
+ return true;
}
+};
- case POT_BRILLIANCE:
+class PotionBrilliance : public PotionEffect
+{
+private:
+ PotionBrilliance() : PotionEffect(POT_BRILLIANCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBrilliance);
+public:
+ static const PotionBrilliance &instance()
+ {
+ static PotionBrilliance inst; return inst;
+ }
+ bool effect(int pow=40) const
{
const bool were_brilliant = you.duration[DUR_BRILLIANCE] > 0;
@@ -202,10 +300,22 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
if (!were_brilliant)
notify_stat_change(STAT_INT, 5, true);
- break;
+
+ return true;
}
+};
- case POT_AGILITY:
+class PotionAgility : public PotionEffect
+{
+private:
+ PotionAgility() : PotionEffect(POT_AGILITY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionAgility);
+public:
+ static const PotionAgility &instance()
+ {
+ static PotionAgility inst; return inst;
+ }
+ bool effect(int pow=40) const
{
const bool were_agile = you.duration[DUR_AGILITY] > 0;
@@ -216,84 +326,150 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
if (!were_agile)
notify_stat_change(STAT_DEX, 5, true);
- break;
+ return true;
}
+};
-#if TAG_MAJOR_VERSION == 34
- case POT_GAIN_STRENGTH:
- if (mutate(MUT_STRONG, "potion of gain strength", true, false, false, true))
- learned_something_new(HINT_YOU_MUTATED);
- break;
- case POT_GAIN_DEXTERITY:
- if (mutate(MUT_AGILE, "potion of gain dexterity", true, false, false, true))
- learned_something_new(HINT_YOU_MUTATED);
- break;
+class PotionFlight : public PotionEffect
+{
+private:
+ PotionFlight() : PotionEffect(POT_FLIGHT) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionFlight);
+public:
+ static const PotionFlight &instance()
+ {
+ static PotionFlight inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return flight_allowed();
+ }
- case POT_GAIN_INTELLIGENCE:
- if (mutate(MUT_CLEVER, "potion of gain intelligence", true, false, false, true))
- learned_something_new(HINT_YOU_MUTATED);
- break;
-#endif
+ bool effect(int pow=40) const
+ {
+ you.attribute[ATTR_FLIGHT_UNCANCELLABLE] = 1;
+ fly_player(pow);
+ return you.airborne();
+ }
- case POT_FLIGHT:
- if (!flight_allowed())
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- if (potion && was_known)
- return false;
- break;
+ mpr("You cannot fly right now.");
+ return false;
}
- you.attribute[ATTR_FLIGHT_UNCANCELLABLE] = 1;
- fly_player(pow);
- break;
+ effect();
+ return true;
+ }
+};
- case POT_POISON:
-#if TAG_MAJOR_VERSION == 34
- case POT_STRONG_POISON:
-#endif
- if (player_res_poison() >= 1)
- mpr("You feel slightly nauseous.");
- else
- {
- mprf(MSGCH_WARN,
- "That liquid tasted very nasty...");
+class PotionPoison : public PotionEffect
+{
+private:
+ PotionPoison() : PotionEffect(POT_POISON) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionPoison);
+public:
+ static const PotionPoison &instance()
+ {
+ static PotionPoison inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ //Poison resistance is enough to not get poisoned by
+ // ingestion
+ return player_res_poison() >= 1;
+ }
- int amount = 10 + random2avg(15, 2);
- string msg = "a potion of poison";
+ bool effect(int pow=40) const
+ {
+ mprf(MSGCH_WARN,
+ "That liquid tasted very nasty...");
- poison_player(amount, "", msg);
- xom_is_stimulated(100 / xom_factor);
- }
- break;
+ int amount = 10 + random2avg(15, 2);
+ string msg = "a potion of poison";
- // Potions of slowing no longer exist, but tons of other effects use
- // potion_effect(POT_SLOWING) so this code stays in.
- case POT_SLOWING:
- if (slow_player(10 + random2(pow)))
- xom_is_stimulated(50 / xom_factor);
- break;
+ return poison_player(amount, "", msg);
+ }
+
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ xom_is_stimulated(100 / _xom_factor(was_known));
+ return true;
+ }
+};
- case POT_CANCELLATION:
+class PotionCancellation : public PotionEffect
+{
+private:
+ PotionCancellation() : PotionEffect(POT_CANCELLATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionCancellation);
+public:
+ static const PotionCancellation &instance()
+ {
+ static PotionCancellation inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
debuff_player();
mpr("You feel magically purged.");
- break;
+ return true;
+ }
+};
+
+class PotionConfusion : public PotionEffect
+{
+private:
+ PotionConfusion() : PotionEffect(POT_CONFUSION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionConfusion);
+public:
+ static const PotionConfusion &instance()
+ {
+ static PotionConfusion inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return !you.clarity() || you.duration[DUR_DIVINE_STAMINA] > 0;
+ }
- case POT_CONFUSION:
- if (confuse_player(3 + random2(8)))
- xom_is_stimulated(100 / xom_factor);
- break;
+ bool effect(int pow=40) const
+ {
+ return confuse_player(3+random2(pow));
+ }
- case POT_INVISIBILITY:
- if (you.backlit() || you.haloed())
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- // XXX: merge with item_use.cc:_dont_use_invis()
- if (potion && was_known && get_contamination_level() > 1)
- {
- mpr("You cannot become invisible while glowing.");
- return false;
- }
+ mpr("You cannot confuse yourself now.");
+ return false;
+ }
+
+ if(effect())
+ xom_is_stimulated(100 / _xom_factor(was_known));
+
+ return true;
+ }
+};
+
+class PotionInvisibility : public PotionEffect
+{
+private:
+ PotionInvisibility() : PotionEffect(POT_INVISIBILITY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionInvisibility);
+public:
+ static const PotionInvisibility &instance()
+ {
+ static PotionInvisibility inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ if (you.backlit() || you.haloed())
+ {
vector<const char *> afflictions;
if (you.haloed())
afflictions.push_back("halo");
@@ -326,54 +502,35 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
you.set_duration(DUR_INVIS, 15 + random2(pow), 100);
else
you.increase_duration(DUR_INVIS, random2(pow), 100);
+ return true;
+ }
- if (potion)
- you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
-
- break;
-
-#if TAG_MAJOR_VERSION == 34
- case POT_PORRIDGE:
- if (you.species == SP_VAMPIRE
- || player_mutation_level(MUT_CARNIVOROUS) == 3)
- {
- mpr("Blech - that potion was really gluggy!");
- }
- else
- {
- mpr("That potion was really gluggy!");
- lessen_hunger(6000, true);
- }
- break;
-#endif
-
- case POT_DEGENERATION:
- if (potion)
- mpr("There was something very wrong with that liquid!");
-
- if (lose_stat(STAT_RANDOM, 1 + random2avg(4, 2), false,
- "drinking a potion of degeneration"))
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- xom_is_stimulated(50 / xom_factor);
+ mpr("You cannot turn invisible while glowing.");
+ return false;
}
- break;
- case POT_DECAY:
- if (you.rot(&you, 0, 3 + random2(3)))
- xom_is_stimulated(50 / xom_factor);
- break;
-
-#if TAG_MAJOR_VERSION == 34
- case POT_WATER:
-#endif
- case NUM_POTIONS:
- if (you.species == SP_VAMPIRE)
- mpr("Blech - this tastes like water.");
- else
- mpr("This tastes like water.");
- break;
+ effect();
+ you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
+ return true;
+ }
+};
- case POT_EXPERIENCE:
+class PotionExperience : public PotionEffect
+{
+private:
+ PotionExperience() : PotionEffect(POT_EXPERIENCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionExperience);
+public:
+ static const PotionExperience &instance()
+ {
+ static PotionExperience inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
if (you.experience_level < 27)
{
mpr("You feel more experienced!");
@@ -387,20 +544,45 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
mpr("A flood of memories washes over you.");
more();
skill_menu(SKMF_EXPERIENCE_POTION, 750 * you.experience_level);
- break;
+ return true;
+ }
+};
- case POT_MAGIC:
+class PotionMagic : public PotionEffect
+{
+private:
+ PotionMagic() : PotionEffect(POT_MAGIC) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionMagic);
+public:
+ static const PotionMagic &instance()
+ {
+ static PotionMagic inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
// Allow repairing rot, disallow going through Death's Door.
#if TAG_MAJOR_VERSION == 34
- if (you.species == SP_DJINNI)
- return potion_effect(POT_HEAL_WOUNDS, pow, potion, was_known);
+ if (you.species == SP_DJINNI && PotionHealWounds::instance().can_quaff())
+ return PotionHealWounds::instance().effect(pow);
#endif
inc_mp(10 + random2avg(28, 3));
mpr("Magic courses through your body.");
- break;
+ return true;
+ }
+};
- case POT_RESTORE_ABILITIES:
+class PotionRestoreAbilities : public PotionEffect
+{
+private:
+ PotionRestoreAbilities() : PotionEffect(POT_RESTORE_ABILITIES) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionRestoreAbilities);
+public:
+ static const PotionRestoreAbilities &instance()
+ {
+ static PotionRestoreAbilities inst; return inst;
+ }
+ bool effect(int pow=40) const
{
bool nothing_happens = true;
if (you.duration[DUR_BREATH_WEAPON])
@@ -413,101 +595,541 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
// Give a message if no message otherwise.
if (!restore_stat(STAT_ALL, 0, false) && nothing_happens)
mpr("You feel refreshed.");
- break;
+ return nothing_happens;
}
+};
- case POT_BERSERK_RAGE:
- if (potion && was_known && !you.can_go_berserk(true, potion, false))
- return false;
-
+class PotionBerserk : public PotionEffect
+{
+private:
+ PotionBerserk() : PotionEffect(POT_BERSERK_RAGE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBerserk);
+public:
+ static const PotionBerserk &instance()
+ {
+ static PotionBerserk inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_go_berserk(true, true, false);
+ }
+ bool effect(int pow=40) const
+ {
if (you.species == SP_VAMPIRE && you.hunger_state <= HS_SATIATED)
{
mpr("You feel slightly irritated.");
make_hungry(100, false);
+ return false;
}
else
{
- if (you.go_berserk(was_known, true))
- xom_is_stimulated(50);
+ you.go_berserk(true, true);
+ return true;
}
- break;
-
- case POT_CURE_MUTATION:
- if (potion && was_known && undead_mutation_rot())
+ }
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
{
- mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
- : "You cannot mutate.");
+ mpr("You cannot go berserk now.");
return false;
}
+
+ if(effect())
+ xom_is_stimulated(50);
+
+ return true;
+ }
+};
+
+class PotionCureMutation : public PotionEffect
+{
+private:
+ PotionCureMutation() : PotionEffect(POT_CURE_MUTATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionCureMutation);
+public:
+ static const PotionCureMutation &instance()
+ {
+ static PotionCureMutation inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_safely_mutate();
+ }
+ bool effect(int pow=40) const
+ {
mpr("It has a very clean taste.");
+ bool mutated = false;
for (int i = 0; i < 7; i++)
if (random2(9) >= i)
- delete_mutation(RANDOM_MUTATION, "potion of cure mutation", false);
- break;
-
- case POT_MUTATION:
- if (potion && was_known && undead_mutation_rot())
+ mutated |= delete_mutation(RANDOM_MUTATION, "potion of cure mutation", false);
+ return mutated;
+ }
+ bool quaff(bool was_known) const
+ {
+ if (was_known && undead_mutation_rot())
{
mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
: "You cannot mutate.");
return false;
}
+ effect();
+ return true;
+ }
+};
+class PotionMutation : public PotionEffect
+{
+private:
+ PotionMutation() : PotionEffect(POT_MUTATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionMutation);
+public:
+ static const PotionMutation &instance()
+ {
+ static PotionMutation inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_safely_mutate();
+ }
+ bool effect(int pow=40) const
+ {
mpr("You feel extremely strange.");
+ bool mutated = false;
for (int i = 0; i < 3; i++)
- mutate(RANDOM_MUTATION, "potion of mutation", false);
+ mutated |= mutate(RANDOM_MUTATION, "potion of mutation", false);
learned_something_new(HINT_YOU_MUTATED);
- did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
- break;
-
- case POT_BENEFICIAL_MUTATION:
- if (undead_mutation_rot())
+ return mutated;
+ }
+ bool quaff(bool was_known) const
+ {
+ if (was_known && undead_mutation_rot())
{
- if (potion && was_known)
- {
- mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
- : "You cannot mutate.");
- return false;
- }
+ mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
+ : "You cannot mutate.");
+ return false;
+ }
+ effect();
+ // Zin conduct is violated even if you get lucky and don't mutate
+ did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
+ return true;
+ }
+};
+
+class PotionBeneficialMutation : public PotionEffect
+{
+private:
+ PotionBeneficialMutation() : PotionEffect(POT_BENEFICIAL_MUTATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBeneficialMutation);
+public:
+ static const PotionBeneficialMutation &instance()
+ {
+ static PotionBeneficialMutation inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.can_safely_mutate();
+ }
+ bool effect(int pow=40) const
+ {
+ if(undead_mutation_rot()) {
mpr("You feel dead inside.");
- mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
+ return mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
true, false, false, true);
- break;
}
- if (mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
- true, false, false, true))
- {
+ const bool mutated = mutate(RANDOM_GOOD_MUTATION, "potion of beneficial mutation",
+ true, false, false, true);
+ if (mutated)
mpr("You feel fantastic!");
- }
else
mpr("You feel fantastic for a moment.");
learned_something_new(HINT_YOU_MUTATED);
+ return mutated;
+ }
+ bool quaff(bool was_known) const
+ {
+ if (was_known && undead_mutation_rot())
+ {
+ mpr(you.form == TRAN_LICH ? "You cannot mutate at present."
+ : "You cannot mutate.");
+ return false;
+ }
+ effect();
+
+ // Zin conduct is violated even if you get lucky and don't mutate
did_god_conduct(DID_DELIBERATE_MUTATING, 10, was_known);
- break;
+ return true;
+ }
+};
- case POT_RESISTANCE:
+class PotionResistance : public PotionEffect
+{
+private:
+ PotionResistance() : PotionEffect(POT_RESISTANCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionResistance);
+public:
+ static const PotionResistance &instance()
+ {
+ static PotionResistance inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
mprf(MSGCH_DURATION, "You feel protected.");
you.increase_duration(DUR_RESISTANCE, random2(pow) + 35);
- break;
+ return true;
+ }
+};
+
+class PotionDegeneration : public PotionEffect
+{
+private:
+ PotionDegeneration() : PotionEffect(POT_DEGENERATION) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionDegeneration);
+public:
+ static const PotionDegeneration &instance()
+ {
+ static PotionDegeneration inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return lose_stat(STAT_RANDOM, 1 + random2avg(4, 2), false,
+ "drinking a potion of degeneration");
+ }
+ bool quaff(bool was_known) const
+ {
+ mpr("There was something very wrong with that liquid.");
+ if(effect())
+ xom_is_stimulated( 50 / _xom_factor(was_known));
+ return true;
+ }
+};
+
+class PotionDecay : public PotionEffect
+{
+private:
+ PotionDecay() : PotionEffect(POT_DECAY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionDecay);
+public:
+ static const PotionDecay &instance()
+ {
+ static PotionDecay inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return you.rot(&you, 0, 3 + random2(3));;
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ xom_is_stimulated( 50 / _xom_factor(was_known));
+ return true;
+ }
+};
- case POT_LIGNIFY:
- if (potion && was_known && !transform(0, TRAN_TREE, false, true))
+class PotionLignify : public PotionEffect
+{
+private:
+ PotionLignify() : PotionEffect(POT_LIGNIFY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionLignify);
+public:
+ static const PotionLignify &instance()
+ {
+ static PotionLignify inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return transform(0, TRAN_TREE, false, true);
+ }
+ bool effect(int pow=40) const
+ {
+ return transform(30, TRAN_TREE, false);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(was_known && !can_quaff())
+ {
+ mpr("You cannot become a tree right now.");
return false;
+ }
- if (transform(30, TRAN_TREE, !was_known))
+ if(effect())
{
you.transform_uncancellable = true;
did_god_conduct(DID_CHAOS, 10, was_known);
}
else
mpr("You feel woody for a moment.");
- break;
+ return true;
+ }
+};
+
+// Removed potions
+#if TAG_MAJOR_VERSION == 34
+class PotionBloodCoagulated : public PotionEffect
+{
+private:
+ PotionBloodCoagulated() : PotionEffect(POT_BLOOD_COAGULATED) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionBloodCoagulated);
+public:
+ static const PotionBloodCoagulated &instance()
+ {
+ static PotionBloodCoagulated inst; return inst;
}
- if (potion && !was_known)
+ bool effect(int pow=40) const
+ {
+ if (you.species == SP_VAMPIRE)
+ {
+ mpr("This tastes delicious.");
+ lessen_hunger(pow, true);
+ }
+ else
+ {
+ const int herbivorous = player_mutation_level(MUT_HERBIVOROUS);
+ if (herbivorous < 3 && player_likes_chunks())
+ mpr("This tastes like blood.");
+ else
+ mpr("Yuck - this tastes like blood.");
+ // no actual effect, just 'flavour' ha ha ha
+ }
+ return true;
+ }
+
+ bool quaff(bool was_known) const
+ {
+ effect(840);
+ did_god_conduct(DID_DRINK_BLOOD, 1 + random2(3), was_known);
+ return true;
+ }
+};
+
+class PotionGainStrength : public PotionEffect
+{
+private:
+ PotionGainStrength() : PotionEffect(POT_GAIN_STRENGTH) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionGainStrength);
+public:
+ static const PotionGainStrength &instance()
+ {
+ static PotionGainStrength inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return mutate(MUT_STRONG, "potion of gain strength", true, false, false, true);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ learned_something_new(HINT_YOU_MUTATED);
+ return true;
+ }
+};
+
+class PotionGainDexterity : public PotionEffect
+{
+private:
+ PotionGainDexterity() : PotionEffect(POT_GAIN_DEXTERITY) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionGainDexterity);
+public:
+ static const PotionGainDexterity &instance()
+ {
+ static PotionGainDexterity inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return mutate(MUT_STRONG, "potion of gain dexterity", true, false, false, true);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ learned_something_new(HINT_YOU_MUTATED);
+ return true;
+ }
+};
+
+class PotionGainIntelligence : public PotionEffect
+{
+private:
+ PotionGainIntelligence() : PotionEffect(POT_GAIN_INTELLIGENCE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionGainIntelligence);
+public:
+ static const PotionGainIntelligence &instance()
+ {
+ static PotionGainIntelligence inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ return mutate(MUT_STRONG, "potion of gain intelligence", true, false, false, true);
+ }
+ bool quaff(bool was_known) const
+ {
+ if(effect())
+ learned_something_new(HINT_YOU_MUTATED);
+ return true;
+ }
+};
+
+class PotionPorridge : public PotionEffect
+{
+private:
+ PotionPorridge() : PotionEffect(POT_PORRIDGE) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionPorridge);
+public:
+ static const PotionPorridge &instance()
+ {
+ static PotionPorridge inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ if (you.species == SP_VAMPIRE
+ || player_mutation_level(MUT_CARNIVOROUS) == 3)
+ {
+ mpr("Blech - that potion was really gluggy!");
+ }
+ else
+ {
+ mpr("That potion was really gluggy!");
+ lessen_hunger(6000, true);
+ }
+ return true;
+ }
+};
+
+class PotionWater : public PotionEffect
+{
+private:
+ PotionWater() : PotionEffect(POT_WATER) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionWater);
+public:
+ static const PotionWater &instance()
+ {
+ static PotionWater inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ if (you.species == SP_VAMPIRE)
+ mpr("Blech - this tastes like water.");
+ else
+ mpr("This tastes like water.");
+ return true;
+ }
+};
+#endif
+
+
+// Potion effects that do not come in potion form but are
+// still applied by other sources. XXX: this can
+// probably be refactored further.
+class PotionSlowing : public PotionEffect
+{
+private:
+ PotionSlowing() : PotionEffect(POT_SLOWING) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionSlowing);
+public:
+ static const PotionSlowing &instance()
+ {
+ static PotionSlowing inst; return inst;
+ }
+ bool can_quaff() const
+ {
+ return you.stasis(false);
+ }
+
+ bool effect(int pow=40) const
+ {
+ return slow_player(10 + random2(pow));
+ }
+};
+
+class PotionStale : public PotionEffect
+{
+private:
+ PotionStale() : PotionEffect(NUM_POTIONS) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionStale);
+public:
+ static const PotionStale &instance()
+ {
+ static PotionStale inst; return inst;
+ }
+ bool effect(int pow=40) const
+ {
+ mpr("That potion was far past its expiry date.");
+ return true;
+ }
+};
+
+static const PotionEffect* potion_effects[] =
+{
+ &PotionCuring::instance(),
+ &PotionHealWounds::instance(),
+ &PotionHaste::instance(),
+ &PotionMight::instance(),
+ &PotionBrilliance::instance(),
+ &PotionAgility::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionGainStrength::instance(),
+ &PotionGainDexterity::instance(),
+ &PotionGainIntelligence::instance(),
+#endif
+ &PotionFlight::instance(),
+ &PotionPoison::instance(),
+ &PotionSlowing::instance(),
+ &PotionCancellation::instance(),
+ &PotionConfusion::instance(),
+ &PotionInvisibility::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionPorridge::instance(),
+#endif
+ &PotionDegeneration::instance(),
+ &PotionDecay::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionWater::instance(),
+#endif
+ &PotionExperience::instance(),
+ &PotionMagic::instance(),
+ &PotionRestoreAbilities::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionPoison::instance(),
+#endif
+ &PotionBerserk::instance(),
+ &PotionCureMutation::instance(),
+ &PotionMutation::instance(),
+ &PotionResistance::instance(),
+ &PotionBlood::instance(),
+#if TAG_MAJOR_VERSION == 34
+ &PotionBloodCoagulated::instance(),
+#endif
+ &PotionLignify::instance(),
+ &PotionBeneficialMutation::instance(),
+ &PotionStale::instance()
+};
+
+const PotionEffect* get_potion_effect(potion_type pot)
+{
+ COMPILE_CHECK(ARRAYSZ(potion_effects) == NUM_POTIONS+1);
+ ASSERT_RANGE(pot, 0, NUM_POTIONS+1);
+ return potion_effects[pot];
+}
+
+/**
+ * Apply the effect of a potion to the player.
+ *
+ * This is called when the player quaffs a potion ONLY
+ * Beams, cards, miscasts, and god effects that need a potion effect should apply
+ * the effect method as appropriate, since these should not have the same Xom effects
+ * and don't deal with item identification.
+ * @param pot_eff The potion type.
+ * @param pow The power of the effect. 40 for actual potions.
+ * @param was_known Whether the potion was already identified.
+ *
+ * @return If the potion was used.
+ */
+bool potion_effect(potion_type pot_eff, item_def *potion, bool was_known)
+{
+ if (!was_known)
{
set_ident_flags(*potion, ISFLAG_IDENT_MASK);
set_ident_type(*potion, ID_KNOWN_TYPE);
@@ -515,5 +1137,18 @@ bool potion_effect(potion_type pot_eff, int pow, item_def *potion, bool was_know
identify_healing_pots();
}
- return true;
+ return get_potion_effect(pot_eff)->quaff(was_known);
+}
+
+int _xom_factor(bool was_known)
+{
+ // Knowingly drinking bad potions is much less amusing.
+ int xom_factor = 1;
+ if (was_known)
+ {
+ xom_factor *= 2;
+ if (!player_in_a_dangerous_place())
+ xom_factor *= 3;
+ }
+ return xom_factor;
}
diff --git a/crawl-ref/source/potion.h b/crawl-ref/source/potion.h
index d1f0320..add26d1 100644
--- a/crawl-ref/source/potion.h
+++ b/crawl-ref/source/potion.h
@@ -6,7 +6,36 @@
#ifndef POTION_H
#define POTION_H
-bool potion_effect(potion_type pot_eff, int pow,
- item_def *potion = nullptr, bool was_known = true);
+bool potion_effect(potion_type pot_eff,
+ item_def *potion, bool was_known = true);
+
+class PotionEffect
+{
+private:
+ PotionEffect() = delete;
+ DISALLOW_COPY_AND_ASSIGN(PotionEffect);
+protected:
+ PotionEffect(potion_type);
+public:
+ bool can_quaff() const;
+
+ // Elsewhere in the code there are things that can have the effect
+ // effect of a potion without actually being potions, there
+ // are even some legacy 'potions' around in this code that
+ // nowdays only provide the potion-like effect
+
+ // Returns whether or not the potion had an effect
+ virtual bool effect(int pow = 40) const { return false; }
+
+ // Quaff also handles god-conduct and potion-specific
+ // uncancellability
+ // Returns whether or not the potion was actually quaffed
+ bool quaff(bool was_known = true) const;
+
+ const string potion_name;
+ const potion_type kind;
+};
+
+const PotionEffect* get_potion_effect(potion_type pot);
#endif
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index e939545..57ae5fc 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1078,6 +1078,7 @@ static int _xom_do_potion(bool debug = false)
return XOM_GOOD_POTION;
potion_type pot = POT_CURING;
+ const PotionEffect * pot_eff = get_potion_effect(pot);
while (true)
{
pot = random_choose(POT_CURING, POT_HEAL_WOUNDS, POT_MAGIC, POT_HASTE,
@@ -1087,18 +1088,13 @@ static int _xom_do_potion(bool debug = false)
if (pot == POT_EXPERIENCE && !one_chance_in(6))
pot = POT_BERSERK_RAGE;
- bool has_effect = true;
- // Don't pick something that won't have an effect.
+ pot_eff = get_potion_effect(pot);
+
+ bool has_effect = pot_eff->can_quaff();
+ // Xom checks for some extra HW and Magic effects
// Extending an existing effect is okay, though.
switch (pot)
{
- case POT_CURING:
- if (you.duration[DUR_POISONING] || you.rotting || you.disease
- || you.duration[DUR_CONF])
- {
- break;
- }
- // else fall through
case POT_HEAL_WOUNDS:
if (you.hp == you.hp_max && player_rotted() == 0)
has_effect = false;
@@ -1107,10 +1103,6 @@ static int _xom_do_potion(bool debug = false)
if (you.magic_points == you.max_magic_points)
has_effect = false;
break;
- case POT_BERSERK_RAGE:
- if (!you.can_go_berserk(false))
- has_effect = false;
- break;
default:
break;
}
@@ -1128,9 +1120,9 @@ static int _xom_do_potion(bool debug = false)
_note_potion_effect(pot);
- potion_effect(pot, 150, nullptr, false);
+ pot_eff->effect(100);
- level_change(); // potion_effect() doesn't do this anymore
+ level_change(); // pot_eff->effect() for Experience doesn't do this
return XOM_GOOD_POTION;
}
--
1.9.3 (Apple Git-50)
From 8ce5b0a368a4c1f609e890e33c0845bb880b9433 Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Thu, 27 Nov 2014 22:06:56 -0600
Subject: [PATCH 2/3] Potion of Ambrosia replaces Potion of Conusion
Confuses, grants Elixir-like regen that ends at a timeout or
when not confused, whichever comes first. This patch doesn't
change the apperacne of confusion in vaults since there
might be better choices on a vault by vault basis and it might
be convenient to have those changes in a separate commit.
Conflicts:
crawl-ref/source/potion.cc
---
crawl-ref/source/dat/descript/items.txt | 6 ++++
crawl-ref/source/duration-data.h | 39 +++++++++++----------
crawl-ref/source/enum.h | 4 ++-
crawl-ref/source/itemname.cc | 3 +-
crawl-ref/source/makeitem.cc | 2 +-
crawl-ref/source/player-reacts.cc | 5 +++
crawl-ref/source/player.cc | 20 +++++++++++
crawl-ref/source/player.h | 1 +
crawl-ref/source/potion.cc | 37 +++++++------------
crawl-ref/source/rltiles/dc-item.txt | 2 +-
.../source/rltiles/item/potion/i-ambrosia.png | Bin 0 -> 1341 bytes
crawl-ref/source/shopping.cc | 3 +-
crawl-ref/source/tags.cc | 2 +-
13 files changed, 72 insertions(+), 52 deletions(-)
create mode 100644 crawl-ref/source/rltiles/item/potion/i-ambrosia.png
diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt
index 9132538..805d4f3 100644
--- a/crawl-ref/source/dat/descript/items.txt
+++ b/crawl-ref/source/dat/descript/items.txt
@@ -839,6 +839,12 @@ potion of agility
A magic potion which greatly increases the dexterity and evasiveness of one who
drinks it.
%%%%
+potion of ambrosia
+
+A strange substance, produced by ghost moths. Consuming it will cause regeneration
+of health and magic, at the expense of mental clarity. The two effects are inexorably
+linked, regeneration will end immediatly if the user regains ther senses.
+%%%%
potion of beneficial mutation
A potion which gives you a supposedly good mutation.
diff --git a/crawl-ref/source/duration-data.h b/crawl-ref/source/duration-data.h
index 8cedb16..a85bfc8 100644
--- a/crawl-ref/source/duration-data.h
+++ b/crawl-ref/source/duration-data.h
@@ -369,7 +369,9 @@ static const duration_def duration_data[] =
{ DUR_CLEAVE,
LIGHTBLUE, "Cleave",
"cleaving", "cleave",
- "You are cleaving through your foes.", D_DISPELLABLE},
+ "You are cleaving through your foes.", true },
+ { DUR_AMBROSIA, false, GREEN, "Ambros", "", "ambrosia",
+ "You are regenerating under the effects of ambrosia.", false },
// The following are visible in wizmode only, or are handled
// specially in the status lights and/or the % or @ screens.
@@ -407,23 +409,22 @@ static const duration_def duration_data[] =
#if TAG_MAJOR_VERSION == 34
// And removed ones
- { DUR_REPEL_MISSILES, 0, "", "", "old repel missiles", "", D_NO_FLAGS},
- { DUR_DEFLECT_MISSILES, 0, "", "", "old deflect missiles", "", D_NO_FLAGS},
- { DUR_JELLY_PRAYER, 0, "", "", "old jelly prayer", "", D_NO_FLAGS},
- { DUR_CONTROLLED_FLIGHT, 0, "", "", "old controlled flight", "", D_NO_FLAGS},
- { DUR_SEE_INVISIBLE, 0, "", "", "old see invisible", "", D_NO_FLAGS},
- { DUR_INSULATION, 0, "", "", "old insulation", "", D_NO_FLAGS},
- { DUR_BARGAIN, 0, "", "", "old bargain", "", D_NO_FLAGS},
- { DUR_SLAYING, 0, "", "", "old slaying", "", D_NO_FLAGS},
- { DUR_MISLED, 0, "", "", "old misled", "", D_NO_FLAGS},
- { DUR_NAUSEA, 0, "", "", "old nausea", "", D_NO_FLAGS},
- { DUR_TEMP_MUTATIONS, 0, "", "", "old temporary mutations", "", D_NO_FLAGS},
- { DUR_BATTLESPHERE, 0, "", "", "old battlesphere", "", D_NO_FLAGS},
- { DUR_RETCHING, 0, "", "", "old retching", "", D_NO_FLAGS},
- { DUR_SPIRIT_HOWL, 0, "", "", "old spirit howl", "", D_NO_FLAGS},
- { DUR_SONG_OF_SHIELDING, 0, "", "", "old song of shielding", "", D_NO_FLAGS},
- { DUR_ANTENNAE_EXTEND, 0, "", "", "old antennae extend", "", D_NO_FLAGS},
- { DUR_AMBROSIA, 0, "", "", "old ambrosia", "", D_NO_FLAGS},
- { DUR_BUILDING_RAGE, 0, "", "", "old building rage", "", D_NO_FLAGS},
+ { DUR_REPEL_MISSILES, false, 0, "", "", "old repel missiles", "", false },
+ { DUR_DEFLECT_MISSILES, false, 0, "", "", "old deflect missiles", "", false },
+ { DUR_JELLY_PRAYER, false, 0, "", "", "old jelly prayer", "", false },
+ { DUR_CONTROLLED_FLIGHT, false, 0, "", "", "old controlled flight", "", false },
+ { DUR_SEE_INVISIBLE, false, 0, "", "", "old see invisible", "", false },
+ { DUR_INSULATION, false, 0, "", "", "old insulation", "", false },
+ { DUR_BARGAIN, false, 0, "", "", "old bargain", "", false },
+ { DUR_SLAYING, false, 0, "", "", "old slaying", "", false },
+ { DUR_MISLED, false, 0, "", "", "old misled", "", false },
+ { DUR_NAUSEA, false, 0, "", "", "old nausea", "", false },
+ { DUR_TEMP_MUTATIONS, false, 0, "", "", "old temporary mutations", "", false },
+ { DUR_BATTLESPHERE, false, 0, "", "", "old battlesphere", "", false },
+ { DUR_RETCHING, false, 0, "", "", "old retching", "", false },
+ { DUR_SPIRIT_HOWL, false, 0, "", "", "old spirit howl", "", false },
+ { DUR_SONG_OF_SHIELDING, false, 0, "", "", "old song of shielding", "", false },
+ { DUR_ANTENNAE_EXTEND, false, 0, "", "", "old antennae extend", "", false },
+ { DUR_BUILDING_RAGE, false, 0, "", "", "old building rage", "", false },
#endif
};
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index e096412..3d5e7eb 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1647,7 +1647,9 @@ enum duration_type
DUR_TORNADO_COOLDOWN,
#if TAG_MAJOR_VERSION == 34
DUR_NAUSEA,
+#endif
DUR_AMBROSIA,
+#if TAG_MAJOR_VERSION == 34
DUR_TEMP_MUTATIONS,
#endif
DUR_DISJUNCTION,
@@ -3592,7 +3594,7 @@ enum potion_type
POT_POISON,
POT_SLOWING,
POT_CANCELLATION,
- POT_CONFUSION,
+ POT_AMBROSIA,
POT_INVISIBILITY,
#if TAG_MAJOR_VERSION == 34
POT_PORRIDGE,
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 366bfbd..b8f004b 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -693,7 +693,7 @@ const char* potion_type_name(int potiontype)
case POT_POISON: return "poison";
case POT_SLOWING: return "slowing";
case POT_CANCELLATION: return "cancellation";
- case POT_CONFUSION: return "confusion";
+ case POT_AMBROSIA: return "ambrosia";
case POT_INVISIBILITY: return "invisibility";
case POT_DEGENERATION: return "degeneration";
case POT_DECAY: return "decay";
@@ -3107,7 +3107,6 @@ bool is_bad_item(const item_def &item, bool temp)
case POT_SLOWING:
if (you.species == SP_FORMICID)
return false;
- case POT_CONFUSION:
case POT_DEGENERATION:
return true;
case POT_DECAY:
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index f0955f1..dc6b178 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1301,7 +1301,7 @@ static void _generate_potion_item(item_def& item, int force_type,
35, POT_MUTATION,
35, POT_LIGNIFY,
34, POT_CANCELLATION,
- 34, POT_CONFUSION,
+ 34, POT_AMBROSIA,
25, POT_DEGENERATION,
23, POT_CURE_MUTATION,
12, POT_BENEFICIAL_MUTATION,
diff --git a/crawl-ref/source/player-reacts.cc b/crawl-ref/source/player-reacts.cc
index 5f10734..4dedbcf 100644
--- a/crawl-ref/source/player-reacts.cc
+++ b/crawl-ref/source/player-reacts.cc
@@ -717,6 +717,11 @@ static void _decrement_durations()
you.attribute[ATTR_INVIS_UNCANCELLABLE] = 0;
}
+ // Decrement ambrosia before confusion, otherwise confusion ending
+ // will cancel ambrosia early. Might be a bad coupling, but ambrosia
+ // needs to use DUR_CONF otherwise it won't behave right if a player
+ // gets confused after eating ambrosia.
+ dec_ambrosia_player(delay);
_decrement_a_duration(DUR_CONF, delay, "You feel less confused.");
_decrement_a_duration(DUR_LOWERED_MR, delay, "You feel less vulnerable to hostile enchantments.");
_decrement_a_duration(DUR_SLIMIFY, delay, "You feel less slimy.",
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e5d9852..40c60df 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5368,6 +5368,26 @@ void dec_elixir_player(int delay)
_dec_elixir_mp(delay);
}
+void dec_ambrosia_player(int delay)
+{
+ if(!you.confused() && you.duration[DUR_AMBROSIA])
+ {
+ you.duration[DUR_AMBROSIA] = 0;
+ return;
+ }
+
+ you.duration[DUR_AMBROSIA] -= delay;
+ if(you.duration[DUR_AMBROSIA] < 0)
+ you.duration[DUR_AMBROSIA] = 0;
+
+ int heal_hp = (delay * you.hp_max / 10) / BASELINE_DELAY;
+ if (!you.duration[DUR_DEATHS_DOOR])
+ inc_hp(heal_hp);
+
+ int heal_mp = (delay * you.max_magic_points / 10) / BASELINE_DELAY;
+ inc_mp(heal_mp);
+}
+
bool flight_allowed(bool quiet)
{
if (get_form()->forbids_flight())
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index ac3e60e..8ba0a9d 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -1052,6 +1052,7 @@ void dec_exhaust_player(int delay);
bool haste_player(int turns, bool rageext = false);
void dec_haste_player(int delay);
void dec_elixir_player(int delay);
+void dec_ambrosia_player(int delay);
bool flight_allowed(bool quiet = false);
void fly_player(int pow, bool already_flying = false);
void float_player();
diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc
index c50e128..9e820f7 100644
--- a/crawl-ref/source/potion.cc
+++ b/crawl-ref/source/potion.cc
@@ -420,38 +420,26 @@ public:
}
};
-class PotionConfusion : public PotionEffect
+class PotionAmbrosia : public PotionEffect
{
private:
- PotionConfusion() : PotionEffect(POT_CONFUSION) { }
- DISALLOW_COPY_AND_ASSIGN(PotionConfusion);
+ PotionAmbrosia() : PotionEffect(POT_AMBROSIA) { }
+ DISALLOW_COPY_AND_ASSIGN(PotionAmbrosia);
public:
- static const PotionConfusion &instance()
+ static const PotionAmbrosia &instance()
{
- static PotionConfusion inst; return inst;
+ static PotionAmbrosia inst; return inst;
}
- bool can_quaff() const
- {
- return !you.clarity() || you.duration[DUR_DIVINE_STAMINA] > 0;
- }
-
bool effect(int pow=40) const
{
- return confuse_player(3+random2(pow));
- }
-
- bool quaff(bool was_known) const
- {
- if(was_known && !can_quaff())
+ int ambrosia_turns = 3+random2(8);
+ if (confuse_player(ambrosia_turns))
{
- mpr("You cannot confuse yourself now.");
- return false;
+ mpr("You feel invigorated.");
+ you.increase_duration(DUR_AMBROSIA, ambrosia_turns);
+ return true;
}
-
- if(effect())
- xom_is_stimulated(100 / _xom_factor(was_known));
-
- return true;
+ return false;
}
};
@@ -1019,7 +1007,6 @@ public:
};
#endif
-
// Potion effects that do not come in potion form but are
// still applied by other sources. XXX: this can
// probably be refactored further.
@@ -1078,7 +1065,7 @@ static const PotionEffect* potion_effects[] =
&PotionPoison::instance(),
&PotionSlowing::instance(),
&PotionCancellation::instance(),
- &PotionConfusion::instance(),
+ &PotionAmbrosia::instance(),
&PotionInvisibility::instance(),
#if TAG_MAJOR_VERSION == 34
&PotionPorridge::instance(),
diff --git a/crawl-ref/source/rltiles/dc-item.txt b/crawl-ref/source/rltiles/dc-item.txt
index 3796a88..8c80d54 100644
--- a/crawl-ref/source/rltiles/dc-item.txt
+++ b/crawl-ref/source/rltiles/dc-item.txt
@@ -834,7 +834,7 @@ i-flight POT_FLIGHT
i-poison POT_POISON
i-slowing POT_SLOWING
i-cancel POT_CANCELLATION
-i-confusion POT_CONFUSION
+i-ambrosia POT_AMBROSIA
i-invisibility POT_INVISIBILITY
i-porridge POT_PORRIDGE
i-degeneration POT_DEGENERATION
diff --git a/crawl-ref/source/rltiles/item/potion/i-ambrosia.png b/crawl-ref/source/rltiles/item/potion/i-ambrosia.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab9c04950f157a393b050eff844b505344a412f6
GIT binary patch
literal 1341
zcmV-D1;YA?P)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F8000B<X+uL$Nkc;*
zP;zf(X>4Tx062|}Ro!pfR1`mnZ(O7nKcKOW4i$^9Ra0BJ8yc;~21%2p=|UR0&DbiW
z$#rfTQ`a`O(`{9s_5yDV_yd5l2Of}kLK+Oj_Ok5(v`JGz71bo9J#^YYXp{DWs&KBa
zQ@dTpxRI}aIp=pi@6k0t$5)!;m`NF6-tt{FpOKHBn3g+MAqmexC-gw4rh87hTrL7G
z#)U`L!(So6-Zux@>;H3gR;i~0B%VTSS3P|m@o9jRsXML@Al^p#@G0Lx-0?i(9WEw_
zSYddU<1E8793KxjQ|c&UmW!m<wJPEz#Qifd`D_gH9D=nYPc7;iy3Be}cI}#B(pb7r
zQ2)<0Z#G)-dhzM<<|dEgyN}ggcgNHaf39n}NyINBzUKHDCVv(2y~bQ6jd(9W@|l`@
zq{8{hHx}zt?;zfZxN7)?sZhRX&6Fm%ZE|_eKB|VCYq~dzJ%bk!->TC>k>?{om1c9S
zUx<6_jj_<bFzzi(=30Ih>!T&^M{wWM#><F%5P#^}>IBbOSf*xP<^F{$j$aOQ5Y{cT
zROCL1M7^NKK<?M4#<(px;Nu~3TQXfUjub-vl4Az5h`EvTZbPkvoEw^(%X2^EKD8>L
z&(yA}mSw#iM0^;IB{ZO5!wl{^Sg-*ysE~&Yz8!E;Qv(A`lu*=Clo*MpVGd>OdF6n^
zam1Jntk;<}MrqIC5$=Q>n{*R}?8oOIDUw5En2dl--Xw34!z7E+5pr<Twj7JkV%^#F
z^FB1tE8`u5%(<RMUli}Gd(zOafAsejYx|L$X)B+22f)J)w3q|&`mZkiuq*PhLN2^}
zv+L>-OgyQ-soSab)C%saskMla`aQLVzg0+MZf20tJU&K{hZoBrUc+U4e9&<J19^6g
zw<TiDI@c3vSSRQQrH3Ur+aF1l-;_U<73B-%ymEJ2m)mwp_*D2-_)+*y_+I!KWZ{x<
zS@=n~B77rUjGfiv=VSBigL+%lGEKW)Q!u5Bv|D;f%1SRtuSmtnpVTc4Nn_F;)a>3o
zw|KmGEe4#xz17wBu{f`SS_4i66?j31EjY7n{zGfhONK~c+td!TS#B}JoR}5UAd7p&
z5phTyXSkK0xCeD3xaYP^o&J~#Xp9xFb0C;HHml5fA<%h1eR|qw7wxF+oN<lWx-aij
zl-K1neyXTku=K%xSu;&JP<gUTJ?bvd>L9T1Aits?sKNIwvGaN)^WO$I^cUV)HzL_|
z1K?{9p!>B*)`xfEv!4N6IG{J&h49W#Bz^(#YWw%`e_a{8n{G9m5AeR~_yl0%<7V@p
z<z{o^OZ2}6aLN1^Spac(61Cxm00039Nkl<ZSP5fb7zLvtFd71*Aut*OqaiRF0wX;H
z7-<jy|4A^Dk%a`sL@Ryr<Ox`<jEoEejE$}tBnJXa=n~Z8UkyErVid?in5D=PGzkG@
z3$R&=EKdyw;EeN~mK(u#xgYmOi3(&#Q6&mM@q9k*3fK}{aSrn}$a0Wc7@$T7FuZR1
z!0_twU4~boFk>-kWM3o8QY8dL>jaR^#L5PR47SjriUU9)KrWz46o4!j(^W=s11L(6
z0df?8Lu?jAmKr4?MlJv)GGqsU9A`L72iZL^HdRVObWdP72xc3QMpsL_k`T#KyiBU4
z0d!knX#$=@pmC0_4kJj=6_CLvDGJCipSoHA9kDx|b#lL*00000NkvXXu0mjfeb{i!
literal 0
HcmV?d00001
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 3e1890a..c05bade 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1529,6 +1529,7 @@ unsigned int item_value(item_def item, bool ident)
case POT_MAGIC:
case POT_INVISIBILITY:
case POT_CANCELLATION:
+ case POT_AMBROSIA:
valued += 80;
break;
@@ -1561,7 +1562,6 @@ unsigned int item_value(item_def item, bool ident)
case POT_PORRIDGE:
#endif
case POT_BLOOD:
- case POT_CONFUSION:
case POT_POISON:
case POT_SLOWING:
valued += 10;
@@ -1916,7 +1916,6 @@ bool is_worthless_consumable(const item_def &item)
#if TAG_MAJOR_VERSION == 34
case POT_BLOOD_COAGULATED:
#endif
- case POT_CONFUSION:
case POT_DECAY:
case POT_DEGENERATION:
case POT_POISON:
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index f5a00f0..b738d10 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -3781,7 +3781,7 @@ void unmarshallItem(reader &th, item_def &item)
}
if (item.base_type == OBJ_POTIONS && item.sub_type == POT_WATER)
- item.sub_type = POT_CONFUSION;
+ item.sub_type = POT_POISON;
if (item.base_type == OBJ_STAVES && item.sub_type == STAFF_CHANNELING)
item.sub_type = STAFF_ENERGY;
--
1.9.3 (Apple Git-50)
From a8f3db3309f3d9cbf77d9bcd024bc4e87aa119dd Mon Sep 17 00:00:00 2001
From: "Edgar A. Bering IV" <trizor@gmail.com>
Date: Fri, 28 Nov 2014 17:40:33 -0600
Subject: [PATCH 3/3] Replace confusion with ambrosia in vaults.
This is in a separate commit for possible balance and flavor reasons.
---
crawl-ref/source/dat/des/branches/orc.des | 6 +++---
crawl-ref/source/dat/des/branches/snake.des | 2 +-
crawl-ref/source/dat/des/branches/swamp.des | 2 +-
crawl-ref/source/dat/des/branches/vaults_rooms_standard.des | 2 +-
crawl-ref/source/dat/des/builder/food.des | 2 +-
crawl-ref/source/dat/des/portals/bailey.des | 2 +-
crawl-ref/source/dat/des/portals/ossuary.des | 4 ++--
crawl-ref/source/dat/des/portals/sewer.des | 2 +-
crawl-ref/source/dat/des/serial/magic_research.des | 2 +-
crawl-ref/source/dat/des/variable/grated_community.des | 2 +-
crawl-ref/source/dat/des/variable/lemuel_castle.des | 2 +-
11 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/crawl-ref/source/dat/des/branches/orc.des b/crawl-ref/source/dat/des/branches/orc.des
index d0b552c..5a7522a 100644
--- a/crawl-ref/source/dat/des/branches/orc.des
+++ b/crawl-ref/source/dat/des/branches/orc.des
@@ -189,11 +189,11 @@ ORIENT: float
MONS: orc, orc priest / orc wizard
MONS: w:50 orc warrior / ogre, swamp drake
# The drake's name is Bobby. Since you did ask.
-KITEM: 1 = beef jerky / nothing / animal skin / potion of confusion /\
+KITEM: 1 = beef jerky / nothing / animal skin / potion of ambrosia /\
potion of degeneration / w:2 potion of haste / w:2 potion of might
KFEAT: 1 = 1
-ITEM: club, potion of confusion, slice of pizza, beef jerky / weight:40 nothing
-ITEM: potion of confusion
+ITEM: club, potion of ambrosia, slice of pizza, beef jerky / weight:40 nothing
+ITEM: potion of ambrosia
SHUFFLE: defO
KFEAT: O = enter_orcish_mines
MAP
diff --git a/crawl-ref/source/dat/des/branches/snake.des b/crawl-ref/source/dat/des/branches/snake.des
index 7cbf6c7..1b203eb 100644
--- a/crawl-ref/source/dat/des/branches/snake.des
+++ b/crawl-ref/source/dat/des/branches/snake.des
@@ -198,7 +198,7 @@ KMONS: 123 = water moccasin / black mamba / nothing
KMONS: 4 = guardian serpent
KMONS: 5 = naga mage / nothing
KITEM: 1235 = potion of poison w:20 / \
- potion of confusion / nothing w:20
+ potion of ambrosia / nothing w:20
KITEM: 4 = any weapon good_item ego:venom q:1 / \
any weapon good_item ego:venom q:2
KFEAT: 1234 = shallow_water
diff --git a/crawl-ref/source/dat/des/branches/swamp.des b/crawl-ref/source/dat/des/branches/swamp.des
index b6d48af..08adfc8 100644
--- a/crawl-ref/source/dat/des/branches/swamp.des
+++ b/crawl-ref/source/dat/des/branches/swamp.des
@@ -1218,7 +1218,7 @@ MONS: hydra
NSUBST: : = 5:W / *:.
SUBST: w = w:10 t:10
KFEAT: K = shallow_water
-KITEM: K = potion of confusion / potion of degeneration / \
+KITEM: K = potion of ambrosia / potion of degeneration / \
potion of decay / potion of mutation
KPROP: w = no_rtele_into
MARKER: K = lua:fog_machine { cloud_type="black smoke", \
diff --git a/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des b/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des
index 9497e58..0b626d8 100644
--- a/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des
+++ b/crawl-ref/source/dat/des/branches/vaults_rooms_standard.des
@@ -249,7 +249,7 @@ MONS: deep elf fighter / w:5 deep elf knight / w:3 deep elf mage /\
MONS: Ijyb / Blork the orc / Urug / Erolcha / Snorg / Terence / Jessica /\
Sigmund / Psyche / Erica / Agnes / Maud / Louise / Rupert /\
Wiglaf / Norris / goblin
-KITEM: ! = any potion / potion of confusion, \
+KITEM: ! = any potion / potion of ambrosia, \
any potion / potion of poison, any potion
KITEM: $ = q:132 gold / q:66 gold / q:33 gold
MAP
diff --git a/crawl-ref/source/dat/des/builder/food.des b/crawl-ref/source/dat/des/builder/food.des
index 916a23a..08db2f5 100644
--- a/crawl-ref/source/dat/des/builder/food.des
+++ b/crawl-ref/source/dat/des/builder/food.des
@@ -126,7 +126,7 @@ TAGS: uniq_second_food extra chance_second_food
SUBVAULT: X : fruiting_plant
SUBVAULT: W : fruiting_plant
KITEM: p = potion of restore abilities w:2 / potion of poison w:3 / \
- potion of confusion w:1 / nothing
+ potion of ambrosia w:1 / nothing
MONS: big kobold ; wand of magic darts ident:type . short sword
MAP
XXXXX..WWWWW
diff --git a/crawl-ref/source/dat/des/portals/bailey.des b/crawl-ref/source/dat/des/portals/bailey.des
index 2f813ce..bd78bd6 100644
--- a/crawl-ref/source/dat/des/portals/bailey.des
+++ b/crawl-ref/source/dat/des/portals/bailey.des
@@ -277,7 +277,7 @@ MONS: gnoll ; spear / goblin ; spear
: end
SUBST: . = ...;!
COLOUR: ; = red
-KITEM: ! = potion of confusion q:2 ident:type
+KITEM: ! = potion of ambrosia q:2 ident:type
KFEAT: ! = floor
SUBST: ; = .
MAP
diff --git a/crawl-ref/source/dat/des/portals/ossuary.des b/crawl-ref/source/dat/des/portals/ossuary.des
index 5a22ce3..b4e744d 100644
--- a/crawl-ref/source/dat/des/portals/ossuary.des
+++ b/crawl-ref/source/dat/des/portals/ossuary.des
@@ -487,14 +487,14 @@ MONS: gnoll zombie / hobgoblin zombie / orc zombie / \
# mix of good items with useless ones
ITEM: scroll of random uselessness w:20 / scroll of immolation / \
scroll of identify / scroll of remove curse / \
- potion of mutation w:5 / potion of confusion w:5 / \
+ potion of mutation w:5 / potion of ambrosia w:5 / \
potion of degeneration / potion of lignification / \
potion of restore abilities / potion of curing w:15
# and sometimes mostly useless ones
ITEM: scroll of noise / scroll of random uselessness w:20 / \
scroll of immolation / potion of mutation w:5 / \
potion of poison / potion of degeneration / \
- potion of confusion w:20
+ potion of ambrosia w:20
# occasionally just use this
ITEM: any potion / any scroll w:5 / nothing
SHUFFLE: hjkl
diff --git a/crawl-ref/source/dat/des/portals/sewer.des b/crawl-ref/source/dat/des/portals/sewer.des
index 3e111f6..aae6150 100644
--- a/crawl-ref/source/dat/des/portals/sewer.des
+++ b/crawl-ref/source/dat/des/portals/sewer.des
@@ -862,7 +862,7 @@ ITEM: scroll of identify / scroll of recharging / \
buckler / nothing
KITEM: ' = scroll of random uselessness w:30 / \
scroll of identify / scroll of teleportation / \
- potion of confusion w:50 / potion of poison w:50 / \
+ potion of ambrosia w:50 / potion of poison w:50 / \
potion of mutation / potion of flight / \
hat / buckler / pair of gloves w:5 / pair of boots w:5
MAP
diff --git a/crawl-ref/source/dat/des/serial/magic_research.des b/crawl-ref/source/dat/des/serial/magic_research.des
index 65fd03e..dc2d2d5 100644
--- a/crawl-ref/source/dat/des/serial/magic_research.des
+++ b/crawl-ref/source/dat/des/serial/magic_research.des
@@ -139,7 +139,7 @@ MONS: sea snake / redback, red wasp / yellow wasp
MONS: mana viper / tarantella
KMONS: D = death drake
KITEM: E = potion of poison ident:type / \
- potion of confusion ident:type / \
+ potion of ambrosia ident:type / \
potion of decay ident:type
COLOUR: .012345DE = lightgreen
FTILE: .+n012345DE = floor_moss
diff --git a/crawl-ref/source/dat/des/variable/grated_community.des b/crawl-ref/source/dat/des/variable/grated_community.des
index 569e3e1..c744947 100644
--- a/crawl-ref/source/dat/des/variable/grated_community.des
+++ b/crawl-ref/source/dat/des/variable/grated_community.des
@@ -64,7 +64,7 @@ KFEAT: A = general shop type:Slaves suffix:and_Accessories count:10 ; \
KFEAT: B = food shop name:Jack type:Jerk-a-riffic suffix:Jerky count:10 ; \
q:5 beef jerky
KFEAT: C = distillery shop type:Miraculous suffix:Elixirs count:10 \
- greed:50 ; potion of confusion
+ greed:50 ; potion of ambrosia
: local smithy = string.gsub(crawl.make_name(), " ", "_")
: kfeat("D = armour shop name:The_Legendary_" .. smithy .. " \
: type:Legendary suffix:Smithy count:10 greed:40 ;\
diff --git a/crawl-ref/source/dat/des/variable/lemuel_castle.des b/crawl-ref/source/dat/des/variable/lemuel_castle.des
index 3065b3f..3fbef0a 100644
--- a/crawl-ref/source/dat/des/variable/lemuel_castle.des
+++ b/crawl-ref/source/dat/des/variable/lemuel_castle.des
@@ -144,7 +144,7 @@ NAME: lemuel_castle_interior_carwin_2
TAGS: lemuel_castle_interior
: castle_lemuel_subvault_setup(_G)
SUBST: $ = $:5 .
-ITEM: w:5 meat ration / beef jerky / potion of confusion ident:type
+ITEM: w:5 meat ration / beef jerky / potion of ambrosia ident:type
MAP
+c....+.......1.............$*c+
...1..cccccccccccccccccccccccXc.
--
1.9.3 (Apple Git-50)
|