Add: Bonus Event
This commit is contained in:
@@ -8,11 +8,13 @@ import config
|
||||
from lamps.Lamp import Lamp
|
||||
from lamps.LampGroup import CHAMP_LAMPS
|
||||
from lamps.LampGroup import UPPER_PLAYFIELD_TIME_LAMPS
|
||||
from lamps.LampGroup import TUNNEL_LAMPS
|
||||
from lamps.LampGroup import BONUS_MULTIPLIER_LAMPS
|
||||
from lamps.LampGroup import BONUS_LAMPS
|
||||
|
||||
from events.LeaveUpperPlayfieldEvent import LeaveUpperPlayfieldEvent
|
||||
|
||||
|
||||
class PlayerState:
|
||||
display = None
|
||||
specialDisplay = None
|
||||
@@ -136,6 +138,7 @@ class PlayerState:
|
||||
|
||||
def resetTunnel(self):
|
||||
self.tunnelLit = 0
|
||||
TUNNEL_LAMPS.deactivate()
|
||||
|
||||
def advanceRightOrangeSpecial(self):
|
||||
self.orangeSpecialRight = True
|
||||
@@ -163,8 +166,11 @@ class PlayerState:
|
||||
Lamp("Special Red").activate()
|
||||
|
||||
def advanceTunnel(self):
|
||||
if self.tunnelLit <= 5:
|
||||
self.tunnelLit += 1
|
||||
if self.tunnelLit >= 5:
|
||||
return
|
||||
|
||||
self.tunnelLit += 1
|
||||
TUNNEL_LAMPS.activateNext()
|
||||
|
||||
def advanceBonus(self):
|
||||
if self.bonus >= 20:
|
||||
|
||||
@@ -10,7 +10,3 @@ class BankEvent(Event):
|
||||
def trigger(self, target):
|
||||
super().trigger(target)
|
||||
self.bankSolenoid.trigger()
|
||||
self.advanceBonus()
|
||||
|
||||
def advanceBonus(self):
|
||||
self.playerState().advanceBonus()
|
||||
|
||||
11
events/BonusEvent.py
Normal file
11
events/BonusEvent.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from Event import Event
|
||||
|
||||
|
||||
class BonusEvent(Event):
|
||||
def __init__(self, playerState):
|
||||
self.playerState = playerState
|
||||
super().__init__("Bonus Event")
|
||||
|
||||
def trigger(self, target):
|
||||
super().trigger(target)
|
||||
self.playerState.advanceBonus()
|
||||
@@ -18,7 +18,30 @@ from events.RedSpecialEvent import RedSpecialEvent
|
||||
from events.OrangeSpecialEvent import OrangeSpecialEvent
|
||||
from events.SpinnerEvent import SpinnerEvent
|
||||
from events.FixedTargetEvent import FixedTargetEvent
|
||||
from events.BonusEvent import BonusEvent
|
||||
|
||||
BONUS_EVENT_TARGETS = [
|
||||
"Left Inlane",
|
||||
"Right Inlane",
|
||||
"Right Outlane Kicker",
|
||||
"Canal Button Bottom",
|
||||
"Canal Button Middle Bottom",
|
||||
"Canal Button Middle Top",
|
||||
"Canal Button Top",
|
||||
"Fixed Target 1",
|
||||
"Fixed Target 2",
|
||||
"Fixed Target 3",
|
||||
"Fixed Target 4",
|
||||
"Fixed Target 5",
|
||||
"Left Bank Left",
|
||||
"Left Bank Middle Left",
|
||||
"Left Bank Middle Right",
|
||||
"Left Bank Right",
|
||||
"Right Bank Left",
|
||||
"Right Bank Middle",
|
||||
"Right Bank Right",
|
||||
|
||||
]
|
||||
class EventFactory:
|
||||
def __init__(self, targets, currentPlayer):
|
||||
self.targets = targets
|
||||
@@ -123,5 +146,13 @@ class EventFactory:
|
||||
self.__registerEventToTarget(event, self.targets["Fixed Target 5"])
|
||||
return event
|
||||
|
||||
def createBonusEvent(self):
|
||||
event = BonusEvent(self.currentPlayer)
|
||||
self.__registerEventToTargets(event, BONUS_EVENT_TARGETS)
|
||||
|
||||
def __registerEventToTargets(self, event, targetNames):
|
||||
for targetName in targetNames:
|
||||
self.__registerEventToTarget(event, self.targets[targetName])
|
||||
|
||||
def __registerEventToTarget(self, event, target):
|
||||
target.on(target.hit_key, event.trigger)
|
||||
|
||||
@@ -46,6 +46,14 @@ UPPER_PLAYFIELD_TIME_LAMPS = LampGroup([
|
||||
Lamp("Lamp 30 Sec")
|
||||
])
|
||||
|
||||
TUNNEL_LAMPS = LampGroup([
|
||||
Lamp("1st Button"),
|
||||
Lamp("2nd Button"),
|
||||
Lamp("3rd Button"),
|
||||
Lamp("4th Button"),
|
||||
Lamp("5th Button")
|
||||
])
|
||||
|
||||
BONUS_MULTIPLIER_LAMPS = LampGroup([
|
||||
Lamp("Bonus Multiplier x10"),
|
||||
Lamp("Bonus Multiplier x20"),
|
||||
|
||||
Reference in New Issue
Block a user