From a54a70d88b5defdb58de2f8434fab5c82a663f80 Mon Sep 17 00:00:00 2001 From: rustushki Date: Sun, 5 Nov 2006 21:43:24 +0000 Subject: [PATCH] Heal should be implemented now. Heal removes sleep, poison, paralysis and madness. --- data/eventtypes/heal.xml | 12 ++++++++++++ data/fighter/Hand.xml | 2 +- eventtype.py | 8 +++----- fighter.py | 12 +++++++----- transaction.py | 28 +++++++++++++++------------- 5 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 data/eventtypes/heal.xml diff --git a/data/eventtypes/heal.xml b/data/eventtypes/heal.xml new file mode 100644 index 0000000..bbbaf10 --- /dev/null +++ b/data/eventtypes/heal.xml @@ -0,0 +1,12 @@ + + + heal + WHITE + 3 + + sleep + poison + paralysis + madness + + diff --git a/data/fighter/Hand.xml b/data/fighter/Hand.xml index 1b57436..fad3191 100644 --- a/data/fighter/Hand.xml +++ b/data/fighter/Hand.xml @@ -7,7 +7,7 @@ - + diff --git a/eventtype.py b/eventtype.py index ad339ce..c58289a 100644 --- a/eventtype.py +++ b/eventtype.py @@ -34,7 +34,7 @@ class EventType: self.__afflictions = [] aTree = eTree.xpathEval("//status") for a in aTree: - self.__afflictions.append(a.content) + self.__afflictions.append((a.content,a.prop("remove")=="True")) # Retrieving any elementals self.__elementals = [] @@ -108,8 +108,7 @@ class EventType: for s in self.__afflictions: if eventOccurs(t.getStatusModifier(s)): - # CHANGE: the True should be taken from the remove property of status - transList.append(TransactionStatus(t,s,True)) + transList.append(TransactionStatus(t,s[0],not s[1])) elif self.__typeName == "WHITE": @@ -130,7 +129,6 @@ class EventType: transList.append(TransactionStatistic(t,"hp",int(hpChange))) for s in self.__afflictions: if eventOccurs(t.getStatusModifier(s)): - # CHANGE: the True should be taken from the remove property of status - transList.append(TransactionStatus(t,s,True)) + transList.append(TransactionStatus(t,s[0],not s[1])) return transList diff --git a/fighter.py b/fighter.py index 0c2aac5..03c8c57 100644 --- a/fighter.py +++ b/fighter.py @@ -253,9 +253,9 @@ class Fighter: def getEventTypes(self): """Return list of events available to fighter.""" if self.__jobType == "blackmage": - return ["attack","fire1","ice1","cure1","fog","poison","quit"] + return ["attack","fire1","ice1","fog","poison","quit"] elif self.__jobType == "swordsman": - return ["attack","quit"] + return ["attack","cure1","heal","quit"] elif self.__name == "Roc": return ["attack","ice1"] elif self.__name == "Imp": @@ -359,6 +359,7 @@ class Fighter: found = True break + print s if not found: self.__status.append(s) s.genEntrance() @@ -367,14 +368,15 @@ class Fighter: def removeStatus(self,s): """Remove status s from status list for fighter.""" + found = False for i in self.__status: - if i == s: + if i.getName() == s: found = True break if found == True: - self.__status.remove(s) - s.genExit(self) + self.__status.remove(i) + i.genExit() else: print 'ERROR: Status was not in list!' diff --git a/transaction.py b/transaction.py index ec55ca5..21b005f 100644 --- a/transaction.py +++ b/transaction.py @@ -82,20 +82,22 @@ class TransactionStatus(Transaction): tlistEntrance =[] tlistPerTurnOnMove = [] - # poison status - if self.__status == "poison": - # remove 5% of hp per turn; this is lame and should be more dynamic - trans = TransactionStatistic(self.target,"hp",int(-1 * self.target.getStat("hp").getMax()*.05)) - tlistPerTurnOnMove.append(trans) - elif self.__status == "aglup": - trans = TransactionStatistic(self.target,"agl",10) - tlistEntrance.append(trans) - trans = TransactionStatistic(self.target,"agl",-10) - tlistExit.append(trans) + if not self.__add: + self.target.removeStatus(self.__status) + else: + # poison status + if self.__status == "poison": + # remove 5% of hp per turn; this is lame and should be more dynamic + trans = TransactionStatistic(self.target,"hp",int(-1 * self.target.getStat("hp").getMax()*.05)) + tlistPerTurnOnMove.append(trans) + elif self.__status == "aglup": + trans = TransactionStatistic(self.target,"agl",10) + tlistEntrance.append(trans) + trans = TransactionStatistic(self.target,"agl",-10) + tlistExit.append(trans) - - # create the status object and add it to the target - self.target.addStatus(Status(self.__status,tlistEntrance,tlistPerTurn,tlistPerIter,tlistExit,tlistPerTurnOnMove)) + # create the status object and add it to the target + self.target.addStatus(Status(self.__status,tlistEntrance,tlistPerTurn,tlistPerIter,tlistExit,tlistPerTurnOnMove)) def getStatus(self): -- 2.11.4.GIT