コード例 #1
0
ファイル: light.c プロジェクト: RandolfShanksCarter/DeadStars
varargs int visibility(object ob) {
    int x;

    if( !ob ) ob = previous_object();
    x = effective_light(ob);
    if( x > 5 || x < -2 ) return 0;
    else if( x > 3 || x < 0 ) return 1;
    else return 2;
}
コード例 #2
0
ファイル: _peek.c プロジェクト: ehershey/pd
int cmd_peek(string str) {
    object ob;
 
   if (!abil()) {
      return 0;
   }
    if(!str) {
        notify_fail("Peek at what?\n");
        return 0;
    }
    str = lower_case(str);
    if(str = this_player()->query_name()) return 0;
    if(sscanf(str, "at %s", str) != 1) {
        notify_fail("Peek at what?\n");
        return 0;
    }
    if(this_player()->query_disabled()) return 1;
    this_player()->set_disabled();
    ob = environment(this_player());
    if(effective_light(this_player()) < 0) {
        write("It is too dark.");
        return 1;
    }
    if(total_light(this_player()) < 1) write("It is dark.\n");
    if(ob->id(str)) 
        write((string)ob->query_long(str));
    else if(ob = present(str, this_player()))
        write((string)ob->query_long(str));
    else if(ob = present(str, environment(this_player()))) 
        write((string)ob->query_long(str));
    else {
        write("You do not notice that here.");
        return 1;
    }
/*    if(random(40) > (int)this_player()->query_skill("stealth")) {
        if(living(ob)) {
          say(this_player()->query_cap_name()+" glances at "+ob->query_cap_name()+" slyly.", ob);
          tell_object(ob, this_player()->query_cap_name()+" glances at you slyly.");
        }
        else
          say(this_player()->query_cap_name()+" looks over the "+str+".");
    }
    else */ this_player()->add_skill_points("stealth", 1);
    return 1;
}