#NEWLINE# def attacked( self , source , attack ) : #NEWLINE# #INDENT# for defense in self . defenses : #NEWLINE# #INDENT# defense . apply ( self , attack ) #NEWLINE# if ( ( attack . adj_damage <= 0 ) or ( attack . adj_accuracy <= 0 ) ) : #NEWLINE# #INDENT# if defense . success_map : #NEWLINE# #INDENT# self . broadcast ( target = source , ** defense . success_map ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# source . broadcast ( verb = attack . verb , target = self , ** attack . fail_map ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# #UNINDENT# source . broadcast ( verb = attack . verb , target = self , ** attack . success_map ) #NEWLINE# current_pool = getattr ( self , attack . damage_pool ) #NEWLINE# setattr ( self , attack . damage_pool , ( current_pool - attack . adj_damage ) ) #NEWLINE# combat_log ( source , ( lambda : '' . join ( [ '{N} result -- ' , attack . damage_pool , ' old: ' , str ( current_pool ) , ' new: ' , str ( ( current_pool - attack . adj_damage ) ) ] ) ) , self ) #NEWLINE# self . check_status ( )