summaryrefslogtreecommitdiff
path: root/src/xtra1.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-05 23:42:13 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-07 15:28:26 +0200
commit62e385cb769000cfefa052b1ab3e155314e7ac37 (patch)
treea3f9acc5147789393128df51dadd0599c4aacb5e /src/xtra1.c
parenta9b597979d99a53c56d2fa5b8498834364fef7a9 (diff)
Lua: Move HOOK_CALC_BONUS corruption code to C
Diffstat (limited to 'src/xtra1.c')
-rw-r--r--src/xtra1.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/xtra1.c b/src/xtra1.c
index 1d2d8ba0..c30d6e4d 100644
--- a/src/xtra1.c
+++ b/src/xtra1.c
@@ -2503,6 +2503,78 @@ static void calc_schools()
}
}
+/* Apply corruptions */
+static void calc_corruptions()
+{
+ if (player_has_corruption(CORRUPT_BALROG_AURA))
+ {
+ p_ptr->xtra_f3 |= TR3_SH_FIRE;
+ p_ptr->xtra_f3 |= TR3_LITE1;
+ }
+
+ if (player_has_corruption(CORRUPT_BALROG_WINGS))
+ {
+ p_ptr->xtra_f4 |= TR4_FLY;
+ p_ptr->stat_add[A_CHR] -= 4;
+ p_ptr->stat_add[A_DEX] -= 2;
+ }
+
+ if (player_has_corruption(CORRUPT_BALROG_STRENGTH))
+ {
+ p_ptr->stat_add[A_STR] += 3;
+ p_ptr->stat_add[A_CON] += 1;
+ p_ptr->stat_add[A_DEX] -= 3;
+ p_ptr->stat_add[A_CHR] -= 1;
+ }
+
+ if (player_has_corruption(CORRUPT_DEMON_SPIRIT))
+ {
+ p_ptr->stat_add[A_INT] += 1;
+ p_ptr->stat_add[A_CHR] -= 2;
+ }
+
+ if (player_has_corruption(CORRUPT_DEMON_HIDE))
+ {
+ p_ptr->to_a = p_ptr->to_a + p_ptr->lev;
+ p_ptr->dis_to_a = p_ptr->dis_to_a + p_ptr->lev;
+ p_ptr->pspeed = p_ptr->pspeed - (p_ptr->lev / 7);
+ if (p_ptr->lev >= 40)
+ {
+ p_ptr->xtra_f2 |= TR2_IM_FIRE;
+ }
+ }
+
+ if (player_has_corruption(CORRUPT_DEMON_REALM))
+ {
+ /* 1500 may seem a lot, but people are rather unlikely to
+ get the corruption very soon due to the dependencies. */
+ if (s_info[SKILL_DAEMON].mod == 0)
+ {
+ s_info[SKILL_DAEMON].mod = 1500;
+ }
+ s_info[SKILL_DAEMON].hidden = FALSE;
+ }
+
+ if (player_has_corruption(CORRUPT_RANDOM_TELEPORT))
+ {
+ p_ptr->xtra_f3 |= TR3_TELEPORT;
+ }
+
+ if (player_has_corruption(CORRUPT_ANTI_TELEPORT))
+ {
+ if (p_ptr->corrupt_anti_teleport_stopped == FALSE)
+ {
+ p_ptr->resist_continuum = TRUE;
+ }
+ }
+
+ if (player_has_corruption(CORRUPT_TROLL_BLOOD))
+ {
+ p_ptr->xtra_f3 |= (TR3_REGEN | TR3_AGGRAVATE);
+ p_ptr->xtra_esp |= ESP_TROLL;
+ }
+}
+
/* Apply flags */
static int extra_blows;
static int extra_shots;
@@ -2920,6 +2992,9 @@ void calc_bonuses(bool_ silent)
/* Take care of spell schools */
calc_schools();
+ /* Take care of corruptions */
+ calc_corruptions();
+
/* The powers gived by the wielded monster */
calc_wield_monster();