Documentation Update. Part 2.
[asgard.git] / equiption.py
blobc66fe7dbf228dcd5c5ee8c60ace147f1242e056a
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 self.__head = head
35 self.__armor = armor
36 self.__left = l
37 self.__right = r
39 def getHead(self):
40 """Get head armor."""
41 return self.__head
43 def setHead(self,h):
44 """Change head armor."""
45 self.__head = h
47 def getArmor(self):
48 """Get body armor."""
49 return self.__armor
51 def setArmor(self,a):
52 """Change body armor."""
53 self.__armor = a
55 def getLeft(self):
56 """Get left arm weapon/armor."""
57 return self.__left
59 def setLeft(self,l):
60 """Change left arm weapon/armor."""
61 self.__left = l
63 def getRight(self):
64 """Get right arm weapon/armor."""
65 return self.__right
67 def setRight(self,r):
68 """Change right arm weapon/armor."""
69 self.__right = r
71 def computeAtkMod(self):
72 """Compute attack modifier. Currently hard-coded."""
73 # Left/Right Attack Mods
74 if self.__left == 'Sword' or self.__right == 'Sword':
75 return 10
76 elif self.__left == 'Katana' or self.__right == 'Katana':
77 return 12
78 elif self.__left == 'Bow' or self.__right == 'Bow':
79 return 5
80 elif self.__left == 'Staff' or self.__right == 'Staff':
81 return 7
84 def computeDefMod(self):
85 """Compute defense modifier. Currently hard-coded."""
86 dMod = 0
88 # Head Defense Mods
89 if self.__head == 'Helm':
90 dMod += 2
91 # Left/Right Defense Mods
92 if self.__left == 'Shield' or self.__right == 'Shield':
93 dMod += 3
94 # Armor Defense Mods
95 if self.__armor == 'Chain Mail':
96 dMod += 8
97 elif self.__armor == 'Cloak':
98 dMod += 3
100 return dMod
102 def computeEvaMod(self):
103 """Compute evasion modifier. Currently hard-coded."""
104 eMod = 0
106 # Left/Right Evasion Mods
107 if self.__left == 'Shield' or self.__right == 'Shield':
108 eMod += 1
109 if self.__left == 'Sword' or self.__right == 'Sword':
110 eMod += 3
111 if self.__left == 'Katana' or self.__right == 'Katana':
112 eMod += 1
113 if self.__left == 'Staff' or self.__right == 'Staff':
114 eMod += 5
115 # Armor Evasion Mods
116 if self.__armor == 'Chain Mail':
117 eMod += 4
118 elif self.__armor == 'Cloak':
119 eMod += 6
121 return eMod