summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 12:48:15 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 12:48:15 +0000
commit445895d95df53255dd570691f1ebb3eb538348d0 (patch)
tree2d840a26c0f7a44b50c3d88a48038a5c13a5c24c
parente6584efd5c0dfe8d24d07ceca6db2d563d2b9cd9 (diff)
downloadcrawl-ref-445895d95df53255dd570691f1ebb3eb538348d0.tar.gz
crawl-ref-445895d95df53255dd570691f1ebb3eb538348d0.zip
Revert the change on ammo handling for Tiles, and replace it with a more
generic logic that uses item tiles for BEAM_MISSILE, else bolts according to flavour. Identify monster fired ammunition ego if the launcher ego is known, not that it has much of an effect because plain ammo gets no special description. In the message list the fired item as it will look to the player (i.e. "arrow of ice" for a plain arrow fired off a bow of frost), even though the item actually dropped will still be a plain one. I hope this isn't too confusing. (And if it is, it should be easy to revert. :p) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6331 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/acr.cc3
-rw-r--r--crawl-ref/source/beam.cc7
-rw-r--r--crawl-ref/source/item_use.cc118
-rw-r--r--crawl-ref/source/itemname.cc2
-rw-r--r--crawl-ref/source/items.cc6
-rw-r--r--crawl-ref/source/mon-util.cc2
-rw-r--r--crawl-ref/source/mstuff2.cc15
-rw-r--r--crawl-ref/source/tile1.cc29
8 files changed, 88 insertions, 94 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 02b2083931..1248faf706 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1964,6 +1964,7 @@ void process_command( command_type cmd )
case CMD_TOGGLE_FRIENDLY_PICKUP:
{
+#ifndef WIZARD
if (!god_gives_permanent_followers(you.religion))
{
mpr("I'm sorry, your allies won't ever be able to pick up items.");
@@ -1977,7 +1978,7 @@ void process_command( command_type cmd )
}
break;
}
-
+#endif
// Toggle pickup mode for friendlies.
_print_friendly_pickup_setting(false);
mpr("Change to (d)efault, (n)othing, (f)riend-dropped, or (a)ll? ",
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index d8c7fafd58..5ace0228a4 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -214,6 +214,7 @@ static void _ench_animation( int flavour, const monsters *mon, bool force )
|| flavour == BEAM_BANISH
|| flavour == BEAM_BLINK) ? EC_WARP
: EC_ENCHANT;
+
zap_animation( element_colour( elem ), mon, force );
}
@@ -1761,7 +1762,7 @@ void fire_beam(bolt &pbolt, item_def *item, bool drop_item)
#ifdef USE_TILE
int tile_beam = -1;
- if (item && !pbolt.is_tracer)
+ if (item && !pbolt.is_tracer && pbolt.flavour == BEAM_MISSILE)
{
tile_beam = tileidx_item_throw(*item,
pbolt.target_x - pbolt.source_x,
@@ -4358,7 +4359,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
if (beam.fr_count == 1 && !beam.dont_stop_fr)
beam.dont_stop_fr = true;
else
- beam.dont_stop_foe = true;
+ beam.dont_stop_foe = true;
}
}
@@ -4520,7 +4521,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
if (beam.fr_count == 1 && !beam.dont_stop_fr)
beam.dont_stop_fr = true;
else
- beam.dont_stop_foe = true;
+ beam.dont_stop_foe = true;
}
}
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index b13cb3aa24..d8a59d1aa1 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -364,10 +364,10 @@ static const char *shield_base_name(const item_def *shield)
static const char *shield_impact_degree(int impact)
{
- return (impact > 160? "severely " :
- impact > 130? "significantly " :
- impact > 110? "" :
- NULL);
+ return (impact > 160 ? "severely " :
+ impact > 130 ? "significantly " :
+ impact > 110 ? ""
+ : NULL);
}
static void warn_rod_shield_interference(const item_def &)
@@ -605,7 +605,7 @@ void wield_effects(int item_wield_2, bool showMsgs)
break;
case SPWPN_FLAME:
- mpr("It glows red for a moment.");
+ mpr("It bursts into flame!");
break;
case SPWPN_FROST:
@@ -1719,12 +1719,14 @@ int launcher_final_speed(const item_def &launcher, const item_def *shield)
// Determines if the end result of the combined launcher + ammo brands a
// fire/frost beam.
+// positive: frost, negative: flame, zero: neither
bool elemental_missile_beam(int launcher_brand, int ammo_brand)
{
- int element = (launcher_brand == SPWPN_FROST)
- + (ammo_brand == SPMSL_ICE)
- - (launcher_brand == SPWPN_FLAME)
- - (ammo_brand == SPMSL_FLAME);
+ int element = (launcher_brand == SPWPN_FROST
+ + ammo_brand == SPMSL_ICE
+ - launcher_brand == SPWPN_FLAME
+ - ammo_brand == SPMSL_FLAME);
+
return (element);
}
@@ -2008,7 +2010,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
if (projected == LRET_LAUNCHED)
{
const item_def &launcher = you.inv[you.equip[EQ_WEAPON]];
- const int bow_brand = get_weapon_brand( launcher );
+ const int bow_brand = get_weapon_brand( launcher );
const int ammo_brand = get_ammo_brand( item );
bool poisoned = (ammo_brand == SPMSL_POISONED);
@@ -2234,66 +2236,42 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
}
// Note that bow_brand is known since the bow is equipped.
- if (bow_brand == SPWPN_FLAME || ammo_brand == SPMSL_FLAME)
+ if ((bow_brand == SPWPN_FLAME || ammo_brand == SPMSL_FLAME)
+ && ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST)
{
- if (ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST)
- {
-#ifdef USE_TILE
- // Mark brand for tile output.
- if (ammo_brand != SPMSL_FLAME)
- set_item_ego_type( item, OBJ_MISSILES, SPMSL_FLAME );
-#endif
-
- // [dshaligram] Branded arrows are much stronger.
- dice_mult = (dice_mult * 150) / 100;
+ // [dshaligram] Branded arrows are much stronger.
+ dice_mult = (dice_mult * 150) / 100;
- pbolt.flavour = BEAM_FIRE;
- pbolt.name = "bolt of ";
+ pbolt.flavour = BEAM_FIRE;
+ pbolt.name = "bolt of ";
- if (poisoned)
- pbolt.name += "poison ";
+ if (poisoned)
+ pbolt.name += "poison ";
- pbolt.name += "flame";
- pbolt.colour = RED;
- pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
- pbolt.thrower = KILL_YOU_MISSILE;
- pbolt.aux_source.clear();
- }
-#ifdef USE_TILE
- else
- set_item_ego_type( item, OBJ_MISSILES, SPMSL_NORMAL );
-#endif
+ pbolt.name += "flame";
+ pbolt.colour = RED;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
+ pbolt.thrower = KILL_YOU_MISSILE;
+ pbolt.aux_source.clear();
}
- if (bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE)
+ if ((bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE)
+ && ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME)
{
- if (ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME)
- {
-#ifdef USE_TILE
- // Mark brand for tile output.
- if (ammo_brand != SPMSL_ICE)
- set_item_ego_type( item, OBJ_MISSILES, SPMSL_ICE );
-#endif
+ // [dshaligram] Branded arrows are much stronger.
+ dice_mult = (dice_mult * 150) / 100;
- // [dshaligram] Branded arrows are much stronger.
- dice_mult = (dice_mult * 150) / 100;
+ pbolt.flavour = BEAM_COLD;
+ pbolt.name = "bolt of ";
- pbolt.flavour = BEAM_COLD;
- pbolt.name = "bolt of ";
+ if (poisoned)
+ pbolt.name += "poison ";
- if (poisoned)
- pbolt.name += "poison ";
-
- pbolt.name += "frost";
- pbolt.colour = WHITE;
- pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
- pbolt.thrower = KILL_YOU_MISSILE;
- pbolt.aux_source.clear();
- }
-#ifdef USE_TILE
- else
- set_item_ego_type( item, OBJ_MISSILES, SPMSL_NORMAL );
-#endif
+ pbolt.name += "frost";
+ pbolt.colour = WHITE;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT);
+ pbolt.thrower = KILL_YOU_MISSILE;
+ pbolt.aux_source.clear();
}
// The chief advantage here is the extra damage this does
@@ -2565,12 +2543,30 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
pbolt.hit, pbolt.damage.num, pbolt.damage.size );
#endif
+ // Print type of item as influenced by launcher.
+ item_def ammo = item;
+ if (pbolt.flavour == BEAM_FIRE)
+ {
+ if (ammo.special != SPMSL_FLAME)
+ ammo.special = SPMSL_FLAME;
+ }
+ else if (pbolt.flavour == BEAM_COLD)
+ {
+ if (ammo.special != SPMSL_ICE)
+ ammo.special = SPMSL_ICE;
+ }
+ else
+ {
+ if (ammo.special != SPMSL_NORMAL && ammo.special != SPMSL_POISONED)
+ ammo.special = SPMSL_NORMAL;
+ }
+
// Create message.
mprf( "%s %s%s %s.",
teleport ? "Magically, you" : "You",
projected ? "" : "awkwardly ",
projected == LRET_LAUNCHED ? "shoot" : "throw",
- item.name(DESC_NOCAP_A).c_str() );
+ ammo.name(DESC_NOCAP_A).c_str() );
// Ensure we're firing a 'missile'-type beam.
pbolt.is_beam = false;
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 1e0c1310d9..6cd8e97e04 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1700,7 +1700,7 @@ bool item_type_known( const item_def& item )
}
const item_type_id_type idt = objtype_to_idtype(item.base_type);
- if ( idt != NUM_IDTYPE && item.sub_type < 50 )
+ if (idt != NUM_IDTYPE && item.sub_type < 50 )
return (type_ids[idt][item.sub_type] == ID_KNOWN_TYPE);
else
return (false);
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 38ba9d2681..18ffb6224f 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1195,8 +1195,8 @@ void pickup()
}
else if (mitm[o].link == NON_ITEM) // just one item?
{
- // deliberately allowing the player to pick up
- // a killed item here
+ // Deliberately allowing the player to pick up
+ // a killed item here.
pickup_single_item(o, mitm[o].quantity);
}
else if (Options.pickup_mode != -1
@@ -1213,7 +1213,7 @@ void pickup()
// Must save this because pickup can destroy the item.
next = mitm[o].link;
- if ( num_nonsquelched && _invisible_to_player(mitm[o]) )
+ if (num_nonsquelched && _invisible_to_player(mitm[o]))
{
o = next;
continue;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 92fa662ddd..e6f118a6ef 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3319,7 +3319,7 @@ void monsters::equip_weapon(item_def &item, int near, bool msg)
mpr("You sense an unholy aura.");
break;
case SPWPN_FLAME:
- mpr("It glows red for a moment.");
+ mpr("It bursts into flame!");
break;
case SPWPN_FROST:
mpr("It is covered in frost.");
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 52be635898..909e09d6ff 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1192,10 +1192,10 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
int diceMult = 100;
// Some initial convenience & initializations.
- int wepClass = mitm[hand_used].base_type;
- int wepType = mitm[hand_used].sub_type;
+ int wepClass = mitm[hand_used].base_type;
+ int wepType = mitm[hand_used].sub_type;
- int weapon = monster->inv[MSLOT_WEAPON];
+ int weapon = monster->inv[MSLOT_WEAPON];
int lnchType = (weapon != NON_ITEM) ? mitm[weapon].sub_type : 0;
const bool skilled = mons_class_flag(monster->type, M_FIGHTER);
@@ -1450,9 +1450,18 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
pbolt.name = item.name(DESC_PLAIN, false, false, false);
}
msg += ".";
+
if (monster->visible())
+ {
mpr(msg.c_str());
+ if (projected == LRET_LAUNCHED
+ && item_type_known(mitm[monster->inv[MSLOT_WEAPON]]))
+ {
+ set_ident_flags(mitm[hand_used], ISFLAG_KNOW_TYPE);
+ }
+ }
+
// [dshaligram] When changing bolt names here, you must edit
// hiscores.cc (scorefile_entry::terse_missile_cause()) to match.
if (projected == LRET_LAUNCHED)
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index c5ecc5384b..5dcea8891f 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -1892,17 +1892,14 @@ int tileidx_item(const item_def &item)
}
}
-/*
- Determine Octant of missile direction
- ---> X+
- |
- | 701
- Y 6O2
- + 543
-
- the octant boundary slope tan(pi/8)=sqrt(2)-1 = 0.414 is approximated by 2/5
-
-*/
+// Determine Octant of missile direction
+// .---> X+
+// |
+// | 701
+// Y 6O2
+// + 543
+//
+// The octant boundary slope tan(pi/8)=sqrt(2)-1 = 0.414 is approximated by 2/5.
static int _tile_bolt_dir(int dx, int dy)
{
int ax = abs(dx);
@@ -1925,16 +1922,6 @@ int tileidx_item_throw(const item_def &item, int dx, int dy)
int ch = -1;
int dir = _tile_bolt_dir(dx, dy);
- switch (get_ammo_brand(item))
- {
- case SPMSL_FLAME:
- return (tileidx_zap(RED));
- case SPMSL_ICE:
- return (tileidx_zap(WHITE));
- default:
- break;
- }
-
// Thrown items with multiple directions
switch (item.sub_type)
{