Skip to content

Commit

Permalink
Adding support for spells that conflict with other spells, eg. polymo…
Browse files Browse the repository at this point in the history
…rph and incognito.
  • Loading branch information
Admin-Yukiko committed Dec 24, 2023
1 parent 93c3806 commit 85a0342
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 22 deletions.
6 changes: 6 additions & 0 deletions pkg/skills/magery/config/spells.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ Spell 35
RegCost BloodMoss 1
RegCost Garlic 1
RegCost NightShade 1
Conflicts 56 106 107 113 116
}

Spell 36
Expand Down Expand Up @@ -1512,6 +1513,7 @@ Spell 56
RegCost BloodMoss 1
RegCost MandrakeRoot 1
RegCost SpiderSilk 1
Conflicts 35 106 107 113 116
}

Spell 57
Expand Down Expand Up @@ -1892,6 +1894,7 @@ Spell 106
RegCost 0x0F78
RegCost 0x0F7D
val 5
Conflicts 35 56 107 113 116
}

Spell 107
Expand All @@ -1915,6 +1918,7 @@ Spell 107
RegCost 0x0F7D
RegCost 0x0F81
val 5
Conflicts 35 56 106 113 116
}

Spell 108
Expand Down Expand Up @@ -2053,6 +2057,7 @@ Spell 113
RegCost 0x0F8A
ChaosMutation 10 <= 7
val 6
Conflicts 35 56 106 107 116
}


Expand Down Expand Up @@ -2122,5 +2127,6 @@ Spell 116
RegCost 0x0F8A
ChaosMutation 10 <= 4
val 5
Conflicts 35 56 106 107 113
}

52 changes: 52 additions & 0 deletions pkg/skills/magery/spellStarter.src
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ program SpellStarter(params)
return 0;
endif

// Check for conflicting spells.
var conflict := conflict := ConflictsCheck( mobile, spell_id );
if( conflict )
SendSysMessage( mobile, "You cannot cast this spell while under the influence of " + conflict + ".", color := 33 );
return 0;
endif

// Perform various checks to see if mobile can perform the spell
var requires_mana := 1;
var requires_regs := 1;
Expand All @@ -55,6 +62,7 @@ program SpellStarter(params)
requires_mana := CInt(settings_elem.PlyrScrollsReqMana);
requires_regs := CInt(settings_elem.PlyrScrollsReqRegs);
endif

// Check for staff requirement of reagents and mana for casting spells.
if ( !mobile.IsA(POLCLASS_NPC) && (mobile.cmdlevel >= CInt(settings_elem.StaffCmdLvl)) && !scroll )
requires_mana := CInt(settings_elem.StaffRequiresMana);
Expand All @@ -67,6 +75,7 @@ program SpellStarter(params)
requires_regs := 0;
requires_mana := 1;
endif

// This check for casting from back pages of a runebook.
if( no_regs__no_mana )
requires_regs := 0;
Expand Down Expand Up @@ -319,3 +328,46 @@ function FailSpell(mobile)
PlaySoundEffect(mobile, SFX_SPELL_FAIL);
return 1;
endfunction

//////////////////////////////////////////////////////////////////////////////////////////
//
// ConflictsCheck( byref mobile, byref spell_id )
//
// Purpose: This function checks for any spell for that the mobile might have active
// which conflicts with the spell the mobile is attempting to cast.
//
// Parameter: mobile::mobileref, current_spell::string
//
// Returns: The a string, the conflicting spell name or an empty string if
// no conflicts were found for the current spell being cast.
//
// Created: 2023-05-16 01:29:14 by Yukiko
//
// Comments: Currently, there are only two standard magery spells that conflict with
// each other, Incognito and Polymorph. It is possible, if a developer adds
// optional magic systems such as the sorcery or cleric packages this
// function might need to be modified.
//
//////////////////////////////////////////////////////////////////////////////////////////
function ConflictsCheck( byref mobile, byref spell_id )

var current_spell_elem := MS_GetSpellsCfgElem(spell_id);
var current_spell := current_spell_elem.Name;
var conlicting_spells := current_spell_elem.Conflicts;
var conflicts := SplitWords( conlicting_spells );
// var temp := spell_id in
var conflicting_spell := conflicts;



MS_GetSpellsCfgElem(spell_id);
if( current_spell == "Incognito" && GetObjProperty( mobile, "Polymorphed" ) )
return "Polymorph";
elseif( current_spell == "Polymorph" && GetObjProperty( mobile, "Incognito" ) )
return "Incognito";
else
return "";
endif
// return conflicting_spell_name;
// NecroHBeast
endfunction
15 changes: 8 additions & 7 deletions pkg/skills/necromancy/eomen.src
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ program evil_omen( params )

SendSysMessage(caster, "Select your victim:", 1, 88);
var cast_on := Target(caster);


var duration := 20;
info := info;
Expand All @@ -27,7 +27,7 @@ program evil_omen( params )
var cast_onrs := GetAttribute(cast_on, RESISTING_SPELLS);
var modrs := cast_onrs / 50 * -1;
modrs := modrs * 10;

detach();
PlayObjectCenteredEffectEx( cast_on, 0x3779, 1, 15, 9502, 67, 0, 7 );
PlaySoundEffect(cast_on, 0xFC);
Expand All @@ -36,22 +36,23 @@ program evil_omen( params )
Setobjproperty(cast_on, "evilomen", 1);
ModifyResistance(cast_on, DMG_PHYSICAL, -20);
SetAttributeTemporaryMod( cast_on, RESISTING_SPELLS, GetAttributeTemporaryMod(cast_on, RESISTING_SPELLS) + modrs );

Sleep(duration);

PlayObjectCenteredEffectEx( cast_on, 0x3779, 1, 15, 9502, 67, 0, 7 );
PlaySoundEffect(cast_on, 0xFC);
Sleep(1);
PlayObjectCenteredEffectEx( cast_on, 0x3728, 1, 13, 9912, 1150, 0, 7 );
Eraseobjproperty(cast_on, "evilomen");
ModifyResistance(cast_on, DMG_PHYSICAL, 20);
SetAttributeTemporaryMod( cast_on, RESISTING_SPELLS, GetAttributeTemporaryMod(cast_on, RESISTING_SPELLS) - modrs );

endprogram

/*
What this spell is supposed to do not what this implentation does:
Be it a strike from a sword or the sting of a spell, the next bad thing that happens to the receiver of this curse will be worse. The player affected by this spell:
What this spell is supposed to do not what this implentation does:
Be it a strike from a sword or the sting of a spell, the next bad thing that happens to
the receiver of this curse will be worse. The player affected by this spell:

Will receive a +25% increase from the next source of damage.
Will receive a +1 boost to the level of poison the next time they are poisoned.
Expand Down
30 changes: 15 additions & 15 deletions pkg/skills/necromancy/hbeast.src
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ program horrific_beast( params )
SetObjProperty (caster, "oldrace", caster.title_race);
SetObjProperty (caster, "oldmurderer", caster.murderer);
elseif(Getobjproperty(caster, "poly") == 2)
if(getobjproperty(caster, "horrificbeast"))
eraseobjproperty(caster,"horrificbeast");
eraseobjproperty(caster,"NewRegenRateForLife");
recalcvitals(caster);
if(GetObjProperty(caster, "horrificbeast"))
EraseObjProperty(caster,"horrificbeast");
EraseObjProperty(caster,"NewRegenRateForLife");
RecalcVitals(caster);
PlaySoundEffect(caster, 0x165);
PlayObjectCenteredEffectEx( caster, 0x3728, 1, 13, 9918, 92, 0, 3 );
caster.graphic := caster.trueobjtype;
Expand All @@ -45,32 +45,32 @@ program horrific_beast( params )
EraseObjProperty (caster, "poly");
return 0;
endif
if(getobjproperty(caster, "wraith") && !caster.cmdlevel)
if(GetObjProperty(caster, "wraith") && !caster.cmdlevel)
RevokePrivilege(caster, "freemove");
caster.ar_mod := caster.ar_mod - getobjproperty(caster, "wraith");
endif

eraseobjproperty(caster,"wraith");
eraseobjproperty(caster,"vampire");
EraseObjProperty(caster,"wraith");
EraseObjProperty(caster,"vampire");
if(Cint(GetObjProperty(caster, "vampiric_resist")))
var vampresist := Cint(GetObjProperty(caster, "vampiric_resist"));
SetAttributeBaseValue(caster, RESISTING_SPELLS, vampresist * 10);
EraseObjProperty(caster, "vampiric_resist");
endif
eraseobjproperty(caster,"lichform");
eraseobjproperty(caster,"NewRegenRateForLife");
eraseobjproperty(caster,"NewRegenRateForMana");
eraseobjproperty(caster,"NewRegenRateForStamina");
recalcvitals(caster);
EraseObjProperty(caster,"lichform");
EraseObjProperty(caster,"NewRegenRateForLife");
EraseObjProperty(caster,"NewRegenRateForMana");
EraseObjProperty(caster,"NewRegenRateForStamina");
RecalcVitals(caster);
endif

PlaySoundEffect(caster, 0x165);
PlayObjectCenteredEffectEx( caster, 0x3728, 1, 13, 9918, 92, 0, 3 );
caster.graphic := 0x2EA;
caster.murderer := 1;
setobjproperty(caster, "horrificbeast", 1);
setobjproperty(caster, "poly", 2);
setobjproperty(caster, "NewRegenRateForLife", 15000);
SetObjProperty(caster, "horrificbeast", 1);
SetObjProperty(caster, "poly", 2);
SetObjProperty(caster, "NewRegenRateForLife", 15000);
RecalcVitals(caster);


Expand Down

0 comments on commit 85a0342

Please sign in to comment.