Skip to content

Commit

Permalink
Skill and Spell fixes
Browse files Browse the repository at this point in the history
Fixes issues with using bash on objects.
Fixes issues with some spells working incorrectly when cast from a familiar
Fixes corner case where a spell cannot be used on a PC animal
Gives benefit to highly skilled group teleport casters by reducing cost slightly based on skill level/total spell roll.
Fixes issue with dispel magic not working correctly on summoned undead
  • Loading branch information
omnidecker committed Jun 7, 2024
1 parent f46028e commit 6b236de
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 27 deletions.
3 changes: 2 additions & 1 deletion vme/zone/skills.zon
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,7 @@ code
tgt := findunit(self,arg,FIND_UNIT_SURRO,null);
}

if ((tgt == null) or (not visible(self,tgt)))
if ((tgt == null) or (not visible(self,tgt)) or (not((tgt.type==UNIT_ST_PC) or (tgt.type==UNIT_ST_NPC))))
{
act("Bash who?", A_ALWAYS, self, null, null, TO_CHAR);
quit;
Expand Down Expand Up @@ -13739,3 +13739,4 @@ M_NORSE_GOD_LIGHT_GODLY(150,SEX_FEMALE)
end

%end

102 changes: 76 additions & 26 deletions vme/zone/spells.zon
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,7 @@ external

var
mboost : integer;
ex_ptr : extraptr;

code
{
Expand All @@ -1870,8 +1871,13 @@ if ((tgt==self) and (medi.type!=UNIT_ST_OBJ))
self.mana:=self.mana+100;
quit;
}
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;

ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((tgt == self) or (ex_ptr.descr == tgt.name))){ // fixes mobs that can't heal themselves and allows familiars to heal owners in rare corner cases
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
}

if (hm < 0)
{
Expand Down Expand Up @@ -3292,6 +3298,7 @@ var
in_gr : integer;
kids : integer;
mta : integer;
gtpcost : integer;

code
{
Expand Down Expand Up @@ -3441,15 +3448,17 @@ code
}
}

gtpcost := 10 - (hm/120); // benefit for good casters for group teleport
log(itoa(gtpcost));

if (self.mana < (kids * 10)) /* 10 mana per grouped char */
if (self.mana < (kids * gtpcost)) /* 10 mana per grouped char */
{
act("You have insufficient mana to teleport everyone in your group.",
A_ALWAYS, self, null, null, TO_CHAR);
goto tele_self;
}

self.mana:= self.mana - (kids * 10);
self.mana:= self.mana - (kids * gtpcost);

if (in_gr == FALSE)
goto tele_self;
Expand Down Expand Up @@ -8338,6 +8347,7 @@ external
var
heal : integer;
i : integer;
ex_ptr:extraptr;
code
{
/*
Expand All @@ -8346,8 +8356,12 @@ code
of the target character.
*/

if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((tgt == self) or (ex_ptr.descr == tgt.name))){ // fixes mobs that can't heal themselves and allows familiars to heal owners in rare corner cases
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
}

if (hm < 0)
{
Expand Down Expand Up @@ -8383,17 +8397,22 @@ external
var
heal : integer;
i : integer;
ex_ptr:extraptr;
code
{
/*
Spell Cure Light Wounds
This spell cures minor wounds, or partly heals major wounds
/*
Spell Cure Serious Wounds
This spell cures moderate wounds, or partly heals major wounds
of the target character.
*/

if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;

ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((tgt == self) or (ex_ptr.descr == tgt.name))){ // fixes mobs that can't heal themselves and allows familiars to heal owners in rare corner cases
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
}
if (hm < 0)
{
act("Nothing happens.", A_ALWAYS, self, null, null, TO_CHAR);
Expand Down Expand Up @@ -8422,11 +8441,16 @@ external
var
heal : integer;
i : integer;
ex_ptr:extraptr;
code
{

if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((tgt == self) or (ex_ptr.descr == tgt.name))){ // fixes mobs that can't heal themselves and allows familiars to heal owners in rare corner cases
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
}

if (hm < 0)
{
Expand All @@ -8452,18 +8476,25 @@ dilbegin bless(medi:unitptr, tgt : unitptr, arg : string,
external
integer bonusCalc(hm : integer);
integer max@function(a:integer, b:integer);
var
ex_ptr:extraptr;
code
{

/*
Spell Bless:
This spell raises the gods good attention to a character.
With divine intervention, the characters DIV, BRA, DEX and STR
is raised temporarily.
*/

if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;

ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((tgt == self) or (ex_ptr.descr == tgt.name))){ // fixes mobs that can't bless themselves and allows familiars to bless owners in rare corner cases
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
}
if ((hm < 0) or isaff(tgt, ID_BLESS) or isaff(tgt, ID_UNHOLY_BLESSING))
{
act("Nothing happens.", A_ALWAYS, self, null, null, TO_CHAR);
Expand Down Expand Up @@ -8503,6 +8534,8 @@ dilbegin ubless(medi:unitptr,tgt:unitptr,arg:string,hm:integer,effect:string);
external
integer bonusCalc(hm : integer);
integer max@function(a:integer, b:integer);
var
ex_ptr:extraptr;
code
{
/*
Expand All @@ -8512,9 +8545,12 @@ code
is raised temporarily.
*/

if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;

ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((tgt == self) or (ex_ptr.descr == tgt.name))){ // fixes mobs that can't cast unholy blessing on themselves and allows familiars to cast unholy blessing on owners in rare corner cases
if ((not RACE_IS_HUMANOID(tgt.race)) and (not RACE_IS_MAMMAL(tgt.race)))
hm := -1;
}
if ((hm < 0) or isaff(tgt, ID_BLESS) or isaff(tgt, ID_UNHOLY_BLESSING))
{
act("Nothing happens.", A_ALWAYS, self, null, null, TO_CHAR);
Expand Down Expand Up @@ -10716,7 +10752,7 @@ var
code
{
interrupt(SFB_DEAD, activator == self, vanish);
interrupt (SFB_MSG,TRUE,gotmsg);
interrupt (SFB_MSG,TRUE,gotmsg);
heartbeat := PULSE_SEC * 100;
d := pwr / 15 + 2;

Expand All @@ -10727,14 +10763,21 @@ if (d>0)
d := d - 1;
goto start;
}

goto vanish;

:gotmsg:
parse:= getwords(argument);
if (parse.[0] == "spl_dispel")
if (atoi(parse.[1]) <= pwr)
goto start;
if (parse.[0] == "spl_dispel"){
if (atoi(parse.[1]) >= pwr){
goto vanish;
} else {
if (atoi(parse.[1]) >= (pwr/2)){
d := d - 1;
}
}
}
goto start;


:vanish:
u:=load ("dust_bones@spells");
Expand Down Expand Up @@ -10973,10 +11016,16 @@ dilbegin refresh(med : unitptr, targ : unitptr, arg : string,
hm : integer, effect : string);
var
amount : integer;
ex_ptr : extraptr;
code
{
if ((not RACE_IS_HUMANOID(targ.race)) and (not RACE_IS_MAMMAL(targ.race)))
hm := -1;

ex_ptr:="$owner" in self.extra;
log(ex_ptr.descr);
if (not((targ == self) or (ex_ptr.descr == targ.name))){ // fixes mobs that can't refres themselves and allows familiars to refresh owners in rare corner cases
if ((not RACE_IS_HUMANOID(targ.race)) and (not RACE_IS_MAMMAL(targ.race)))
hm := -1;
}

if (hm < 0)
{
Expand Down Expand Up @@ -11513,7 +11562,7 @@ var

code
{
if ((tgt.type != UNIT_ST_NPC) or (not(race_lower_animal(tgt.race))))
if ((not(race_lower_animal(tgt.race)))) // there are cases where an PC can be a 'lower animal' - Removing NPC check
{
act("Your spell will only heal animals.",
A_ALWAYS, self, null, null, TO_CHAR);
Expand Down Expand Up @@ -15449,3 +15498,4 @@ end

%end


0 comments on commit 6b236de

Please sign in to comment.