Attached Files |
0001-Replace-corrosion-with-a-temporary-effect.patch [^] (11,557 bytes) 2014-05-07 17:11 [Show Content] [Hide Content]From 8cca97ba1b5c1aafe0ec4baa47133d4dffce3c97 Mon Sep 17 00:00:00 2001
From: Shayne Halvorson <N78291@gmail.com>
Date: Tue, 6 May 2014 13:31:16 -0500
Subject: [PATCH] Replace corrosion with a temporary effect.
If your equipment would have been corroded under the old system,
you now get a temporary (but stacking) -5 AC and -3 weapon damage.
Corrosion against armour-wearing monsters instead halves their AC.
---
crawl-ref/source/attack.cc | 3 +++
crawl-ref/source/enum.h | 2 ++
crawl-ref/source/items.cc | 26 ++++++++++----------------
crawl-ref/source/mon-ench.cc | 11 +++++++++--
crawl-ref/source/mon-info.cc | 4 ++++
crawl-ref/source/mon-info.h | 1 +
crawl-ref/source/monster.cc | 4 ++++
crawl-ref/source/output.cc | 15 ++++++++++++++-
crawl-ref/source/player-reacts.cc | 8 ++++++++
crawl-ref/source/player.cc | 4 ++++
crawl-ref/source/status.cc | 2 ++
crawl-ref/source/wiz-you.cc | 3 ++-
12 files changed, 63 insertions(+), 20 deletions(-)
diff --git a/crawl-ref/source/attack.cc b/crawl-ref/source/attack.cc
index 0727a3e..9f9619c 100644
--- a/crawl-ref/source/attack.cc
+++ b/crawl-ref/source/attack.cc
@@ -1365,6 +1365,9 @@ int attack::player_apply_slaying_bonuses(int damage, bool aux)
if (weapon->base_type == OBJ_RODS)
damage_plus = weapon->special;
+
+ if (you.duration[DUR_CORROSION] && !is_artefact(*weapon))
+ damage_plus -= 3 * you.props["corrosion_amount"].get_int();
}
damage_plus += slaying_bonus(PWPN_DAMAGE,
!weapon && wpn_skill == SK_THROWING
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index d558874..0bbdabb 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1692,6 +1692,7 @@ enum duration_type
DUR_ABJURATION_AURA,
DUR_MESMERISE_IMMUNE,
DUR_NO_POTIONS,
+ DUR_CORROSION,
NUM_DURATIONS
};
@@ -1821,6 +1822,7 @@ enum enchant_type
ENCH_SAP_MAGIC,
ENCH_SHROUD,
ENCH_PHANTOM_MIRROR,
+ ENCH_CORROSION,
// Update enchantment names in mon-ench.cc when adding or removing
// enchantments.
NUM_ENCHANTMENTS
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index a2990ed..5896dd5 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -47,6 +47,7 @@
#include "makeitem.h"
#include "message.h"
#include "misc.h"
+#include "mon-ench.h"
#include "notes.h"
#include "options.h"
#include "orb.h"
@@ -4106,14 +4107,12 @@ void corrode_item(item_def &item, actor *holder)
if (holder && holder->is_player())
{
- mprf("The acid corrodes %s!", item.name(DESC_YOUR).c_str());
+ you.increase_duration(DUR_CORROSION, 10 + roll_dice(2, 4), 50,
+ "The acid corrodes your equipment!");
xom_is_stimulated(50);
-
- if (item.base_type == OBJ_ARMOUR)
- you.redraw_armour_class = true;
-
- if (you.equip[EQ_WEAPON] == item.link)
- you.wield_change = true;
+ you.props["corrosion_amount"].get_int()++;
+ you.redraw_armour_class = true;
+ you.wield_change = true;
}
else if (holder && holder->type == MONS_PLAYER_SHADOW)
return; // it's just a temp copy of the item
@@ -4126,18 +4125,13 @@ void corrode_item(item_def &item, actor *holder)
}
else
{
- mprf("The acid corrodes %s %s!",
- apostrophise(holder->name(DESC_THE)).c_str(),
- item.name(DESC_PLAIN).c_str());
+ mprf("The acid corrodes %s equipment!",
+ apostrophise(holder->name(DESC_THE)).c_str());
}
}
- how_rusty--;
-
- if (item.base_type == OBJ_WEAPONS)
- item.plus2 = how_rusty;
- else
- item.plus = how_rusty;
+ if (holder && holder->is_monster())
+ holder->as_monster()->add_ench(mon_enchant(ENCH_CORROSION, 0));
}
// If there is only one unidentified subtype left in the item's object type,
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc
index 7356c19..fecba39 100644
--- a/crawl-ref/source/mon-ench.cc
+++ b/crawl-ref/source/mon-ench.cc
@@ -961,6 +961,11 @@ void monster::remove_enchantment_effect(const mon_enchant &me, bool quiet)
simple_monster_message(this, " is no longer being sapped.");
break;
+ case ENCH_CORROSION:
+ if (!quiet)
+ simple_monster_message(this, " is no longer covered in acid.");
+ break;
+
default:
break;
}
@@ -1070,7 +1075,7 @@ void monster::timeout_enchantments(int levels)
case ENCH_BLIND: case ENCH_WORD_OF_RECALL: case ENCH_INJURY_BOND:
case ENCH_FLAYED: case ENCH_BARBS:
case ENCH_AGILE: case ENCH_FROZEN: case ENCH_EPHEMERAL_INFUSION:
- case ENCH_BLACK_MARK: case ENCH_SAP_MAGIC:
+ case ENCH_BLACK_MARK: case ENCH_SAP_MAGIC: case ENCH_CORROSION:
lose_ench_levels(i->second, levels);
break;
@@ -1286,6 +1291,7 @@ void monster::apply_enchantment(const mon_enchant &me)
case ENCH_FROZEN:
case ENCH_EPHEMERAL_INFUSION:
case ENCH_SAP_MAGIC:
+ case ENCH_CORROSION:
// case ENCH_ROLLING:
decay_enchantment(en);
break;
@@ -2169,7 +2175,7 @@ static const char *enchant_names[] =
#endif
"poison_vuln", "icemail", "agile",
"frozen", "ephemeral_infusion", "black_mark", "grand_avatar",
- "sap magic", "shroud", "phantom_mirror", "buggy",
+ "sap magic", "shroud", "phantom_mirror", "corrosion", "buggy",
};
static const char *_mons_enchantment_name(enchant_type ench)
@@ -2326,6 +2332,7 @@ int mon_enchant::calc_duration(const monster* mons,
cturn = 300 / _mod_speed(25, mons->speed);
break;
case ENCH_SLOW:
+ case ENCH_CORROSION:
cturn = 250 / (1 + modded_speed(mons, 10));
break;
case ENCH_FEAR:
diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc
index 6f6ba1e..24b9a13 100644
--- a/crawl-ref/source/mon-info.cc
+++ b/crawl-ref/source/mon-info.cc
@@ -200,6 +200,8 @@ static monster_info_flags ench_to_mb(const monster& mons, enchant_type ench)
return MB_SAP_MAGIC;
case ENCH_SHROUD:
return MB_SHROUD;
+ case ENCH_CORROSION:
+ return MB_CORROSION;
default:
return NUM_MB_FLAGS;
}
@@ -1602,6 +1604,8 @@ vector<string> monster_info::attributes() const
v.push_back("magic-sapped");
if (is(MB_SHROUD))
v.push_back("shrouded");
+ if (is(MB_CORROSION))
+ v.push_back("covered in acid");
return v;
}
diff --git a/crawl-ref/source/mon-info.h b/crawl-ref/source/mon-info.h
index fd5e64a..9ba65c9 100644
--- a/crawl-ref/source/mon-info.h
+++ b/crawl-ref/source/mon-info.h
@@ -117,6 +117,7 @@ enum monster_info_flags
MB_BLACK_MARK,
MB_SAP_MAGIC,
MB_SHROUD,
+ MB_CORROSION,
NUM_MB_FLAGS
};
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index a135d87..3c7f5a4 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3418,10 +3418,14 @@ int monster::armour_class() const
if (has_ench(ENCH_WITHDRAWN))
a += 10;
+
// Penalty due to bad temp mutations.
if (has_ench(ENCH_WRETCHED))
a -= get_ench(ENCH_WRETCHED).degree;
+ if (has_ench(ENCH_CORROSION))
+ a /= 2;
+
return max(a, 0);
}
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 7b45d14..f3ffd7c 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -29,6 +29,7 @@
#include "godabil.h"
#include "initfile.h"
#include "itemname.h"
+#include "itemprop.h"
#include "items.h"
#include "lang-fake.h"
#include "libutil.h"
@@ -750,6 +751,8 @@ static void _print_stats_ac(int x, int y)
CGOTOXY(x+4, y, GOTO_STAT);
if (you.duration[DUR_ICY_ARMOUR] || player_stoneskin() || player_icemail_armour_class())
textcolor(LIGHTBLUE);
+ else if (you.duration[DUR_CORROSION])
+ textcolor(RED);
else
textcolor(HUD_VALUE_COLOUR);
string ac = make_stringf("%2d ", you.armour_class());
@@ -790,7 +793,16 @@ static void _print_stats_wp(int y)
string text;
if (you.weapon())
{
- const item_def& wpn = *you.weapon();
+ item_def wpn = *you.weapon();
+
+ if (you.duration[DUR_CORROSION] && is_melee_weapon(wpn) &&
+ !is_artefact(wpn))
+ {
+ if (wpn.base_type == OBJ_RODS)
+ wpn.special -= 3 * you.props["corrosion_amount"].get_int();
+ else
+ wpn.plus2 -= 3 * you.props["corrosion_amount"].get_int();
+ }
const string prefix = item_prefix(wpn);
const int prefcol = menu_colour(wpn.name(DESC_INVENTORY), prefix);
@@ -1044,6 +1056,7 @@ static void _get_status_lights(vector<status_light>& out)
DUR_BRILLIANCE,
DUR_MIGHT,
DUR_NO_POTIONS,
+ DUR_CORROSION,
};
status_info inf;
diff --git a/crawl-ref/source/player-reacts.cc b/crawl-ref/source/player-reacts.cc
index a706608..a224d11 100644
--- a/crawl-ref/source/player-reacts.cc
+++ b/crawl-ref/source/player-reacts.cc
@@ -1016,6 +1016,14 @@ static void _decrement_durations()
_decrement_a_duration(DUR_SAP_MAGIC, delay,
"Your magic seems less tainted.");
+ if (_decrement_a_duration(DUR_CORROSION, delay,
+ "You repair your equipment."))
+ {
+ you.props["corrosion_amount"] = 0;
+ you.redraw_armour_class = true;
+ you.wield_change = true;
+ }
+
if (!you.duration[DUR_SAP_MAGIC])
{
_decrement_a_duration(DUR_MAGIC_SAPPED, delay,
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index a214d7f..5817c90 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4270,6 +4270,7 @@ void display_char_status()
STATUS_MAGIC_SAPPED,
DUR_PORTAL_PROJECTILE,
DUR_NO_POTIONS,
+ DUR_CORROSION,
};
status_info inf;
@@ -6643,6 +6644,9 @@ int player::armour_class() const
if (mutation[MUT_ICEMAIL])
AC += 100 * player_icemail_armour_class();
+ if (you.duration[DUR_CORROSION])
+ AC -= 500 * you.props["corrosion_amount"].get_int();
+
if (!player_is_shapechanged()
|| (form == TRAN_DRAGON && player_genus(GENPC_DRACONIAN))
|| (form == TRAN_STATUE && species == SP_GARGOYLE))
diff --git a/crawl-ref/source/status.cc b/crawl-ref/source/status.cc
index 93f1bec..3c44414 100644
--- a/crawl-ref/source/status.cc
+++ b/crawl-ref/source/status.cc
@@ -167,6 +167,8 @@ static duration_def duration_data[] =
BLUE, "Abj", "aura of abjuration", "You are abjuring all hostile summons around you." },
{ DUR_NO_POTIONS, false,
RED, "-Potion", "no potions", "You cannot drink potions." },
+ { DUR_CORROSION, false,
+ RED, "Corr", "corroded equipment", "Your equipment is corroded." },
};
static int duration_index[NUM_DURATIONS];
diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc
index ed31705..5339023 100644
--- a/crawl-ref/source/wiz-you.cc
+++ b/crawl-ref/source/wiz-you.cc
@@ -878,7 +878,8 @@ static const char* dur_names[] =
"dragon call cooldown",
"aura of abjuration",
"mesmerisation immunity",
- "no potions"
+ "no potions",
+ "corrosion"
};
void wizard_edit_durations(void)
--
1.7.9.5
|