int can_cast(object tp, object tgt, object *weps) { if (!tp) return 0; if (environment(tp)->query_property("no attack")) FAIL("Some force prevents your violence."); if (tp->query_disable() || tp->query_casting() || tp->query_magic_round()) FAIL("You are busy."); if (!tgt) FAIL("Stab whom?"); if (!living(tgt)) FAIL("That is not alive."); if (tp == tgt) FAIL("That would hurt."); if (tp->query_rest_type()) FAIL("You must stand up first."); if (tp->query_riding()) FAIL("You cannot stab effectively while riding."); if (!sizeof(weps)) FAIL("You need to use "+a_or_an(TYPE)+" "+TYPE+" for that."); if (!tp->kill_ob(tgt)) FAIL("You may not attack "+tgt->query_cap_name()+"."); return 1; }
int can_cast(object tp, object tgt, object wep, string limb) { if (!tp) return 0; if (tp->query_ghost()) FAIL("You can't do that as a ghost.\n"); if (tp->query_busy()) FAIL("You are busy.\n"); if (environment(tp)->query_property("no attack")) FAIL("You may not attack here.\n"); if (tp->query_rest_type()) FAIL("You must be standing to do that.\n"); if (tp->query_riding()) FAIL("You can't sneak around while riding."); if (sizeof(tp->query_riders())) FAIL("You can't sneak around with people riding on your back."); if (!tgt) FAIL("Cripple whom?\n"); if (!limb) FAIL("Aim for what limb?\n"); if (!living(tgt)) FAIL("That is not alive.\n"); if (tgt == tp) FAIL("You try to hit yourself, but just look stupid doing it.\n"); if (!wep && sizeof(tp->query_limbs_wielded()) == sizeof(tp->query_wielding_limbs())) FAIL("You're not using the right weapons.\n"); if (tp->query_current_attacker()) FAIL("You are too busy fighting!\n"); if (member_array(tgt, tp->query_hunted()) != -1) FAIL("You have lost the element of surprise!\n"); if (!(tgt->query_is_limb(limb))) FAIL(tgt->query_subjective()+" does not have "+a_or_an(limb)+" "+limb+".\n"); if (tp->query_sp() < 25) FAIL("You are too tired.\n"); if (userp(tgt) && !interactive(tgt)) FAIL("You may not attack link-dead players.\n"); return 1; }
describe_location() { char new_control[8]; char *comma_pos; int print_room_desc, print_room_desc_alt; char *item; /* check which room description should be printed */ if ((comma_pos = strchr(ROOM_DESC_CONTROL(room), ',')) != NULL) if (strchr(ROOM_DESC_CONTROL(room), '+') != NULL) strcpy(new_control, comma_pos + 1); else { strncpy(new_control, ROOM_DESC_CONTROL(room), comma_pos - ROOM_DESC_CONTROL(room)); *(new_control + (comma_pos - ROOM_DESC_CONTROL(room))) = '\0'; } else strcpy(new_control, "RC"); if ((strchr(new_control, 'R') != NULL) && (*ROOM_DESC(room) != '-')) print_room_desc = 1; else print_room_desc = 0; if ((strchr(new_control, 'C') != NULL) && (*ROOM_DESC_ALT(room) != '\0')) print_room_desc_alt = 1; else print_room_desc_alt = 0; if (print_room_desc || print_room_desc_alt || (*CONTENTS(room) != '\0')) print("\n"); if (print_room_desc) printn(ROOM_DESC(room)); if (print_room_desc_alt) printn(ROOM_DESC_ALT(room)); if (*CONTENTS(room) != '\0') { item = strtok(CONTENTS(room), ","); do { print("There is "); a_or_an(item); print(item); print(" here.\n"); } while ((item = nexttok(",")) != NULL); } }