Update of /cvsroot/wpdev/xmlscripts/scripts/magic
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8706/magic
Modified Files:
__init__.py spell.py utilities.py
Log Message:
mage ai updates
Index: spell.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/spell.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** spell.py 16 Oct 2004 14:08:21 -0000 1.31
--- spell.py 16 Oct 2004 18:41:35 -0000 1.32
***************
*** 111,114 ****
--- 111,117 ----
#
def saymantra(self, char, mode):
+ if char.npc and char.bodytype != BODY_HUMAN:
+ return
+
if self.mantra and mode in [MODE_BOOK, MODE_SCROLL]:
char.say(self.mantra)
***************
*** 130,139 ****
# We are frozen
if char.frozen:
! char.socket.clilocmessage(502643)
return 0
# We are already casting a spell
if char.hasscript('magic') or (socket and socket.hastag('cast_target')):
! char.socket.clilocmessage(502642)
return 0
--- 133,148 ----
# We are frozen
if char.frozen:
! if socket:
! socket.clilocmessage(502643)
! else:
! npc_debug(char, 'Trying to cast while being frozen.')
return 0
# We are already casting a spell
if char.hasscript('magic') or (socket and socket.hastag('cast_target')):
! if socket:
! socket.clilocmessage(502642)
! else:
! npc_debug(char, 'Trying to cast spell while already casting a spell.')
return 0
***************
*** 141,145 ****
# the spell in our spellbook (0-based index)
if not self.inherent and mode == MODE_BOOK and not hasSpell(char, self.spellid - 1):
! char.message("You don't know the spell you want to cast.")
return 0
--- 150,157 ----
# the spell in our spellbook (0-based index)
if not self.inherent and mode == MODE_BOOK and not hasSpell(char, self.spellid - 1):
! if socket:
! char.message("You don't know the spell you want to cast.")
! else:
! npc_debug(char, 'Trying to cast spell %s unknown to the npc.' % self.__class__.__name__)
return 0
***************
*** 277,281 ****
# Check for Reagents
! if len(self.reagents) > 0:
items = countReagents(char.getbackpack(), self.reagents.copy())
--- 289,293 ----
# Check for Reagents
! if not char.npc and len(self.reagents) > 0:
items = countReagents(char.getbackpack(), self.reagents.copy())
***************
*** 338,342 ****
# Consume Reagents
! if len(self.reagents) > 0:
lowerreagentcost = properties.fromchar(char, LOWERREAGENTCOST)
--- 350,354 ----
# Consume Reagents
! if not char.npc and len(self.reagents) > 0:
lowerreagentcost = properties.fromchar(char, LOWERREAGENTCOST)
***************
*** 379,387 ****
damage = rolldice(dice, sides, bonus) * 100.0
! bonus = char.skill[INSCRIPTION] / 100.0
bonus += char.intelligence / 10.0
bonus += properties.fromchar(char, SPELLDAMAGEBONUS)
- damage *= 1.0 + bonus / 100.0
char.checkskill(self.damageskill, 0, 1200)
damage *= (30 + (9 * char.skill[self.damageskill]) / 100.0) / 100.0
--- 391,400 ----
damage = rolldice(dice, sides, bonus) * 100.0
! bonus = char.skill[INSCRIPTION] / 100.0
bonus += char.intelligence / 10.0
bonus += properties.fromchar(char, SPELLDAMAGEBONUS)
+ damage *= 1.0 + bonus / 100.0
+
char.checkskill(self.damageskill, 0, 1200)
damage *= (30 + (9 * char.skill[self.damageskill]) / 100.0) / 100.0
***************
*** 430,434 ****
if item:
item = item.serial
! char.socket.attachtarget('magic.target_response', [ self, mode, args, item ], 'magic.target_cancel', 'magic.target_timeout', 8000) # Don't forget the timeout later on
else:
# Callback to the NPC AI ??
--- 443,447 ----
if item:
item = item.serial
! char.socket.attachtarget('magic.target_response', [ self, mode, args, item ], 'magic.target_cancel', 'magic.target_timeout', 30000) # Don't forget the timeout later on
else:
# Callback to the NPC AI ??
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/__init__.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** __init__.py 16 Oct 2004 14:08:21 -0000 1.20
--- __init__.py 16 Oct 2004 18:41:35 -0000 1.21
***************
*** 42,45 ****
--- 42,47 ----
socket.log(LOG_ERROR, "Trying to cast unknown spell: %d.\n" % spell)
socket.sysmessage('ERROR: Unknown Spell')
+ else:
+ npc_debug(char, "Trying to cast unknown spell: %d." % spell)
return
***************
*** 51,55 ****
return False
else:
! socket.deltag('spell_delay')
spells[spell].precast(char, mode, args, target, item)
--- 53,57 ----
return False
else:
! socket.deltag('spell_delay')
spells[spell].precast(char, mode, args, target, item)
***************
*** 70,75 ****
# Target Response
def target_response( char, args, target ):
! # No more npc saftey from here
! char.socket.deltag('cast_target')
spell = args[0]
--- 72,77 ----
# Target Response
def target_response( char, args, target ):
! if char.socket:
! char.socket.deltag('cast_target')
spell = args[0]
***************
*** 161,166 ****
char.socket.clilocmessage(501857)
! def onCastSpell(char, spell):
! castSpell(char, spell)
# These Events happen for characters who are casting a spell right now
--- 163,168 ----
char.socket.clilocmessage(501857)
! def onCastSpell(char, spell, mode = 0, args = [], target = None, item = None):
! castSpell(char, spell, mode, args, target, item)
# These Events happen for characters who are casting a spell right now
Index: utilities.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/utilities.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** utilities.py 24 Sep 2004 11:07:04 -0000 1.16
--- utilities.py 16 Oct 2004 18:41:35 -0000 1.17
***************
*** 55,64 ****
if char.socket:
char.socket.deltag('cast_target')
!
! char.effect(0x3735, 1, 30)
! char.soundeffect(0x5c)
# Check whether the spellbook's of a char have that specific spell
def hasSpell(char, spell):
book = char.itemonlayer(1)
--- 55,68 ----
if char.socket:
char.socket.deltag('cast_target')
!
! # Only play the fizzle effect for players
! char.effect(0x3735, 1, 30)
! char.soundeffect(0x5c)
# Check whether the spellbook's of a char have that specific spell
def hasSpell(char, spell):
+ if char.npc:
+ return True
+
book = char.itemonlayer(1)
***************
*** 228,229 ****
--- 232,241 ----
if item:
item.delete()
+
+ #
+ # Say a NPC debug message.
+ #
+ def npc_debug(char, message):
+ #char.say(message)
+ pass
+
|