A few Bug-Fixes and Ideas

This commit is contained in:
JamDog
2010-11-06 15:47:38 +00:00
parent 222be04ec5
commit d4454288b1
9 changed files with 249 additions and 150 deletions

View File

@@ -1587,6 +1587,7 @@ void init_spell_levels(void)
spell_level(SPELL_FIREBALL, CLASS_MAGIC_USER, 15);
spell_level(SPELL_CHARM, CLASS_MAGIC_USER, 16);
spell_level(SPELL_IDENTIFY, CLASS_MAGIC_USER, 20);
spell_level(SPELL_FLY, CLASS_MAGIC_USER, 22);
spell_level(SPELL_ENCHANT_WEAPON, CLASS_MAGIC_USER, 26);
spell_level(SPELL_CLONE, CLASS_MAGIC_USER, 30);

View File

@@ -581,8 +581,18 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
}
snprintf(str, slen, "%d", GET_CHA(c));
}
else if (!str_cmp(field, "class"))
sprinttype(GET_CLASS(c), pc_class_types, str, slen);
else if (!str_cmp(field, "class")) {
if (subfield && *subfield) {
int cl = get_class_by_name(subfield);
if (cl != -1) {
GET_CLASS(c) = cl;
snprintf(str, slen, "1");
} else {
snprintf(str, slen, "0");
}
} else
sprinttype(GET_CLASS(c), pc_class_types, str, slen);
}
else if (!str_cmp(field, "con")) {
if (subfield && *subfield) {
int addition = atoi(subfield);
@@ -766,8 +776,13 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
}
break;
case 'l':
if (!str_cmp(field, "level"))
snprintf(str, slen, "%d", GET_LEVEL(c));
if (!str_cmp(field, "level")) {
if (subfield && *subfield) {
int lev = atoi(subfield);
GET_LEVEL(c) = MIN(MAX(lev, 0), LVL_IMMORT-1);
} else
snprintf(str, slen, "%d", GET_LEVEL(c));
}
break;
case 'm':
if (!str_cmp(field, "mana")) {

View File

@@ -413,6 +413,13 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
to_vict = "Your eyes tingle.";
break;
case SPELL_FLY:
af[0].duration = 24;
SET_BIT_AR(af[0].bitvector, AFF_FLYING);
accum_duration = TRUE;
to_vict = "You float above the ground.";
break;
case SPELL_INFRAVISION:
af[0].duration = 12 + level;
SET_BIT_AR(af[0].bitvector, AFF_INFRAVISION);

View File

@@ -34,6 +34,8 @@ static void medit_save_to_disk(zone_vnum zone_num);
static void medit_disp_positions(struct descriptor_data *d);
static void medit_disp_sex(struct descriptor_data *d);
static void medit_disp_attack_types(struct descriptor_data *d);
static bool medit_illegal_mob_flag(int fl);
static int medit_get_mob_flag_by_number(int num);
static void medit_disp_mob_flags(struct descriptor_data *d);
static void medit_disp_aff_flags(struct descriptor_data *d);
static void medit_disp_menu(struct descriptor_data *d);
@@ -328,14 +330,57 @@ static void medit_disp_attack_types(struct descriptor_data *d)
write_to_output(d, "Enter attack type : ");
}
/* Find mob flags that shouldn't be set by builders */
static bool medit_illegal_mob_flag(int fl)
{
int i;
/* add any other flags you dont want them setting */
const int illegal_flags[] = {
MOB_ISNPC,
MOB_NOTDEADYET,
};
const int num_illegal_flags = sizeof(illegal_flags)/sizeof(int);
for (i=0; i < num_illegal_flags;i++)
if (fl == illegal_flags[i])
return (TRUE);
return (FALSE);
}
/* Due to illegal mob flags not showing in the mob flags list,
we need this to convert the list number back to flag value */
static int medit_get_mob_flag_by_number(int num)
{
int i, count = 0;
for (i = 0; i < NUM_MOB_FLAGS; i++) {
if (medit_illegal_mob_flag(i)) continue;
if ((++count) == num) return i;
}
/* Return 'illegal flag' value */
return -1;
}
/* Display mob-flags menu. */
static void medit_disp_mob_flags(struct descriptor_data *d)
{
int i, count = 0, columns = 0;
char flags[MAX_STRING_LENGTH];
get_char_colors(d->character);
clear_screen(d);
column_list(d->character, 0, action_bits, NUM_MOB_FLAGS, TRUE);
/* Mob flags has special handling to remove illegal flags from the list */
for (i = 0; i < NUM_MOB_FLAGS; i++) {
if (medit_illegal_mob_flag(i)) continue;
write_to_output(d, "%s%2d%s) %-20.20s %s", grn, ++count, nrm, action_bits[i],
!(++columns % 2) ? "\r\n" : "");
}
sprintbitarray(MOB_FLAGS(OLC_MOB(d)), action_bits, AF_ARRAY_MAX, flags);
write_to_output(d, "\r\nCurrent flags : %s%s%s\r\nEnter mob flags (0 to quit) : ", cyn, flags, nrm);
}
@@ -478,7 +523,7 @@ static void medit_disp_stats_menu(struct descriptor_data *d)
void medit_parse(struct descriptor_data *d, char *arg)
{
int i = -1;
int i = -1, j;
char *oldtext = NULL;
if (OLC_MODE(d) > MEDIT_NUMERICAL_RESPONSE) {
@@ -837,8 +882,13 @@ void medit_parse(struct descriptor_data *d, char *arg)
case MEDIT_NPC_FLAGS:
if ((i = atoi(arg)) <= 0)
break;
else if (i <= NUM_MOB_FLAGS)
else if ( (j = medit_get_mob_flag_by_number(i)) == -1) {
write_to_output(d, "Invalid choice!\r\n");
write_to_output(d, "Enter mob flags (0 to quit) :");
return;
} else if (j <= NUM_MOB_FLAGS) {
TOGGLE_BIT_AR(MOB_FLAGS(OLC_MOB(d)), (i - 1));
}
medit_disp_mob_flags(d);
return;

View File

@@ -21,6 +21,7 @@
#include "boards.h"
#include "improved-edit.h"
#include "oasis.h"
#include "class.h"
#include "dg_scripts.h" /* for trigedit_string_cleanup */
#include "modify.h"
#include "quest.h"
@@ -278,7 +279,7 @@ ACMD(do_skillset)
struct char_data *vict;
char name[MAX_INPUT_LENGTH];
char buf[MAX_INPUT_LENGTH], helpbuf[MAX_STRING_LENGTH];
int skill, value, i, qend;
int skill, value, i, qend, pc, pl;
argument = one_argument(argument, name);
@@ -302,6 +303,8 @@ ACMD(do_skillset)
return;
}
skip_spaces(&argument);
pc = GET_CLASS(vict);
pl = GET_LEVEL(vict);
/* If there is no chars in argument */
if (!*argument) {
@@ -347,6 +350,13 @@ ACMD(do_skillset)
send_to_char(ch, "You can't set NPC skills.\r\n");
return;
}
if ((spell_info[skill].min_level[(pc)] >= LVL_IMMORT) && (pl < LVL_IMMORT)) {
send_to_char(ch, "%s cannot be learned by mortals.\r\n", spell_info[skill].name);
return;
} else if (spell_info[skill].min_level[(pc)] > pl) {
send_to_char(ch, "%s is a level %d %s.\r\n", GET_NAME(vict), pl, pc_class_types[pc]);
send_to_char(ch, "The minimum level for %s is %d for %ss.\r\n", spell_info[skill].name, spell_info[skill].min_level[(pc)], pc_class_types[pc]);
}
/* find_skill_num() guarantees a valid spell_info[] index, or -1, and we
* checked for the -1 above so we are safe here. */

View File

@@ -834,6 +834,10 @@ void mag_assign_spells(void)
TAR_CHAR_ROOM | TAR_FIGHT_VICT, TRUE, MAG_DAMAGE,
NULL);
spello(SPELL_FLY, "fly", 40, 20, 2, POS_FIGHTING,
TAR_CHAR_ROOM, FALSE, MAG_AFFECTS,
"You drift slowly to the ground.");
spello(SPELL_GROUP_HEAL, "group heal", 80, 60, 5, POS_STANDING,
TAR_IGNORE, FALSE, MAG_GROUPS,
NULL);

View File

@@ -82,16 +82,17 @@
#define SPELL_WORD_OF_RECALL 42 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_REMOVE_POISON 43 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_SENSE_LIFE 44 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_ANIMATE_DEAD 45 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_DISPEL_GOOD 46 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_GROUP_ARMOR 47 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_GROUP_HEAL 48 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_GROUP_RECALL 49 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_ANIMATE_DEAD 45 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_DISPEL_GOOD 46 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_GROUP_ARMOR 47 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_GROUP_HEAL 48 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_GROUP_RECALL 49 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_INFRAVISION 50 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_WATERWALK 51 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_IDENTIFY 52 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_IDENTIFY 52 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_FLY 53 /* Reserved Skill[] DO NOT CHANGE */
/** Total Number of defined spells */
#define NUM_SPELLS 52
#define NUM_SPELLS 53
/* Insert new spells here, up to MAX_SPELLS */
#define MAX_SPELLS 130

View File

@@ -21,6 +21,7 @@
#include "spells.h"
#include "handler.h"
#include "interpreter.h"
#include "class.h"
/** Aportable random number function.
@@ -1471,3 +1472,12 @@ void new_affect(struct affected_type *af)
for (i=0; i<AF_ARRAY_MAX; i++) af->bitvector[i]=0;
}
/* Handy function to get class ID number by name (abbreviations allowed) */
int get_class_by_name(char *classname)
{
int i;
for (i=0; i<NUM_CLASSES; i++)
if (is_abbrev(classname, pc_class_types[i])) return(i);
return (-1);
}

View File

@@ -67,6 +67,7 @@ IDXTYPE atoidx( const char *str_to_conv );
char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad);
char *strpaste(char *str1, char *str2, char *joiner);
void new_affect(struct affected_type *af);
int get_class_by_name(char *classname);
/* Public functions made available form weather.c */
void weather_and_time(int mode);