<s> from mpf . system . mode import Mode <EOL> class Bonus ( Mode ) : <EOL> def mode_init ( self ) : <EOL> self . machine . events . add_handler ( '<STR_LIT>' , <EOL> self . player_add ) <EOL> def player_add ( self , player , ** kwargs ) : <EOL> player [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> def mode_start ( self , ** kwargs ) : <EOL> if self . machine . game . tilted : <EOL> self . stop ( ) <EOL> self . bonus_score = <NUM_LIT:0> <EOL> self . bonus_start ( ) <EOL> def bonus_start ( self ) : <EOL> self . machine . events . post ( '<STR_LIT>' ) <EOL> self . delay . add ( name = '<STR_LIT>' , ms = <NUM_LIT> , callback = self . slings ) <EOL> def slings ( self ) : <EOL> self . machine . events . post ( '<STR_LIT>' ) <EOL> self . bonus_score += self . player [ '<STR_LIT>' ] * <NUM_LIT:100> <EOL> self . delay . add ( name = '<STR_LIT>' , ms = <NUM_LIT> , callback = self . total_hits ) <EOL> def total_hits ( self ) : <EOL> self . machine . events . post ( '<STR_LIT>' ) <EOL> self . bonus_score += self . player [ '<STR_LIT>' ] * <NUM_LIT:50> <EOL> self . delay . add ( name = '<STR_LIT>' , ms = <NUM_LIT> , callback = self . subtotal ) <EOL> def subtotal ( self ) : <EOL> self . machine . events . post ( '<STR_LIT>' , points = self . bonus_score ) <EOL> self . delay . add ( name = '<STR_LIT>' , ms = <NUM_LIT> , callback = self . do_multiplier ) <EOL> def do_multiplier ( self ) : <EOL> self . machine . events . post ( '<STR_LIT>' ) <EOL> self . delay . add ( name = '<STR_LIT>' , ms = <NUM_LIT> , callback = self . total_bonus ) <EOL> def total_bonus ( self ) : <EOL> self . bonus_score *= self . player [ '<STR_LIT>' ] <EOL> self . player [ '<STR_LIT>' ] += self . bonus_score <EOL> self . machine . events . post ( '<STR_LIT>' , points = self . bonus_score ) <EOL> self . delay . add ( name = '<STR_LIT>' , ms = <NUM_LIT> , callback = self . end_bonus ) <EOL> def end_bonus ( self ) : <EOL> if not self . player [ '<STR_LIT>' ] : <EOL> self . player [ '<STR_LIT>' ] = <NUM_LIT:1> <EOL> else : <EOL> self . player [ '<STR_LIT>' ] = False <EOL> self . stop ( ) </s>
