Beispiel #1
0
int cmd_replace(string str) {
    string who, limb;
    string *missing;
    string *limbs;
    int healing;
    int cost;
    object tp, ob;

    if (!spell())
    {
        write("What?\n");
        return 1;
    }

    tp = this_player();

    if( tp->query_ghost() )
        return notify_fail("You cannot do that in your immaterial state.\n");
    
    if( !str )
        return notify_fail("Replace what?\n");
    
    if( sscanf(str, "%s %s", who, limb) != 2 )
        return notify_fail("Correct syntax: <replace [player] [limb]>\n");
    
    ob = present(who, environment(tp));
    
    if( !ob )
        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 = (string *)ob->query_limbs();
    missing = (string *)ob->query_severed_limbs();
    
    if( !missing )
    {
        if( ob == tp )
            return notify_fail("You are not missing any limbs!\n");
        else
            return notify_fail(ob->query_cap_name()+" is not missing any limbs.\n");
    }
    
    if( member_array(limb, missing) == -1 || member_array(limb, limbs) != -1)
    {
        if( tp == ob )
            return notify_fail("You are not missing that limb!\n");
        else
            return notify_fail(ob->query_cap_name()+" is not missing that limb!\n");
    }

    this_player()->set_magic_round();
    healing = (int)tp->query_skill("healing")/2;
    healing += tp->query_skill("faith")/3;
    healing += tp->query_skill("belief")/3;
    healing -= random(76);
    
    if( tp == ob )
        cost = 175 + random(76);
    else
        cost = 250 + random(51);
    
    if( (int)tp->query_mp() < cost )
        return notify_fail("Too low on magic power.\n");
    
    tp->add_mp(-cost);
    
    if( healing < 1 )
    {
        message("info", "Your concentration is simply too weak.", tp);
        message("info", tp->query_cap_name() + " loses " +
                tp->query_possessive() + " concentration while in " +
                "prayer.", environment(tp), tp);
        tp->add_skill_points("healing", 10);
        return 1;
    }

    if( !add_limb(ob, limb) )
         return 0;

    if( tp == ob )
    {
        message("info", "Your " + limb + " regenerates through prayer!", tp);
        message("info", tp->query_cap_name() + "'s " + limb + " regenerates " +
                "through prayer!", environment(tp), tp);
        tp->add_skill_points("healing", to_int((healing / 3) + random(healing * 2 / 3)));
        tp->add_exp(to_int((healing / 3) + random(healing * 2 / 3)));
    }
    else
    {
        message("info", "You regenerate " + ob->query_cap_name() + "'s " +
                limb + " through prayer!", tp);
        message("info", tp->query_cap_name() + " regenerates your " + limb +
                " through prayer!", ob);
        message("info", tp->query_cap_name() + " says a prayer that " +
                "regenerates " + ob->query_cap_name() + "'s " + limb + ".",
                environment(tp), ({ tp, ob }) );
        tp->add_skill_points("healing", to_int((healing * 2 / 3) + random(healing / 3)));
        tp->add_exp(to_int((healing * 2 / 3) + random(healing / 3)));
        tp->add_alignment(to_int((healing * 2 / 3) + random(healing / 3)));
    }
Beispiel #2
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;
}