summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 16:10:31 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-11 16:10:31 +0000
commit4661402a536708e9c1f97415b9298bff2cd59719 (patch)
treebc47fdbfe2aab7d5ab5067bcf06d541283820677 /crawl-ref
parent04ef4ac34d7bbc5358a3adbf542071599e71c515 (diff)
downloadcrawl-ref-4661402a536708e9c1f97415b9298bff2cd59719.tar.gz
crawl-ref-4661402a536708e9c1f97415b9298bff2cd59719.zip
[1678085] Fixed efreet message sequence (Erik).
Fixed off-by-one-column beam animations. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1017 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/beam.cc18
-rw-r--r--crawl-ref/source/it_use3.cc19
-rw-r--r--crawl-ref/source/monplace.cc46
-rw-r--r--crawl-ref/source/monplace.h3
4 files changed, 51 insertions, 35 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 3f2cbdda3e..032477d7a9 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -147,10 +147,10 @@ void zap_animation( int colour, const monsters *mon, bool force )
if (!see_grid( x, y ))
return;
- const int drawx = x - you.x_pos + 18;
- const int drawy = y - you.y_pos + 9;
+ const int drawx = grid2viewX(x);
+ const int drawy = grid2viewY(y);
- if (drawx > 8 && drawx < 26 && drawy > 0 && drawy < 18)
+ if (in_los_bounds(drawx, drawy))
{
textcolor( colour );
gotoxy( drawx, drawy );
@@ -1402,10 +1402,10 @@ void fire_beam( struct bolt &pbolt, item_def *item )
// respect to killed monsters, cloud trails, etc.
// draw new position
- int drawx = tx - you.x_pos + 18;
- int drawy = ty - you.y_pos + 9;
+ int drawx = grid2viewX(tx);
+ int drawy = grid2viewY(ty);
// bounds check
- if (drawx > 8 && drawx < 26 && drawy > 0 && drawy < 18)
+ if (in_los_bounds(drawx, drawy))
{
if (pbolt.colour == BLACK)
textcolor(random_colour());
@@ -4251,13 +4251,13 @@ static void explosion_cell(struct bolt &beam, int x, int y, bool drawOnly)
if (drawOnly)
{
- int drawx = realx - you.x_pos + 18;
- int drawy = realy - you.y_pos + 9;
+ int drawx = grid2viewX(realx);
+ int drawy = grid2viewY(realy);
if (see_grid(realx, realy) || (realx == you.x_pos && realy == you.y_pos))
{
// bounds check
- if (drawx > 8 && drawx < 26 && drawy > 0 && drawy < 18)
+ if (in_los_bounds(drawx, drawy))
{
if (beam.colour == BLACK)
textcolor(random_colour());
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index d2b4d5d733..a7b96a93ca 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -725,19 +725,24 @@ static bool efreet_flask(void)
mpr("You open the flask...");
- dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
-
- if (create_monster( MONS_EFREET, ENCH_ABJ_V, behaviour,
- you.x_pos, you.y_pos, MHITYOU, 250 ) != -1)
+ const int efreet = create_monster( MONS_EFREET, ENCH_ABJ_V, behaviour,
+ you.x_pos, you.y_pos, MHITYOU, 250,
+ false, false, true );
+ if (efreet != -1)
{
+ monsters *mon = &menv[efreet];
+
mpr( "...and a huge efreet comes out." );
-
- mpr( (behaviour == BEH_FRIENDLY) ? "\"Thank you for releasing me!\""
- : "It howls insanely!" );
+ player_angers_monster(mon);
+ mpr( (mon->attitude == ATT_FRIENDLY)?
+ "\"Thank you for releasing me!\""
+ : "It howls insanely!" );
}
else
canned_msg(MSG_NOTHING_HAPPENS);
+ dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 );
+
return (true);
} // end efreet_flask()
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index e743667e80..9c70d802a2 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1295,9 +1295,33 @@ coord_def find_newmons_square(int mons_class, int x, int y)
return (pos);
}
+bool player_angers_monster(monsters *creation)
+{
+ // get the drawbacks, not the benefits...
+ // (to prevent demon-scumming)
+ if ( (you.religion == GOD_ZIN ||
+ you.religion == GOD_SHINING_ONE ||
+ you.religion == GOD_ELYVILON) &&
+ mons_is_unholy(creation) )
+ {
+ if ( creation->attitude != ATT_HOSTILE )
+ {
+ creation->attitude = ATT_HOSTILE;
+ if ( see_grid(creation->x, creation->y)
+ && player_monster_visible(creation) )
+ {
+ mprf("%s is enraged by your holy aura!",
+ ptr_monam(creation, DESC_CAP_THE));
+ }
+ }
+ return (true);
+ }
+ return (false);
+}
+
int create_monster( int cls, int dur, int beha, int cr_x, int cr_y,
int hitting, int zsec, bool permit_bands,
- bool force_place )
+ bool force_place, bool force_behaviour )
{
int summd = -1;
coord_def pos = find_newmons_square(cls, cr_x, cr_y);
@@ -1338,24 +1362,10 @@ int create_monster( int cls, int dur, int beha, int cr_x, int cr_y,
if (beha == BEH_GOD_GIFT)
creation->flags |= MF_GOD_GIFT;
-
- // get the drawbacks, not the benefits...
- // (to prevent demon-scumming)
- if ( (you.religion == GOD_ZIN ||
- you.religion == GOD_SHINING_ONE ||
- you.religion == GOD_ELYVILON) &&
- mons_is_unholy(creation) )
- {
- if ( creation->attitude != ATT_HOSTILE )
- {
- creation->attitude = ATT_HOSTILE;
- if ( see_grid(cr_x, cr_y) )
- mpr("The monster is enraged by your holy aura!");
- }
- creation->behaviour = BEH_HOSTILE;
- beha = BEH_HOSTILE;
- }
+ if (!force_behaviour && player_angers_monster(creation))
+ beha = BEH_HOSTILE;
+
if (beha == BEH_CHARMED)
{
creation->attitude = ATT_HOSTILE;
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index 5b89d73871..5f00448a2b 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -50,8 +50,9 @@ int mons_place( int mon_type, char behaviour, int target, bool summoned,
* *********************************************************************** */
int create_monster( int cls, int dur, int beha, int cr_x, int cr_y,
int hitting, int zsec, bool permit_bands = false,
- bool force_place = false );
+ bool force_place = false, bool force_behaviour = false );
+bool player_angers_monster(monsters *mon);
// last updated 12may2000 {dlb}
/* ***********************************************************************