Exemplo n.º 1
0
int cmd_envelop(string str) {
   int dmg;
   object ob, tp, env;
   tp = this_player();
   env = environment(tp);
   if (!str) ob = tp->query_current_attacker();
   else ob = present(str, env);
   if (!ob) {
      notify_fail("You do not see that here.\n");
      return 0;
   }
   if (tp->query_subclass() != "cleric")
      return notify_fail("What?\n");
   if (env->query_property("no attack") || env->query_property("no magic"))
      return notify_fail("Greater powers prevent your malice.\n");
   if (!living(ob))
      return notify_fail("Syntax: <envelop [living]>\n");
   if (!alignment_ok(tp))
      return notify_fail("You have abandoned the powers of good, thus they
abandon you.\n");
   if (ob == tp)
      return notify_fail("The gods laugh at you.\n");
   if (tp->query_mp() < 25) 
      return notify_fail("Your spell fails, due to lack of magic.\n");
   if (this_player()->query_disable())
      return notify_fail("You are busy.\n");
    if(!this_player()->kill_ob(ob)) {
        write(ob->query_cap_name()+" can't be attacked by you yet.");
       return 1;
    }
   dmg = tp->query_skill("belief")/2 + tp->query_stats("wisdom")/2;
   dmg -= ob->query_stats("wisdom")/3 + ob->query_skill("magic defense")/4;
   if (dmg < 10) {
      write("%^CYAN%^Your spell fails.");
      tell_room(env, "%^CYAN%^"+tp->query_cap_name()+"'s spell fails.", ({ tp }));
Exemplo n.º 2
0
int can_cast(object tp) {
  object env;

  if (!tp) return 0;

  env = environment(tp);

  if (env->query_property("no magic"))
    FAIL("Some force prevents your magic.");

  if (tp->query_busy())
    FAIL("You are busy.");

  if (tp->query_ghost())
    FAIL("Alas, your restless soul is too pained for that.");

  if (!alignment_ok(tp))
    FAIL("You have betrayed the source of your powers.");

  if ((env->query_property("no attack") && env->query_property("no steal") &&
      env->query_property("no bump")) || env->query_property("sanctuary"))
        FAIL("This room has already been sanctified.");

  if (tp->query_mp() < 300)
    FAIL("Not enough magic.");

  return 1;
}
Exemplo n.º 3
0
static void add(struct siphash24_ctx *ctx, const void *p, size_t len)
{
	const unsigned char *data = p;
	size_t bufsize = ctx->bytes % sizeof(ctx->buf.u8);

	if (bufsize + len >= sizeof(ctx->buf.u8)) {
		// Fill the buffer, and process it.
		memcpy(ctx->buf.u8 + bufsize, data,
		       sizeof(ctx->buf.u8) - bufsize);
		ctx->bytes += sizeof(ctx->buf.u8) - bufsize;
		data += sizeof(ctx->buf.u8) - bufsize;
		len -= sizeof(ctx->buf.u8) - bufsize;
		add_64bits(ctx->v, ctx->buf.u64);
		bufsize = 0;
	}

	while (len >= sizeof(ctx->buf.u8)) {
		// Process full chunks directly from the source.
		if (alignment_ok(data, sizeof(uint64_t)))
			add_64bits(ctx->v, *(const uint64_t *)data);
		else {
			memcpy(ctx->buf.u8, data, sizeof(ctx->buf));
			add_64bits(ctx->v, ctx->buf.u64);
		}
		ctx->bytes += sizeof(ctx->buf.u8);
		data += sizeof(ctx->buf.u8);
		len -= sizeof(ctx->buf.u8);
	}
	    
	if (len) {
		// Fill the buffer with what remains.
		memcpy(ctx->buf.u8 + bufsize, data, len);
		ctx->bytes += len;
	}
}
Exemplo n.º 4
0
int cmd_rapture(string str) {
    object env;
    object *inv;
    int i, tmp;

   if (!spell()) {
      write("Only those of great faith can cast this spell.");
      return 1;
   }
    if(str) return 0;
    env = environment(this_player());
    if(!env) return 0;
    if(this_player()->query_ghost()) {
        notify_fail("Bah! You have already experienced rapture!\n");
        return 0;
    }
    if(env->query_property("no magic") || env->query_property("no attack")) {
        notify_fail("A holy force prevents the rapture.\n");
        return 0;
    }
    if((int)this_player()->query_mp() < 20) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    if((int)this_player()->query_skill("faith") < 65) {
        notify_fail("You do not have the faith to bring about rapture.\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    for(i=0, tmp =sizeof((inv=users())); i<tmp; i++) {
        if(inv[i]->query_blocked("shout")) continue;
        if(!inv[i]->query_ansi()) tell_object(inv[i],
          "%^RED%^The air begins to thicken and bleed red with impending death through rapture.\n%^RESET%^");
        else tell_object(inv[i], red("The air begins to thicken and bleed red with impending death through rapture.\n"));
    }
    this_player()->set_magic_round();
    call_out("do_rapture", 7, env);
    this_player()->add_mp(-(int)this_player()->query_mp()); //abuse fix 930907 blodgett
    this_player()->set_paralyzed(8);
    return 1;
}
Exemplo n.º 5
0
int cmd_replacin(string str) {
    string who, limb;
    string *missing;
    string *limbs;
    int healing;
    int cost;
    object tp, ob;
    tp = this_player();

    if(!spell())
      return notify_fail("What?\n");

    if(this_player()->query_ghost())
      return notify_fail("You cannot do that in your immaterial state.\n");

    if(!str)
      return notify_fail("Replace what?\n");

    if(!alignment_ok(tp))
      return notify_fail("You have betrayed the source of your powers!\n");

    if(sscanf(str, "%s %s", who, limb) != 2)
      return notify_fail("Correct syntax: <replace [player] [limb]>\n");

    if(who == "me") ob = tp;
    else ob = find_player(who);

    if(!ob || environment(ob) != environment(tp))
      return notify_fail(capitalize(who) + " is not here.\n");

    if(ob->query_ghost())
      return notify_fail("You cannot help the dead in that way.\n");

    if(!living(ob))
      return notify_fail(ob->query_cap_name()+" is not a living thing!\n");

    limbs = ob->query_limbs();
    missing = ob->query_severed_limbs();

    if(!ob->query_is_limb(limb)) {
      write("That is not a valid limb!");
      return 1;
      }

    if(!missing) {
      if(ob==tp) notify_fail("You are not missing any limbs!\n");
      else notify_fail(ob->query_cap_name()+" is not missing any limbs.\n");
      return 1;
      }

    if(member_array(limb, limbs) != -1) {
        if(tp==ob) notify_fail("You are not missing that limb!\n");
        else notify_fail(ob->query_cap_name()+" is not missing that limb.\n");
        return 1;
    }

    if(member_array(limb, missing) == -1) {
      if(tp==ob) notify_fail("You are not missing your that limb!\n");
      else notify_fail(ob->query_cap_name()+" is not missing that limb!\n");
      return 1;
      }

    tp->set_magic_round();
    healing = tp->query_skill("healing");
    healing -= random(101);
    if(tp==ob) cost = 120;
    else cost = random(100) + 20;

    if(tp->query_mp() < cost)
      return notify_fail("Not enough magical power.\n");

    tp->add_mp(-cost);

    if(healing < 1) {
      write("Your concentration is simply too weak.\n");
      say(tp->query_cap_name()+" loses "+tp->query_possessive()+" concentration while in prayer.\n", tp);
      tp->add_skill_points("healing", 10);
      return 1;
      }

    add_limb(ob, limb, tp, healing);
    return 1;
}
Exemplo n.º 6
0
int cmd_cure(string str) {
    string whom, limb, clas;
    int amount, cost, healing, i;
    object tp, ob;
    string * limbs;
   if (!spell()) {
      notify_fail("What?\n");
      return 0;
   }
    if(!str) {
        notify_fail("Cure whom?\n");
        return 0;
    }
    tp = this_player();
    if(tp->query_disable()) {
        notify_fail("You are in the middle of something else.\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    healing = (int)tp->query_skill("healing");
    clas = (string)tp->query_subclass();
    if(str == "me" || str == "myself") ob = tp;
    else ob = present(str, environment(tp));
    if(!ob) {
        if(sscanf(str, "%s %s", whom, limb) != 2) {
            notify_fail("Correct syntax: <cure [who] [(limb)]\n");
            return 0;
        }
        if(whom == "me" || whom == "myself") ob = tp;
        else ob = present(whom, environment(tp));
    }
    if(!ob) {
        notify_fail("Cure whom?\n");
        return 0;
    }
    if(!limb) cost = healing*2/3;
    else if(limb == "all") cost = healing;
    else if(member_array(limb, (string *)ob->query_limbs()) == -1) {
        notify_fail("That limb is missing!\n");
        return 0;
    }
    else cost = healing/3;
    if(ob != tp) cost = random(cost);
    if((int)tp->query_mp() < cost) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    tp->add_mp(-cost);
    amount = (healing*((int)ob->query_level()))/10;
    if(amount > 400) {
       log_file("hmmm", this_player()->query_name()+" healing "+ob->query_short()+" "+amount+"\n");
       amount = 400;
    }
    if(clas == "paladin"){
      amount = amount/2;
    }
    this_player()->set_magic_round(2);
    if(tp == ob) tp->add_skill_points("healing", amount/6);
    else {
        tp->add_skill_points("healing", amount/2);
        tp->add_alignment("healing", amount/5);
    }
    if(!limb) {
      if (tp->query_hp() < 1) {
        ob->set_hp(1);
        send_messages(tp, ob, clas, 0);}
      else{   
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);}
    }
    else if(limb == "all") {
        limbs = (string *)ob->query_limbs();
        for(i=0; i<sizeof(limbs); i++) {
          ob->heal_limb(limbs[i], (amount/2));
        }
      if (tp->query_hp() < 1) {
        ob->set_hp(1);
        send_messages(tp, ob, clas, 0);}
      else{   
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);}
    }
    else {
        ob->add_hp(amount/4);
      if (tp->query_hp() < 1) {
        ob->set_hp(1);
        send_messages(tp, ob, clas, 0);}
      else{   
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);}
    }
    tp->set_disable();
    return 1;
}
Exemplo n.º 7
0
int cmd_heal(string str) {
  string whom, limb, clas;
  int amount, cost, healing, i, wisdom;
  object tp, ob;
  string * limbs;
  if (!spell()) {
    return 0;
  }
  if(!str) {
    notify_fail("Heal whom?\n");
    return 0;
  }
  tp = this_player();
  if(tp->query_disable()) {
    notify_fail("You are in the middle of something else.\n");
    return 0;
  }
  if(!alignment_ok(this_player())) {
    notify_fail("You have betrayed the source of your powers.\n");
    return 0;
  }
  if(this_player()->query_ghost())
    return notify_fail("You cannot speak without a body.\n");
  healing = (int)tp->query_skill("healing")/2;
  healing += (int)tp->query_level()/3;
  healing += (int)tp->query_skill("faith")/4;
  healing += tp->query_skill("belief")/4;

  clas = (string)tp->query_subclass();
  if(str == "me" || str == "myself") ob = tp;
  else ob = present(str, environment(tp));
  if(!ob) {
    if(sscanf(str, "%s %s", whom, limb) != 2) {
      notify_fail("Heal whom?\n");
      return 0;
    }
    if(whom == "me" || whom == "myself") ob = tp;
    else ob = present(whom, environment(tp));
  }
  if(!ob) {
    notify_fail("Heal whom?\n");
    return 0;
  }
  if(!limb) cost = healing/2;
  else if(limb == "all") cost = healing*3/4;
  else if(member_array(limb, (string *)ob->query_limbs()) == -1) {
    notify_fail("That limb is missing!\n");
    return 0;
  }
  else cost = healing/3;
  if(ob != tp) cost = random(cost);
  if((int)tp->query_mp() < cost) {
    notify_fail("Too low on magic power.\n");
    return 0;
  }
  tp->add_mp(-cost);
  amount = (healing);
  if(amount > 800) {
    log_file("hmmm", this_player()->query_name()+" healing "+ob->query_short()+" "+amount+"\n");
    amount = 800;
  }
  this_player()->set_magic_round(2);
  if(tp == ob) tp->add_skill_points("healing", amount/3);
  else {
    tp->add_skill_points("healing", amount/2);
    tp->add_alignment(amount/5);
    tp->add_exp(amount/4);
  }
  if(!limb) {
    ob->add_hp(amount);
  }
  else if(limb == "all") {
    limbs = (string *)ob->query_limbs();
    for(i=0; i<sizeof(limbs); i++) {
      ob->heal_limb(limbs[i], (amount/2));
    }
    ob->add_hp(amount/2);
  }
  else {
    ob->heal_limb(limb, amount);  
    ob->add_hp(amount/3);
  }
  send_messages(tp, ob, clas, limb);
  return 1;
}
Exemplo n.º 8
0
Arquivo: _heal.c Projeto: ehershey/pd
int cmd_heal(string str) {
    string whom, limb, clas;
    int amount, cost, healing, i, wisdom;
    object tp, ob;
    string * limbs;

   if (!spell()) {
      write("What?\n");
      return 1;
   }
    if(!str) {
        notify_fail("Heal whom?\n");
        return 0;
    }
    tp = this_player();
    if(tp->query_casting()) {
        notify_fail("You are in the middle of another spell!\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    healing = (int)tp->query_skill("healing");
    wisdom = (int)tp->query_stats("wisdom");
    clas = (string)tp->query_subclass();
    if(str == "me" || str == "myself") ob = tp;
    else ob = present(str, environment(tp));
    if(!ob) {
        if(sscanf(str, "%s %s", whom, limb) != 2) {
            notify_fail("Correct syntax: <heal [who] [(limb)]\n");
            return 0;
        }
        if(whom == "me" || whom == "myself") ob = tp;
        else ob = present(whom, environment(tp));
    }
    if(!ob) {
        notify_fail("Heal whom?\n");
        return 0;
    }
    if(!limb) cost = 22;
    else if(limb == "all") cost = 44;
    else if(member_array(limb, (string *)tp->query_limbs()) == -1) {
        notify_fail("You do not have a "+limb+".\n");
        return 0;
    }
    else cost = 14;
    if(ob != tp) cost = random(cost);
    if((int)tp->query_mp() < cost) {
        notify_fail("Too low on magic power.\n");
        tp->add_mp(-cost);
        return 0;
    }
    this_player()->set_magic_round(1);
    tp->add_mp(-cost);
    if(healing < 5) amount = 0;
    else amount = random(wisdom + (healing/10));
    if(!amount) {
        write("You do not have the skill to do that.");
        return 1;
    }
    if(tp == ob) tp->add_skill_points("healing", amount);
    else {
        tp->add_skill_points("healing", amount * 2);
        tp->add_alignment(amount);
        tp->add_exp(random((amount/2)+2));
    }
    if(!limb) {
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);
    }
    else if(limb == "all") {
        limbs = (string *)ob->query_limbs();
        for(i=0; i<sizeof(limbs); i++) {
            ob->heal_limb(limbs[i], (amount / 2));
        }
        ob->add_hp(amount / 2);
        send_messages(tp, ob, clas, limb);
    }
    else {
        ob->heal_limb(limb, amount);
        send_messages(tp, ob, clas, limb);
    }
    return 1;
}
Exemplo n.º 9
0
Arquivo: _peace.c Projeto: ehershey/pd
int cmd_peace(string str) {
    object *inv;
    int faith, belief, i, def;
    if (!spell() && !wizardp(this_player())) {
        write("What?\n");
        return 1;
    }
    if((int)this_player()->query_mp() < 10) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    if (this_player()->query_disable() && !wizardp(this_player()))
        return notify_fail("You are busy.\n");
    if(!alignment_ok(this_player()) && !wizardp(this_player())) {
        notify_fail("You have betrayed the source of your power.\n");
        return 0;
    }
    faith = (int)this_player()->query_skill("faith");
    belief = (int)this_player()->query_skill("belief");
    this_player()->add_mp(-random(51));
    if (!wizardp(this_player())) {
        if (this_player()->query_subclass() == "cleric") {
            if (belief < 10) def = 2; else
            if (belief < 55) def = 3; else
            if (belief < 110) def = 4; else
            if (belief < 165) def = 5; else
            if (belief < 220) def = 6; else
            if (belief >= 220) def = 7;
            this_player()->add_mp(belief/2-random(belief/4));
            if(random(def)<2) {
                notify_fail("Your belief does not bring peace, this time.\n");
                return 0;
            }
        }
        else {
            if (faith < 10) def = 2; else
            if (faith < 55) def = 3; else
            if (faith < 110) def = 4; else
            if (faith < 165) def = 5; else
            if (faith < 220) def = 6; else
            if (faith >= 220) def = 7;
            this_player()->add_mp(faith/2-random(faith/4));
            if(random(def)<2) {
                notify_fail("Your faith does not bring peace, this time.\n");
                return 0;
            }
        }
    }
    write("You bring peace to the area.\n");
    say(this_player()->query_cap_name()+" raises "+this_player()->query_possessive()+" hands to the sky and brings peace to the area.\n", this_player());
    if ((this_player()->query_class("cleric"))) {
        this_player()->add_skill_points("belief", 1);
    }
    if ((this_player()->query_class("monk"))) {
        this_player()->add_skill_points("faith", 1);
    }
    this_player()->add_alignment(5);
    this_player()->set_magic_round(2);
    this_player()->set_disable(2);
    inv = all_inventory(environment(this_player()));
    for(i=0; i<sizeof(inv); i++) {
        if(!living(inv[i])) continue;
        inv[i]->cease_all_attacks();
    }
    return 1;
}
Exemplo n.º 10
0
int cmd_invisibility(string str) {
    object ob;
    int inv;
    int cost;
 
   if (!spell()) {
      notify_fail("Your powers are not strong enough.\n");
      return 0;
   }
    this_player()->set_magic_round();
    if(!str) {
        notify_fail("Cast a invisibility on whom?\n");
        return 0;
    }
    ob = present(str, environment(this_player()));
    if(!ob) {
	if(str == "me" || str == "myself") ob = this_player();
    }
    if(!ob) {
        notify_fail(capitalize(str)+" is not here.\n");
        return 0;
    }
    if(!living(ob)) {
        notify_fail(capitalize(str)+" is not alive!\n");
        return 0;
    }
    if(ob->query_invis()) {
        notify_fail("Make the invisible invisible?\n");
}
    if(environment(this_player())->query_property("no magic")) {
	notify_fail("Something is blocking your concentration.\n");
	return 0;
    }
    if(ob == this_player()) cost = 50 + random(150);
    else cost = 50 + random(75);
    if((int)this_player()->query_mp() < cost) {
	notify_fail("Too low on magic power.\n");
	return 0;
    }
   inv = (int)this_player()->query_skill("conjuring");
   if(inv < 70) {
        write("You mutter words beyond your understanding.");
        say(this_player()->query_cap_name()+" mutters words beyond "+
          this_player()->query_possessive()+" understanding.", this_player());
        return 1;
    }
    if(!alignment_ok(this_player())) {
        write("You have betrayed the source of your powers.");
        return 1;
    }
    if (ob->query_invis())
      return notify_fail("That person is already invisible!!!!\n");
    this_player()->add_mp(-cost);
    write("You look at "+ob->query_cap_name()+" and call on your powers of illusion.");
    tell_object(ob, this_player()->query_cap_name()+
      " looks at you and calls on "+this_player()->query_possessive()+
      " powers of illusion.");
    say(this_player()->query_cap_name()+" looks at "+ob->query_cap_name()+
" and calls on "+this_player()->query_possessive()+" powers of illusion.",
      ob);
    if(random(101) > inv) {
        this_player()->add_skill_points("conjuring", random(10));
        return 1;
    }
if (!wizardp(this_player())) {
    ob->set_invis();
    call_out("take_off", inv/3+1, ob);
   } else 
     {
      ob->set_invis();
      call_out("take_off", 50, ob);
     }
    this_player()->set_magic_round();
    this_player()->add_skill_points("conjuring", random(inv/2));
    this_player()->add_exp(random(inv));
    return 1;
}
Exemplo n.º 11
0
int cmd_dispell(string str) {
    int which, skip, i, faith, wisdom, cost;
    string whom, cl;
    object tp, ob;
    object *inv;
    if (!spell()) {
        write("What?\n");
        return 1;
    }
    this_player()->set_magic_round();
    if(!str) {
        if(!(ob=(object)this_player()->query_current_attacker())) {
            notify_fail("Dispell whom?\n");
            return 0;
        }
    }
    tp = this_player();
    if((cl = (string)this_player()->query_subclass()) != "monk" &&
      cl != "cleric"  && cl !="paladin" && cl != "blue" && cl != "white") {
        notify_fail("You feel confused.\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    if (tp->query_disable())
        return notify_fail("You are busy.\n");
    if(tp->query_casting()) return 1;
    if(environment(tp)->query_property("no magic")) {
        notify_fail("Something is blocking your concentration.\n");
        return 0;
    }
    if(str == "all") return dispell_all(tp);
    if(!ob) ob = present(str, environment(tp));
    if(!ob) {
        inv = all_inventory(environment(tp));
        sscanf(str, "%s %d", whom, which);
        for(i=0, skip = 0; i<sizeof(inv) && !ob; i++) {
            if(inv[i]->id(whom)) {
                skip ++;
                if(skip == which) ob = inv[i];
            }
        }
        if(!ob) {
            notify_fail("Dispell whom?\n");
            return 0;
        }
    }
    if(!living(ob)) {
        notify_fail(ob->query_cap_name()+" is not a living thing!\n");
        return 0;
    }
    if(cl == "kataan" && (int)ob->query_alignment() < 0) {
        write(ob->query_cap_name()+" is not good!\n");
        tp->add_alignment(10);
        tp->add_mp(-5);
        return 1;
    }
    else if(cl != "kataan" && (int)ob->query_alignment() > 0) {
      write(ob->query_cap_name()+" is not evil!\n");
      this_player()->add_alignment(-10);
      this_player()->add_mp(-5);
      return 1;
    }
    if(!this_player()->kill_ob(ob)) {
        write(ob->query_cap_name()+" can't be attacked by you yet.");
       return 1;
    }
    faith = (int)tp->query_skill("faith");
    if (tp->query_subclass()=="paladin")
      faith += random(tp->query_level()*20/10);
    wisdom = (int)ob->query_stats("wisdom");
    faith -= wisdom;
    if(faith < 2) faith = 2;
    faith = random(faith)+faith;
    cost = faith/7;
    if((int)tp->query_mp() < cost) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    tp->set_disable();
    tp->add_mp(-cost);
    tp->set_casting(faith);
    say("%^YELLOW%^"+tp->query_cap_name()+" mutters a prayer against enemies of the faith.");
    write("%^YELLOW%^You mutter a prayer against enemies of the faith.");
    tell_room(environment(tp), "%^ORANGE%^"+ob->query_cap_name()+" is struck by the force of "+tp->query_cap_name()+"'s faith!\n", ({tp, ob }) );