I am a new coder trying to help fix up an old mud and I am running in to issues with a spell. The spell gives a % of defense every level but right now instead of reducing damage someone receives it heals them instead.
On a small side note when I change 10: #define STONEFORM_FRACTION -(caster->query_level()*2); to 10: #define STONEFORM_FRACTION (caster->query_level()*2); by removing the - the spell kills people once it wears off. Any help would be greatly appreciated! Code Follows:
5: #include "path.h" 6: inherit SPELL_BASE; 7: #define STONEFORM_DURATION_BASE 0; 8: #define STONEFORM_DURATION_LEVEL 2; 9: #define STONEFORM_GP 10; 10: #define STONEFORM_FRACTION -(caster->query_level()*2); 11: 12: void setup(){ 13: set_target_type("one"); 14: set_range(0); 15: set_friendly(1); 16: set_gp_cost(10); 17: set_casting_time(4); 18: set_rounds(({ "round1", "round2", "round3", "round4" })); 19: set_help_desc("This spell allows a Runeseeker to make a pact with " 20: "an elemental from within the earth, causing a melding " 21: "between the elemental and the target, making the subject " 22: "become very elemental appearing. The stronger the cater, " 23: "the more damage the elemental will absorb.\n\n"); 24: 25: } 26: 27: varargs int round1(object caster, mixed target, mixed out_range, int time, int quiet){ 28: tell_object(caster, "You draw a sigil on the ground, and shake a handful of " 29: "dirt above it as you cast your spell.\nThe dirt falls to the ground, and as " 30: "the first grain lands, the ground begins to tremble and shake.\nThe rumbling " 31: "is the voice of an elemental, accepting your request to meld.\n"); 32: tell_room(environment(caster), caster->query_myname()+ 33: " dusts a handful of dirt and sand onto a glyph drawn upon " 34: "the ground.\nAs the grains strike the ground, a rumbling " 35: "begins.\nYou could be mistaken, but that sounds like speech.\n", ({caster, target})); 36: chant("Potentia Alterans Terram"); 37: return 0; 38: } 39: 40: varargs int round2(object caster, mixed target, mixed out_range, int time, int quiet){ 41: if(!target){ 42: tell_object(caster, "You do not have a target for the elemental to meld with.\n"); 43: tell_room(environment(caster), caster->query_myname()+" looks around puzzled, and " 44: "stops the spell.\n", ({caster, target})); 45: tell_object(target, caster->query_myname()+" tried to protect you with " 46: "a stoneform elemental melding, but you ran off!\n"); 47: return -1; 48: } 49: if(target->query_stoneskin_spell() || target->query_clover_of_lloth_spell() || 50: target->query_mirror_spell() || target->query_armour_spell() || 51: target->query_wraithform_spell()){ 52: tell_object(caster, "The magic around your target disrupts your spellcasting.\n"); 53: tell_object(target, caster->query_myname()+" looks at you, and " 54: "winces as his spell shatters.\n"); 55: tell_room(environment(caster), "As "+caster->query_myname()+" looks at " 56: +target->query_myname()+", "+caster->query_pronoun()+" stops casting.\n", ({caster, target})); 57: return -1; 58: } 59: if(target != caster){ 60: tell_object(caster, "You converse with the elemental in Terran, thanks to " 61: "the magic of your spell, asking it to join with "+target->query_myname()+".\n"); 62: tell_object(target, caster->query_myname()+" speaks in a foreign tongue, made " 63: "of rumbling and similar sounds, and continues his spell.\n"); 64: tell_room(environment(caster), caster->query_myname()+" makes noises sounding " 65: "like rumbling earth and falling rocks, while concentrating on "+target->query_myname()+".\n", 66: ({caster, target})); 67: chant("Terra Virtutem Praesidio"); 68: return 0; 69: } 70: else{ 71: tell_object(caster, "You converse with the elemental in Terran, thanks to " 72: "the magic of your spell, asking it to join with you.\n"); 73: tell_room(environment(caster), caster->myname()+" speaks in some foreign " 74: "tongue, sounding like tumbling rocks and rumbling stone.\n", caster); 75: chant("Terra Virtutem Primerios"); 76: return 0; 77: } 78: } 79: 80: varargs int round3(object caster, mixed target, mixed out_range, int time, int quiet){ 81: if(target != caster){ 82: tell_object(target, caster->query_myname()+"'s spell begins drawing the " 83: "earth and stone surrounding you, up around your body.\n"); 84: tell_room(environment(caster), "The pact "+caster->query_myname()+" has cast begins " 85: "to draw earth and stone around "+target->query_myname()+".\n", 86: ({caster, target})); 87: } 88: else{ 89: tell_object(caster, "Your elemental pact begins drawing stone around your body.\n");
90: tell_room(environment(caster), "The pact "+caster->query_myname()+" has cast begins " 91: "to draw earth and stone around "+target->query_pronoun()+".\n", ({caster, target})); 92: } 93: return 0; 94: } 95: varargs int round4(object caster, mixed target, mixed out_range, int time, int quiet){ 96: object shadow; 97: int stoneform_temp_number; 98: tell_object(target, "Your feel a strange sensation as you meld with the " 99: "elemental, slightly putting you out of sorts.\n"); 100: tell_object(caster, "Your spell completes, enveloping the target with " 101: "stone and earth.\n"); 102: tell_room(environment(caster), caster->query_myname()+" completes the " 103: "spell, and "+target->query_myname()+" looks almost like an earth elemental, " 104: "except the eyes are still humanoid instead of obsidian.\n", ({caster, target})); 105: 106: stoneform_temp_number = 2 * (int)caster->query_level(); 107: target->add_timed_property("STONEFORM_ON", 1, stoneform_temp_number); 108: shadow = clone_object("/std/spells/SHADOWS/stoneform.c"); 109: shadow->setup_shadow(target); 110: target->add_extra_look(shadow); 111: return 1; 112: }
The spell gives a % of defense every level but right now instead of reducing damage someone receives it heals them instead.
On a small side note when I change 10: #define STONEFORM_FRACTION -(caster->query_level()*2); to 10: #define STONEFORM_FRACTION (caster->query_level()*2);
by removing the - the spell kills people once it wears off. Any help would be greatly appreciated!
Code Follows:
5: #include "path.h"
6: inherit SPELL_BASE;
7: #define STONEFORM_DURATION_BASE 0;
8: #define STONEFORM_DURATION_LEVEL 2;
9: #define STONEFORM_GP 10;
10: #define STONEFORM_FRACTION -(caster->query_level()*2);
11:
12: void setup(){
13: set_target_type("one");
14: set_range(0);
15: set_friendly(1);
16: set_gp_cost(10);
17: set_casting_time(4);
18: set_rounds(({ "round1", "round2", "round3", "round4" }));
19: set_help_desc("This spell allows a Runeseeker to make a pact with "
20: "an elemental from within the earth, causing a melding "
21: "between the elemental and the target, making the subject "
22: "become very elemental appearing. The stronger the cater, "
23: "the more damage the elemental will absorb.\n\n");
24:
25: }
26:
27: varargs int round1(object caster, mixed target, mixed out_range, int time, int quiet){
28: tell_object(caster, "You draw a sigil on the ground, and shake a handful of "
29: "dirt above it as you cast your spell.\nThe dirt falls to the ground, and as "
30: "the first grain lands, the ground begins to tremble and shake.\nThe rumbling "
31: "is the voice of an elemental, accepting your request to meld.\n");
32: tell_room(environment(caster), caster->query_myname()+
33: " dusts a handful of dirt and sand onto a glyph drawn upon "
34: "the ground.\nAs the grains strike the ground, a rumbling "
35: "begins.\nYou could be mistaken, but that sounds like speech.\n", ({caster, target}));
36: chant("Potentia Alterans Terram");
37: return 0;
38: }
39:
40: varargs int round2(object caster, mixed target, mixed out_range, int time, int quiet){
41: if(!target){
42: tell_object(caster, "You do not have a target for the elemental to meld with.\n");
43: tell_room(environment(caster), caster->query_myname()+" looks around puzzled, and "
44: "stops the spell.\n", ({caster, target}));
45: tell_object(target, caster->query_myname()+" tried to protect you with "
46: "a stoneform elemental melding, but you ran off!\n");
47: return -1;
48: }
49: if(target->query_stoneskin_spell() || target->query_clover_of_lloth_spell() ||
50: target->query_mirror_spell() || target->query_armour_spell() ||
51: target->query_wraithform_spell()){
52: tell_object(caster, "The magic around your target disrupts your spellcasting.\n");
53: tell_object(target, caster->query_myname()+" looks at you, and "
54: "winces as his spell shatters.\n");
55: tell_room(environment(caster), "As "+caster->query_myname()+" looks at "
56: +target->query_myname()+", "+caster->query_pronoun()+" stops casting.\n", ({caster, target}));
57: return -1;
58: }
59: if(target != caster){
60: tell_object(caster, "You converse with the elemental in Terran, thanks to "
61: "the magic of your spell, asking it to join with "+target->query_myname()+".\n");
62: tell_object(target, caster->query_myname()+" speaks in a foreign tongue, made "
63: "of rumbling and similar sounds, and continues his spell.\n");
64: tell_room(environment(caster), caster->query_myname()+" makes noises sounding "
65: "like rumbling earth and falling rocks, while concentrating on "+target->query_myname()+".\n",
66: ({caster, target}));
67: chant("Terra Virtutem Praesidio");
68: return 0;
69: }
70: else{
71: tell_object(caster, "You converse with the elemental in Terran, thanks to "
72: "the magic of your spell, asking it to join with you.\n");
73: tell_room(environment(caster), caster->myname()+" speaks in some foreign "
74: "tongue, sounding like tumbling rocks and rumbling stone.\n", caster);
75: chant("Terra Virtutem Primerios");
76: return 0;
77: }
78: }
79:
80: varargs int round3(object caster, mixed target, mixed out_range, int time, int quiet){
81: if(target != caster){
82: tell_object(target, caster->query_myname()+"'s spell begins drawing the "
83: "earth and stone surrounding you, up around your body.\n");
84: tell_room(environment(caster), "The pact "+caster->query_myname()+" has cast begins "
85: "to draw earth and stone around "+target->query_myname()+".\n",
86: ({caster, target}));
87: }
88: else{
89: tell_object(caster, "Your elemental pact begins drawing stone around your body.\n");
90: tell_room(environment(caster), "The pact "+caster->query_myname()+" has cast begins "
91: "to draw earth and stone around "+target->query_pronoun()+".\n", ({caster, target}));
92: }
93: return 0;
94: }
95: varargs int round4(object caster, mixed target, mixed out_range, int time, int quiet){
96: object shadow;
97: int stoneform_temp_number;
98: tell_object(target, "Your feel a strange sensation as you meld with the "
99: "elemental, slightly putting you out of sorts.\n");
100: tell_object(caster, "Your spell completes, enveloping the target with "
101: "stone and earth.\n");
102: tell_room(environment(caster), caster->query_myname()+" completes the "
103: "spell, and "+target->query_myname()+" looks almost like an earth elemental, "
104: "except the eyes are still humanoid instead of obsidian.\n", ({caster, target}));
105:
106: stoneform_temp_number = 2 * (int)caster->query_level();
107: target->add_timed_property("STONEFORM_ON", 1, stoneform_temp_number);
108: shadow = clone_object("/std/spells/SHADOWS/stoneform.c");
109: shadow->setup_shadow(target);
110: target->add_extra_look(shadow);
111: return 1;
112: }