49 #define WANT_UNARMED_SKILLS
59 static int attack_hth(
object *
pl,
int dir,
const char *
string,
object *skill);
83 LOG(
llevError,
"init_skills: multiple skill using same subtype %d, %s, %s\n",
97 LOG(
llevError,
"init_skills: skill subtype %d doesn't have a name?\n", i);
115 for (tmp = op->
inv; tmp; tmp = tmp->
below) {
154 if (!skill && !skill_tool)
208 object *skill = NULL, *skill_tool = NULL, *tmp;
217 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below) {
218 if (tmp->type ==
SKILL
220 && strlen(tmp->skill) >= strlen(name))
228 && strlen(tmp->skill) >= strlen(name)) {
258 object *skill = NULL, *skill_tool = NULL, *tmp;
263 for (tmp = who->
inv; tmp != NULL; tmp = tmp->
below) {
264 if (tmp->type ==
SKILL && tmp->subtype == skillno)
270 else if (tmp->type ==
SKILL_TOOL && tmp->subtype == skillno) {
373 int do_skill(
object *op,
object *part,
object *skill,
int dir,
const char *
string) {
374 int success = 0, exp = 0;
386 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
408 "You come to earth.", NULL);
412 "You rise into the air!.", NULL);
419 exp = success =
steal(op, dir, skill);
423 exp = success =
pick_lock(op, dir, skill);
427 exp = success =
hide(op, skill);
431 success =
jump(op, dir, skill);
445 (void)
attack_hth(op, dir,
"karate-chopped", skill);
474 exp = success =
singing(op, dir, skill);
502 success =
skill_throw(op, part, dir,
string, skill);
507 "This skill is not currently implemented.", NULL);
513 "There is no special attack for this skill.", NULL);
517 success =
pray(op, skill);
530 "This skill is already in effect.", NULL);
602 float base, value, lvl_mult = 0.0;
628 op_lvl += 5*abs(op->
magic);
636 return ((sint64)(op_exp*0.1)+1);
657 lvl_mult = (float)op_lvl/(
float)(skill->
level ? skill->
level : 1);
663 value = base*lvl_mult;
667 #ifdef SKILL_UTIL_DEBUG
670 return ((sint64)value);
693 if (!scroll->
skill) {
694 LOG(
llevError,
"skill scroll %s does not have skill pointer set.\n", scroll->
name);
702 for (tmp = pl->
inv; tmp != NULL; tmp = tmp->
below)
721 LOG(
llevError,
"skill scroll %s does not have valid skill name (%s).\n", scroll->
name, scroll->
skill);
747 rv = (int)((100.0f*((
float)a)/((
float)b))+0.5f);
777 int i, num_skills_found = 0;
778 static const char *
const periods =
"........................................";
782 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
784 if (search && strstr(tmp->
name, search) == NULL)
791 snprintf(skills[num_skills_found++],
MAX_BUF,
"%slvl:%3d (xp:%"FMT64
"/%"FMT64
"/%d%%)",
797 snprintf(skills[num_skills_found++],
MAX_BUF,
"%slvl:%3d (xp:%"FMT64
"/%"FMT64
")",
810 "Your character has too many skills. "
811 "Something isn't right - contact the server admin", NULL);
818 "Player skills:", NULL);
820 if (num_skills_found > 1)
821 qsort(skills, num_skills_found,
MAX_BUF, (
int (*)(
const void *,
const void *))strcmp);
823 for (i = 0; i < num_skills_found; i++) {
825 skills[i], skills[i]);
829 "You can handle %d weapon improvements.",
830 "You can handle %d weapon improvements.",
834 if (strcmp(cp,
"none") == 0)
839 cp ? cp :
"no god at current time");
842 "Your equipped item power is %d out of %d\n",
843 "Your equipped item power is %d out of %d\n",
870 for (skop = op->
inv; skop != NULL; skop = skop->
below) {
881 "Unable to find skill %s",
882 "Unable to find skill %s",
887 len = strlen(skop->
skill);
894 if (len >= strlen(
string)) {
898 while (*
string == 0x20)
900 if (strlen(
string) == 0)
904 #ifdef SKILL_UTIL_DEBUG
905 LOG(
llevDebug,
"use_skill() got skill: %s\n", sknum > -1 ? skills[sknum].name :
"none");
938 object *tmp, *best_skill = NULL;
939 int dragon =
is_dragon_pl(op), last_skill =
sizeof(unarmed_skills), i;
948 for (tmp = op->
inv; tmp; tmp = tmp->
below) {
959 for (i = 0; i < last_skill; i++) {
987 static int do_skill_attack(
object *tmp,
object *op,
const char *
string,
object *skill) {
1005 for (i = 0; i <
sizeof(unarmed_skills); i++)
1018 "You have no unarmed combat skills!", NULL);
1028 "Couldn't change to skill %s",
1029 "Couldn't change to skill %s",
1042 LOG(
llevError,
"Player %s does not have current weapon set but flag_ready_weapon is set\n", op->
name);
1043 for (tmp = op->
inv; tmp; tmp = tmp->
below)
1126 int skill_attack(
object *tmp,
object *
pl,
int dir,
const char *
string,
object *skill) {
1169 "There is nothing to attack!", NULL);
1196 static int attack_hth(
object *
pl,
int dir,
const char *
string,
object *skill) {
1197 object *enemy = NULL, *weapon;
1200 for (weapon = pl->
inv; weapon; weapon = weapon->
below) {
1208 "You are unable to unwield %s in order to attack with %s.",
1209 "You are unable to unwield %s in order to attack with %s.",
1210 weaponname, skill->
name);
1214 "You unwield your weapon in order to attack.", NULL);
1248 "You have no ready weapon to attack with!", NULL);
#define MSG_TYPE_SKILL_MISSING
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
int apply_special(object *who, object *op, int aflags)
const char * determine_god(object *op)
int skill_ident(object *pl, object *skill)
void change_exp(object *op, sint64 exp, const char *skill_name, int flag)
static int attack_hth(object *pl, int dir, const char *string, object *skill)
sstring add_refcount(sstring str)
#define SK_TWO_HANDED_WEAPON
int attack_ob(object *op, object *hitter)
int do_harvest(object *pl, int dir, object *skill)
#define MSG_TYPE_SKILL_FAILURE
#define SK_MISSILE_WEAPON
int use_skill(object *op, const char *string)
#define MSG_TYPE_SKILL_LIST
short freearr_x[SIZEOFFREE]
int pick_lock(object *pl, int dir, object *skill)
static object * adjust_skill_tool(object *who, object *skill, object *skill_tool)
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
sint64 level_exp(int level, double expmul)
int change_skill(object *who, object *new_skill, int flag)
object * ranges[range_size]
void update_object(object *op, int action)
#define MSG_TYPE_VICTIM_WAS_HIT
int do_skill(object *op, object *part, object *skill, int dir, const char *string)
static int attack_melee_weapon(object *op, int dir, const char *string, object *skill)
int jump(object *pl, int dir, object *skill)
int remove_trap(object *op, object *skill)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
sint64 last_skill_exp[NUM_SKILLS]
#define SK_USE_MAGIC_ITEM
short freearr_y[SIZEOFFREE]
#define MSG_TYPE_SKILL_ERROR
object * give_skill_by_name(object *op, const char *skill_name)
int use_alchemy(object *op)
struct obj * chosen_skill
#define MSG_TYPE_SKILL_SUCCESS
#define FLAG_CAN_USE_SKILL
int hide(object *op, object *skill)
int is_dragon_pl(const object *op)
void link_player_skills(object *op)
#define SK_ONE_HANDED_WEAPON
int steal(object *op, int dir, object *skill)
struct obj * current_weapon
#define OB_TYPE_MOVE_BLOCK(ob1, type)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
static object * find_best_player_hth_skill(object *op)
int describe_shop(const object *op)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
static int clipped_percent(sint64 a, sint64 b)
int strncasecmp(const char *s1, const char *s2, int n)
int learn_skill(object *pl, object *scroll)
#define FLAG_READY_WEAPON
int snprintf(char *dest, int max, const char *format,...)
int pray(object *pl, object *skill)
static int do_skill_attack(object *tmp, object *op, const char *string, object *skill)
sint64 calc_skill_exp(object *who, object *op, object *skill)
void show_skills(object *op, const char *search)
int singing(object *pl, int dir, object *skill)
int find_traps(object *pl, object *skill)
sstring add_string(const char *str)
#define MSG_TYPE_ATTACK_DID_HIT
#define GET_MAP_OB(M, X, Y)
int skill_throw(object *op, object *part, int dir, const char *params, object *skill)
void apply_anim_suffix(object *who, sstring suffix)
int use_oratory(object *pl, int dir, object *skill)
uint8 permanent_exp_ratio
void LOG(LogLevel logLevel, const char *format,...)
const int learn_spell[MAX_STAT+1]
object * find_skill_by_name(object *who, const char *name)
object * last_skill_ob[NUM_SKILLS]
void query_name(const object *op, char *buf, size_t size)
#define SK_SUBTRACT_SKILL_EXP
int random_roll(int min, int max, const object *op, int goodbad)
void clear_skill(object *who)
object * find_skill_by_number(object *who, int skillno)
int write_on_item(object *pl, const char *params, object *skill)
const char * skill_names[NUM_SKILLS]
void fix_object(object *op)
void meditate(object *pl, object *skill)
EXTERN archetype * first_archetype
int skill_attack(object *tmp, object *pl, int dir, const char *string, object *skill)