static void _shatter_device_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Shatter Device"); break; case SPELL_DESC: var_set_string(res, "Destroy a magical device in your inventory for various effects."); break; case SPELL_CAST: { obj_prompt_t prompt = {0}; var_set_bool(res, FALSE); prompt.prompt = "Shatter which device?"; prompt.error = "You have nothing to shatter."; prompt.filter = object_is_device; prompt.where[0] = INV_PACK; prompt.where[1] = INV_FLOOR; obj_prompt(&prompt); if (!prompt.obj) return; var_set_bool(res, TRUE); if (prompt.obj->activation.type == EFFECT_NONE) { msg_print("Nothing happens."); } else if (prompt.obj->activation.type == EFFECT_DESTRUCTION) { if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), 4 * p_ptr->lev)) msg_print("The dungeon collapses..."); else msg_print("The dungeon trembles."); } else if ( prompt.obj->activation.type == EFFECT_HEAL_CURING || prompt.obj->activation.type == EFFECT_HEAL_CURING_HERO || prompt.obj->activation.type == EFFECT_RESTORING ) { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0, TRUE); (void)set_blind(0, TRUE); (void)set_confused(0, TRUE); (void)set_image(0, TRUE); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); update_stuff(); /* hp may change if Con was drained ... */ hp_player(5000); } else if ( prompt.obj->activation.type == EFFECT_TELEPORT_AWAY || prompt.obj->activation.type == EFFECT_BANISH_EVIL || prompt.obj->activation.type == EFFECT_BANISH_ALL ) { banish_monsters(p_ptr->lev * 4); } else { project(0, 5, py, px, prompt.obj->activation.difficulty * 16, _object_dam_type(prompt.obj), PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1); } prompt.obj->number--; obj_release(prompt.obj, 0); break; } default: default_spell(cmd, res); break; } }
static void _shatter_device_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, "Shatter Device"); break; case SPELL_DESC: var_set_string(res, "Destroy a magical device in your inventory for various effects."); break; case SPELL_CAST: { int item; object_type *o_ptr; var_set_bool(res, FALSE); item_tester_hook = object_is_device; if (!get_item(&item, "Shatter which device?", "You have nothing to shatter.", USE_INVEN)) return; o_ptr = &inventory[item]; var_set_bool(res, TRUE); if (o_ptr->activation.type == EFFECT_NONE) { msg_print("Nothing happens."); } else if (o_ptr->activation.type == EFFECT_DESTRUCTION) { if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), 4 * p_ptr->lev)) msg_print("The dungeon collapses..."); else msg_print("The dungeon trembles."); } else if ( o_ptr->activation.type == EFFECT_HEAL_CURING || o_ptr->activation.type == EFFECT_HEAL_CURING_HERO || o_ptr->activation.type == EFFECT_RESTORING ) { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0, TRUE); (void)set_blind(0, TRUE); (void)set_confused(0, TRUE); (void)set_image(0, TRUE); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); update_stuff(); /* hp may change if Con was drained ... */ hp_player(5000); } else if ( o_ptr->activation.type == EFFECT_TELEPORT_AWAY || o_ptr->activation.type == EFFECT_BANISH_EVIL || o_ptr->activation.type == EFFECT_BANISH_ALL ) { banish_monsters(p_ptr->lev * 4); } else { project(0, 5, py, px, o_ptr->activation.difficulty * 16, _object_dam_type(o_ptr), PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1); } inven_item_increase(item, -1); inven_item_describe(item); inven_item_optimize(item); break; } default: default_spell(cmd, res); break; } }
static void _shatter_device_spell(int cmd, variant *res) { switch (cmd) { case SPELL_NAME: var_set_string(res, T("Shatter Device", "")); break; case SPELL_DESC: var_set_string(res, T("Destroy a magical device in your inventory for various effects.", "")); break; case SPELL_CAST: { int item; object_type *o_ptr; var_set_bool(res, FALSE); item_tester_hook = item_tester_hook_recharge; if (!get_item(&item, "Shatter which device?", "You have nothing to shatter.", USE_INVEN)) return; o_ptr = &inventory[item]; var_set_bool(res, TRUE); if (_object_is_(o_ptr, TV_STAFF, SV_STAFF_DESTRUCTION)) { if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), 4 * p_ptr->lev)) msg_print("The dungeon collapses..."); else msg_print("The dungeon trembles."); } else if ( _object_is_(o_ptr, TV_STAFF, SV_STAFF_HEALING) || _object_is_(o_ptr, TV_ROD, SV_ROD_HEALING) || _object_is_(o_ptr, TV_ROD, SV_ROD_RESTORATION) ) { msg_print("You feel life flow through your body!"); restore_level(); (void)set_poisoned(0, TRUE); (void)set_blind(0, TRUE); (void)set_confused(0, TRUE); (void)set_image(0, TRUE); (void)set_stun(0, TRUE); (void)set_cut(0, TRUE); (void)do_res_stat(A_STR); (void)do_res_stat(A_CON); (void)do_res_stat(A_DEX); (void)do_res_stat(A_WIS); (void)do_res_stat(A_INT); (void)do_res_stat(A_CHR); update_stuff(); hp_player(5000); } else if (_object_is_(o_ptr, TV_ROD, SV_ROD_TELEPORT_AWAY)) { banish_monsters(p_ptr->lev * 4); } else { project(0, 5, py, px, k_info[o_ptr->k_idx].level * 16, _object_dam_type(o_ptr), PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1); } inven_item_increase(item, -1); inven_item_describe(item); inven_item_optimize(item); break; } default: default_spell(cmd, res); break; } }