summaryrefslogtreecommitdiff
path: root/src/lua_bind.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-07 14:50:36 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-07 15:28:27 +0200
commita01f15e08da3b2e0e326b2a94100e17962136741 (patch)
treefa07a987e816cc752f909b689e2118f6c963c3b3 /src/lua_bind.c
parent41b6617e992d3fedda4c0a93ddd0fa4ad834a2ae (diff)
Lua: Refactor all the corruption code into C
Diffstat (limited to 'src/lua_bind.c')
-rw-r--r--src/lua_bind.c166
1 files changed, 0 insertions, 166 deletions
diff --git a/src/lua_bind.c b/src/lua_bind.c
index 1add61e3..df335dd3 100644
--- a/src/lua_bind.c
+++ b/src/lua_bind.c
@@ -586,173 +586,7 @@ void lua_display_list(int y, int x, int h, int w, cptr title, list_type* list, i
display_list(y, x, h, w, title, list->list, max, begin, sel, sel_color);
}
-/*
- * Corruptions
- */
-bool_ player_has_corruption(int corruption_idx)
-{
- if (corruption_idx < 0)
- {
- return FALSE;
- }
-
-
-
- return (p_ptr->corruptions[corruption_idx]);
-}
-
-bool_ player_can_gain_corruption(int corruption_idx)
-{
- cptr r_name = rp_ptr->title + rp_name;
- bool_ allowed = TRUE; /* Allowed by default */
-
- assert(corruption_idx >= 0);
-
- if (corruption_idx == CORRUPT_TROLL_BLOOD)
- {
- /* Ok trolls should not get this one. never. */
- if (streq(r_name, "Troll"))
- {
- allowed = FALSE;
- }
- }
-
- /* Theme module adds additional restrictions for Maiar */
-
- if (game_module_idx == MODULE_THEME)
- {
- if (streq(r_name, "Maia"))
- {
- /* We use a whitelist of corruptions for Maiar */
- bool_ allow = FALSE;
- if ((corruption_idx == CORRUPT_BALROG_AURA) ||
- (corruption_idx == CORRUPT_BALROG_WINGS) ||
- (corruption_idx == CORRUPT_BALROG_STRENGTH) ||
- (corruption_idx == CORRUPT_BALROG_FORM) ||
- (corruption_idx == CORRUPT_DEMON_BREATH))
- {
- allow = TRUE;
- };
-
- /* Mix result into 'allowed' flag */
- allowed = allowed & allow;
- }
- }
-
- /* Result */
- return allowed;
-}
-
-static void subrace_add_power(player_race_mod *rmp_ptr, int power)
-{
- int i;
-
- for (i=0; i<4; i++)
- {
- if (rmp_ptr->powers[i] == -1)
- {
- rmp_ptr->powers[i] = power;
- return;
- }
- }
-}
-static void player_gain_vampire_teeth()
-{
- player_race_mod *rmp_ptr = NULL;
-
- switch_subrace(SUBRACE_SAVE, TRUE);
-
- rmp_ptr = &race_mod_info[SUBRACE_SAVE];
- subrace_add_power(rmp_ptr, PWR_VAMPIRISM);
- rmp_ptr->flags1 = rmp_ptr->flags1
- | PR1_VAMPIRE
- | PR1_UNDEAD
- | PR1_NO_SUBRACE_CHANGE;
-}
-
-static void player_gain_vampire_strength()
-{
- player_race_mod *rmp_ptr = &race_mod_info[SUBRACE_SAVE];
- /* Apply the bonuses/penalities */
- rmp_ptr->r_mhp = rmp_ptr->r_mhp + 1;
- rmp_ptr->r_exp = rmp_ptr->r_exp + 100;
-
- rmp_ptr->r_adj[A_STR + 1] = rmp_ptr->r_adj[A_STR + 1] + 3;
- rmp_ptr->r_adj[A_INT + 1] = rmp_ptr->r_adj[A_INT + 1] + 2;
- rmp_ptr->r_adj[A_WIS + 1] = rmp_ptr->r_adj[A_WIS + 1] - 3;
- rmp_ptr->r_adj[A_DEX + 1] = rmp_ptr->r_adj[A_DEX + 1] - 2;
- rmp_ptr->r_adj[A_CON + 1] = rmp_ptr->r_adj[A_CON + 1] + 1;
- rmp_ptr->r_adj[A_CHR + 1] = rmp_ptr->r_adj[A_CHR + 1] - 4;
-
- /* be reborn! */
- do_rebirth();
- cmsg_print(TERM_L_DARK, "You feel death slipping inside.");
-}
-
-static void player_gain_vampire()
-{
- player_race_mod *rmp_ptr = &race_mod_info[SUBRACE_SAVE];
-
- /* Be a Vampire and be proud of it */
- cptr title = get_subrace_title(SUBRACE_SAVE);
- if (streq(title, " ") || streq(title, "Vampire"))
- {
- title = "Vampire";
- rmp_ptr->place = FALSE;
- set_subrace_title(SUBRACE_SAVE, title);
- }
- else
- {
- char buf[512];
- sprintf(buf, "Vampire %s", title);
- set_subrace_title(SUBRACE_SAVE, buf);
- }
-
- /* Bonus/and .. not bonus :) */
- rmp_ptr->flags1 = rmp_ptr->flags1 | PR1_HURT_LITE;
- rmp_ptr->oflags2[2] = rmp_ptr->oflags2[2]
- | TR2_RES_POIS
- | TR2_RES_NETHER
- | TR2_RES_COLD
- | TR2_RES_DARK
- | TR2_HOLD_LIFE;
- rmp_ptr->oflags3[2] = rmp_ptr->oflags3[2]
- | TR3_LITE1;
-}
-
-static void player_set_corruption(int c, bool_ set)
-{
- p_ptr->corruptions[c] = set;
- p_ptr->redraw = p_ptr->redraw | PR_BASIC;
- p_ptr->update = p_ptr->update | PU_BONUS | PU_TORCH | PU_BODY | PU_POWERS;
-
-}
-
-void player_gain_corruption(int corruption_idx)
-{
- player_set_corruption(corruption_idx, TRUE);
-
- if (corruption_idx == CORRUPT_VAMPIRE_TEETH)
- {
- player_gain_vampire_teeth();
- }
- else if (corruption_idx == CORRUPT_VAMPIRE_STRENGTH)
- {
- player_gain_vampire_strength();
- }
- else if (corruption_idx == CORRUPT_VAMPIRE_VAMPIRE)
- {
- player_gain_vampire();
- }
-}
-
-void player_lose_corruption(int corruption_idx)
-{
- player_set_corruption(corruption_idx, FALSE);
- /* Currently no corruptions need
- any special handling when lost */
-}
/*
* Gods