Skip to content

Commit

Permalink
Merge pull request GrognardsFromHell#799 from doug1234/FixPalCovSpells
Browse files Browse the repository at this point in the history
Fix spells for Paladin's Cove (shold fix the spiritual weapon bug)
  • Loading branch information
doug1234 authored Dec 17, 2024
2 parents ab7183c + 91d692f commit 1489821
Show file tree
Hide file tree
Showing 87 changed files with 6,224 additions and 0 deletions.
103 changes: 103 additions & 0 deletions tpdatasrc/palcov/scr/Spell026 - Banishment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
from toee import *

def OnBeginSpellCast( spell ):
print "Banishment OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-abjuration-conjure", spell.caster )

def OnSpellEffect( spell ):
print "Banishment OnSpellEffect"

remove_list = []

spell.duration = 0
hitDiceAmount = 2 * spell.caster_level
banish_casterLV = spell.caster_level

# check for any item that is distasteful to the subjects (Needs suggestions)
bonus1_list = [8028] ## Potion of Protection From Outsiders
for bonus1 in bonus1_list:
if spell.caster.item_find(bonus1) != OBJ_HANDLE_NULL:
spell.dc = spell.dc + 2 ## the saving throw DC increases by 2
# does NOT work! (Needs a fix.)
# spell.caster_level = spell.caster_level + 1 ## +1 bonus on your caster level check for overcoming Spell Resistance

# check for rare items that work twice as well as a normal item for the purpose of the bonuses (Needs suggestions)
bonus2_list = [12900] ## Swamp Lotus
for bonus2 in bonus2_list:
if spell.caster.item_find(bonus2) != OBJ_HANDLE_NULL:
spell.dc = spell.dc + 4 ## the saving throw DC increases by 4
# does NOT work! (Needs a fix.)
# spell.caster_level = spell.caster_level + 2 ## +2 bonus on your caster level check for overcoming Spell Resistance

for target_item in spell.target_list:

# check critter hit dice
targetHitDice = target_item.obj.hit_dice_num

# check if target does not exceed the amount allowed
if hitDiceAmount >= targetHitDice:

# spell.dc is DC - target's HD + caster's caster_level
#- spell.dc = spell.dc - targetHitDice + banish_casterLV
#- spell.dc = max( 1, spell.dc )

# Fix for DC growing out of control, marc.
special_save_dc = spell.dc - targetHitDice + banish_casterLV
special_save_dc = max( 1, special_save_dc )

if (target_item.obj.type == obj_t_npc):

# check target is EXTRAPLANAR
if target_item.obj.d20_query_has_spell_condition( sp_Summoned ) or target_item.obj.is_category_type( mc_type_outsider ) or target_item.obj.is_category_subtype(mc_subtype_extraplanar):

# subtract the target's hit dice from the amount allowed
hitDiceAmount = hitDiceAmount - targetHitDice

# allow Will saving throw to negate
if target_item.obj.saving_throw_spell( special_save_dc, D20_Save_Will, D20STD_F_NONE, spell.caster, spell.id ):
# saving throw successful
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 30001 )
game.particles( 'Fizzle', target_item.obj )

else:
# saving throw unsuccessful
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 30002 )

# creature is sent back to its own plane (no 20% of wrong plane, DUMB)
# kill for now
# So you'll get awarded XP for the kill
if not target_item.obj in game.leader.group_list():
target_item.obj.damage( game.leader , D20DT_UNSPECIFIED, dice_new( "1d1" ) )
target_item.obj.critter_kill()
if target_item.obj.d20_query_has_spell_condition( sp_Summoned ):
game.particles( 'sp-Dismissal', target_item.obj.location )
target_item.obj.destroy()
else:
game.particles( 'sp-Dismissal', target_item.obj )
target_item.obj.condition_add_with_args( 'sp-Animate Dead', spell.id, spell.duration, 3 )

else:
# target is not EXTRAPLANAR
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 31007 )
game.particles( 'Fizzle', target_item.obj )

else:
# target is not an NPC
game.particles( 'Fizzle', target_item.obj )

else:
# ran out of allowed HD
game.particles( 'Fizzle', target_item.obj )

remove_list.append( target_item.obj )

spell.target_list.remove_target( target_item.obj )
spell.spell_end( spell.id )

def OnBeginRound( spell ):
print "Banishment OnBeginRound"

def OnEndSpellCast( spell ):
print "Banishment OnEndSpellCast"
98 changes: 98 additions & 0 deletions tpdatasrc/palcov/scr/Spell036 - Blasphemy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
from toee import *
from utilities import dbug

def OnBeginSpellCast( spell ):
print "Blasphemy OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-evocation-conjure", spell.caster )

def OnSpellEffect ( spell ):
print "Blasphemy OnSpellEffect"

remove_list = []
spell.dc = spell.dc + 4 # will save vs. Banishment is -4
spell.caster_level = fix_caster_level(spell)

# List can mutate during processing, so loop through a copy, marc
for target_item in list(spell.target_list): # for target_item in spell.target_list:

obj_hit_dice = target_item.obj.hit_dice_num
alignment = target_item.obj.critter_get_alignment()
dbug(" target_item.obj",target_item.obj,'holy')

# Only works on non-evil creatures
if not (alignment & ALIGNMENT_EVIL) and not (target_item.obj == spell.caster):

game.particles( 'sp-Slay Living', target_item.obj )
dbug(" target_item NOT EVIL",-99,'holy')

# Anything ten or more levels below the caster's level dies
if obj_hit_dice <= (spell.caster_level - 10):
# So you'll get awarded XP for the kill
if not target_item.obj in game.leader.group_list():
target_item.obj.damage( game.leader , D20DT_UNSPECIFIED, dice_new( "1d1" ) )
target_item.obj.critter_kill()

# Anything five or more levels below the caster's level is paralyzed
if obj_hit_dice <= (spell.caster_level - 5):
spell.duration = game.random_range(1,10) * 10
target_item.obj.condition_add_with_args( 'sp-Hold Monster', spell.id, spell.duration, 0 )

# Anything one or more levels below the caster's level is weakened
if obj_hit_dice <= (spell.caster_level - 1):
spell.duration = game.random_range(1,4) + game.random_range(1,4)
dam_amount = game.random_range(1,6) + game.random_range(1,6)
target_item.obj.condition_add_with_args( 'sp-Ray of Enfeeblement', spell.id, spell.duration, dam_amount )

# Anything the caster's level or below is dazed
if obj_hit_dice <= (spell.caster_level):
spell.duration = 1
target_item.obj.condition_add_with_args( 'sp-Daze', spell.id, spell.duration, 0 )

# Summoned and extraplanar creatures below the caster's level are also banished
# if they fail a Will save at -4
if target_item.obj.d20_query_has_spell_condition( sp_Summoned ) or target_item.obj.npc_flags_get() & ONF_EXTRAPLANAR != 0:

# allow Will saving throw to negate
if target_item.obj.saving_throw_spell( spell.dc, D20_Save_Will, D20STD_F_NONE, spell.caster, spell.id ):

# saving throw successful
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 30001 )
game.particles( 'Fizzle', target_item.obj )

else:

# saving throw unsuccessful
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 30002 )

# creature is sent back to its own plane
# kill for now
target_item.obj.critter_kill()

remove_list.append( target_item.obj )

spell.target_list.remove_list( remove_list )
spell.spell_end(spell.id)

def OnBeginRound( spell ):
print "Blasphemy OnBeginRound"

def OnEndSpellCast( spell ):
print "Blasphemy OnEndSpellCast"

#------------------------------------------------------------------------------
# Fix for cleric domain bug, which wrongly increases caster level by +1
# for each unfriendly target on the list.
#------------------------------------------------------------------------------
def fix_caster_level (spell):
dbug("\n\nBLASPHEMY\n----------------",-99,'holy')
dbug("BEFORE spell.caster_level",spell.caster_level,'holy')
dbug("BEFORE len(spell.target_list)",len(spell.target_list),'holy')
if spell.caster.obj_get_int(obj_f_critter_domain_1) == evil or spell.caster.obj_get_int(obj_f_critter_domain_2) == evil:
if spell.caster.stat_level_get(stat_level_cleric) >= 13:
for t in spell.target_list:
if not spell.caster.is_friendly(t.obj):
spell.caster_level = spell.caster_level - 1
dbug("AFTER spell.caster_level",spell.caster_level,'holy')
return spell.caster_level
67 changes: 67 additions & 0 deletions tpdatasrc/palcov/scr/Spell040 - Blindness Deafness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from toee import *

def OnBeginSpellCast( spell ):
print "Blindness/Deafness OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-necromancy-conjure", spell.caster )
return 1

def OnSpellEffect( spell ):
print "Blindness/Deafness OnSpellEffect"

if spell.caster.name == 14959: # Nymph
spell.dc = 17 # 10 + 3 + 4 (charisma)
spell.caster_level = 7

spell.duration = 14400
target_item = spell.target_list[0]

## Solves Radial menu problem for Wands/NPCs
spell_arg = spell.spell_get_menu_arg( RADIAL_MENU_PARAM_MIN_SETTING )
if spell_arg != 1 and spell_arg != 2:
spell_arg = 1 # blineness, marc

# allow Fortitude saving throw to negate
if target_item.obj.saving_throw_spell( spell.dc, D20_Save_Fortitude, D20STD_F_NONE, spell.caster, spell.id ):
# saving throw successful
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 30001 )
game.particles( 'Fizzle', target_item.obj )
spell.target_list.remove_target( target_item.obj )

else:
# saving throw unsuccessful
target_item.obj.float_mesfile_line( 'mes\\spell.mes', 30002 )

if spell_arg == 1:
# apply blindness
return_val = target_item.obj.condition_add_with_args( 'sp-Blindness', spell.id, spell.duration, 0 )
if return_val == 1:
target_item.partsys_id = game.particles( 'sp-Blindness-Deafness', target_item.obj )

else:
# apply deafness
return_val = target_item.obj.condition_add_with_args( 'sp-Deafness', spell.id, spell.duration, 0 )
if return_val == 1:
target_item.partsys_id = game.particles( 'sp-Blindness-Deafness', target_item.obj )

# Nymph
if spell.caster.name == 14959:
for pc in game.party:
if pc != target_item.obj and spell.caster.distance_to(pc) <= 50:
if pc.saving_throw_spell( spell.dc, D20_Save_Fortitude, D20STD_F_NONE, spell.caster, spell.id ):
pc.float_mesfile_line( 'mes\\spell.mes', 30001 )
game.particles( 'Fizzle', pc )
else:
pc.float_mesfile_line( 'mes\\spell.mes', 30002 )
return_val = pc.condition_add_with_args( 'sp-Blindness', spell.id, spell.duration, 0 )
if return_val == 1:
game.particles( 'sp-Blindness-Deafness', pc )

spell.spell_end( spell.id )

def OnBeginRound( spell ):
print "Blindness/Deafness OnBeginRound"

def OnEndSpellCast( spell ):
print "Blindness/Deafness OnEndSpellCast"
79 changes: 79 additions & 0 deletions tpdatasrc/palcov/scr/Spell056 - Charm Person.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from toee import *
from utilities import *
from exclusions import *

def OnBeginSpellCast( spell ):
print "Charm Person OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-enchantment-conjure", spell.caster )

def OnSpellEffect( spell ):
print "Charm Person OnSpellEffect"

if spell.caster.name in [14937]: # Nixie
spell.dc = 15 # 10 + 1 + 4 (charisma)
spell.caster_level = 4
elif spell.caster.name in [14507]: # Dryad
spell.dc = 13 # 10 + 1 + 2 (wisdom)
spell.caster_level = 6

spell.duration = 600 * spell.caster_level
target_item = spell.target_list[0]
target_item_obj = target_item.obj

if game.global_vars[451] & 2**2 != 0:
if game.combat_is_active():
spell.dc = spell.dc - 5 # to reflect a bonus to the saving throw for casting charm in combat

if (not spell.caster in game.party) and (target_item.obj.type != obj_t_pc) and (target_item.obj in game.party):
# NPC enemy is trying to charm an NPC from your party - this is bad because it effectively kills the NPC (is dismissed from party and becomes hostile, thus becoming unrecruitable unless you use dominate person/monster)
target_item_obj = party_closest( spell.caster, conscious_only= 1, mode_select= 0, exclude_warded= 0, exclude_charmed = 1) # select nearest conscious PC instead, who isn't already charmed
if target_item_obj == OBJ_HANDLE_NULL:
target_item_obj = target_item.obj

if not target_item_obj.is_friendly( spell.caster ):
if target_item_obj.is_category_type( mc_type_humanoid ):

if not target_item_obj.saving_throw_spell( spell.dc, D20_Save_Will, D20STD_F_NONE, spell.caster, spell.id ):
# saving throw unsuccessful
target_item_obj.float_mesfile_line( 'mes\\spell.mes', 30002 )

spell.caster.ai_follower_add( target_item_obj )

target_item_obj.condition_add_with_args( 'sp-Charm Person', spell.id, spell.duration, target_item.obj.hit_dice_num )
target_item.partsys_id = game.particles( 'sp-Charm Person', target_item_obj )

# add target to initiative, just in case
target_item_obj.add_to_initiative()
game.update_combat_ui()

else:

# saving throw successful
target_item_obj.float_mesfile_line( 'mes\\spell.mes', 30001 )

game.particles( 'Fizzle', target_item_obj )
spell.target_list.remove_target( target_item_obj )

else:
# not a humanoid
target_item_obj.float_mesfile_line( 'mes\\spell.mes', 30000 )
target_item_obj.float_mesfile_line( 'mes\\spell.mes', 31004 )

game.particles( 'Fizzle', target_item.obj )
spell.target_list.remove_target( target_item_obj )

else:

# can't target friendlies
game.particles( 'Fizzle', target_item_obj )
spell.target_list.remove_target( target_item_obj )

spell.spell_end( spell.id )

def OnBeginRound( spell ):
print "Charm Person OnBeginRound"

def OnEndSpellCast( spell ):
print "Charm Person OnEndSpellCast"
Loading

0 comments on commit 1489821

Please sign in to comment.