static bool _destroy_object(obj_ptr obj) { if (obj->tval == TV_LIFE_BOOK || obj->tval == TV_CRUSADE_BOOK) { char name[MAX_NLEN]; int sp = 0; int osp = p_ptr->csp; switch (obj->sval) { case 0: sp = 10; break; case 1: sp = 25; break; case 2: sp = 100; break; case 3: sp = 666; break; } sp_player(sp); object_desc(name, obj, OD_COLOR_CODED); msg_format("You gleefully destroy %s!", name); if (p_ptr->csp > osp) msg_print("You feel your head clear."); return TRUE; } return FALSE; }
static void _rage_strike_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Ragestrike"); break; case SPELL_DESC: var_set_string(res, "Fire a ball of pure rage at chosen foe, striking with everything you've got!"); break; case SPELL_INFO: var_set_string(res, info_damage(0, 0, _rage_strike_dam())); break; case SPELL_FAIL: sp_player(-p_ptr->csp); break; case SPELL_CAST: { int dir; var_set_bool(res, FALSE); if (p_ptr->chp < 100) { if (!get_check("Really? This will kill you!")) return; } if (!get_aim_dir(&dir)) return; fire_ball(GF_MISSILE, dir, _rage_strike_dam(), 0); take_hit(DAMAGE_NOESCAPE, 100, "Rage", -1); if (!p_ptr->shero) set_stun(99, FALSE); /* 100 is Knocked Out */ sp_player(-p_ptr->csp); /* Don't use SPELL_COST_EXTRA since we pay mana up front these days! */ 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; } }