[wpdev-commits] xmlscripts/scripts/magic spell.py,1.27,1.28
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-09-27 14:37:37
|
Update of /cvsroot/wpdev/xmlscripts/scripts/magic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18250/magic Modified Files: spell.py Log Message: random magic item loot and additional properties Index: spell.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/spell.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** spell.py 25 Sep 2004 12:06:59 -0000 1.27 --- spell.py 27 Sep 2004 14:37:26 -0000 1.28 *************** *** 5,11 **** from wolfpack import properties, utilities from magic.utilities import * ! from wolfpack.consts import MAGICRESISTANCE, EVALUATINGINTEL, INSCRIPTION, \ ! MAGERY, ANIM_CASTDIRECTED, SPELLDAMAGEBONUS, LOG_WARNING, SPELLCHANNELING, \ ! BODY_HUMAN import time --- 5,9 ---- from wolfpack import properties, utilities from magic.utilities import * ! from wolfpack.consts import * import time *************** *** 185,188 **** --- 183,196 ---- # + # Scale Mana + # + def scalemana(self, char, mode, mana): + if mode == MODE_SCROLL: + mana = (mana + 1) / 2 + + percent = properties.fromchar(char, LOWERMANACOST) / 100.0 + return max(0, mana - int(percent * float(mana))) + + # # Calculate the time required to cast this spell # *************** *** 306,320 **** if mode == MODE_BOOK: if self.mana != 0: ! char.mana = max(0, char.mana - self.mana) char.updatemana() # Consume Reagents if len(self.reagents) > 0: ! consumeReagents(char.getbackpack(), self.reagents.copy()) # Reduced Skill, Reduced Mana, No Reagents elif mode == MODE_SCROLL: if self.mana != 0: ! char.mana = max(0, char.mana - (self.mana + 1) / 2) char.updatemana() --- 314,333 ---- if mode == MODE_BOOK: if self.mana != 0: ! mana = self.scalemana(char, MODE_BOOK, self.mana) ! char.mana = max(0, char.mana - mana) char.updatemana() # Consume Reagents if len(self.reagents) > 0: ! lowerreagentcost = properties.fromchar(char, LOWERREAGENTCOST) ! ! if lowerreagentcost == 0 or lowerreagentcost > random.randint(0, 99): ! consumeReagents(char.getbackpack(), self.reagents.copy()) # Reduced Skill, Reduced Mana, No Reagents elif mode == MODE_SCROLL: if self.mana != 0: ! mana = self.scalemana(char, MODE_SCROLL, self.mana) ! char.mana = max(0, char.mana - mana) char.updatemana() |