assembly-skills.patch
./suntzu/assembly-skills.patch · 7.2 KB
From the archive cwg-suntzu-2004-12-31.tgz
Download the archive « Back to the archive contents
diff -BburpN -x '*.o' src.1/act.item.c src/act.item.c
--- src.1/act.item.c 2004-12-19 13:22:21.000000000 -0600
+++ src/act.item.c 2004-12-23 12:02:54.000000000 -0600
@@ -68,16 +68,22 @@ ACMD(do_assemble)
long lVnum = NOTHING;
struct obj_data *pObject = NULL;
char buf[MAX_STRING_LENGTH];
+ int percent;
skip_spaces(&argument);
+ if (!GET_SKILL(ch, subcmd)) {
+ send_to_char(ch, "You know nothing of that art!\r\n");
+ return;
+ }
+
if (*argument == '\0') {
send_to_char(ch, "What would you like to %s?\r\n", CMD_NAME);
return;
} else if ((lVnum = assemblyFindAssembly(argument)) < 0) {
send_to_char(ch, "You can't %s %s %s.\r\n", CMD_NAME, AN(argument), argument);
return;
- } else if (assemblyGetType(lVnum) != subcmd) {
+ } else if (assemblyGetType(lVnum) != (subcmd - 101)) {
send_to_char(ch, "You can't %s %s %s.\r\n", CMD_NAME, AN(argument), argument);
return;
} else if (!assemblyCheckComponents(lVnum, ch)) {
@@ -85,11 +91,22 @@ ACMD(do_assemble)
return;
}
+ percent = rand_number(1, 101);
+
+ if (percent < SG_MIN)
+ skill_gain(ch, subcmd);
+
+ if (percent > GET_SKILL(ch, subcmd)) {
+ send_to_char(ch, "You attempt to create ends in failure!\r\n");
+ return;
+ } else {
/* Create the assembled object. */
if ((pObject = read_object(lVnum, VIRTUAL)) == NULL ) {
send_to_char(ch, "You can't %s %s %s.\r\n", CMD_NAME, AN(argument), argument);
return;
}
+ }
+
add_unique_id(pObject);
/* Now give the object to the character. */
diff -BburpN -x '*.o' src.1/assemblies.h src/assemblies.h
--- src.1/assemblies.h 2004-01-18 18:20:47.000000000 -0600
+++ src/assemblies.h 2004-12-23 11:41:17.000000000 -0600
@@ -14,18 +14,19 @@
* ******************************************************************** */
/* Assembly type: Used in ASSEMBLY.iAssemblyType */
-#define ASSM_ASSEMBLE 0 // Assembly must be assembled.
-#define ASSM_BAKE 1 // Assembly must be baked.
-#define ASSM_BREW 2 // Assembly must be brewed.
-#define ASSM_CRAFT 3 // Assembly must be crafted.
-#define ASSM_FLETCH 4 // Assembly must be fletched.
-#define ASSM_KNIT 5 // Assembly must be knitted.
-#define ASSM_MAKE 6 // Assembly must be made.
-#define ASSM_MIX 7 // Assembly must be mixed.
-#define ASSM_THATCH 8 // Assembly must be thatched.
-#define ASSM_WEAVE 9 // Assembly must be woven.
+#define ASSM_ASSEMBLE 101 // Assembly must be assembled.
+#define ASSM_BAKE 102 // Assembly must be baked.
+#define ASSM_BREW 103 // Assembly must be brewed.
+#define ASSM_CRAFT 104 // Assembly must be crafted.
+#define ASSM_FLETCH 105 // Assembly must be fletched.
+#define ASSM_KNIT 106 // Assembly must be knitted.
+#define ASSM_MAKE 107 // Assembly must be made.
+#define ASSM_MIX 108 // Assembly must be mixed.
+#define ASSM_THATCH 109 // Assembly must be thatched.
+#define ASSM_WEAVE 110 // Assembly must be woven.
+#define ASSM_FORGE 111 // Assembly must be woven.
-#define MAX_ASSM 10 // Number of assembly types.
+#define MAX_ASSM 11 // Number of assembly types.
/* ******************************************************************** *
* Type aliases. *
diff -BburpN -x '*.o' src.1/constants.c src/constants.c
--- src.1/constants.c 2004-09-27 22:09:28.000000000 -0500
+++ src/constants.c 2004-12-23 11:51:28.000000000 -0600
@@ -652,6 +652,7 @@ const char *AssemblyTypes[] = {
"mix",
"thatch",
"weave",
+ "forge",
"\n"
};
diff -BburpN -x '*.o' src.1/interpreter.c src/interpreter.c
--- src.1/interpreter.c 2004-10-25 20:01:35.000000000 -0500
+++ src/interpreter.c 2004-12-23 09:13:59.000000000 -0600
@@ -378,6 +378,7 @@ cpp_extern const struct command_info cmd
{ "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 },
{ "fletch" , "fletch" , POS_SITTING , do_assemble , 0, SCMD_FLETCH },
{ "follow" , "fol" , POS_RESTING , do_follow , 0, 0 },
+ { "forge" , "for" , POS_SITTING , do_assemble , 0, SCMD_FORGE },
{ "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_FREEZE, SCMD_FREEZE },
{ "get" , "get" , POS_RESTING , do_get , 0, 0 },
diff -BburpN -x '*.o' src.1/interpreter.h src/interpreter.h
--- src.1/interpreter.h 2004-09-10 19:21:27.000000000 -0500
+++ src/interpreter.h 2004-12-23 11:41:43.000000000 -0600
@@ -266,14 +266,15 @@ struct alias_data {
/* * do_assemble * These constants *must* corespond with
the ASSM_xxx constants in * assemblies.h. */
-#define SCMD_ASSEMBLE 0
-#define SCMD_BAKE 1
-#define SCMD_BREW 2
-#define SCMD_CRAFT 3
-#define SCMD_FLETCH 4
-#define SCMD_KNIT 5
-#define SCMD_MAKE 6
-#define SCMD_MIX 7
-#define SCMD_THATCH 8
-#define SCMD_WEAVE 9
+#define SCMD_ASSEMBLE 101
+#define SCMD_BAKE 102
+#define SCMD_BREW 103
+#define SCMD_CRAFT 104
+#define SCMD_FLETCH 105
+#define SCMD_KNIT 106
+#define SCMD_MAKE 107
+#define SCMD_MIX 108
+#define SCMD_THATCH 109
+#define SCMD_WEAVE 110
+#define SCMD_FORGE 111
diff -BburpN -x '*.o' src.1/spell_parser.c src/spell_parser.c
--- src.1/spell_parser.c 2004-10-23 23:14:26.000000000 -0500
+++ src/spell_parser.c 2004-12-23 09:12:03.000000000 -0600
@@ -1113,5 +1113,17 @@ void mag_assign_spells(void)
skillo(SKILL_WP_FLAIL, "flail");
skillo(SKILL_WP_STAFF, "staff");
skillo(SKILL_WP_HAMMER, "hammer");
+ skillo(SKILL_MAKE, "make");
+ skillo(SKILL_BREW, "brew");
+ skillo(SKILL_BAKE, "bake");
+ skillo(SKILL_ASSEMBLE, "assemble");
+ skillo(SKILL_CRAFT, "craft");
+ skillo(SKILL_FLETCH, "fletch");
+ skillo(SKILL_KNIT, "knit");
+ skillo(SKILL_MIX, "mix");
+ skillo(SKILL_THATCH, "thatch");
+ skillo(SKILL_WEAVE, "weave");
+ skillo(SKILL_FORGE, "forge");
+
}
diff -BburpN -x '*.o' src.1/spells.h src/spells.h
--- src.1/spells.h 2004-03-30 19:50:25.000000000 -0600
+++ src/spells.h 2004-12-23 09:13:12.000000000 -0600
@@ -94,9 +94,20 @@
#define SPELL_CAUSE_CRITIC 55 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_IDENTIFY 56 /* Reserved Skill[] DO NOT CHANGE */
/* Insert new spells here, up to MAX_SPELLS */
-#define MAX_SPELLS 120
+#define MAX_SPELLS 100
/* PLAYER SKILLS - Numbered from MAX_SPELLS+1 to MAX_SKILLS */
+#define SKILL_MAKE 101
+#define SKILL_BREW 102
+#define SKILL_BAKE 103
+#define SKILL_ASSEMBLE 104
+#define SKILL_CRAFT 105
+#define SKILL_FLETCH 106
+#define SKILL_KNIT 107
+#define SKILL_MIX 108
+#define SKILL_THATCH 109
+#define SKILL_WEAVE 110
+#define SKILL_FORGE 111
#define SKILL_BACKSTAB 121 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_BASH 122 /* Reserved Skill[] DO NOT CHANGE */
#define SKILL_HIDE 123 /* Reserved Skill[] DO NOT CHANGE */