bool prend(t_game *game, t_player *player, char *arg) { if (game == NULL || player == NULL || arg == NULL) return (true); if (take_item(&game->map, player, get_type_inv(strtok(arg, " "))) == true) return (true); add_string(player->client, OK); return (false); }
void do_hellblades( CHAR_DATA *ch, char *argument ) { char arg1[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; CHAR_DATA *victim; OBJ_DATA *obj; int cost = 0; argument = one_argument( argument, arg1); if (!IS_CLASS(ch, CLASS_WIZARD)) { send_to_char("Huh?\n\r",ch); return; } if ( arg1[0] == '\0' ) { stc("#CUse #RHell#LBlades#C on who?\n\r",ch); return; } if ((victim = get_char_room(ch, arg1)) == NULL) { stc("#CThey aren't here.\n\r", ch); return; } if (victim == ch) { stc("#CYeah ok..... #sd#so#sr#sk#C....\n\r",ch); return; } if (!IS_CLASS(ch, CLASS_WIZARD)) { stc("#CHuh?\n\r",ch); return; } if (ch->pcdata->stats[WL_SPELLS] < 7) { stc("#RYou do not yet have mastery of this spell.\n\r",ch); return; } if (is_safe(ch,victim)) return; if (ch->pcdata->powers[WL_SKILLS] < 4) cost = 20000; if (ch->pcdata->powers[WL_SKILLS] > 3) cost = 10000; if (ch->mana < 20000 && ch->pcdata->powers[WL_SKILLS] < 4) { stc("#CYou do not have the #c20000#C required mana.\r\n",ch); return; } else if (ch->mana < 10000 && ch->pcdata->powers[WL_SKILLS] > 3) { stc("#CYou do not have the #c10000#C required mana.\r\n",ch); return; } if (ch->pcdata->powers[WL_SKILLS] > 3 && number_range(1, 100) < 10) { if (IS_LEG_L(victim,LOST_LEG)) { sprintf( buf, "#7%s#C has already lost their left leg.\n\r", victim->name); stc( buf, ch); return; } if (!IS_LEG_L(victim,LOST_LEG)) SET_BIT(victim->loc_hp[4],LOST_LEG); else { sprintf( buf, "#7%s#C has already lost theit left leg.\n\r", victim->name); stc( buf, ch); return; } if (!IS_BLEEDING(victim,BLEEDING_LEG_L)) SET_BIT(victim->loc_hp[6],BLEEDING_LEG_L); if (IS_BLEEDING(victim,BLEEDING_FOOT_L)) REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_L); act("#CYour hellblades spin around you, cutting off #7$N's#C left leg!",ch,NULL,victim,TO_CHAR); act("#7$n's#C hellblades spin around them, cutting off #7$N's#C left leg!",ch,NULL,victim,TO_NOTVICT); act("#7$n's#C hellblades spin around them, cutting off your left leg!",ch,NULL,victim,TO_VICT); make_part(victim,"leg"); if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG)) { if ((obj = get_eq_char( victim, WEAR_LEGS )) != NULL) take_item(victim,obj); } if ((obj = get_eq_char( victim, WEAR_FEET )) != NULL) take_item(victim,obj); if (IS_LEG_R(victim,LOST_LEG)) { sprintf( buf, "#7%s#C has already lost their right leg.\n\r", victim->name); stc( buf, ch); return; } if (!IS_LEG_R(victim,LOST_LEG)) SET_BIT(victim->loc_hp[5],LOST_LEG); else { sprintf( buf, "#7%s#C has already lost their right leg.\n\r", victim->name); stc( buf, ch); return; } if (!IS_BLEEDING(victim,BLEEDING_LEG_R)) SET_BIT(victim->loc_hp[6],BLEEDING_LEG_R); if (IS_BLEEDING(victim,BLEEDING_FOOT_R)) REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_R); act("#CYour hellblades spin around you, cutting off #7$N's#C right leg!",ch,NULL,victim,TO_CHAR); act("#7$n's#C hellblades spin around them, cutting off #7$N's#C right leg!",ch,NULL,victim,TO_NOTVICT); act("#7$n's#C hellblades spin around him, cutting off your right leg!",ch,NULL,victim,TO_VICT); make_part(victim,"leg"); if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG)) { if ((obj = get_eq_char( victim, WEAR_LEGS )) != NULL) take_item(victim,obj); } if ((obj = get_eq_char( victim, WEAR_FEET )) != NULL) take_item(victim,obj); } /* if (ch->pcdata->powers[WL_SKILLS] > 3 && number_range(1, 75) < 5 && !IS_NPC(victim)) { behead( victim ); sprintf( buf, "#7%s#C is cut to pieces by #7%s's#C hellblades.\n\r", victim->name, ch->name); do_info( ch, buf); ch->pkill ++; victim->pdeath -= 1; ch->race ++; return; }*/ WAIT_STATE(ch, 17); victim->hit *= .95; ch->mana -= cost; return; }
void player_act() { switch(get_last_action()) { case ACTION_TILL: till(x, y, current_map); break; case ACTION_PICKUP: { item* it = get_item(items_at(x, y, current_map), item_count_at(x, y, current_map), PURPOSE_PICKUP, true); if(!it) break; printf_message(COLOR_DEFAULT, "Picked up %d %s", it->count, it->name); callback("picked_up", it->script_state); take_item(x, y, it, current_map); add_item(it); } break; case ACTION_DROP: { item* it = get_item(inventory, item_count, PURPOSE_DROP, false); if(!it) break; if(it->can_equip && equipment[it->slot] == it) { equipment[it->slot] = 0; printf_message(COLOR_DEFAULT, "You unequip the %s, and drop it on the ground.", it->name); callback("removed", it->script_state); } item* clone = clone_item(it); callback("dropped", clone->script_state); place_item(x, y, clone, current_map); remove_item(it, -1); } break; case ACTION_APPLY: { item* it = get_item(inventory, item_count, PURPOSE_APPLY, false); if(!it) break; callback("apply", it->script_state); remove_item(it, 1); } break; case ACTION_EQUIP: { item* it = get_item(inventory, item_count, PURPOSE_EQUIP, false); if(!it || it->slot == SLOT_INVALID) break; callback("equip", it->script_state); printf_message(COLOR_DEFAULT, "You equip the %s.", it->name); equipment[it->slot] = it; break; } case ACTION_REMOVE: { item* it = get_item(equipment, 3, PURPOSE_REMOVE, false); if(!it) break; callback("remove", it->script_state); equipment[it->slot] = 0; printf_message(COLOR_DEFAULT, "You unequip the %s.", it->name); break; } case ACTION_PLANT: { if(!can_plant(x, y, current_map, true)) break; item* it = get_item(inventory, item_count, PURPOSE_PLANT, false); if(!it) break; if(spawn_plant(x, y, it->plant_id, current_map)) { printf_message(COLOR_DEFAULT, "You plant the %s in the tilled soil.", it->name); remove_item(it, 1); } break; } case ACTION_HARVEST: { add_item(harvest_plant(x, y, current_map)); break; } case ACTION_HELP: show_controls(); break; case ACTION_INVENTORY: get_item(inventory, item_count, PURPOSE_NONE, false); break; case ACTION_WATER: water_tile(x, y, current_map); break; case ACTION_EXAMINE: { int mx, my; get_last_mouse_position(&mx, &my); int xdiff = mx - pres_x; int ydiff = my - pres_y; if(mx < 1 || my < 1 || mx > 78 || my > 78) break; examine(x + xdiff, y +ydiff, current_map); } break; } if(ep_current <= 0) add_message(COLOR_EP_CRIT, "Out of energy, you fall to the ground."); }
void act_on_object(int ans) { int i, j; int dx, dy; /* can't find objects is time is stopped */ if (c[TIMESTOP]) return; i=item[playerx][playery]; if (i == ONOTHING) return; showcell(playerx,playery); yrepcount=0; switch (i) { case OPOTION: i = iarg[playerx][playery]; opotion(i, ans); break; case OSCROLL: i = iarg[playerx][playery]; oscroll(i, ans); break; case OALTAR: oaltar(ans); move_world(0); break; case OBOOK: obook(ans); break; case OCOOKIE: ocookie(ans); break; case OTHRONE: othrone(0, ans); break; case OTHRONE2: othrone(1, ans); break; case ODEADTHRONE: odeadthrone(ans); break; case OORB: take_item(ans); break; case OBRASSLAMP: if (ans=='r') { i=rnd(100); if (i>90) { Print("The magic genie was very upset at being disturbed!"); losehp(DIED_ANNOYED_GENIE, (int)c[HP]/2+1); UlarnBeep(); } /* higher level, better chance of spell */ else if ( (rnd(100)+c[LEVEL]/2) > 80) { j = 0; for (i = 0; i < SPELL_COUNT; i++) { if (!spelknow[i]) { add_option(i, spelname[i], ""); j++; } } if (j > 0) { print_header("A magic genie appears! What spell would you like?"); set_callback("obrasslamp"); break; } else Print("A magic genie appears! The genie has no new spells to teach you."); } else { Print("Nothing happened."); } if (rnd(100) < 15) { Print("The genie prefers not to be disturbed again!"); forget(); c[LAMP]=0; /* chance of finding lamp again */ } UpdateStatus(); } else if (ans=='t') { if (take(OBRASSLAMP,0)==0) forget(); } return; case OWWAND: take_item(ans); break; case OHANDofFEAR: take_item(ans); break; case OSTAIRSUP: ostairs(1, ans); /* up */ break; case OFOUNTAIN: ofountain(ans); break; case OCHEST: ochest(ans); break; case OSCHOOL: if (ans == 'g') { oschool(); } break; case OBANK2: case OBANK: if (ans == 'g') { if (i==OBANK) obank(); else obank2(); } break; case ODNDSTORE: if (ans == 'g') dndstore(); break; case OSTAIRSDOWN: ostairs(-1, ans); /* down */ break; case OCLOSEDDOOR: /* can't move objects if time is stopped */ if (c[TIMESTOP]) return; dx = playerx; dy = playery; if (dropflag) return; if ((ans==ESC) || (ans=='i')) { playerx = lastpx; playery = lastpy; lastpx = (char) dx; lastpy = (char) dy; break; } else { /* Try and open the door that is here */ oopendoor(playerx, playery); if (item[playerx][playery] == OCLOSEDDOOR) { /* * Door didn't open. * Move the player back where they came from. */ playerx = lastpx; playery = lastpy; lastpx = (char) dx; lastpy = (char) dy; } move_world(0); } break; case OENTRANCE: if (ans == 'g') { newcavelevel(1); playerx = 33; playery = MAXY - 2; /* Make sure the entrance to the dungeon is clear */ item[33][MAXY-1] = ONOTHING; mitem[33][MAXY-1].mon = MONST_NONE; draws(0,MAXX,0,MAXY); UpdateStatusAndEffects(); return; } break; case OVOLDOWN: if ((ans==ESC) || (ans=='i')) { break; } if (level!=0) { Print("The shaft only extends 5 feet downward!"); return; } if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { Print("You slip and fall down the shaft."); UlarnBeep(); losehp(DIED_SLIPPED_VOLCANO_SHAFT, 30+rnd(20)); UpdateStatus(); } nap(3000); newcavelevel(DBOTTOM+1); /* down to V1 */ playerx = (char) rnd(MAXX-2); playery = (char) rnd(MAXY-2); positionplayer(); draws(0,MAXX,0,MAXY); UpdateStatusAndEffects(); return; case OVOLUP: if ((ans==ESC) || (ans=='i')) { break; } if (packweight() > 40+5*(c[DEXTERITY]+c[STRENGTH]+c[STREXTRA])) { Print("You slip and fall down the shaft."); UlarnBeep(); losehp(DIED_SLIPPED_VOLCANO_SHAFT, 15+rnd(20)); UpdateStatus(); return; } nap(3000); newcavelevel(0); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) { /* put player near volcano shaft */ if (item[j][i]==OVOLDOWN) { playerx = (char) j; playery = (char) i; j=MAXX; i=MAXY; positionplayer(); } } draws(0,MAXX,0,MAXY); UpdateStatusAndEffects(); return; case OTRADEPOST: if (ans == 'g') { otradepost(); } return; case OHOME: if (ans == 'g') { ohome(); } return; case OPAD: if (ans == 'c') { opad(); } return; case OSPEED: if (ans=='s') { Print("Ohwowmanlikethingstotallyseemtoslowdown!"); c[HASTESELF] += 200 + c[LEVEL]; c[HALFDAM] += 300 + rnd(200); adjust_ability(INTELLIGENCE, -2); adjust_ability(WISDOM, -2); adjust_ability(CONSTITUTION, -2); adjust_ability(DEXTERITY, -2); adjust_ability(STRENGTH, -2); forget(); UpdateStatus(); } else if (ans=='t') { if (take(OSPEED,0)==0) forget(); } break; case OSHROOMS: if (ans=='e') { Print("Things start to get real spacey..."); c[HASTEMONST] += rnd(75) + 25; c[CONFUSE] += 30+rnd(10); adjust_ability(WISDOM, 2); adjust_ability(CHARISMA, 2); forget(); UpdateStatus(); } else if (ans=='t') { if (take(OSHROOMS,0)==0) forget(); } break; case OACID: if (ans=='e') { Print("You are now frying your ass off!"); c[CONFUSE] += 30 + rnd(10); adjust_ability(WISDOM, 2); adjust_ability(INTELLIGENCE, 2); c[AWARENESS] += 1500; c[AGGRAVATE] += 1500; { int j, k; /* heal monsters */ for(j = 0 ; j < MAXY ; j++) { for(k = 0 ; k < MAXX ; k++) { if (mitem[k][j].mon) { hitp[k][j] = monster[(int) mitem[k][j].mon].hitpoints; } } } } forget(); UpdateStatus(); } else if (ans=='t') { if (take(OACID,0)==0) forget(); } break; case OHASH: if (ans=='s') { Print("WOW! You feel stooooooned..."); c[HASTEMONST] += rnd(75)+25; adjust_ability(INTELLIGENCE, 2); adjust_ability(WISDOM, 2); adjust_ability(CONSTITUTION, -2); adjust_ability(DEXTERITY, -2); c[HALFDAM] += 300+rnd(200); c[CLUMSINESS] += rnd(1800)+200; forget(); UpdateStatus(); } else if (ans=='t') { if (take(OHASH,0)==0) forget(); } break; case OCOKE: if (ans=='s') { Print("Your nose begins to bleed!"); adjust_ability(DEXTERITY, -2); adjust_ability(CONSTITUTION, -2); adjust_ability(CHARISMA, 3); for(i = ABILITY_FIRST ; i <= ABILITY_LAST ; i++) { adjust_ability(i, 33); } c[COKED] += 10; forget(); UpdateStatus(); } else if (ans=='t') { if (take(OCOKE, 0) == 0) forget(); } break; case OWALL: break; case OANNIHILATION: if (player_has_item(OSPHTALISMAN)) { Print("The Talisman of the Sphere protects you from annihilation!"); return; } /* annihilated by sphere of annihilation */ died(DIED_SPHERE_ANNIHILATION, 0); return; case OLRS: if (nearbymonst()) return; if (ans == 'g') { olrs(); } break; default: if (ans == 't') { if (take(i, iarg[playerx][playery]) == 0) forget(); } break; } }
//extern Rect pc_area_buttons[6][6] ; // 0 - whole 1 - pic 2 - name 3 - stat strs 4,5 - later //extern Rect item_string_rects[24][4]; // 0 - name 1 - drop 2 - id 3 - bool handle_action(EventRecord event,short mode) //short mode; // ignore, { short i; Point the_point; short choice = 4; bool to_return = false; the_point = event.where; GlobalToLocal(&the_point); if (file_in_mem == false) return false; for (i = 0; i < 6; i++) if ((PtInRect(the_point,&pc_area_buttons[i][0]) == true) && (univ.party[i].main_status > 0)) { do_button_action(0,i); current_active_pc = i; display_party(6,1); draw_items(1); } for (i = 0; i < 5; i++) if ((PtInRect(the_point,&edit_rect[i][0]) == true) && (univ.party[current_active_pc].main_status > 0)) { do_button_action(0,i + 10); if (save_blocked == false) if ((choice = FCD(904,0)) == 1) return to_return; else save_blocked = true; switch(i) { case 0: display_pc(current_active_pc,0,0); break; case 1: display_pc(current_active_pc,1,0); break; case 2: pick_race_abil(&univ.party[current_active_pc],0,0); break; case 3: spend_xp(current_active_pc,1,0); break; case 4: edit_xp(&univ.party[current_active_pc]); break; } } for (i = 0; i < 24; i++) if ((PtInRect(the_point,&item_string_rects[i][1]) == true) && // drop item (univ.party[current_active_pc].items[i].variety > 0)) { // variety = 0 no item in slot/ non 0 item exists flash_rect(item_string_rects[i][1]); take_item(current_active_pc,i); draw_items(1); } for (i = 0; i < 24; i++) if ((PtInRect(the_point,&item_string_rects[i][2]) == true) && // identify item (univ.party[current_active_pc].items[i].variety > 0)) { flash_rect(item_string_rects[i][2]); univ.party[current_active_pc].items[i].ident = true; draw_items(1); } return to_return; }