Skip to content
This repository has been archived by the owner on Nov 12, 2018. It is now read-only.

Commit

Permalink
#31 Use self.resources instead of self.self_info.resources
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenein committed Aug 19, 2016
1 parent df0160c commit 5f99800
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions epicbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ def check_bastion(self):
"""
Plays a bastion battle and/or collects a gift.
"""
if self.self_info.resources[ResourceType.runes] >= self.BASTION_GIFT_RUNES:
if self.resources[ResourceType.runes] >= self.BASTION_GIFT_RUNES:
logging.info("Collecting bastion gift…")
for reward_type, amount in self.api.open_fair_citadel_gate().items():
logging.info("Collected %s %s.", amount, reward_type.name)
self.notifications.append("Collect *{} {}* from *bastion*.".format(amount, reward_type.name))
self.self_info.resources[ResourceType.runes] -= self.BASTION_GIFT_RUNES
self.resources[ResourceType.runes] -= self.BASTION_GIFT_RUNES

logging.info("Starting bastion…")
error, bastion = self.api.start_bastion()
Expand Down Expand Up @@ -343,7 +343,7 @@ def can_upgrade(self, entity_type: Union[BuildingType, UnitType], level: int) ->
# Dictionaries to match resources against.
current_values = {
BuildingType: self.buildings.max_level,
ResourceType: self.self_info.resources,
ResourceType: self.resources,
}
for type_, argument in self.library.requirements[entity_type, level].items():
if current_values[type(type_)].get(type_, 0) < argument:
Expand Down Expand Up @@ -392,10 +392,10 @@ def send_telegram_notification(self):
).format(
self_info=self.self_info,
requests=self.api.request_id,
food=self.format_amount(self.self_info.resources[ResourceType.food]),
gold=self.format_amount(self.self_info.resources[ResourceType.gold]),
sand=self.format_amount(self.self_info.resources[ResourceType.sand]),
runes=self.format_amount(self.self_info.resources[ResourceType.runes]),
food=self.format_amount(self.resources[ResourceType.food]),
gold=self.format_amount(self.resources[ResourceType.gold]),
sand=self.format_amount(self.resources[ResourceType.sand]),
runes=self.format_amount(self.resources[ResourceType.runes]),
construction=construction,
notifications="\n".join("\N{CONSTRUCTION WORKER} %s" % line for line in self.notifications),
log_counter=self.context.log_handler.counter,
Expand Down

0 comments on commit 5f99800

Please sign in to comment.