-
Notifications
You must be signed in to change notification settings - Fork 1
/
bonus.py
94 lines (73 loc) · 4.03 KB
/
bonus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#####################################################################################
## ____ _______ _________________ _ _____ ________ ___ ______________
## / __/__< / / / / __/ __/ ___/ __ \/ |/ / _ \ / __/ __ \/ _ \/_ __/ _/ __/
## / _//___/ /_ _/ _\ \/ _// /__/ /_/ / / // / _\ \/ /_/ / , _/ / / _/ // _/
## /_/ /_/ /_/ /___/___/\___/\____/_/|_/____/ /___/\____/_/|_| /_/ /___/___/
##
## A P-ROC Project by Mark Sunnucks
## Built on PyProcGame from Adam Preble and Gerry Stellenberg
## Thanks to Scott Danesi for inspiration from his Earthshaker Aftershock
#####################################################################################
#################################################################################
# ___
# / _ ) ___ ___ __ __ ___
# / _ |/ _ \ / _ \/ // /(_-<
# /____/ \___//_//_/\_,_//___/
#
#################################################################################
import procgame
from procgame import *
import locale
import logging
import procgame.dmd
from procgame.dmd import font_named
class Bonus(game.Mode):
"""docstring for Bonus"""
def __init__(self, game, priority):
super(Bonus, self).__init__(game, priority)
# Settings Variables #
self.delay_time = 2
self.bonus_value = 1000
# System Variables #
self.total_value = 0
self.log = logging.getLogger('f14.bonus')
anim = dmd.Animation().load("/P-ROC/games/F14SecondSortie/assets/dmd/bonus_spin.dmd")
self.first_layer = dmd.AnimatedLayer(frames=anim.frames, hold=False, repeat=True, frame_time=4)
def mode_started(self):
# Disable the flippers
self.game.coils.flipperEnable.disable()
#self.game.sound.stop_music()
self.game.sound.fadeout_music(time_ms=1000)
#self.game.utilities.disableGI()
self.game.utilities.disableAllLamps(include_GI=False)
def mode_stopped(self):
# Enable the flippers
self.game.coils.flipperEnable.enable() # Can possibly remove this and let the "Ball Start" function handle it.
self.game.utilities.enableGI()
def calculate(self,callback):
self.callback = callback
self.total_value = self.game.utilities.get_player_stats('bonus') * self.bonus_value * self.game.utilities.get_player_stats('bonus_x')
self.bonus()
def bonus(self):
self.log.info('Initial Bonus')
self.second_layer = dmd.TextLayer(26, 14, font_named("Font_CC_5px_az.dmd")).set_text("BONUS "+str(self.game.utilities.get_player_stats('bonus') * self.bonus_value))
self.second_layer.composite_op = 'blacksrc'
self.layer = dmd.GroupedLayer(128, 32, [self.first_layer,self.second_layer])
self.game.utilities.acFlashSchedule(coilname='upKicker_flasher3',schedule=0x0000000C, cycle_seconds=1, now=True)
self.delay(name='next_frame', event_type=None, delay=self.delay_time, handler=self.multiplier)
def multiplier(self):
self.log.info('Multiplier')
self.third_layer = dmd.TextLayer(26, 20, font_named("Font_CC_5px_az.dmd")).set_text("MULTIPLIER X"+str(self.game.utilities.get_player_stats('bonus_x')))
self.third_layer.composite_op = 'blacksrc'
self.layer = dmd.GroupedLayer(128, 32, [self.first_layer,self.second_layer,self.third_layer])
self.delay(name='next_frame', event_type=None, delay=self.delay_time, handler=self.total)
def total(self):
self.log.info('Total')
self.fourth_layer = dmd.TextLayer(26, 26, font_named("Font_CC_5px_az.dmd")).set_text("TOTAL "+str(self.total_value))
self.fourth_layer.composite_op = 'blacksrc'
self.layer = dmd.GroupedLayer(128, 32, [self.first_layer,self.second_layer,self.third_layer,self.fourth_layer])
self.game.utilities.score(self.total_value) # this should upadte the player score in question
self.delay(name='next_frame', event_type=None, delay=self.delay_time, handler=self.finish)
def finish(self):
self.game.sound.stop_music()
self.callback()