Skip to content

Instantly share code, notes, and snippets.

@mjgpy3
Last active November 28, 2024 01:01
Show Gist options
  • Save mjgpy3/cc1fe19836e6205a896d83bfd0d564c8 to your computer and use it in GitHub Desktop.
Save mjgpy3/cc1fe19836e6205a896d83bfd0d564c8 to your computer and use it in GitHub Desktop.
types.dhall
let filter = https://prelude.dhall-lang.org/List/filter.dhall
let length = https://prelude.dhall-lang.org/List/length.dhall
let any = https://prelude.dhall-lang.org/List/any.dhall
let map = https://prelude.dhall-lang.org/List/map.dhall
let sum = https://prelude.dhall-lang.org/Natural/sum.dhall
let showNat = https://prelude.dhall-lang.org/Natural/show.dhall
let default = https://prelude.dhall-lang.org/Optional/default.dhall
let concatMapSep = https://prelude.dhall-lang.org/Text/concatMapSep.dhall
let VehicleType =
< DragRacer
| IceCreamTruck
| Bike
| Buggy
| BikeWithSidecar
| Gyrocopter
| Car
| Jeep
| PerformanceCar
| Truck
| Ambulance
| Motorhome
| HeavyTruck
| MonsterTruck
| Helicopter
| Bus
| APC
| Tank
| WarRig
>
let vehicleType =
\(type : VehicleType) ->
merge
{ DragRacer = "Drag Racer"
, IceCreamTruck = "Ice Cream Truck"
, Bike = "Bike"
, Buggy = "Buggy"
, BikeWithSidecar = "Bike w/ Sidecar"
, Gyrocopter = "Gyrocopter"
, Car = "Car"
, Jeep = "Jeep"
, PerformanceCar = "Performance Car"
, Truck = "Truck"
, Ambulance = "Ambulance"
, Motorhome = "Motorhome"
, HeavyTruck = "heavy Truck"
, MonsterTruck = "Monster Truck"
, Helicopter = "Helicopter"
, Bus = "Bus"
, APC = "APC"
, Tank = "Tank"
, WarRig = "War Rig"
}
type
let VehicleWeight = < Lightweight | Middleweight | Heavyweight >
let vehicleWeight =
\(weight : VehicleWeight) ->
merge
{ Lightweight = "Lightweight"
, Middleweight = "Middleweight"
, Heavyweight = "Heavyweight "
}
weight
let VehicleSpecialRules =
< JetEngine
| InfuriatingJingle
| FullThrottle
| Pivot
| RollCage
| Airwolf
| Airborne
| SlipAway
| Uppers
| Downers
| MobileGarage
| BigTyres
| BattleTaxi
| Sardines
| CrushAttack
| AllTerrain
| WarRig
>
let vehicleSpecialName =
\(special : VehicleSpecialRules) ->
merge
{ JetEngine = "Jet Engine"
, InfuriatingJingle = "Infuriating Jingle"
, FullThrottle = "Full Throttle"
, Pivot = "Pivot"
, RollCage = "Roll Cage"
, Airwolf = "Airwolf"
, Airborne = "Airborne"
, SlipAway = "Slip Away"
, Uppers = "Uppers"
, Downers = "Downers"
, MobileGarage = "Mobile Garage"
, BigTyres = "Big Tyres"
, BattleTaxi = "Battle Taxi"
, Sardines = "Sardines"
, CrushAttack = "Crush Attack"
, AllTerrain = "All Terrain"
, WarRig = "War Rig"
}
special
let vehicleSpecialRules =
\(type : VehicleType) ->
merge
{ DragRacer = [ VehicleSpecialRules.JetEngine ]
, IceCreamTruck = [ VehicleSpecialRules.InfuriatingJingle ]
, Bike =
[ VehicleSpecialRules.FullThrottle, VehicleSpecialRules.Pivot ]
, Buggy = [ VehicleSpecialRules.RollCage ]
, BikeWithSidecar =
[ VehicleSpecialRules.FullThrottle, VehicleSpecialRules.Pivot ]
, Gyrocopter =
[ VehicleSpecialRules.Airwolf, VehicleSpecialRules.Airborne ]
, Car = [] : List VehicleSpecialRules
, Jeep = [] : List VehicleSpecialRules
, PerformanceCar = [ VehicleSpecialRules.SlipAway ]
, Truck = [] : List VehicleSpecialRules
, Ambulance =
[ VehicleSpecialRules.Uppers, VehicleSpecialRules.Downers ]
, Motorhome = [ VehicleSpecialRules.MobileGarage ]
, HeavyTruck = [] : List VehicleSpecialRules
, MonsterTruck =
[ VehicleSpecialRules.BigTyres, VehicleSpecialRules.CrushAttack ]
, Helicopter =
[ VehicleSpecialRules.Airwolf, VehicleSpecialRules.Airborne ]
, Bus = [] : List VehicleSpecialRules
, APC =
[ VehicleSpecialRules.BattleTaxi, VehicleSpecialRules.Sardines ]
, Tank =
[ VehicleSpecialRules.Pivot
, VehicleSpecialRules.CrushAttack
, VehicleSpecialRules.AllTerrain
]
, WarRig = [ VehicleSpecialRules.WarRig ]
}
type
let weight =
\(type : VehicleType) ->
merge
{ DragRacer = VehicleWeight.Lightweight
, IceCreamTruck = VehicleWeight.Middleweight
, Bike = VehicleWeight.Lightweight
, Buggy = VehicleWeight.Lightweight
, BikeWithSidecar = VehicleWeight.Lightweight
, Gyrocopter = VehicleWeight.Middleweight
, Car = VehicleWeight.Middleweight
, Jeep = VehicleWeight.Middleweight
, PerformanceCar = VehicleWeight.Middleweight
, Truck = VehicleWeight.Middleweight
, Ambulance = VehicleWeight.Middleweight
, Motorhome = VehicleWeight.Middleweight
, HeavyTruck = VehicleWeight.Heavyweight
, MonsterTruck = VehicleWeight.Heavyweight
, Helicopter = VehicleWeight.Heavyweight
, Bus = VehicleWeight.Heavyweight
, APC = VehicleWeight.Heavyweight
, Tank = VehicleWeight.Heavyweight
, WarRig = VehicleWeight.Heavyweight
}
type
let vehicleCost =
\(type : VehicleType) ->
merge
{ DragRacer = 5
, IceCreamTruck = 5
, Bike = 5
, Buggy = 5
, BikeWithSidecar = 8
, Gyrocopter = 10
, Car = 12
, Jeep = 15
, PerformanceCar = 15
, Truck = 15
, Ambulance = 25
, Motorhome = 25
, HeavyTruck = 25
, MonsterTruck = 25
, Helicopter = 30
, Bus = 30
, APC = 35
, Tank = 40
, WarRig = 40
}
type
let hullPoints =
\(type : VehicleType) ->
merge
{ DragRacer = 4
, IceCreamTruck = 10
, Bike = 4
, Buggy = 6
, BikeWithSidecar = 4
, Gyrocopter = 4
, Car = 10
, Jeep = 10
, PerformanceCar = 8
, Truck = 12
, Ambulance = 12
, Motorhome = 10
, HeavyTruck = 14
, MonsterTruck = 10
, Helicopter = 8
, Bus = 16
, APC = 16
, Tank = 20
, WarRig = 20
}
type
let Handling = < Handling2 | Handling3 | Handling4 | Handling5 | Handling6 >
let handlingUp =
\(handling : Handling) ->
merge
{ Handling2 = Handling.Handling3
, Handling3 = Handling.Handling4
, Handling4 = Handling.Handling5
, Handling5 = Handling.Handling6
, Handling6 = Handling.Handling6
}
handling
let showHandling =
\(handling : Handling) ->
merge
{ Handling2 = "2"
, Handling3 = "3"
, Handling4 = "4"
, Handling5 = "5"
, Handling6 = "6"
}
handling
let handling =
\(type : VehicleType) ->
merge
{ DragRacer = Handling.Handling4
, IceCreamTruck = Handling.Handling3
, Bike = Handling.Handling5
, Buggy = Handling.Handling4
, BikeWithSidecar = Handling.Handling5
, Gyrocopter = Handling.Handling4
, Car = Handling.Handling3
, Jeep = Handling.Handling3
, PerformanceCar = Handling.Handling4
, Truck = Handling.Handling2
, Ambulance = Handling.Handling2
, Motorhome = Handling.Handling3
, HeavyTruck = Handling.Handling2
, MonsterTruck = Handling.Handling3
, Helicopter = Handling.Handling3
, Bus = Handling.Handling2
, APC = Handling.Handling3
, Tank = Handling.Handling4
, WarRig = Handling.Handling2
}
type
let Gear = < Gear1 | Gear2 | Gear3 | Gear4 | Gear5 | Gear6 >
let showGear =
\(gear : Gear) ->
merge
{ Gear1 = "1"
, Gear2 = "2"
, Gear3 = "3"
, Gear4 = "4"
, Gear5 = "5"
, Gear6 = "6"
}
gear
let gearDown =
\(gear : Gear) ->
merge
{ Gear1 = Gear.Gear1
, Gear2 = Gear.Gear1
, Gear3 = Gear.Gear2
, Gear4 = Gear.Gear3
, Gear5 = Gear.Gear4
, Gear6 = Gear.Gear5
}
gear
let maxGear =
\(type : VehicleType) ->
merge
{ DragRacer = Gear.Gear6
, IceCreamTruck = Gear.Gear4
, Bike = Gear.Gear6
, Buggy = Gear.Gear6
, BikeWithSidecar = Gear.Gear6
, Gyrocopter = Gear.Gear6
, Car = Gear.Gear5
, Jeep = Gear.Gear5
, PerformanceCar = Gear.Gear6
, Truck = Gear.Gear4
, Ambulance = Gear.Gear5
, Motorhome = Gear.Gear4
, HeavyTruck = Gear.Gear3
, MonsterTruck = Gear.Gear4
, Helicopter = Gear.Gear4
, Bus = Gear.Gear3
, APC = Gear.Gear4
, Tank = Gear.Gear3
, WarRig = Gear.Gear4
}
type
let vehicleBuildSlots =
\(type : VehicleType) ->
merge
{ DragRacer = 2
, IceCreamTruck = 2
, Bike = 1
, Buggy = 2
, BikeWithSidecar = 2
, Gyrocopter = 0
, Car = 2
, Jeep = 3
, PerformanceCar = 2
, Truck = 3
, Ambulance = 3
, Motorhome = 3
, HeavyTruck = 5
, MonsterTruck = 2
, Helicopter = 4
, Bus = 3
, APC = 1
, Tank = 4
, WarRig = 5
}
type
let crew =
\(type : VehicleType) ->
merge
{ DragRacer = 1
, IceCreamTruck = 2
, Bike = 1
, Buggy = 2
, BikeWithSidecar = 2
, Gyrocopter = 1
, Car = 2
, Jeep = 2
, PerformanceCar = 1
, Truck = 3
, Ambulance = 3
, Motorhome = 3
, HeavyTruck = 4
, MonsterTruck = 2
, Helicopter = 2
, Bus = 8
, APC = 6
, Tank = 3
, WarRig = 5
}
type
let WeaponFacing = < Turret | Around | Front | Rear | Sides >
let WeaponType =
< Cannon125MM
| ArcLightningProjector
| BFG
| Blunderbuss
| Caltrop
| CombatLaser
| DeathRay
| ExplodingRam
| Flamethrower
| GasGrenades
| GlueDropper
| GrabberArm
| GravGun
| Grenades
| Handgun
| Harpoon
| HeavyMachineGun
| HomingMissile
| HypnoRay
| KineticSuperBooster
| MachineGun
| MagneticJammer
| Mines
| MiniGun
| MolotovCocktails
| Mortar
| OilSlickDropper
| Ram
| RCCarBombs
| Rifle
| Rockets
| SentryGun
| Shotgun
| Smoke
| SteelNets
| SubmachineGun
| Magnum
| Thumper
| WreckLobber
| WreckingBall
>
let weaponName =
\(type : WeaponType) ->
merge
{ Cannon125MM = "125mm Cannon"
, ArcLightningProjector = "Arc Lightning Projector"
, BFG = "BFG"
, Blunderbuss = "Blunderbuss"
, Caltrop = "Caltrop"
, CombatLaser = "Combat Laser"
, DeathRay = "Death Ray"
, ExplodingRam = "Exploding Ram"
, Magnum = "Magnum"
, Flamethrower = "Flamethrower"
, GasGrenades = "Gas Grenades"
, GlueDropper = "Glue Dropper"
, GrabberArm = "Grabber Arm"
, GravGun = "Grav Gun"
, Grenades = "Grenades"
, Handgun = "Handgun"
, Harpoon = "Harpoon"
, HeavyMachineGun = "Heavy Machine Gun"
, HomingMissile = "Homing Missile"
, HypnoRay = "Hypno Ray"
, KineticSuperBooster = "Kinetic Super Booster"
, MachineGun = "Machine Gun"
, MagneticJammer = "Magnetic Jammer"
, Mines = "Mines"
, MiniGun = "Mini Gun"
, MolotovCocktails = "Molotov Cocktails"
, Mortar = "Mortar"
, OilSlickDropper = "Oil Slick Dropper"
, Ram = "Ram"
, RCCarBombs = "RC Car Bombs"
, Rifle = "Rifle"
, Rockets = "Rockets"
, SentryGun = "Sentry Gun"
, Shotgun = "Shotgun"
, Smoke = "Smoke"
, SteelNets = "Steel Nets"
, SubmachineGun = "Submachine Gun"
, Thumper = "Thumper"
, WreckLobber = "Wreck Lobber"
, WreckingBall = "Wrecking Ball"
}
type
let D6s = Natural
let Range =
< Double
| SmallBurst
| DoubleBurst
| Smash
| LargeTemplate
| Medium
| LargeBurst
| Short
| Long
>
let showRange =
\(range : Range) ->
merge
{ Double = "Double"
, SmallBurst = "Small Burst"
, DoubleBurst = "Double Burst"
, Smash = "Smash"
, LargeTemplate = "Large Template"
, Medium = "Medium"
, LargeBurst = "Large Burst"
, Short = "Short"
, Long = "Long"
}
range
let WeaponSpecialRules =
< See
| RemoteControlledCar
| Electrical
| Trebuchet
| LowLoader
| Dumper
| SteelBall
| MindControl
| GravityManipulation
| RidonkulousFirepower
| Scrapshot
| Splash
| Atomize
| Explosive
| Fire
| CrewFired
| Entangle
| SentryGun
| Harpoon
| Blitz
| Blast
| HeatSeeking
| ChokingGas
| Toss
| Indirect
>
let showWeaponSpecialRule =
\(special : WeaponSpecialRules) ->
merge
{ See = "See special rules"
, RemoteControlledCar = "Remote Controlled Car"
, Electrical = "Electrical"
, Trebuchet = "Trebuchet"
, LowLoader = "LowLoader"
, Dumper = "Dumper"
, SteelBall = "Steel Ball"
, MindControl = "Mind Control"
, GravityManipulation = "Gravity Manipulation"
, RidonkulousFirepower = "Ridonkulous Firepower"
, Scrapshot = "Scrapshot"
, Splash = "Splash"
, Atomize = "Atomize"
, Explosive = "Explosive"
, Fire = "Fire"
, CrewFired = "Crew Fired"
, Entangle = "Entangle"
, SentryGun = "Sentry Gun"
, Harpoon = "Harpoon"
, Blitz = "Blitz"
, Blast = "Blast"
, HeatSeeking = "Heat Seeking"
, ChokingGas = "Choking Gas"
, Toss = "Toss"
, Indirect = "Indirect"
}
special
let WeaponStats =
{ attack : Optional D6s
, range : Optional Range
, buildSlots : Natural
, ammo : Optional Natural
, specialRules : List WeaponSpecialRules
, cost : Natural
}
let weaponStats =
\(type : WeaponType) ->
merge
{ Cannon125MM =
{ attack = Some 8
, range = Some Range.Double
, buildSlots = 3
, ammo = Some 3
, specialRules = [ WeaponSpecialRules.See ]
, cost = 6
}
, ArcLightningProjector =
{ attack = Some 6
, range = Some Range.Double
, buildSlots = 3
, ammo = Some 1
, specialRules =
[ WeaponSpecialRules.Electrical, WeaponSpecialRules.See ]
, cost = 6
}
, BFG =
{ attack = Some 10
, range = Some Range.Double
, buildSlots = 2
, ammo = Some 1
, specialRules = [ WeaponSpecialRules.See ]
, cost = 1
}
, Blunderbuss =
{ attack = Some 1
, range = Some Range.Double
, buildSlots = 1
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.Scrapshot ]
, cost = 1
}
, Caltrop =
{ attack = None D6s
, range = Some Range.SmallBurst
, buildSlots = 1
, ammo = Some 3
, specialRules = [ WeaponSpecialRules.See ]
, cost = 1
}
, CombatLaser =
{ attack = Some 3
, range = Some Range.DoubleBurst
, buildSlots = 1
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.Splash ]
, cost = 5
}
, DeathRay =
{ attack = Some 3
, range = Some Range.Double
, buildSlots = 1
, ammo = Some 1
, specialRules = [ WeaponSpecialRules.Atomize ]
, cost = 3
}
, ExplodingRam =
{ attack = Some 6
, range = Some Range.Smash
, buildSlots = 1
, ammo = Some 1
, specialRules = [ WeaponSpecialRules.See ]
, cost = 3
}
, Flamethrower =
{ attack = Some 6
, range = Some Range.LargeTemplate
, buildSlots = 2
, ammo = Some 3
, specialRules =
[ WeaponSpecialRules.Fire, WeaponSpecialRules.Explosive ]
, cost = 6
}
, Magnum =
{ attack = Some 1
, range = Some Range.Double
, buildSlots = 0
, ammo = None Natural
, specialRules =
[ WeaponSpecialRules.CrewFired, WeaponSpecialRules.Blast ]
, cost = 3
}
, GasGrenades =
{ attack = Some 1
, range = Some Range.Medium
, buildSlots = 0
, ammo = Some 5
, specialRules =
[ WeaponSpecialRules.CrewFired
, WeaponSpecialRules.Blitz
, WeaponSpecialRules.ChokingGas
]
, cost = 6
}
, GlueDropper =
{ attack = None D6s
, range = Some Range.LargeBurst
, buildSlots = 1
, ammo = Some 1
, specialRules = [ WeaponSpecialRules.See ]
, cost = 1
}
, GrabberArm =
{ attack = Some 3
, range = Some Range.Short
, buildSlots = 1
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.Toss ]
, cost = 6
}
, GravGun =
{ attack = Some 3
, range = Some Range.Double
, buildSlots = 1
, ammo = Some 1
, specialRules =
[ WeaponSpecialRules.Electrical
, WeaponSpecialRules.GravityManipulation
]
, cost = 2
}
, Grenades =
{ attack = Some 1
, range = Some Range.Medium
, buildSlots = 0
, ammo = Some 5
, specialRules =
[ WeaponSpecialRules.CrewFired
, WeaponSpecialRules.Blast
, WeaponSpecialRules.Explosive
, WeaponSpecialRules.Blitz
]
, cost = 1
}
, Handgun =
{ attack = Some 1
, range = Some Range.Medium
, buildSlots = 0
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.CrewFired ]
, cost = 0
}
, Harpoon =
{ attack = Some 5
, range = Some Range.Double
, buildSlots = 1
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.Harpoon ]
, cost = 2
}
, HeavyMachineGun =
{ attack = Some 3
, range = Some Range.Double
, buildSlots = 1
, ammo = None Natural
, specialRules = [] : List WeaponSpecialRules
, cost = 3
}
, HomingMissile =
{ attack = Some 6
, range = None Range
, buildSlots = 2
, ammo = Some 3
, specialRules =
[ WeaponSpecialRules.Blast
, WeaponSpecialRules.HeatSeeking
, WeaponSpecialRules.Explosive
]
, cost = 8
}
, HypnoRay =
{ attack = Some 3
, range = Some Range.Double
, buildSlots = 1
, ammo = Some 1
, specialRules =
[ WeaponSpecialRules.Electrical, WeaponSpecialRules.MindControl ]
, cost = 2
}
, KineticSuperBooster =
{ attack = Some 6
, range = Some Range.Double
, buildSlots = 1
, ammo = Some 1
, specialRules =
[ WeaponSpecialRules.Electrical, WeaponSpecialRules.See ]
, cost = 6
}
, MachineGun =
{ attack = Some 2
, range = Some Range.Double
, buildSlots = 1
, ammo = None Natural
, specialRules = [] : List WeaponSpecialRules
, cost = 2
}
, MagneticJammer =
{ attack = None D6s
, range = None Range
, buildSlots = 0
, ammo = None Natural
, specialRules =
[ WeaponSpecialRules.Electrical, WeaponSpecialRules.See ]
, cost = 2
}
, Mines =
{ attack = Some 3
, range = Some Range.SmallBurst
, buildSlots = 1
, ammo = Some 1
, specialRules = [ WeaponSpecialRules.Blast ]
, cost = 1
}
, MiniGun =
{ attack = Some 4
, range = Some Range.Double
, buildSlots = 1
, ammo = None Natural
, specialRules = [] : List WeaponSpecialRules
, cost = 5
}
, MolotovCocktails =
{ attack = Some 1
, range = Some Range.Medium
, buildSlots = 0
, ammo = Some 5
, specialRules =
[ WeaponSpecialRules.CrewFired
, WeaponSpecialRules.Blitz
, WeaponSpecialRules.Fire
, WeaponSpecialRules.Indirect
]
, cost = 1
}
, Mortar =
{ attack = Some 4
, range = Some Range.Double
, buildSlots = 1
, ammo = Some 3
, specialRules = [ WeaponSpecialRules.See ]
, cost = 4
}
, OilSlickDropper =
{ attack = None D6s
, range = Some Range.LargeBurst
, buildSlots = 0
, ammo = Some 3
, specialRules = [ WeaponSpecialRules.See ]
, cost = 2
}
, Ram =
{ attack = Some 2
, range = Some Range.Smash
, buildSlots = 1
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.See ]
, cost = 4
}
, RCCarBombs =
{ attack = None D6s
, range = Some Range.Short
, buildSlots = 0
, ammo = Some 3
, specialRules = [ WeaponSpecialRules.RemoteControlledCar ]
, cost = 6
}
, Rifle =
{ attack = Some 1
, range = Some Range.Double
, buildSlots = 0
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.CrewFired ]
, cost = 3
}
, Rockets =
{ attack = Some 6
, range = Some Range.Double
, buildSlots = 2
, ammo = Some 3
, specialRules = [] : List WeaponSpecialRules
, cost = 5
}
, SentryGun =
{ attack = Some 2
, range = None Range
, buildSlots = 0
, ammo = Some 2
, specialRules = [ WeaponSpecialRules.SentryGun ]
, cost = 2
}
, Shotgun =
{ attack = None Natural
, range = None Range
, buildSlots = 0
, ammo = None Natural
, specialRules =
[ WeaponSpecialRules.CrewFired, WeaponSpecialRules.See ]
, cost = 4
}
, Smoke =
{ attack = None D6s
, range = Some Range.LargeBurst
, buildSlots = 0
, ammo = Some 3
, specialRules = [ WeaponSpecialRules.See ]
, cost = 1
}
, SteelNets =
{ attack = Some 1
, range = Some Range.Medium
, buildSlots = 0
, ammo = None Natural
, specialRules =
[ WeaponSpecialRules.CrewFired, WeaponSpecialRules.Entangle ]
, cost = 1
}
, SubmachineGun =
{ attack = Some 3
, range = Some Range.Medium
, buildSlots = 0
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.CrewFired ]
, cost = 5
}
, Thumper =
{ attack = None D6s
, range = Some Range.Medium
, buildSlots = 2
, ammo = Some 1
, specialRules =
[ WeaponSpecialRules.Electrical, WeaponSpecialRules.See ]
, cost = 4
}
, WreckLobber =
{ attack = None D6s
, range = Some Range.Double
, buildSlots = 4
, ammo = Some 3
, specialRules =
[ WeaponSpecialRules.Trebuchet
, WeaponSpecialRules.LowLoader
, WeaponSpecialRules.Dumper
]
, cost = 4
}
, WreckingBall =
{ attack = None D6s
, range = None Range
, buildSlots = 1
, ammo = None Natural
, specialRules = [ WeaponSpecialRules.SteelBall ]
, cost = 4
}
}
type
let showWeaponAttack =
\(type : WeaponType) ->
merge
{ None = "", Some = \(d6s : Natural) -> "${showNat d6s}D6" }
(weaponStats type).attack
let Upgrade =
< EjectorSeat
| ClusterBombs
| ImprovisedSludgeThrower
| ArmourPlating
| TankTracks
| ExtraCrewmember
| NitroBooster
>
let upgradeName =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = "Ejector Seat"
, ClusterBombs = "Custer Bombs"
, ImprovisedSludgeThrower = "Improvised Sludge Thrower"
, ArmourPlating = "Armour Plating"
, TankTracks = "Tank Tracks"
, ExtraCrewmember = "Extra Crewmember"
, NitroBooster = "Nitro Booster"
}
upgrade
let seeSpecialForUpgrade =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = True
, ClusterBombs = True
, ImprovisedSludgeThrower = True
, ArmourPlating = False
, TankTracks = True
, ExtraCrewmember = False
, NitroBooster = True
}
upgrade
let upgradeCost =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = 1
, ClusterBombs = 1
, ImprovisedSludgeThrower = 1
, ArmourPlating = 4
, TankTracks = 4
, ExtraCrewmember = 4
, NitroBooster = 6
}
upgrade
let upgradeSlots =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = 0
, ClusterBombs = 0
, ImprovisedSludgeThrower = 1
, ArmourPlating = 1
, TankTracks = 1
, ExtraCrewmember = 0
, NitroBooster = 0
}
upgrade
let Weapon = { type : WeaponType, facing : WeaponFacing }
let weaponCost =
\(weapon : Weapon) ->
let baseCost = (weaponStats weapon.type).cost
in merge
{ Turret = 3 * baseCost
, Around = baseCost
, Rear = baseCost
, Front = baseCost
, Sides = baseCost
}
weapon.facing
let turreted = \(type : WeaponType) -> { type, facing = WeaponFacing.Turret }
let frontFacing = \(type : WeaponType) -> { type, facing = WeaponFacing.Front }
let rearFacing = \(type : WeaponType) -> { type, facing = WeaponFacing.Rear }
let sideFacing = \(type : WeaponType) -> { type, facing = WeaponFacing.Sides }
let around = \(type : WeaponType) -> { type, facing = WeaponFacing.Around }
let Custom =
{ name : Text
, description : Optional Text
, type : VehicleType
, upgrades : List Upgrade
, weapons : List Weapon
}
let isArmourPlating =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = False
, ClusterBombs = False
, ImprovisedSludgeThrower = False
, ArmourPlating = True
, TankTracks = False
, ExtraCrewmember = False
, NitroBooster = False
}
upgrade
let isTankTracks =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = False
, ClusterBombs = False
, ImprovisedSludgeThrower = False
, ArmourPlating = False
, TankTracks = True
, ExtraCrewmember = False
, NitroBooster = False
}
upgrade
let isExtraCrew =
\(upgrade : Upgrade) ->
merge
{ EjectorSeat = False
, ClusterBombs = False
, ImprovisedSludgeThrower = False
, ArmourPlating = False
, TankTracks = False
, ExtraCrewmember = True
, NitroBooster = False
}
upgrade
let customHullPoints =
\(custom : Custom) ->
hullPoints custom.type
+ 2 * length Upgrade (filter Upgrade isArmourPlating custom.upgrades)
let customMaxGear =
\(custom : Custom) ->
if any Upgrade isTankTracks custom.upgrades
then gearDown (maxGear custom.type)
else maxGear custom.type
let customHandling =
\(custom : Custom) ->
if any Upgrade isTankTracks custom.upgrades
then handlingUp (handling custom.type)
else handling custom.type
let customCrew =
\(custom : Custom) ->
crew custom.type
+ length Upgrade (filter Upgrade isExtraCrew custom.upgrades)
let TermValue = { name : Text, value : Natural }
let CanFormula = { term : TermValue, factor : Optional TermValue }
let turretFactor =
\(facing : WeaponFacing) ->
merge
{ Around = None TermValue
, Sides = None TermValue
, Front = None TermValue
, Rear = None TermValue
, Turret = Some { name = "Turret_Tax", value = 3 }
}
facing
let weaponCansForumula =
\(weapon : Weapon) ->
{ term =
{ name = weaponName weapon.type
, value = (weaponStats weapon.type).cost
}
, factor = turretFactor weapon.facing
}
let upgradeCansForumula =
\(upgrade : Upgrade) ->
{ term = { name = upgradeName upgrade, value = upgradeCost upgrade }
, factor = None TermValue
}
let customCansFormula =
\(custom : Custom) ->
[ { term =
{ name = vehicleType custom.type
, value = vehicleCost custom.type
}
, factor = None TermValue
}
]
# map Weapon CanFormula weaponCansForumula custom.weapons
# map Upgrade CanFormula upgradeCansForumula custom.upgrades
let formulaTotal =
\(formula : List CanFormula) ->
let one = { name = "", value = 1 }
let termTotal =
\(f : CanFormula) ->
(default TermValue one f.factor).value * f.term.value
in sum (map CanFormula Natural termTotal formula)
let showVerboseFormula =
\(formula : List CanFormula) ->
let showTermNames =
\(f : CanFormula) ->
let factor =
merge
{ None = ""
, Some = \(tv : TermValue) -> "${tv.name} × "
}
f.factor
in "${factor}cost(${f.term.name})"
let showTermValues =
\(f : CanFormula) ->
let factor =
merge
{ None = ""
, Some = \(tv : TermValue) -> "${showNat tv.value} × "
}
f.factor
in "${factor}${showNat f.term.value}"
in "${concatMapSep
" + "
CanFormula
showTermNames
formula} = ${concatMapSep
" + "
CanFormula
showTermValues
formula} = ${showNat (formulaTotal formula)}"
let weaponSlots = \(weapon : Weapon) -> (weaponStats weapon.type).buildSlots
let customSlotsUsed =
\(custom : Custom) ->
sum (map Weapon Natural weaponSlots custom.weapons)
+ sum (map Upgrade Natural upgradeSlots custom.upgrades)
let isHandgunWithAround =
\(weapon : Weapon) ->
let isAround =
\(facing : WeaponFacing) ->
merge
{ Around = True
, Sides = False
, Turret = False
, Front = False
, Rear = False
}
facing
let isHandgun =
\(weapon : WeaponType) ->
merge
{ Cannon125MM = False
, ArcLightningProjector = False
, BFG = False
, Blunderbuss = False
, Caltrop = False
, CombatLaser = False
, DeathRay = False
, ExplodingRam = False
, Flamethrower = False
, Magnum = False
, GasGrenades = False
, GlueDropper = False
, GrabberArm = False
, GravGun = False
, Grenades = False
, Handgun = True
, Harpoon = False
, HeavyMachineGun = False
, HomingMissile = False
, HypnoRay = False
, KineticSuperBooster = False
, MachineGun = False
, MagneticJammer = False
, Mines = False
, MiniGun = False
, MolotovCocktails = False
, Mortar = False
, OilSlickDropper = False
, Ram = False
, RCCarBombs = False
, Rifle = False
, Rockets = False
, SentryGun = False
, Shotgun = False
, Smoke = False
, SteelNets = False
, SubmachineGun = False
, Thumper = False
, WreckLobber = False
, WreckingBall = False
}
weapon
in isAround weapon.facing && isHandgun weapon.type
let hasHandgunWithAround =
\(weapons : List Weapon) -> any Weapon isHandgunWithAround weapons
in { VehicleType
, vehicleType
, VehicleWeight
, vehicleWeight
, VehicleSpecialRules
, WeaponType
, weaponStats
, Upgrade
, Weapon
, turreted
, frontFacing
, rearFacing
, sideFacing
, around
, Custom
, customHullPoints
, customMaxGear
, customHandling
, customCrew
, customSlotsUsed
, hasHandgunWithAround
, WeaponFacing
, showGear
, showHandling
, weight
, hullPoints
, handling
, maxGear
, vehicleBuildSlots
, crew
, vehicleSpecialRules
, vehicleSpecialName
, vehicleCost
, upgradeCost
, upgradeName
, seeSpecialForUpgrade
, weaponCost
, weaponName
, showWeaponAttack
, showWeaponSpecialRule
, WeaponSpecialRules
, showRange
, formulaTotal
, customCansFormula
, showVerboseFormula
}
let Month =
< Sep | Oct | Nov | Dec | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug >
let Day = { month : Month, day : Natural }
let Range = { start : Day, end : Day }
let DayOfWeek = < Sun | Mon | Tue | Wed | Thr | Fri | Sat >
let RangeWithDaysOfWeek = { range : Range, daysOfWeek : List DayOfWeek }
let TimeSegment =
< Day : Day
| Range : Range
| RangeWithDaysOfWeek : RangeWithDaysOfWeek
| AllYear
>
let Animal =
< Squirrel
| RuffledGrouse
| RabbitCottontail
| BobwhiteQuail
| HareSnowshoeOrVarying
| Pheasant
| WoodchuckGroundhog
| Crow
| StarlingAndEnglishSparrow
| WildTurkeyMaleOrFemale
| SpringGobbler
| BlackBear
| DeerArchery
| DeerRegularFirearms
| DeerAntlerlessRegularFirearms
| Coyote
| Fox
| Raccoon
>
let Tool = < Bow | Crossbow | Rifle >
let State = < PA | WV | OH >
let WMU =
< _1A
| _1B
| _2A
| _2B
| _2C
| _2D
| _2E
| _2F
| _2G
| _3A
| _3B
| _3C
| _3D
| _4A
| _4B
| _4C
| _4D
| _4E
| _5A
| _5B
| _5C
| _5D
>
let Area = < PAWMU : WMU >
let DailyPosLimit = { daily : Natural, posession : Natural }
let DailySeasonLimit = { daily : Natural, season : Natural }
let Limit =
< DailyPos : DailyPosLimit
| NoLimit
| NPerLicenseYear : Natural
| DailySeason : DailySeasonLimit
| License
>
let Season =
{ animal : Animal
, days : List TimeSegment
, areas : List Area
, limit : Limit
}
let allWMUs =
[ Area.PAWMU WMU._1A
, Area.PAWMU WMU._1B
, Area.PAWMU WMU._2A
, Area.PAWMU WMU._2B
, Area.PAWMU WMU._2C
, Area.PAWMU WMU._2D
, Area.PAWMU WMU._2E
, Area.PAWMU WMU._2F
, Area.PAWMU WMU._2G
, Area.PAWMU WMU._3A
, Area.PAWMU WMU._3B
, Area.PAWMU WMU._3C
, Area.PAWMU WMU._3D
, Area.PAWMU WMU._4A
, Area.PAWMU WMU._4B
, Area.PAWMU WMU._4C
, Area.PAWMU WMU._4D
, Area.PAWMU WMU._4E
, Area.PAWMU WMU._5A
, Area.PAWMU WMU._5B
, Area.PAWMU WMU._5C
, Area.PAWMU WMU._5D
]
in { Season
, Area
, DailyPosLimit
, Limit
, Day
, Range
, TimeSegment
, Animal
, Tool
, State
, WMU
, allWMUs
, Month
, DayOfWeek
}
let SimpleCount = { item : Text, count : Natural }
let Value =
< Count : Natural
| KeyedCount : List SimpleCount
| Happened : Bool
| FreeForm : Text
| Listing : List Text
>
let Tracker = { key : Text, value : Value }
let Trackers =
< One : Tracker | Many : { label : Text, trackers : List Tracker } >
let TS = { day : Natural, month : Natural, year : Natural }
let Entry = { at : TS, stats : List Trackers }
let freeForm =
\(key : Text) ->
\(t : Text) ->
Trackers.One { key, value = Value.FreeForm t }
let happened =
\(key : Text) ->
\(h : Bool) ->
Trackers.One { key, value = Value.Happened h }
let count =
\(key : Text) ->
\(n : Natural) ->
Trackers.One { key, value = Value.Count n }
let keyedCount =
\(key : Text) ->
\(counts : List SimpleCount) ->
Trackers.One { key, value = Value.KeyedCount counts }
let kc = \(item : Text) -> \(count : Natural) -> { item, count }
let list =
\(key : Text) ->
\(l : List Text) ->
Trackers.One { key, value = Value.Listing l }
let two =
\(label : Text) ->
\(_1 : Tracker) ->
\(_2 : Tracker) ->
Trackers.Many { label, trackers = [ _1, _2 ] }
let group =
\(label : Text) ->
\(trackers : List Tracker) ->
Trackers.Many { label, trackers }
let steps = count "steps"
let calories = count "calories"
let weight = count "weight"
let psalms = count "psalms"
let synaxarion = happened "synaxarion" True
let dishes = happened "dishes" True
let bikeMinutes = count "bikeMinutes"
let morningPrayer = happened "morningPrayer" True
let eveningPrayer = happened "eveningPrayer" True
let lineADay = list "lineADay"
let specialTopics = list "specialTopics"
let avoidedP = happened "avoidedP" True
let finishedMovies = list "finishedMovies"
let finishedShows = list "finishedShows"
let finishedBooks = list "finishedBooks"
let finishedVideoGames = list "finishedVideoGames"
let emptyList = [] : List Text
let sleep =
\(v : { minutes : Natural, hours : Natural }) ->
group
"sleepLastNight"
[ { key = "hours", value = Value.Count v.hours }
, { key = "minutes", value = Value.Count v.minutes }
]
let healthApp2 =
\ ( v
: { familyFun30Min : Bool
, protein : Bool
, hadWaterEarly : Bool
, enoughWater : Bool
, healthyOrNoBreakfast : Bool
, connectWithFriends : Bool
}
) ->
group
"healthAppStuff"
[ { key = "familyFun30Min", value = Value.Happened v.familyFun30Min }
, { key = "protein", value = Value.Happened v.protein }
, { key = "waterEarly", value = Value.Happened v.hadWaterEarly }
, { key = "enoughWater", value = Value.Happened v.enoughWater }
, { key = "connectWithFriends"
, value = Value.Happened v.connectWithFriends
}
, { key = "healthyOrNoBreakfast"
, value = Value.Happened v.healthyOrNoBreakfast
}
]
let healthAppStuff =
\ ( v
: { familyFun30Min : Bool
, protein : Bool
, hadWaterEarly : Bool
, enoughWater : Bool
, healthyOrNoBreakfast : Bool
}
) ->
group
"healthAppStuff"
[ { key = "familyFun30Min", value = Value.Happened v.familyFun30Min }
, { key = "protein", value = Value.Happened v.protein }
, { key = "waterEarly", value = Value.Happened v.hadWaterEarly }
, { key = "enoughWater", value = Value.Happened v.enoughWater }
, { key = "healthyOrNoBreakfast"
, value = Value.Happened v.healthyOrNoBreakfast
}
]
let cheapBeerCal = 146
let ounces = { stein = 16, blueBottle = 12 }
let water = count "waterIntakeOz"
let skateSession =
\ ( v
: { minutes : Natural
, rpe : Natural
, setup : Text
, scenario : Text
, workingOn : List Text
, badSlam : Bool
}
) ->
group
"skateSession"
[ { key = "minutes", value = Value.Count v.minutes }
, { key = "setup", value = Value.FreeForm v.setup }
, { key = "scenario", value = Value.FreeForm v.scenario }
, { key = "rpe", value = Value.Count v.rpe }
, { key = "badSlam", value = Value.Happened v.badSlam }
, { key = "workingOn", value = Value.Listing v.workingOn }
]
in { steps
, calories
, weight
, kc
, Entry
, morningPrayer
, eveningPrayer
, synaxarion
, psalms
, lineADay
, specialTopics
, finishedMovies
, finishedShows
, finishedBooks
, finishedVideoGames
, skateSession
, healthAppStuff
, healthApp2
, sleep
, count
, avoidedP
, freeForm
, keyedCount
, happened
, list
, emptyList
, two
, group
, cheapBeerCal
, ounces
, water
, dishes
, bikeMinutes
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment