Attached Files:
|
poison_reflect.patch [^] (8,842 bytes) 2011-08-22 21:46 [Show Content] [Hide Content]From 955c410411ec2a7d752cc497bddac0a3dbdd5fb9 Mon Sep 17 00:00:00 2001
From: Aaron Becker <akbecker@gmail.com>
Date: Mon, 22 Aug 2011 14:44:35 -0500
Subject: [PATCH] Don't blame the player for reflecting poisonous bolts at enemies.
---
crawl-ref/source/actor.h | 3 ++-
crawl-ref/source/beam.cc | 24 ++++++++++++------------
crawl-ref/source/beam.h | 3 ++-
crawl-ref/source/item_use.cc | 2 +-
crawl-ref/source/monster.cc | 4 ++--
crawl-ref/source/monster.h | 3 ++-
crawl-ref/source/player.cc | 2 +-
crawl-ref/source/player.h | 3 ++-
crawl-ref/source/spl-damage.cc | 4 ++--
9 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index e82b639..62689bc 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -186,7 +186,8 @@ public:
virtual void teleport(bool right_now = false,
bool abyss_shift = false,
bool wizard_tele = false) = 0;
- virtual void poison(actor *attacker, int amount = 1, bool force = false) = 0;
+ virtual void poison(actor *attacker, int amount = 1, bool force = false,
+ bool blame = false) = 0;
virtual bool sicken(int amount, bool allow_hint = true) = 0;
virtual void paralyse(actor *attacker, int strength) = 0;
virtual void petrify(actor *attacker) = 0;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 5e8f30b..4f5c228 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1616,7 +1616,8 @@ int mons_adjust_flavoured(monster* mons, bolt &pbolt, int hurted,
}
}
else if (res <= 0 && doFlavouredEffects && !one_chance_in(3))
- poison_monster(mons, pbolt.agent());
+ poison_monster(mons, pbolt.agent(), 1,
+ false, YOU_KILL(pbolt.thrower));
break;
}
@@ -1634,11 +1635,13 @@ int mons_adjust_flavoured(monster* mons, bolt &pbolt, int hurted,
// Poison arrow can poison any living thing regardless of
// poison resistance. - bwr
if (mons->has_lifeforce())
- poison_monster(mons, pbolt.agent(), 2, true);
+ poison_monster(mons, pbolt.agent(), 2,
+ true, YOU_KILL(pbolt.thrower));
}
}
else if (doFlavouredEffects)
- poison_monster(mons, pbolt.agent(), 4);
+ poison_monster(mons, pbolt.agent(), 4,
+ false, YOU_KILL(pbolt.thrower));
break;
@@ -2007,7 +2010,8 @@ void bolt::apply_bolt_petrify(monster* mons)
}
}
-static bool _curare_hits_monster(actor *agent, monster* mons, int levels)
+static bool _curare_hits_monster(actor *agent, monster* mons,
+ int levels, bool blame)
{
if (!mons->alive())
return (false);
@@ -2015,7 +2019,7 @@ static bool _curare_hits_monster(actor *agent, monster* mons, int levels)
if (mons->res_poison() > 0)
return (false);
- poison_monster(mons, agent, levels, false);
+ poison_monster(mons, agent, levels, false, blame);
int hurted = 0;
@@ -2033,16 +2037,12 @@ static bool _curare_hits_monster(actor *agent, monster* mons, int levels)
if (mons->alive())
enchant_monster_with_flavour(mons, agent, BEAM_SLOW);
- // Deities take notice.
- if (agent == &you)
- did_god_conduct(DID_POISON, 5 + random2(3));
-
return (hurted > 0);
}
// Actually poisons a monster (with message).
bool poison_monster(monster* mons, const actor *who, int levels,
- bool force, bool verbose)
+ bool force, bool blame, bool verbose)
{
if (!mons->alive())
return (false);
@@ -2067,7 +2067,7 @@ bool poison_monster(monster* mons, const actor *who, int levels,
}
// Finally, take care of deity preferences.
- if (who == &you)
+ if (blame && who == &you)
did_god_conduct(DID_POISON, 5 + random2(3));
return (new_pois.degree > old_pois.degree);
@@ -4111,7 +4111,7 @@ void bolt::monster_post_hit(monster* mon, int dmg)
if (item->special == SPMSL_CURARE)
{
if (ench_power == AUTOMATIC_HIT
- && _curare_hits_monster(agent(), mon, 2)
+ && _curare_hits_monster(agent(), mon, 2, YOU_KILL(thrower))
&& !mon->alive())
{
wake_mimic = false;
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index df0ed63..d477d7e 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -313,7 +313,8 @@ spret_type mass_enchantment(enchant_type wh_enchant, int pow,
bool fail = false);
bool poison_monster(monster* mons, const actor* who, int levels = 1,
- bool force = false, bool verbose = true);
+ bool force = false, bool blame = true,
+ bool verbose = true);
bool miasma_monster(monster* mons, const actor* who);
bool napalm_monster(monster* mons, const actor* who, int levels = 1,
bool verbose = true);
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 00e43b5..f465d38 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1507,7 +1507,7 @@ static bool _poison_hit_victim(bolt& beam, actor* victim, int dmg, int corpse)
if (levels <= 0)
return (false);
- victim->poison(agent, levels);
+ victim->poison(agent, levels, false, YOU_KILL(beam.thrower));
return (true);
}
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 6ac552c..55705fb 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3527,7 +3527,7 @@ int monster::mons_species() const
return ::mons_species(type);
}
-void monster::poison(actor *agent, int amount, bool force)
+void monster::poison(actor *agent, int amount, bool force, bool blame)
{
if (amount <= 0)
return;
@@ -3536,7 +3536,7 @@ void monster::poison(actor *agent, int amount, bool force)
if (!(amount /= 2))
amount = 1;
- poison_monster(this, agent, amount, force);
+ poison_monster(this, agent, amount, force, blame);
}
int monster::skill(skill_type sk) const
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index 9cf37a5..71a985c 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -404,7 +404,8 @@ public:
int armour_class() const;
int melee_evasion(const actor *attacker, ev_ignore_type evit) const;
- void poison(actor *agent, int amount = 1, bool force = false);
+ void poison(actor *agent, int amount = 1, bool force = false,
+ bool blame = true);
bool sicken(int strength, bool unused = true);
bool bleed(const actor *agent, int amount, int degree);
void paralyse(actor *, int str);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 2739c4f..7492318 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6310,7 +6310,7 @@ int player::mons_species() const
}
}
-void player::poison(actor *agent, int amount, bool force)
+void player::poison(actor *agent, int amount, bool force, bool blame)
{
::poison_player(amount, agent? agent->name(DESC_NOCAP_A, true) : "");
}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index bcf1209..189046a 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -554,7 +554,8 @@ public:
int hunger_level() const { return hunger_state; }
void make_hungry(int nutrition, bool silent = true);
- void poison(actor *agent, int amount = 1, bool force = false);
+ void poison(actor *agent, int amount = 1, bool force = false,
+ bool blame = true);
bool sicken(int amount, bool allow_hint = true);
void paralyse(actor *, int str);
void petrify(actor *);
diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc
index 18de40c..acd1a90 100644
--- a/crawl-ref/source/spl-damage.cc
+++ b/crawl-ref/source/spl-damage.cc
@@ -424,9 +424,9 @@ spret_type cast_toxic_radiance(bool non_player, bool fail)
if (!mi->has_ench(ENCH_INVIS))
{
const actor* agent = non_player ? 0 : &you;
- bool affected = poison_monster(*mi, agent, 1, false, false);
+ bool affected = poison_monster(*mi, agent);
- if (coinflip() && poison_monster(*mi, agent, 1, false, false))
+ if (coinflip() && poison_monster(*mi, agent))
affected = true;
if (affected)
--
1.7.4.1
warn_about_reflection.patch [^] (2,576 bytes) 2011-08-27 20:07 [Show Content] [Hide Content]From 54b39e417635b0da77ef41d346c4593c60c0ad5b Mon Sep 17 00:00:00 2001
From: Aaron Becker <akbecker@gmail.com>
Date: Sat, 27 Aug 2011 12:37:43 -0500
Subject: [PATCH] Warn the player when equipping a shield of reflection if appropriate.
If the player worships a god who could be angered by the result of a
reflected shot (eg, TSO and poison weapons, Okawaru and harming allies),
warn when equipping reflecting armour.
---
crawl-ref/source/goditem.cc | 5 +++++
crawl-ref/source/goditem.h | 1 +
crawl-ref/source/player-equip.cc | 9 +++++++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/crawl-ref/source/goditem.cc b/crawl-ref/source/goditem.cc
index ecbdb43..6d3c62c 100644
--- a/crawl-ref/source/goditem.cc
+++ b/crawl-ref/source/goditem.cc
@@ -408,6 +408,11 @@ bool is_poisoned_item(const item_def& item)
return (false);
}
+bool is_reflecting_item(const item_def& item)
+{
+ return get_armour_ego_type(item) == SPARM_REFLECTION;
+}
+
bool is_holy_discipline(int discipline)
{
return (discipline & SPTYP_HOLY);
diff --git a/crawl-ref/source/goditem.h b/crawl-ref/source/goditem.h
index 0b28147..53f7a8d 100644
--- a/crawl-ref/source/goditem.h
+++ b/crawl-ref/source/goditem.h
@@ -17,6 +17,7 @@ bool is_chaotic_item(const item_def& item);
bool is_potentially_hasty_item(const item_def& item);
bool is_hasty_item(const item_def& item);
bool is_poisoned_item(const item_def& item);
+bool is_reflecting_item(const item_def& item);
bool is_holy_discipline(int discipline);
bool is_evil_discipline(int discipline);
bool is_holy_spell(spell_type spell, god_type god = GOD_NO_GOD);
diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc
index e15cb6f..bf78d35 100644
--- a/crawl-ref/source/player-equip.cc
+++ b/crawl-ref/source/player-equip.cc
@@ -417,6 +417,15 @@ static void _equip_use_warning(const item_def& item)
mpr("You really shouldn't be using a fast item like this.");
else if (is_poisoned_item(item) && you.religion == GOD_SHINING_ONE)
mpr("You really shouldn't be using a poisoned item like this.");
+ else if (is_reflecting_item(item) && (
+ you.religion == GOD_SHINING_ONE ||
+ you.religion == GOD_ZIN ||
+ you.religion == GOD_ELYVILON ||
+ you.religion == GOD_OKAWARU ||
+ you.religion == GOD_BEOGH ||
+ you.religion == GOD_JIYVA))
+ mpr("Be warned, you will be held responsible "
+ "for any attacks that you reflect.");
}
--
1.7.4.1
|