Update of /cvsroot/wpdev/xmlscripts/scripts/magic
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5334/magic
Modified Files:
__init__.py circle5.py spell.py
Log Message:
A lot of magery fixes.
Index: spell.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/spell.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** spell.py 6 Sep 2004 19:30:33 -0000 1.20
--- spell.py 7 Sep 2004 20:09:52 -0000 1.21
***************
*** 7,10 ****
--- 7,11 ----
from wolfpack.consts import MAGICRESISTANCE, EVALUATINGINTEL, INSCRIPTION, \
MAGERY, ANIM_CASTDIRECTED, SPELLDAMAGEBONUS, LOG_WARNING, SPELLCHANNELING
+ import time
# Recursive Function for counting reagents
***************
*** 96,99 ****
--- 97,103 ----
self.casttime = 500 + (250 * self.circle)
self.castaction = ANIM_CASTDIRECTED
+
+ # Change this to 0 for AoS behaviour
+ self.castrecovery = 1 * circle
#
***************
*** 160,168 ****
char.log(LOG_MESSAGE, "Casting spell %s from %s.\n" % (self.__class__.__name__, source))
! char.addtimer(self.calcdelay(), 'magic.spell.callback', [self, mode, args, target, item], 0, 0, "cast_delay")
return 1
! def calcdelay(self):
! return self.casttime
def checkweapon(self, char):
--- 164,194 ----
char.log(LOG_MESSAGE, "Casting spell %s from %s.\n" % (self.__class__.__name__, source))
! char.addtimer(self.calcdelay(char, mode), 'magic.spell.callback', [self, mode, args, target, item], 0, 0, "cast_delay")
return 1
! #
! # Calculate the time required to cast this spell
! #
! def calcdelay(self, char, mode):
! # Wands and commands don't have a delay
! if mode == MODE_WAND or mode == MODE_CMD:
! return 0
!
! # Get the AOS bonus from all items the character wears
! castspeed = 3 - properties.fromchar(char, CASTSPEEDBONUS)
!
! # Under the influence of the protection spell
! # spells are cast more slowly
! if char.propertyflags & 0x20000:
! castspeed += 2
!
! castspeed += self.circle
!
! if castspeed < 1:
! castspeed = 1
!
! # Was: floor((delay / 4.0) * 1000)
! char.message(str(castspeed / 4.0))
! return castspeed * 250
def checkweapon(self, char):
***************
*** 176,183 ****
# Check if the spellchanneling property is true for this item
! if properties.fromitem(weapon, SPELLCHANNELING) == 0:
! return False
else:
! return True
def checkrequirements(self, char, mode, args=[], target=None, item=None):
--- 202,231 ----
# Check if the spellchanneling property is true for this item
! if not properties.fromitem(weapon, SPELLCHANNELING):
! if not wolfpack.tobackpack(weapon, char):
! weapon.update()
!
! return True
else:
! return True
!
! #
! # Set the delay for the next spell
! #
! def setspelldelay(self, char, mode):
! if char.npc:
! pass
! elif char.socket:
! castrecovery = - properties.fromchar(char, CASTRECOVERYBONUS)
! castrecovery += 6
! castrecovery += self.castrecovery
!
! if castrecovery < 0:
! castrecovery = 0
!
! delay = float(castrecovery) / 4.0
! char.message(str(delay))
!
! char.socket.settag('spell_delay', time.time() + delay)
def checkrequirements(self, char, mode, args=[], target=None, item=None):
***************
*** 272,275 ****
--- 320,326 ----
fizzle(char)
return 0
+
+ # Set the next spell delay
+ self.setspelldelay(char, mode)
return 1
Index: circle5.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle5.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** circle5.py 3 Sep 2004 01:16:22 -0000 1.20
--- circle5.py 7 Sep 2004 20:09:52 -0000 1.21
***************
*** 182,186 ****
if not self.consumerequirements(char, mode, args, target, item):
return
!
# Toggle Magic Reflection
if char.propertyflags & 0x40000:
--- 182,186 ----
if not self.consumerequirements(char, mode, args, target, item):
return
!
# Toggle Magic Reflection
if char.propertyflags & 0x40000:
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/__init__.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** __init__.py 3 Sep 2004 01:31:05 -0000 1.15
--- __init__.py 7 Sep 2004 20:09:52 -0000 1.16
***************
*** 5,8 ****
--- 5,9 ----
from magic.spell import *
from wolfpack import console
+ import time
# Spell Registry
***************
*** 39,47 ****
if not spells.has_key(spell):
if socket:
! socket.log(LOG_ERROR, "Trying to cast unknown spell: %d\n" % spell)
socket.sysmessage('ERROR: Unknown Spell')
return
spells[spell].precast(char, mode, args, target, item)
# Target Cancel
--- 40,58 ----
if not spells.has_key(spell):
if socket:
! socket.log(LOG_ERROR, "Trying to cast unknown spell: %d.\n" % spell)
socket.sysmessage('ERROR: Unknown Spell')
return
+ # Deny casting if spell delay hasn't yet expired
+ if socket and socket.hastag('spell_delay'):
+ spell_delay = float(socket.gettag('spell_delay'))
+ if spell_delay > time.time():
+ socket.clilocmessage(502644)
+ return False
+ else:
+ socket.deltag('spell_delay')
+
spells[spell].precast(char, mode, args, target, item)
+ return True
# Target Cancel
|