(no commit message)
[asgard.git] / equiption.py
blob8a5e2753b04ca4b0cd6ae2d1a7a77ec874d3a751
1 ########################################################
2 #Copyright (c) 2006 Russ Adams, Sean Eubanks, Asgard Contributors
3 #This file is part of Asgard.
5 #Asgard is free software; you can redistribute it and/or modify
6 #it under the terms of the GNU General Public License as published by
7 #the Free Software Foundation; either version 2 of the License, or
8 #(at your option) any later version.
10 #Asgard is distributed in the hope that it will be useful,
11 #but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #GNU General Public License for more details.
15 #You should have received a copy of the GNU General Public License
16 #along with Asgard; if not, write to the Free Software
17 #Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 ########################################################
19 class Equiption:
20 """ Represents the equiption of a fighter. """
22 __head = ""
23 """ A string representing the head equiption. """
25 __armor = ""
26 """ A string representing the armor equiption. """
28 __left = ""
29 """ A string representing the left hand/arm equiption. """
30 __right = ""
31 """ A string representing the right hand/arm equiption. """
33 def __init__(self,head,armor,l,r):
34 """
35 Surface is passed in via the self parameter.
36 @param head : name of item worn on head
37 @type head : string
38 @param armor : name of item worn on body
39 @type armor : string
40 @param left : name of item worn/held by left hand
41 @type left : string
42 @param right : name of item worn/held by right hand
43 @type right : string
44 """
46 self.__head = head
47 self.__armor = armor
48 self.__left = l
49 self.__right = r
51 def getHead(self):
52 """Get head armor."""
53 return self.__head
55 def setHead(self,h):
56 """Change head armor."""
57 self.__head = h
59 def getArmor(self):
60 """Get body armor."""
61 return self.__armor
63 def setArmor(self,a):
64 """Change body armor."""
65 self.__armor = a
67 def getLeft(self):
68 """Get left arm weapon/armor."""
69 return self.__left
71 def setLeft(self,l):
72 """Change left arm weapon/armor."""
73 self.__left = l
75 def getRight(self):
76 """Get right arm weapon/armor."""
77 return self.__right
79 def setRight(self,r):
80 """Change right arm weapon/armor."""
81 self.__right = r
83 def computeAtkMod(self):
84 """Compute attack modifier. Currently hard-coded."""
85 # Left/Right Attack Mods
86 if self.__left == 'Sword' or self.__right == 'Sword':
87 return 10
88 elif self.__left == 'Katana' or self.__right == 'Katana':
89 return 12
90 elif self.__left == 'Bow' or self.__right == 'Bow':
91 return 5
92 elif self.__left == 'Staff' or self.__right == 'Staff':
93 return 7
96 def computeDefMod(self):
97 """Compute defense modifier. Currently hard-coded."""
98 dMod = 0
100 # Head Defense Mods
101 if self.__head == 'Helm':
102 dMod += 2
103 # Left/Right Defense Mods
104 if self.__left == 'Shield' or self.__right == 'Shield':
105 dMod += 3
106 # Armor Defense Mods
107 if self.__armor == 'Chain Mail':
108 dMod += 8
109 elif self.__armor == 'Cloak':
110 dMod += 3
112 return dMod
114 def computeEvaMod(self):
115 """Compute evasion modifier. Currently hard-coded."""
116 eMod = 0
118 # Left/Right Evasion Mods
119 if self.__left == 'Shield' or self.__right == 'Shield':
120 eMod += 1
121 if self.__left == 'Sword' or self.__right == 'Sword':
122 eMod += 3
123 if self.__left == 'Katana' or self.__right == 'Katana':
124 eMod += 1
125 if self.__left == 'Staff' or self.__right == 'Staff':
126 eMod += 5
127 # Armor Evasion Mods
128 if self.__armor == 'Chain Mail':
129 eMod += 4
130 elif self.__armor == 'Cloak':
131 eMod += 6
133 return eMod