summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-10 16:04:14 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-10 16:04:14 +0000
commit512696e788bbd4172853b8a1d7cca95497c98a6a (patch)
treed6477f6a71ab70118cc8126711557eafdb979e03 /crawl-ref
parent684f80b554daadb08cf2c40b8e905737e8655530 (diff)
downloadcrawl-ref-512696e788bbd4172853b8a1d7cca95497c98a6a.tar.gz
crawl-ref-512696e788bbd4172853b8a1d7cca95497c98a6a.zip
Allow player ghosts to use corona.
Breaks save compatibility, upped save major version. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1282 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/acr.cc3
-rw-r--r--crawl-ref/source/beam.cc16
-rw-r--r--crawl-ref/source/externs.h6
-rw-r--r--crawl-ref/source/fight.cc5
-rw-r--r--crawl-ref/source/files.cc2
-rw-r--r--crawl-ref/source/ghost.cc2
-rw-r--r--crawl-ref/source/it_use2.cc2
-rw-r--r--crawl-ref/source/mon-util.cc33
-rw-r--r--crawl-ref/source/mstuff2.cc10
-rw-r--r--crawl-ref/source/output.cc7
-rw-r--r--crawl-ref/source/player.cc8
-rw-r--r--crawl-ref/source/tags.cc7
-rw-r--r--crawl-ref/source/version.h2
-rw-r--r--crawl-ref/source/view.cc5
14 files changed, 85 insertions, 23 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 8fb022ddc6..c9f08f5875 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -2017,6 +2017,9 @@ static void decrement_durations()
Options.tutorial_events[TUT_YOU_ENCHANTED] = tut_slow;
}
+ if (you.backlight > 0 && !--you.backlight)
+ mpr("You are no longer glowing.", MSGCH_DURATION);
+
if (you.confusing_touch > 1)
you.confusing_touch--;
else if (you.confusing_touch == 1)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index a2beb9d7be..20ddbb63d3 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3081,6 +3081,22 @@ static int affect_player( struct bolt &beam )
// these colors are misapplied - see mons_ench_f2() {dlb}
switch (beam.flavour)
{
+ case BEAM_BACKLIGHT:
+ if (!you.invis)
+ {
+ if (you.backlight)
+ mpr("You glow brighter.");
+ else
+ mpr("You are outlined in light.");
+
+ you.backlight += random_range(15, 35);
+ if (you.backlight > 250)
+ you.backlight = 250;
+
+ beam.obvious_effect = true;
+ }
+ break;
+
case BEAM_POLYMORPH:
if (MON_KILL(beam.thrower))
{
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index bfa1f93f60..485bd4da47 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -192,6 +192,7 @@ public:
virtual bool paralysed() const = 0;
virtual bool confused() const = 0;
virtual bool asleep() const { return (false); }
+ virtual bool backlit() const = 0;
virtual void god_conduct(int thing_done, int level) { }
@@ -661,6 +662,7 @@ public:
FixedVector<unsigned char, 100> mutation;
FixedVector<unsigned char, 100> demon_pow;
unsigned char magic_contamination;
+ short backlight;
char confusing_touch;
char sure_blade;
@@ -788,6 +790,7 @@ public:
bool paralysed() const;
bool confused() const;
+ bool backlit() const;
int armour_class() const;
int melee_evasion(const actor *attacker) const;
@@ -948,6 +951,8 @@ public:
void destroy_inventory();
void reset();
void load_spells(int spellbook);
+
+ actor *get_foe() const;
// actor interface
int id() const;
@@ -996,6 +1001,7 @@ public:
bool paralysed() const;
bool confused() const;
bool asleep() const;
+ bool backlit() const;
int holy_aura() const;
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index ce615b13ce..98ef1e7c03 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2131,7 +2131,7 @@ int melee_attack::player_to_hit(bool random_factor)
// Check for backlight (Corona).
if (defender && defender->atype() == ACT_MONSTER)
{
- if (def->has_ench(ENCH_BACKLIGHT))
+ if (defender->backlit())
your_to_hit += 2 + random2(8);
// Invisible monsters are hard to hit.
else if (def->invisible() && !see_invis)
@@ -3071,6 +3071,9 @@ int melee_attack::mons_to_hit()
if (attacker->confused())
mhit -= 5;
+ if (defender->backlit())
+ mhit += 2 + random2(8);
+
// Invisible defender is hard to hit if you can't see invis. Note
// that this applies only to monsters vs monster and monster vs
// player. Does not apply to a player fighting an invisible
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 07b4676347..df241e835c 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -89,7 +89,7 @@
void save_level(int level_saved, bool was_a_labyrinth, char where_were_you);
#define GHOST_MINOR_VERSION 1
-#define LEVEL_MINOR_VERSION 2
+#define LEVEL_MINOR_VERSION 1
#define YOU_MINOR_VERSION 1
static void redraw_all(void)
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 4328e2855d..6bcaa281f0 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -47,6 +47,7 @@ static int search_order_conj[] = {
SPELL_STING,
SPELL_SHOCK,
SPELL_MAGIC_DART,
+ SPELL_BACKLIGHT,
SPELL_NO_SPELL, // end search
};
@@ -87,6 +88,7 @@ static int search_order_misc[] = {
SPELL_POLYMORPH_OTHER,
SPELL_TELEPORT_OTHER,
SPELL_DIG,
+ SPELL_BACKLIGHT,
SPELL_NO_SPELL, // end search
};
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc
index 74d60c78ad..08e083cb69 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -185,6 +185,8 @@ bool potion_effect( char pot_eff, int pow )
if (you.invis > 100)
you.invis = 100;
+
+ you.backlight = 0;
break;
// carnivore check here? {dlb}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 03bb6a72cb..8595bd08dd 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1879,6 +1879,13 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
// handled here as well. -- bwr
switch (monspell)
{
+ case SPELL_BACKLIGHT:
+ {
+ const actor *foe = mon->get_foe();
+ ret = !foe || foe->backlit() || foe->invisible();
+ break;
+ }
+
case SPELL_BERSERKER_RAGE:
if (!mon->needs_berserk(false))
ret = true;
@@ -2484,6 +2491,11 @@ bool monsters::asleep() const
return (mons_is_sleeping(this));
}
+bool monsters::backlit() const
+{
+ return (has_ench(ENCH_BACKLIGHT));
+}
+
int monsters::shield_bonus() const
{
// XXX: Monsters don't actually get shields yet.
@@ -3609,21 +3621,22 @@ void monsters::check_speed()
}
}
-int monsters::foe_distance() const
+actor *monsters::get_foe() const
{
- // early out -- no foe!
if (foe == MHITNOT)
- return (INFINITE_DISTANCE);
-
- if (foe == MHITYOU)
- return grid_distance(x, y, you.x_pos, you.y_pos);
+ return (NULL);
+ else if (foe == MHITYOU)
+ return (&you);
// must be a monster
- const monsters *my_foe = &menv[foe];
- if (my_foe->alive())
- return grid_distance(x, y, my_foe->x, my_foe->y);
+ monsters *my_foe = &menv[foe];
+ return (my_foe->alive()? my_foe : NULL);
+}
- return (INFINITE_DISTANCE);
+int monsters::foe_distance() const
+{
+ const actor *afoe = get_foe();
+ return (afoe? pos().distance_from(afoe->pos()) : INFINITE_DISTANCE);
}
bool monsters::can_go_berserk() const
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 2e0dd8fd9d..7d623cff6e 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1438,6 +1438,16 @@ bolt mons_spells( int spell_cast, int power )
beam.is_beam = true;
break;
+ case SPELL_BACKLIGHT:
+ beam.name = "0";
+ beam.range = 5;
+ beam.rangeMax = 9;
+ beam.type = 0;
+ beam.flavour = BEAM_BACKLIGHT;
+ beam.thrower = KILL_MON_MISSILE;
+ beam.is_beam = true;
+ break;
+
case SPELL_CONFUSE:
beam.name = "0";
beam.range = 5;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 506290aaff..7071c8f2e1 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -578,9 +578,12 @@ void print_stats(void)
cprintf( "Rot " );
}
- if (you.magic_contamination >= 5)
+ if (you.backlit())
{
- textcolor( bad_ench_colour( you.magic_contamination, 15, 25 ) );
+ textcolor(
+ you.magic_contamination >= 5?
+ bad_ench_colour( you.magic_contamination, 15, 25 )
+ : LIGHTBLUE );
cprintf( "Glow " );
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 3944b077c7..9ee2493df7 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4513,6 +4513,9 @@ void player::init()
sure_blade = 0;
synch_time = 0;
+ magic_contamination = 0;
+ backlight = 0;
+
base_hp = 5000;
base_hp2 = 5000;
base_magic_points = 5000;
@@ -5258,3 +5261,8 @@ bool player::invisible() const
{
return (invis);
}
+
+bool player::backlit() const
+{
+ return (magic_contamination >= 5 || backlight);
+}
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index c2cd0d59ad..173f94cee6 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -828,8 +828,8 @@ static void tag_construct_you(struct tagHeader &th)
marshallLong( th, you.real_time );
marshallLong( th, you.num_turns );
- // you.magic_contamination 05/03/05
marshallShort(th, you.magic_contamination);
+ marshallShort(th, you.backlight);
marshallString(th, you.last_altar_inscription.c_str(), 80);
}
@@ -1138,6 +1138,7 @@ static void tag_read_you(struct tagHeader &th, char minorVersion)
you.num_turns = unmarshallLong(th);
you.magic_contamination = unmarshallShort(th);
+ you.backlight = unmarshallShort(th);
you.last_altar_inscription = unmarshallString(th, 80);
}
@@ -1531,10 +1532,6 @@ static void tag_read_level( struct tagHeader &th, char minorVersion )
mgrd[i][j] = NON_MONSTER;
env.cgrid[i][j] = (unsigned char) unmarshallByte(th);
-
- // Ugh! Backward compatibility. 101 was the old (buggy) EMPTY_CLOUD
- if (minorVersion < 2 && env.cgrid[i][j] == 101)
- env.cgrid[i][j] = EMPTY_CLOUD;
}
}
diff --git a/crawl-ref/source/version.h b/crawl-ref/source/version.h
index 975b74f547..2a0fac788b 100644
--- a/crawl-ref/source/version.h
+++ b/crawl-ref/source/version.h
@@ -52,6 +52,6 @@
* *********************************************************************** */
#define BUILD_DATE __DATE__
-#define SAVE_MAJOR_VERSION 1
+#define SAVE_MAJOR_VERSION 2
#endif
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 3074192956..84506e823f 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -741,9 +741,8 @@ bool check_awaken(int mons_aw)
}
}
- // glowing with magical contamination isn't very stealthy
- if (you.magic_contamination > 10)
- mons_perc += you.magic_contamination - 10;
+ if (you.backlit())
+ mons_perc += 15;
if (mons_perc < 0)
mons_perc = 0;