summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2010-05-19 10:57:11 -0400
committerGuillaume Seguin <guillaume@segu.in>2010-05-19 10:57:11 -0400
commit15cf72b71c0dd2a32bd8a941bf2cb8a95da76e9d (patch)
treef41b627128e2b8eb64e67572378c9b5783b020f4
parent2e901b8188823d9734498ed523cd65c8764cec08 (diff)
downloadsqwareapi-15cf72b71c0dd2a32bd8a941bf2cb8a95da76e9d.tar.gz
sqwareapi-15cf72b71c0dd2a32bd8a941bf2cb8a95da76e9d.tar.bz2
Update incoming attacks source wrt rules change
-rw-r--r--sqwarea/__init__.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/sqwarea/__init__.py b/sqwarea/__init__.py
index 11ef11d..ca51966 100644
--- a/sqwarea/__init__.py
+++ b/sqwarea/__init__.py
@@ -384,17 +384,20 @@ class Attack (object):
dest = None
troops = None
arrival = None
+ sender = None
- def __init__ (self, dest, troops, arrival):
+ def __init__ (self, dest, troops, arrival, sender):
self.dest = dest
self.troops = troops
self.arrival = arrival
+ self.sender = sender
@classmethod
def parse (cls, data):
return cls (Point.parse (data["Destination"]),
data["TroopsNumber"],
- Date.parse (data["ArrivalDate"]))
+ Date.parse (data["ArrivalDate"]),
+ data["Sender"])
class OngoingAttack (Attack):
@@ -405,8 +408,8 @@ class OngoingAttack (Attack):
class IncomingAttack (Attack):
def __str__ (self):
- return "Incoming Attack to %s with %d troops, arriving at %s" \
- % (self.dest, self.troops, self.arrival)
+ return "Incoming Attack to %s from %s arriving at %s" \
+ % (self.dest, self.sender, self.arrival)
KING_DIRECTIONS = ["EAST", "WEST", "NORTH", "SOUTH"]