Skip to content

Commit

Permalink
Implemented VR restrictions for HPR aircraft.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwatsonforster committed Oct 7, 2023
1 parent 390fb5e commit 2bd2117
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions airpower/aircraft/_normalflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,18 @@ def doturn(sense, facingchange):

def doverticalroll(sense, facingchange, shift):

# TODO: HPR restrictions
# See rule 13.3.4.

# TODO: LRR restrictions

if self._flighttype != "VC" and self._flighttype != "VD":
raise RuntimeError("attempt to roll vertically while flight type is %s." % self._flighttype)
raise RuntimeError("attempt to roll vertically while flight type is %s." % self._flighttype)
if not self._vertical:
raise RuntimeError("attempt to roll vertically during an HFP.")
raise RuntimeError("attempt to roll vertically during an HFP.")

# The following applies only to HPR aircaft that enter a VC from LVL.
if self._lastflighttype == "LVL" and self._flighttype != "VC" and not self._lastfp:
raise RuntimeError("attempt to roll vertically following LVL flight and not on the last FP.")

self._maneuverap -= self.rolldrag("VR")

Expand Down Expand Up @@ -608,6 +613,11 @@ def doaction(action):
if not self._unloaded:
self._turnfp += 1

# Some rules apply only to the last FP of a move, so we determine if this
# FP is the last FP. See rule 13.3.4.
fp = self._hfp + self._vfp + self._spbrfp
self._lastfp = (fp + 1 > self._fp)

doelements(action, "maneuver", False)

assert aphex.isvalid(self._x, self._y, facing=self._facing)
Expand Down

0 comments on commit 2bd2117

Please sign in to comment.