void amnesia_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Amnesia"); break; case SPELL_DESC: var_set_string(res, "Attempt to make target monster forget something."); break; case SPELL_CAST: { int dir = 0; int lvl = p_ptr->lev; if (p_ptr->lev > 40) lvl += (p_ptr->lev - 40) * 2; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; project_hook(GF_AMNESIA, dir, lvl, PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void android_ray_gun_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Ray Gun"); break; case SPELL_DESC: var_set_string(res, "Fires unresistable damage at chosen foe."); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, spell_power(5 + (p_ptr->lev+1) / 2))); break; case SPELL_CAST: { int dir = 0; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; msg_print("You fire your ray gun."); fire_bolt(GF_MISSILE, dir, spell_power(5 + (p_ptr->lev+1) / 2)); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
/********************************************************************** * Leprechaun Spells and Abilities **********************************************************************/ void _fanaticism_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Fanaticism"); break; case SPELL_DESC: var_set_string(res, "Summon many devoted leprechaun servants at chosen foe."); break; case SPELL_CAST: { int x, y, i; var_set_bool(res, FALSE); if (!target_set(TARGET_KILL)) return; x = target_col; y = target_row; for (i = 0; i < 8; i++) summon_named_creature(-1, y, x, MON_LEPRECHAUN_FANATIC, PM_FORCE_PET); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _summon_horde_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Summon Horde"); break; case SPELL_DESC: var_set_string(res, "Summons Warriors of the Dawn for assistance."); break; case SPELL_CAST: { int num = 3 + randint1(3); int mode = PM_FORCE_PET; int i; if (p_ptr->shero) mode |= PM_HASTE; for (i = 0; i < num; i++) { summon_named_creature(-1, py, px, MON_DAWN, mode); } var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _shout_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Shout"); break; case SPELL_DESC: var_set_string(res, "Projects a cone of sound at a chosen foe."); break; case SPELL_INFO: var_set_string(res, info_damage(3 + (p_ptr->lev-1)/5, 4, 0)); break; case SPELL_CAST: { int dir; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; fire_ball(GF_SOUND, dir, damroll(3 + (p_ptr->lev-1)/5, 4), -2); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void acid_ball_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Acid Ball"); break; case SPELL_DESC: var_set_string(res, "Generate an Acid Ball on chosen target."); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, spell_power(3*p_ptr->lev/2 + 35 + p_ptr->to_d_spell))); break; case SPELL_CAST: { int dir = 0; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; fire_ball(GF_ACID, dir, spell_power(3*p_ptr->lev/2 + 35 + p_ptr->to_d_spell), 2); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void android_bazooka_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Bazooka"); break; case SPELL_DESC: var_set_string(res, "Fires your bazooka at a nearby monster."); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, spell_power(25 + p_ptr->lev * 2))); break; case SPELL_CAST: { int dir = 0; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; msg_print("You fire your bazooka."); fire_ball(GF_MISSILE, dir, spell_power(25 + p_ptr->lev * 2), 2); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _summon_spiders_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Summon Spiders"); break; case SPELL_DESC: var_set_string(res, "Summon spiders for assistance."); break; case SPELL_CAST: { int num = 1; /* randint0(p_ptr->lev/10); */ int ct = 0, i; int l = p_ptr->lev + randint1(p_ptr->lev); for (i = 0; i < num; i++) { ct += summon_specific(-1, py, px, l, SUMMON_SPIDER, PM_FORCE_PET | PM_ALLOW_GROUP); } if (!ct) msg_print("No spiders arrive."); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _barbaric_resistance_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Barbaric Resistance"); break; case SPELL_DESC: var_set_string(res, "Grants temporary protection from the elements."); break; case SPELL_CAST: { int base = 10; if (p_ptr->shero) base = 20; set_oppose_acid(randint1(base) + base, FALSE); set_oppose_elec(randint1(base) + base, FALSE); set_oppose_fire(randint1(base) + base, FALSE); set_oppose_cold(randint1(base) + base, FALSE); set_oppose_pois(randint1(base) + base, FALSE); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void battle_frenzy_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Battle Frenzy"); break; case SPELL_DESC: var_set_string(res, "Gives another bonus to hit and HP, resistance to fear for a while. Hastes you. But decreases AC."); break; case SPELL_CAST: { int b_base = spell_power(25); int sp_base = spell_power(p_ptr->lev / 2); int sp_sides = 20 + p_ptr->lev / 2; set_shero(randint1(b_base) + b_base, FALSE); set_fast(randint1(sp_sides) + sp_base, FALSE); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void acid_bolt_spell(int cmd, variant *res) { int dd = 5 + p_ptr->lev / 4; int ds = 8; switch (cmd) { case SPELL_NAME: var_set_string(res, "Acid Bolt"); break; case SPELL_DESC: var_set_string(res, "Fires a bolt or beam of acid."); break; case SPELL_INFO: var_set_string(res, info_damage(dd, spell_power(ds), spell_power(p_ptr->to_d_spell))); break; case SPELL_CAST: { int dir = 0; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; fire_bolt_or_beam( beam_chance(), GF_ACID, dir, spell_power(damroll(dd, ds) + p_ptr->to_d_spell) ); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void android_rocket_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Rocket Launcher"); break; case SPELL_DESC: var_set_string(res, "Launches a powerful rocket at your opponent."); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, spell_power(p_ptr->lev * 7))); break; case SPELL_CAST: { int dir = 0; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; msg_print("You launch a rocket."); fire_rocket(GF_ROCKET, dir, spell_power(p_ptr->lev * 7), 2); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void android_beam_cannon_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Beam Cannon"); break; case SPELL_DESC: var_set_string(res, ""); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, spell_power(25 + p_ptr->lev * 3))); break; case SPELL_CAST: { int dir = 0; var_set_bool(res, FALSE); if (!get_aim_dir(&dir)) return; msg_print("You fire a beam cannon."); fire_beam(GF_MISSILE, dir, spell_power(25 + p_ptr->lev * 3)); var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void _rodeo_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Rodeo"); break; case SPELL_DESC: var_set_string(res, ""); break; case SPELL_CAST: { char m_name[80]; monster_type *m_ptr; monster_race *r_ptr; int rlev; var_set_bool(res, FALSE); if (p_ptr->riding) { msg_print("You are already riding."); return; } if (!do_riding(TRUE)) return; var_set_bool(res, TRUE); m_ptr = &m_list[p_ptr->riding]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); msg_format("You ride on %s.", m_name); if (is_pet(m_ptr)) break; rlev = r_ptr->level; if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2; if (rlev > 60) rlev = 60+(rlev-60)/2; if ( randint1(skills_riding_current() / 120 + p_ptr->lev * 2 / 3) > rlev && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & RF7_GUARDIAN) && !(r_ptr->flags1 & RF1_QUESTOR) && rlev < p_ptr->lev * 3 / 2 + randint0(p_ptr->lev / 5) ) { msg_format("You tame %s.", m_name); set_pet(m_ptr); } else { msg_format("You have thrown off by %s.", m_name); rakuba(1,TRUE); p_ptr->riding = 0; } break; } default: default_spell(cmd, res); break; } }
void default_spell(int cmd, variant *res) /* Base class */ { switch (cmd) { case SPELL_NAME: var_set_string(res, "Unknown Spell"); break; case SPELL_DESC: case SPELL_INFO: case SPELL_MUT_DESC: var_set_string(res, ""); break; case SPELL_GAIN_MUT: case SPELL_LOSE_MUT: var_clear(res); break; case SPELL_FAIL: case SPELL_STOP: case SPELL_CONT: var_set_bool(res, TRUE); break; case SPELL_CAST: msg_print("Zap?"); var_set_bool(res, TRUE); break; case SPELL_COST_EXTRA: case SPELL_FAIL_MIN: var_set_int(res, 0); break; case SPELL_ENERGY: var_set_int(res, 100); break; case SPELL_CALC_BONUS: var_set_bool(res, TRUE); break; case SPELL_COLOR: var_set_int(res, TERM_WHITE); break; case SPELL_ON_BROWSE: var_set_bool(res, FALSE); break; default: var_clear(res); break; } }
void _grasp_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Vampiric Grasp"); break; case SPELL_DESC: var_set_string(res, "Pulls a target creature to you."); break; case SPELL_CAST: { int m_idx; bool fear = FALSE; monster_type *m_ptr; monster_race *r_ptr; char m_name[MAX_NLEN]; var_set_bool(res, FALSE); if (!target_set(TARGET_KILL)) break; if (!cave[target_row][target_col].m_idx) break; if (!player_has_los_bold(target_row, target_col)) break; if (!projectable(py, px, target_row, target_col)) break; var_set_bool(res, TRUE); m_idx = cave[target_row][target_col].m_idx; m_ptr = &m_list[m_idx]; r_ptr = &r_info[m_ptr->r_idx]; monster_desc(m_name, m_ptr, 0); if (r_ptr->flagsr & RFR_RES_TELE) { if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flagsr & RFR_RES_ALL)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format("%s is unaffected!", m_name); break; } else if (r_ptr->level > randint1(100)) { if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE; msg_format("%s resists!", m_name); break; } } msg_format("You grasp %s.", m_name); teleport_monster_to(m_idx, py, px, 100, TELEPORT_PASSIVE); mon_take_hit(m_idx, damroll(10, 10), &fear, extract_note_dies(real_r_ptr(m_ptr))); break; } default: default_spell(cmd, res); break; } }
/********************************************************************** * Powers **********************************************************************/ static void _absorb_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Absorb Weapon"); break; case SPELL_DESC: var_set_string(res, "Destroys a single weapon, absorbing the essence of its power."); break; case SPELL_CAST: { object_type * o_ptr; int item; char o_name[MAX_NLEN]; var_set_bool(res, FALSE); item_tester_hook = object_is_melee_weapon; if (!get_item(&item, "Absorb which item? ", "You have nothing to absorb.", USE_INVEN | USE_FLOOR)) break; if (item >= 0) o_ptr = &inventory[item]; else o_ptr = &o_list[0 - item]; object_desc(o_name, o_ptr, OD_NAME_ONLY); msg_format("You absorb the power of %s!", o_name); _absorb(o_ptr); if (item >= 0) { inven_item_increase(item, -1); inven_item_describe(item); inven_item_optimize(item); } else { floor_item_increase(0 - item, -1); floor_item_describe(0 - item); floor_item_optimize(0 - item); } var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _charge_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Charge"); break; case SPELL_DESC: var_set_string(res, "Attacks monster with your weapons normally, then move through counter side of the monster."); break; case SPELL_CAST: { int dir, x, y; var_set_bool(res, FALSE); if (p_ptr->riding) { msg_print("You cannot do it when riding."); return; } if (!get_rep_dir2(&dir)) return; if (dir == 5) return; y = py + ddy[dir]; x = px + ddx[dir]; if (!cave[y][x].m_idx) { msg_print("There is no monster there."); return; } py_attack(y, x, 0); if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat)) { y += ddy[dir]; x += ddx[dir]; if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx) { msg_print(NULL); move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); } } var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _greater_focus_rage_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Focus *Rage*"); break; case SPELL_DESC: var_set_string(res, "Damage yourself and regain spell points."); break; case SPELL_INFO: if (p_ptr->shero) var_set_string(res, info_damage(0, 0, 2 * p_ptr->lev)); else var_set_string(res, info_damage(0, 0, 10 + p_ptr->lev)); break; case SPELL_FAIL: { int hp = 10 + p_ptr->lev; if (p_ptr->shero) hp = 2 * p_ptr->lev; take_hit(DAMAGE_NOESCAPE, hp, "Rage", -1); break; } case SPELL_CAST: { int hp = 10 + p_ptr->lev; var_set_bool(res, FALSE); if (p_ptr->shero) hp = 2 * p_ptr->lev; if (p_ptr->chp < hp) { if (!get_check("Really? This will kill you!")) return; } take_hit(DAMAGE_NOESCAPE, hp, "Rage", -1); sp_player(hp * 2); _unclear_mind = FALSE; /* Hack to avoid automatic mana drain for this action */ var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
void spider_web_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Spider Web"); break; case SPELL_DESC: var_set_string(res, "Weaves a fine, silky web which obstructs the movement of all save spiders."); break; case SPELL_CAST: if (p_ptr->lev >= 50) project(0, 1, py, px, 0, GF_WEB, PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE, -1); else { int attempts = 0; int max_attempts = _web_attempts(); int x, y, dir; _place_web(py, px); for (;;) { if (attempts >= max_attempts) break; dir = randint0(9); if (dir == 5) continue; attempts++; y = py + ddy[dir]; x = px + ddx[dir]; _place_web(y, x); } } p_ptr->update |= PU_FLOW; p_ptr->redraw |= PR_MAP; var_set_bool(res, TRUE); break; case SPELL_COST_EXTRA: if (p_ptr->lev >= 50) var_set_int(res, 20); else var_set_int(res, _web_attempts() * 2); break; default: default_spell(cmd, res); break; } }
void _blood_pool_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Blood Pool"); break; case SPELL_DESC: var_set_string(res, "Creates a macabre Potion of Healing made of your own blood."); break; case SPELL_SPOIL_DESC: var_set_string(res, "Create a potion of blood. Player is limited to 30 such potions, and may neither " "drop, throw nor sell them. Quaffing a potion of blood heals 100hp and cures " "blindness, confusion, poison and stuns."); break; case SPELL_CAST: { object_type forge; int ct = _count_blood_potions(); if (ct >= 30) { msg_print("You have too many blood potions at the moment. Why not drink some?"); var_set_bool(res, FALSE); return; } msg_print("You feel light headed."); object_prep(&forge, lookup_kind(TV_POTION, SV_POTION_BLOOD)); /* We can't just drop potions on the ground, or the user can spam the spell! */ if (!inven_carry_okay(&forge)) { msg_print("Your pack is full! The potion goes sour ..."); object_prep(&forge, lookup_kind(TV_POTION, SV_POTION_SALT_WATER)); drop_near(&forge, -1, py, px); } else { inven_carry(&forge); msg_print("You store your blood for future use."); } var_set_bool(res, TRUE); break; } default: default_spell(cmd, res); break; } }
static void _tunnel_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Tunnel"); break; case SPELL_DESC: var_set_string(res, "When using this technique you may move through walls."); break; default: _toggle_spell(MAULER_TOGGLE_TUNNEL, cmd, res); break; } }
static void _stealth_toggle_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Stealthy Approach"); break; case SPELL_DESC: var_set_string(res, "When using this technique, you will gain enhanced stealth."); break; default: _toggle_spell(MYSTIC_TOGGLE_STEALTH, cmd, res); break; } }
static void _shatter_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Shatter"); break; case SPELL_DESC: var_set_string(res, "When using this technique, your weapon will cause earthquakes."); break; default: _toggle_spell(MAULER_TOGGLE_SHATTER, cmd, res); break; } }
static void _splatter_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Splatter"); break; case SPELL_DESC: var_set_string(res, "When using this technique, monsters will explode as you kill them."); break; default: _toggle_spell(MAULER_TOGGLE_SPLATTER, cmd, res); break; } }
static void _maul_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Maul"); break; case SPELL_DESC: var_set_string(res, "When using this technique you will maul your opponents."); break; default: _toggle_spell(MAULER_TOGGLE_MAUL, cmd, res); break; } }
static void _drain_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Drain"); break; case SPELL_DESC: var_set_string(res, "When using this technique you will drain life from your foes. In addition, enemies will never fully recover from the wounds you inflict."); break; default: _toggle_spell(MAULER_TOGGLE_DRAIN, cmd, res); break; } }
static void _block_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Block"); break; case SPELL_DESC: var_set_string(res, "When using this technique, you will gain an AC bonus based on the weight of your current weapon."); break; default: _toggle_spell(MAULER_TOGGLE_BLOCK, cmd, res); break; } }
void hound_run_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Run"); break; case SPELL_DESC: var_set_string(res, "By moving quickly, you will be able to run down your prey or to flee quickly in a pinch."); break; default: quick_walk_spell(cmd, res); break; } }
void hound_leap_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Pounce"); break; case SPELL_DESC: var_set_string(res, "Leap towards a nearby prey and attack in a single action."); break; default: rush_attack_spell(cmd, res); break; } }