Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic
In directory sc8-pr-cvs1:/tmp/cvs-serv27604/wolfpack/magic
Modified Files:
circle1.py circle2.py spell.py utilities.py
Added Files:
circle3.py trap.py
Log Message:
Work in Progress
on wolfpack.magic
--- NEW FILE: circle3.py ---
from wolfpack.magic import registerspell
from wolfpack.magic.spell import CharEffectSpell, Spell, DelayedDamageSpell
from wolfpack.magic.utilities import *
import random
import wolfpack
from wolfpack.utilities import tobackpack
class Bless ( CharEffectSpell ):
def __init__( self ):
CharEffectSpell.__init__( self, 3 )
self.reagents = { REAGENT_MANDRAKE: 1, REAGENT_GARLIC: 1 }
self.mantra = 'Rel Sanct'
def effect( self, char, target ):
statmodifier( char, target, 3, 0 )
target.effect( 0x373a, 10, 15 )
target.soundeffect( 0x1ea )
class Fireball ( DelayedDamageSpell ):
def __init__( self ):
DelayedDamageSpell.__init__( self, 2 )
self.reagents = { REAGENT_BLACKPEARL: 1 }
self.mantra = 'Vas Flam'
self.sound = 0x44b
self.missile = [ 0x36D4, 0, 1, 7, 0 ]
def damage( self, char, target ):
damage = self.scaledamage( char, target, random.randint( 10, 17 ) )
target.damage( DAMAGE_MAGICAL, damage, char )
def onLoad():
Bless().register( 17 )
Fireball().register( 18 )
#MagicLock().register( 19 )
#Poison().register( 20 )
#Telekinesis().register( 21 )
#Teleport().register( 22 )
#Unlock().register( 23 )
#WallOfStone().register( 24 )
--- NEW FILE: trap.py ---
#
# This event should be assigned to trapped containers
# As soon as they are opened, the trap sets off.
#
import wolfpack
from wolfpack.consts import *
def onUse( char, item ):
try:
type = item.gettag( 'trap_type' )
damage = item.gettag( 'trap_damage' )
owner = item.gettag( 'trap_owner' )
except:
item.events.remove( 'wolfpack.magic.trap' )
return 0
char.message( 502999 )
pos = item.pos
wolfpack.effect( 0x36bd, wolfpack.coord( pos.x + 1, pos.y, pos.z, pos.map ), 15, 15 )
wolfpack.effect( 0x36bd, wolfpack.coord( pos.x, pos.y - 1, pos.z, pos.map ), 15, 15 )
wolfpack.effect( 0x36bd, wolfpack.coord( pos.x - 1, pos.y, pos.z, pos.map ), 15, 15 )
wolfpack.effect( 0x36bd, wolfpack.coord( pos.x, pos.y + 1, pos.z, pos.map ), 15, 15 )
item.soundeffect( 0x307 )
events = item.events
events.remove( 'wolfpack.magic.trap' )
item.events = events
# Now Damage the Character
source = wolfpack.findchar( owner )
char.damage( DAMAGE_MAGICAL, damage, source )
return 1
Index: circle1.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic/circle1.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** circle1.py 25 Sep 2003 14:28:43 -0000 1.2
--- circle1.py 25 Sep 2003 23:44:42 -0000 1.3
***************
*** 9,14 ****
class Clumsy ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self )
! self.mana = 4
self.reagents = { REAGENT_BLOODMOSS: 1, REAGENT_NIGHTSHADE: 1 }
self.mantra = 'Uus Jux'
--- 9,13 ----
class Clumsy ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self, 1 )
self.reagents = { REAGENT_BLOODMOSS: 1, REAGENT_NIGHTSHADE: 1 }
self.mantra = 'Uus Jux'
***************
*** 23,28 ****
class Feeblemind ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self )
! self.mana = 4
self.reagents = { REAGENT_GINSENG: 1, REAGENT_NIGHTSHADE: 1 }
self.mantra = 'Rel Wis'
--- 22,26 ----
class Feeblemind ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self, 1 )
self.reagents = { REAGENT_GINSENG: 1, REAGENT_NIGHTSHADE: 1 }
self.mantra = 'Rel Wis'
***************
*** 37,42 ****
class Weaken ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self )
! self.mana = 4
self.reagents = { REAGENT_GARLIC: 1, REAGENT_NIGHTSHADE: 1 }
self.mantra = 'Des Mani'
--- 35,39 ----
class Weaken ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self, 1 )
self.reagents = { REAGENT_GARLIC: 1, REAGENT_NIGHTSHADE: 1 }
self.mantra = 'Des Mani'
***************
*** 51,55 ****
class CreateFood( Spell ):
def __init__( self ):
! self.mana = 4
self.reagents = { REAGENT_GARLIC: 1, REAGENT_GINSENG: 1, REAGENT_MANDRAKE: 1 }
self.mantra = 'In Mani Ylem'
--- 48,52 ----
class CreateFood( Spell ):
def __init__( self ):
! Spell.__init__( self, 1 )
self.reagents = { REAGENT_GARLIC: 1, REAGENT_GINSENG: 1, REAGENT_MANDRAKE: 1 }
self.mantra = 'In Mani Ylem'
***************
*** 72,77 ****
class Heal ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self )
! self.mana = 4
self.reagents = { REAGENT_GARLIC: 1, REAGENT_GINSENG: 1, REAGENT_SPIDERSILK: 1 }
self.mantra = 'In Mani'
--- 69,73 ----
class Heal ( CharEffectSpell ):
def __init__( self ):
! CharEffectSpell.__init__( self, 1 )
self.reagents = { REAGENT_GARLIC: 1, REAGENT_GINSENG: 1, REAGENT_SPIDERSILK: 1 }
self.mantra = 'In Mani'
***************
*** 88,93 ****
class MagicArrow ( DelayedDamageSpell ):
def __init__( self ):
! DelayedDamageSpell.__init__( self )
! self.mana = 4
self.reagents = { REAGENT_SULFURASH: 1 }
self.mantra = 'In Por Ylem'
--- 84,88 ----
class MagicArrow ( DelayedDamageSpell ):
def __init__( self ):
! DelayedDamageSpell.__init__( self, 1 )
self.reagents = { REAGENT_SULFURASH: 1 }
self.mantra = 'In Por Ylem'
***************
*** 96,105 ****
def damage( self, char, target ):
! damage = self.scaledamage( char, target, 4 )
target.damage( DAMAGE_MAGICAL, damage, char )
class ReactiveArmor( Spell ):
def __init__( self ):
! self.mana = 4
self.reagents = { REAGENT_GARLIC: 1, REAGENT_SPIDERSILK: 1, REAGENT_SULFURASH: 1 }
self.mantra = 'Flam Sanct'
--- 91,100 ----
def damage( self, char, target ):
! damage = self.scaledamage( char, target, random.randint( 4, 8 ) )
target.damage( DAMAGE_MAGICAL, damage, char )
class ReactiveArmor( Spell ):
def __init__( self ):
! Spell.__init__( self, 1 )
self.reagents = { REAGENT_GARLIC: 1, REAGENT_SPIDERSILK: 1, REAGENT_SULFURASH: 1 }
self.mantra = 'Flam Sanct'
***************
*** 128,137 ****
# Register the spells in this module (wolfpack.magic.circle1)
def onLoad():
! Clumsy().register( 1, 1 )
! CreateFood().register( 1, 2 )
! Feeblemind().register( 1, 3 )
! Heal().register( 1, 4 )
! MagicArrow().register( 1, 5 )
! #NightSight().register( 1, 6 )
! ReactiveArmor().register( 1, 7 )
! Weaken().register( 1, 8 )
--- 123,132 ----
# Register the spells in this module (wolfpack.magic.circle1)
def onLoad():
! Clumsy().register( 1 )
! CreateFood().register( 2 )
! Feeblemind().register( 3 )
! Heal().register( 4 )
! MagicArrow().register( 5 )
! #NightSight().register( 6 )
! ReactiveArmor().register( 7 )
! Weaken().register( 8 )
Index: circle2.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic/circle2.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** circle2.py 25 Sep 2003 14:28:43 -0000 1.1
--- circle2.py 25 Sep 2003 23:44:42 -0000 1.2
***************
*** 7,10 ****
from wolfpack.utilities import tobackpack
def onLoad():
!
\ No newline at end of file
--- 7,143 ----
from wolfpack.utilities import tobackpack
+ class Agility ( CharEffectSpell ):
+ def __init__( self ):
+ CharEffectSpell.__init__( self, 2 )
+ self.reagents = { REAGENT_MANDRAKE: 1, REAGENT_BLOODMOSS: 1 }
+ self.mantra = 'Ex Uus'
+
+ def effect( self, char, target ):
+ statmodifier( char, target, 1, 0 )
+
+ target.effect( 0x375a, 10, 15 )
+ target.soundeffect( 0x28e )
+
+ class Cunning ( CharEffectSpell ):
+ def __init__( self ):
+ CharEffectSpell.__init__( self, 2 )
+ self.reagents = { REAGENT_MANDRAKE: 1, REAGENT_NIGHTSHADE: 1 }
+ self.mantra = 'Uus Wis'
+
+ def effect( self, char, target ):
+ statmodifier( char, target, 2, 0 )
+
+ target.effect( 0x375a, 10, 15 )
+ target.soundeffect( 0x1eb )
+
+ class Strength ( CharEffectSpell ):
+ def __init__( self ):
+ CharEffectSpell.__init__( self, 2 )
+ self.reagents = { REAGENT_MANDRAKE: 1, REAGENT_NIGHTSHADE: 1 }
+ self.mantra = 'Uus Mani'
+
+ def effect( self, char, target ):
+ statmodifier( char, target, 0, 0 )
+
+ target.effect( 0x375a, 10, 15 )
+ target.soundeffect( 0x1ee )
+
+ class Harm ( DelayedDamageSpell ):
+ def __init__( self ):
+ DelayedDamageSpell.__init__( self, 2 )
+ self.delay = None
+ self.reagents = { REAGENT_SPIDERSILK: 1, REAGENT_NIGHTSHADE: 1 }
+ self.mantra = 'An Mani'
+ self.sound = 0x1f1
+
+ def damage( self, char, target ):
+ distance = target.distanceto( char )
+
+ char.message( 'Distance to target: ' + str( distance ) )
+
+ damage = random.randint( 1, 15 )
+
+ # One field between us and the target
+ if distance == 2:
+ damage *= 0.5
+
+ elif distance > 2:
+ damage *= 0.25
+
+ damage = self.scaledamage( char, target, int( damage ) )
+ target.effect( 0x374a, 10, 15 )
+ target.damage( DAMAGE_MAGICAL, damage, char )
+
+ class MagicTrap ( Spell ):
+ def __init__( self ):
+ Spell.__init__( self, 2 )
+ self.validtarget = TARGET_ITEM
+ self.reagents = { REAGENT_GARLIC: 1, REAGENT_SPIDERSILK: 1, REAGENT_SULFURASH: 1 }
+ self.mantra = 'In Jux'
+
+ def target( self, char, mode, targettype, target ):
+ char.turnto( target )
+
+ if not self.consumerequirements( char, mode ):
+ return
+
+ # Can this be trapped?
+ if target.type != 1:
+ char.message( 'You cannot trap that.' )
+
+ # Already Trapped?
+ if 'wolfpack.magic.trap' in target.events:
+ fizzle( char )
+ return
+
+ pos = target.pos
+ wolfpack.effect( 0x376a, wolfpack.coord( pos.x + 1, pos.y, pos.z, pos.map ), 9, 10 )
+ wolfpack.effect( 0x376a, wolfpack.coord( pos.x, pos.y - 1, pos.z, pos.map ), 9, 10 )
+ wolfpack.effect( 0x376a, wolfpack.coord( pos.x - 1, pos.y, pos.z, pos.map ), 9, 10 )
+ wolfpack.effect( 0x376a, wolfpack.coord( pos.x, pos.y + 1, pos.z, pos.map ), 9, 10 )
+ target.soundeffect( 0x1ef )
+
+ # Add the Trap Properties to the Item
+ target.settag( 'trap_owner', char.serial )
+ target.settag( 'trap_damage', random.randint( 10, 50 ) )
+ target.settag( 'trap_type', 'magic' )
+ target.events = target.events + [ 'wolfpack.magic.trap' ]
+
+ class RemoveTrap ( Spell ):
+ def __init__( self ):
+ Spell.__init__( self, 2 )
+ self.validtarget = TARGET_ITEM
+ self.reagents = { REAGENT_BLOODMOSS: 1, REAGENT_SULFURASH: 1 }
+ self.mantra = 'An Jux'
+
+ def target( self, char, mode, targettype, target ):
+ char.turnto( target )
+
+ if not self.consumerequirements( char, mode ):
+ return
+
+ # Already Trapped?
+ if not'wolfpack.magic.trap' in target.events:
+ fizzle( char )
+ return
+
+ wolfpack.effect( 0x376a, target.pos, 9, 32 )
+ target.soundeffect( 0x1f0 )
+
+ # Add the Trap Properties to the Item
+ target.deltag( 'trap_owner', char.serial )
+ target.deltag( 'trap_damage', random.randint( 10, 50 ) )
+ target.deltag( 'trap_type', 'magic' )
+ events = target.events
+ events.remove( 'wolfpack.magic.trap' )
+ target.events = events
+
def onLoad():
! Agility().register( 9 )
! Cunning().register( 10 )
! #Cure().register( 11 )
! Harm().register( 12 )
! MagicTrap().register( 13 )
! RemoveTrap().register( 14 )
! #Protection().register( 15 )
! Strength().register( 16 )
Index: spell.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic/spell.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** spell.py 25 Sep 2003 14:28:43 -0000 1.2
--- spell.py 25 Sep 2003 23:44:42 -0000 1.3
***************
*** 52,69 ****
return 1
! def register( self, circle, id ):
self.spellid = id
- self.circle = circle
wolfpack.magic.registerspell( self.spellid, self )
! def __init__( self ):
! pass
def calcdelay( self ):
return 250 + ( 250 * self.circle )
!
! # I decided against using a predefined table because
! # this gives shards more ways to customize their magic system
! # 4, 6, 9, 11, 14, 20, 40, 50
def checkrequirements( self, char, mode ):
if char.dead:
--- 52,68 ----
return 1
! def register( self, id ):
self.spellid = id
wolfpack.magic.registerspell( self.spellid, self )
! def __init__( self, circle ):
! # Set Mana
! self.circle = circle
! mana_table = [ 4, 6, 9, 11, 14, 20, 40, 50 ]
! self.mana = mana_table[ self.circle - 1 ]
def calcdelay( self ):
return 250 + ( 250 * self.circle )
!
def checkrequirements( self, char, mode ):
if char.dead:
***************
*** 144,148 ****
class CharEffectSpell ( Spell ):
! def __init__( self ):
self.validtarget = TARGET_CHAR
self.resistable = 1 # Most of them are resistable
--- 143,148 ----
class CharEffectSpell ( Spell ):
! def __init__( self, circle ):
! Spell.__init__( self, circle )
self.validtarget = TARGET_CHAR
self.resistable = 1 # Most of them are resistable
***************
*** 166,170 ****
class DelayedDamageSpell( CharEffectSpell ):
! def __init__( self ):
self.validtarget = TARGET_CHAR
self.harmful = 1 # All of them are harmful
--- 166,171 ----
class DelayedDamageSpell( CharEffectSpell ):
! def __init__( self, circle ):
! CharEffectSpell.__init__( self, circle )
self.validtarget = TARGET_CHAR
self.harmful = 1 # All of them are harmful
Index: utilities.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/magic/utilities.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** utilities.py 25 Sep 2003 14:28:43 -0000 1.2
--- utilities.py 25 Sep 2003 23:44:42 -0000 1.3
***************
*** 55,69 ****
amount = args[1]
! if stat == 0:
char.strength -= amount
char.maxhitpoints -= amount
char.hitpoints = min( char.hitpoints, char.maxhitpoints )
! elif stat == 1:
char.dexterity -= amount
char.maxstamina -= amount
char.stamina = min( char.stamina, char.maxstamina )
! elif stat == 2:
char.intelligence -= amount
char.maxmana -= amount
--- 55,69 ----
amount = args[1]
! if stat == 0 or stat == 3:
char.strength -= amount
char.maxhitpoints -= amount
char.hitpoints = min( char.hitpoints, char.maxhitpoints )
! elif stat == 1 or stat == 3:
char.dexterity -= amount
char.maxstamina -= amount
char.stamina = min( char.stamina, char.maxstamina )
! elif stat == 2 or stat == 3:
char.intelligence -= amount
char.maxmana -= amount
***************
*** 82,86 ****
amount = args[1]
! if stat == 0:
char.strength -= amount
char.maxhitpoints -= amount
--- 82,86 ----
amount = args[1]
! if stat == 0 or stat == 3:
char.strength -= amount
char.maxhitpoints -= amount
***************
*** 88,97 ****
char.updatehealth()
! elif stat == 1:
char.dexterity -= amount
char.maxstamina -= amount
char.stamina = min( char.stamina, char.maxstamina )
! elif stat == 2:
char.intelligence -= amount
char.maxmana -= amount
--- 88,97 ----
char.updatehealth()
! elif stat == 1 or stat == 3:
char.dexterity -= amount
char.maxstamina -= amount
char.stamina = min( char.stamina, char.maxstamina )
! elif stat == 2 or stat == 3:
char.intelligence -= amount
char.maxmana -= amount
***************
*** 114,118 ****
char.dispel( char, 0, "magic_statmodifier", [ "silent" ] )
! if stat == 0:
if target.strength + amount < 1:
amount = - ( target.strength - 1 )
--- 114,118 ----
char.dispel( char, 0, "magic_statmodifier", [ "silent" ] )
! if stat == 0 or stat == 3:
if target.strength + amount < 1:
amount = - ( target.strength - 1 )
***************
*** 123,127 ****
target.updatehealth()
! elif stat == 1:
if target.dexterity + amount < 1:
amount = - ( target.dexterity - 1 )
--- 123,127 ----
target.updatehealth()
! elif stat == 1 or stat == 3:
if target.dexterity + amount < 1:
amount = - ( target.dexterity - 1 )
***************
*** 131,135 ****
target.stamina = min( target.stamina, target.maxstamina )
! elif stat == 2:
if target.intelligence + amount < 1:
amount = - ( target.intelligence - 1 )
--- 131,135 ----
target.stamina = min( target.stamina, target.maxstamina )
! elif stat == 2 or stat == 3:
if target.intelligence + amount < 1:
amount = - ( target.intelligence - 1 )
|