Skip to content

Commit

Permalink
Targaryan House ability
Browse files Browse the repository at this point in the history
  • Loading branch information
tijptjik committed Jun 12, 2016
1 parent 5dec2ca commit 485022e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 48 deletions.
31 changes: 24 additions & 7 deletions S06/core/house.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,32 @@ def is_dothraki(self, league, agent):
assassin = league.game.characters[agent]
return 'Dothraki' in assassin.bio

def bonus_mission(self, league, mission, target_house, target_house_name, target_roster):
def bonus_mission(self, league, mission):

# TODO TARGARYEN ABILITY:

# All Characters on this House’s Roster gain
target_house = mission['data']['target_house']
target_house_name = league.get_house(mission['data']['target_house']).full_name

healths = league.get_house_player(self.name).character_health


# <league_id><house_id><episode_id>

for char, health in healths.iteritems():
if health > 0:
healths[char] += 5

key = "{}{}{}".format(self.name, self.name, league.current_episode)

league.game.set_character_health(key, {
"episode" : league.current_episode,
"house" : self.name,
"health" : healths
})


# 5% Bonus on a succesful attack by a Dothraki Character

print 'WARNING >>> TARGARYEN NEEDS HOUSE ABILITY'
Expand All @@ -957,12 +978,8 @@ def spread_the_word(self, league, mission):
mission = self.reveal_outgoing_missions(league, mission)

if mission['type'] == 'assassination' and mission['success'] and self.is_dothraki(league, mission['data']['agent']):

target_house = mission['data']['target_house']
target_house_name = league.get_house(mission['data']['target_house']).full_name
target_roster = league.get_house(mission['data']['target_house']).character_health

self.bonus_mission(league, mission, target_house, target_house_name, target_roster)

self.bonus_mission(league, mission)

target_player = league.get_house_player(mission['data']['target_house'])
target_player.house.reveal_incoming_missions(league, mission, self.name)
Expand Down
12 changes: 11 additions & 1 deletion S06/core/intelligence.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def _random_selector(self):

intel = self.get_intel_template()

while True:
for i in range(10000):

intel['code'], intel['message'] = random.choice(self.intel_types)()

Expand All @@ -319,6 +319,16 @@ def _random_selector(self):
self.intelligence_events.append(intel)

return intel

# No valid intel after 1000 attempts at generating them

intel = self.get_intel_template()

intel['code'] = 'C|DEPLETED'
intel['message'] = "This character has no secrets left... "

return intel


def get_target_character_code(self):
char = self.target_character_id
Expand Down
2 changes: 1 addition & 1 deletion S06/core/league.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def process_episode_results(self, votes=True, missions=False, analytics=True):
if missions:
# DEVELOPER
self.run_weekly_diplomatic_missions()
# print '*** DIPLOMATIC MISSIONS RUN ***'
print '*** DIPLOMATIC MISSIONS RUN ***'
# DEVELOPER
self.run_weekly_assassion_missions()
print '*** ASSASSINATION MISSIONS RUN ***'
Expand Down
60 changes: 21 additions & 39 deletions S06/fix-character-health.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"source": [
Expand All @@ -20,40 +20,40 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"base[u'character_health'] = {k:v for k,v in base[u'character_health'].iteritems() if v['episode'] < 55}"
"base[u'character_health'] = {k:v for k,v in base[u'character_health'].iteritems() if v['episode'] < 57}"
]
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"missions = {k:v for k,v in base[u'missions'].iteritems() if v['episode'] == '54'}"
"missions = {k:v for k,v in base[u'missions'].iteritems() if v['episode'] == '56'}"
]
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"character_health = {k:v for k,v in base[u'character_health'].iteritems() if v['episode'] == 54}"
"character_health = {k:v for k,v in base[u'character_health'].iteritems() if v['episode'] == 56}"
]
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 5,
"metadata": {
"collapsed": true
},
Expand All @@ -64,7 +64,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 6,
"metadata": {
"collapsed": false
},
Expand All @@ -73,19 +73,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"100\n",
"daenerystargaryen\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"0\n",
"tyrionlannister\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"100\n",
"daenerystargaryen\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"FAIL\n",
Expand All @@ -109,27 +103,19 @@
"FAIL\n",
"\n",
"\n",
"100\n",
"brienneoftarth\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"100\n",
"aryastark\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"0\n",
"aryastark\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"FAIL\n",
"\n",
"\n",
"100\n",
"tyrionlannister\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"FAIL\n",
Expand All @@ -138,14 +124,10 @@
"FAIL\n",
"\n",
"\n",
"100\n",
"wunwun\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n",
"100\n",
"jaqenhghar\n",
"SUCCESS\n",
"FAIL\n",
"\n",
"\n"
]
Expand All @@ -158,7 +140,7 @@
" l = m['league']\n",
" d = base['characters'][m['assassination_agent']]['violence']\n",
" try:\n",
" v = base[u'character_health'][l+h+'54']['health']\n",
" v = base[u'character_health'][l+h+'56']['health']\n",
" print v[m['assassination_target_character']]\n",
" print m['assassination_target_character']\n",
" v[m['assassination_target_character']] = max(v[m['assassination_target_character']] - damage[d], 0)\n",
Expand All @@ -171,7 +153,7 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": 7,
"metadata": {
"collapsed": false,
"scrolled": false
Expand All @@ -183,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 8,
"metadata": {
"collapsed": false
},
Expand Down

0 comments on commit 485022e

Please sign in to comment.