skill.cc
musicmud-2.1.6/src/extras/skill.cc · 2.4 KB
From the archive musicmud2.1.6.tar.gz
Download the archive « Back to the archive contents
/*
* MusicMUD - skills module
* Copyright (C) 2001-2003 Abigail Brady
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "musicmud.h"
#include "verbs.h"
#include "misc.h"
#include "util.h"
#include "events.h"
#include "trap.h"
#include "pflags.h"
#define MODULE "skill"
static char *skillstr(int val)
{
if (val == 0) return "mystified by";
if (val < 2) return "laughable at"; // +2
if (val < 6) return "a novice at"; // +4
if (val < 12) return "getting the hang of"; // +6
if (val < 22) return "not terribly good at"; // +10
if (val < 36) return "generally competent at"; // +14
if (val < 54) return "knowledgeable in the ways of"; // +18
if (val < 78) return "a skilled professional at"; // +24
if (val < 106) return "close to mastering"; // +28
if (val < 130) return "a distinguished expert at"; // +24
if (val < 150) return "one of the luminaries of"; // +20
return "enshrined in the legends of"; // + lots
}
bool is_person(const TeleObject &o)
{
return is_person(o.what);
}
static bool verb_skill(MudObject *who, int argc, const char **argv) {
NewWorld q;
if (argc > 1 && who->get_priv(PFL_SEESTATS)) {
MudObject *qui = planet->get(argv[1]);
if (!qui) {
q = match(who, argc-1, argv+1, is_person, LOOK_ROOM|IGNORE_EXITS);
} else {
q.add(*qui);
}
} else {
q.add(*who);
}
if (!q.getsize()) {
who->printf("Can't find : %s\n", argv[1]);
return true;
}
int i;
MudObject *qui;
int y = 0;
foreach((&q), qui, i) if (is_person(qui)) {
who->printf("%#P %[is/are] %s combat.\n",
qui, skillstr(qui->get_int("skill.combat", 0)));
y = 1;
}
if (!y) {
who->printf("Can't find : %s\n", argv[1]);
return true;
}
return true;
}
#include "verbmodule.h"
void startup() {
AUTO_VERB(skill, 3, 0, PFL_NONE);
}