void display_pc_info() { short i,store; Str255 str; short pc; char to_draw[60]; short weap1 = 24,weap2 = 24,hit_adj = 0, dam_adj = 0,skill_item; pc = store_pc_num; store = pc_carry_weight(pc); i = amount_pc_can_carry(pc); sprintf ((char *) to_draw, "%s is carrying %d stones out of %d.",univ.party[pc].name.c_str(),store,i); csit(1019,69,(char *) to_draw); sprintf((char *) str,"%d out of %d.", univ.party[pc].cur_health,univ.party[pc].max_health); csit(1019,65,(char *) str); sprintf((char *) str,"%d out of %d.", univ.party[pc].cur_sp,univ.party[pc].max_sp); csit(1019,67,(char *) str); for (i = 0; i < 19; i++) { cdsin(1019,18 + i * 2,univ.party[pc].skills[i]); } store = total_encumberance(pc); cdsin(1019,62,store); csit(1019,9,univ.party[pc].name.c_str()); cdsin(1019,11,univ.party[pc].level); cdsin(1019,13,univ.party[pc].experience); cdsin(1019,71,univ.party[pc].skill_pts); store = univ.party[pc].level * univ.party[pc].get_tnl(); cdsin(1019,15,store); csp(1019,7,800 + univ.party[pc].which_graphic,PICT_PC); // Fight bonuses for (i = 0; i < 24; i++) if (((univ.party[pc].items[i].variety == 1) || (univ.party[pc].items[i].variety == 2)) && (univ.party[pc].equip[i] == true)) { if (weap1 == 24) weap1 = i; else weap2 = i; } hit_adj = stat_adj(pc,1) * 5 - (total_encumberance(pc)) * 5 + 5 * minmax(-8,8,univ.party[pc].status[1]); if ((univ.party[pc].traits[2] == false) && (weap2 < 24)) hit_adj -= 25; dam_adj = stat_adj(pc,0) + minmax(-8,8,univ.party[pc].status[1]); if ((skill_item = text_pc_has_abil_equip(pc,37)) < 24) { hit_adj += 5 * (univ.party[pc].items[skill_item].item_level / 2 + 1); dam_adj += univ.party[pc].items[skill_item].item_level / 2; } if ((skill_item = text_pc_has_abil_equip(pc,43)) < 24) { dam_adj += univ.party[pc].items[skill_item].item_level; hit_adj += univ.party[pc].items[skill_item].item_level * 2; } csit(1019,56,"No weapon."); csit(1019,57,""); csit(1019,59,"No weapon."); csit(1019,60,""); if (weap1 < 24) { if (!univ.party[pc].items[weap1].ident) csit(1019,56,"Not identified."); else { if (hit_adj + 5 * univ.party[pc].items[weap1].bonus < 0) sprintf(to_draw,"Penalty to hit: %%%d",hit_adj + 5 * univ.party[pc].items[weap1].bonus); else sprintf(to_draw,"Bonus to hit: +%%%d",hit_adj + 5 * univ.party[pc].items[weap1].bonus); csit(1019,56,to_draw); sprintf(to_draw,"Damage: (1-%d) + %d",univ.party[pc].items[weap1].item_level ,dam_adj + univ.party[pc].items[weap1].bonus); csit(1019,57,to_draw); } } if (weap2 < 24) { if (!univ.party[pc].items[weap2].ident) csit(1019,59,"Not identified."); else { if (hit_adj + 5 * univ.party[pc].items[weap2].bonus < 0) sprintf(to_draw,"Penalty to hit: %%%d",hit_adj + 5 * univ.party[pc].items[weap2].bonus); else sprintf(to_draw,"Bonus to hit: +%%%d",hit_adj + 5 * univ.party[pc].items[weap2].bonus); csit(1019,59,to_draw); sprintf(to_draw,"Damage: (1-%d) + %d",univ.party[pc].items[weap2].item_level ,dam_adj + univ.party[pc].items[weap2].bonus); csit(1019,60,to_draw); } } }
/* Use a staff. -RAK- */ void use() { int32u i; int j, k, item_val, chance, y, x; register int ident; register struct misc *m_ptr; register inven_type *i_ptr; free_turn_flag = TRUE; if (inven_ctr == 0) msg_print("But you are not carrying anything."); else if (!find_range(TV_STAFF, TV_NEVER, &j, &k)) msg_print("You are not carrying any staffs."); else if (get_item(&item_val, "Use which staff?", j, k, 0)) { i_ptr = &inventory[item_val]; free_turn_flag = FALSE; m_ptr = &py.misc; chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level - 5 + (class_level_adj[m_ptr->pclass][CLA_DEVICE] * m_ptr->lev / 3); if (py.flags.confused > 0) chance = chance / 2; if (chance <= 0) chance = 1; if (randint(chance) < USE_DEVICE) msg_print("You failed to use the staff properly."); else if (i_ptr->p1 > 0) { i = i_ptr->flags; ident = FALSE; (i_ptr->p1)--; switch(i) { case ST_HEALING: ident = hp_player(300); if (py.flags.stun>0) { if (py.flags.stun>50) { py.misc.ptohit+=20; py.misc.ptodam+=20; } else { py.misc.ptohit+=5; py.misc.ptodam+=5; } py.flags.stun=0; ident = TRUE; msg_print("You're head stops stinging."); } if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("You feel better."); } break; case ST_GENOCIDE: genocide(FALSE); ident = TRUE; break; case ST_PROBE: probing(); ident = TRUE; break; case ST_IDENTIFY: ident_spell(); ident = TRUE; break; case ST_HOLYNESS: dispel_creature(EVIL,120); protect_evil(); cure_poison(); remove_fear(); hp_player(50); if (py.flags.stun>0) { if (py.flags.stun>50) { py.misc.ptohit+=20; py.misc.ptodam+=20; } else { py.misc.ptohit+=5; py.misc.ptodam+=5; } py.flags.stun=0; ident = TRUE; msg_print("You're head stops stinging."); } if (py.flags.cut>0) { py.flags.cut=0; ident = TRUE; msg_print("You feel better."); } ident = TRUE; break; case ST_MAGI: if (res_stat(A_INT)) { msg_print("You have a warm feeling."); ident = TRUE; } m_ptr = &py.misc; if (m_ptr->cmana < m_ptr->mana) { m_ptr->cmana = m_ptr->mana; ident = TRUE; msg_print("Your feel your head clear."); prt_cmana(); } break; case ST_POWER: dispel_creature(0xFFFFFFFFL,120); break; case ST_SURROUND: map_area(); ident = TRUE; break; case ST_LIGHT: ident = light_area(char_row, char_col); break; case ST_DR_LC: ident = detect_sdoor(); break; case ST_TRP_LC: ident = detect_trap(); break; case ST_TRE_LC: ident = detect_treasure(); break; case ST_OBJ_LC: ident = detect_object(); break; case ST_TELE: teleport(100); ident = TRUE; break; case ST_EARTH: ident = TRUE; earthquake(); break; case ST_SUMMON: ident = FALSE; for (k = 0; k < randint(4); k++) { y = char_row; x = char_col; ident |= summon_monster(&y, &x, FALSE); } break; case ST_DEST: ident = TRUE; destroy_area(char_row, char_col); break; case ST_STAR: ident = TRUE; starlite(char_row, char_col); break; case ST_HAST_MN: ident = speed_monsters(1); break; case ST_SLOW_MN: ident = speed_monsters(-1); break; case ST_SLEE_MN: ident = sleep_monsters2(); break; case ST_CURE_LT: ident = hp_player(randint(8)); break; case ST_DET_INV: ident = detect_invisible(); break; case ST_SPEED: if (py.flags.fast == 0) ident = TRUE; if (py.flags.fast <= 0) py.flags.fast += randint(30) + 15; else py.flags.fast += randint(5); break; case ST_SLOW: if (py.flags.slow == 0) ident = TRUE; py.flags.slow += randint(30) + 15; break; case ST_REMOVE: if (remove_curse()) { if (py.flags.blind < 1) msg_print("The staff glows blue for a moment.."); ident = TRUE; } break; case ST_DET_EVI: ident = detect_evil(); break; case ST_CURING: if ((cure_blindness()) || (cure_poison()) || (cure_confusion()) || (py.flags.stun>0) || (py.flags.cut>0)) ident = TRUE; if (py.flags.stun>0) { if (py.flags.stun>50) { py.misc.ptohit+=20; py.misc.ptodam+=20; } else { py.misc.ptohit+=5; py.misc.ptodam+=5; } py.flags.stun=0; msg_print("You're head stops stinging."); } else if (py.flags.cut>0) { py.flags.cut=0; msg_print("You feel better."); } break; case ST_DSP_EVI: ident = dispel_creature(EVIL, 60); break; case ST_DARK: ident = unlight_area(char_row, char_col); break; default: msg_print("Internal error in staffs()"); break; } if (ident) { if (!known1_p(i_ptr)) { m_ptr = &py.misc; /* round half-way case up */ m_ptr->exp += (i_ptr->level + (m_ptr->lev >> 1)) / m_ptr->lev; prt_experience(); identify(&item_val); i_ptr = &inventory[item_val]; } }
/* Use a staff. -RAK- */ void use() { int32u i; int j, k, item_val, chance, y, x; register int ident; register struct misc *m_ptr; register inven_type *i_ptr; free_turn_flag = TRUE; if (inven_ctr == 0) msg_print("But you are not carrying anything."); else if (!find_range(TV_STAFF, TV_NEVER, &j, &k)) msg_print("You are not carrying any staffs."); else if (get_item(&item_val, "Use which staff?", j, k, CNIL, CNIL)) { i_ptr = &inventory[item_val]; free_turn_flag = FALSE; m_ptr = &py.misc; chance = m_ptr->save + stat_adj(A_INT) - (int)i_ptr->level - 5 + (class_level_adj[m_ptr->pclass][CLA_DEVICE] * m_ptr->lev / 3); if (py.flags.confused > 0) chance = chance / 2; if ((chance < USE_DEVICE) && (randint(USE_DEVICE - chance + 1) == 1)) chance = USE_DEVICE; /* Give everyone a slight chance */ if (chance <= 0) chance = 1; if (randint(chance) < USE_DEVICE) msg_print("You failed to use the staff properly."); else if (i_ptr->p1 > 0) { i = i_ptr->flags; ident = FALSE; (i_ptr->p1)--; while (i != 0) { j = bit_pos(&i) + 1; /* Staffs. */ switch(j) { case 1: ident = light_area(char_row, char_col); break; case 2: ident = detect_sdoor(); break; case 3: ident = detect_trap(); break; case 4: ident = detect_treasure(); break; case 5: ident = detect_object(); break; case 6: teleport(100); ident = TRUE; break; case 7: ident = TRUE; earthquake(); break; case 8: ident = FALSE; for (k = 0; k < randint(4); k++) { y = char_row; x = char_col; ident |= summon_monster(&y, &x, FALSE); } break; case 10: ident = TRUE; destroy_area(char_row, char_col); break; case 11: ident = TRUE; starlite(char_row, char_col); break; case 12: ident = speed_monsters(1); break; case 13: ident = speed_monsters(-1); break; case 14: ident = sleep_monsters2(); break; case 15: ident = hp_player(randint(8)); break; case 16: ident = detect_invisible(); break; case 17: if (py.flags.fast == 0) ident = TRUE; py.flags.fast += randint(30) + 15; break; case 18: if (py.flags.slow == 0) ident = TRUE; py.flags.slow += randint(30) + 15; break; case 19: ident = mass_poly(); break; case 20: if (remove_curse()) { if (py.flags.blind < 1) msg_print("The staff glows blue for a moment.."); ident = TRUE; } break; case 21: ident = detect_evil(); break; case 22: if ((cure_blindness()) || (cure_poison()) || (cure_confusion())) ident = TRUE; break; case 23: ident = dispel_creature(CD_EVIL, 60); break; case 25: ident = unlight_area(char_row, char_col); break; case 32: /* store bought flag */ break; default: msg_print("Internal error in staffs()"); break; } /* End of staff actions. */ } if (ident) { if (!known1_p(i_ptr)) { m_ptr = &py.misc; /* round half-way case up */ m_ptr->exp += (i_ptr->level + (m_ptr->lev >> 1)) / m_ptr->lev; prt_experience(); identify(&item_val); i_ptr = &inventory[item_val]; } }