vitals.bend checks
raw source on the hub · import gralha-bendquest@0.1.0.0/vitals.bend as Vitals
Player vital state and its authoritative death/respawn transitions.
4 imports
import Base import ./game.bend as G import ./health.bend as H import ./rewards.bend as R
Laws
law Vitals.fall_ok provedsource · line 37 · raw
@+state:Vitals.State -> @+timer:U32 -> @+maximum:U32 -> Vitals.OK<Vitals.fall(state, timer), maximum>
law Vitals.revive_ok provedsource · line 48 · raw
@+state:Vitals.State -> @+maximum:U32 -> @+positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(maximum)) == True{} : Bool} -> Vitals.OK<Vitals.revive(state, maximum), maximum>
law Vitals.finish_hit_ok provedsource · line 87 · raw
@+remaining:Nat -> @+word:U32 -> @+state:Vitals.State -> @+timer:U32 -> @+maximum:U32 -> @+exact:{U32.to_nat(word) == remaining : Nat} -> @+bound:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(U32.to_nat(word), U32.to_nat(maximum)) == True{} : Bool} -> Vitals.OK<Vitals.hit_state(Vitals.finish_hit(remaining, word, state, timer)), maximum>
law Vitals.hit_gate_ok provedsource · line 106 · raw
@+is_dead:Bool -> @+state:Vitals.State -> @+damage:U32 -> @+timer:U32 -> @+maximum:U32 -> @+valid:Vitals.OK<state, maximum> -> Vitals.OK<Vitals.hit_state(Vitals.hit_gate(is_dead, state, damage, timer)), maximum>
law Vitals.hit_ok provedsource · line 124 · raw
@+state:Vitals.State -> @+damage:U32 -> @+timer:U32 -> @+maximum:U32 -> @+valid:Vitals.OK<state, maximum> -> Vitals.OK<Vitals.hit_state(Vitals.hit(state, damage, timer)), maximum>
law Vitals.wait_ok provedsource · line 175 · raw
@+state:Vitals.State -> @+maximum:U32 -> @+valid:Vitals.OK<state, maximum> -> Vitals.OK<Vitals.wait(state), maximum>
law Vitals.live_tick_ok provedsource · line 188 · raw
@+state:Vitals.State -> @+amount:U32 -> @+maximum:U32 -> @+bound:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(U32.to_nat(Vitals.hp(state)), U32.to_nat(maximum)) == True{} : Bool} -> @+positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(Vitals.hp(state))) == True{} : Bool} -> Vitals.OK<Vitals.live_tick(state, amount, maximum), maximum>
law Vitals.dead_tick_ok provedsource · line 201 · raw
@+ready:Bool -> @+state:Vitals.State -> @+maximum:U32 -> @+valid:Vitals.OK<state, maximum> -> @+positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(maximum)) == True{} : Bool} -> Vitals.OK<Vitals.upkeep_state(Vitals.dead_tick(ready, state, maximum)), maximum>
law Vitals.upkeep_ok provedsource · line 216 · raw
@+state:Vitals.State -> @+amount:U32 -> @+maximum:U32 -> @+valid:Vitals.OK<state, maximum> -> @+positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(maximum)) == True{} : Bool} -> Vitals.OK<Vitals.upkeep_state(Vitals.upkeep(state, amount, maximum)), maximum>
law Vitals.dead_hit_noop provedsource · line 237 · raw
@+state:Vitals.State -> @+damage:U32 -> @+timer:U32 -> @+dead:{Vitals.dead(state) == 1 : U32} -> {Vitals.hit(state, damage, timer) == Vitals.Hit{state, False{}} : Vitals.Hit}
law Vitals.finish_hit_exact provedsource · line 248 · raw
@+remaining:Nat -> @+word:U32 -> @+state:Vitals.State -> @+timer:U32 -> @+exact:{U32.to_nat(word) == remaining : Nat} -> {U32.to_nat(Vitals.hp(Vitals.hit_state(Vitals.finish_hit(remaining, word, state, timer)))) == remaining : Nat}
law Vitals.live_hit_exact provedsource · line 267 · raw
@+state:Vitals.State -> @+damage:U32 -> @+timer:U32 -> @+alive:{Vitals.dead(state) == 0 : U32} -> {U32.to_nat(Vitals.hp(Vitals.hit_state(Vitals.hit(state, damage, timer)))) == 0x6f51b0319916bc200dd5f3949f31668e/health.Health.hurt(U32.to_nat(Vitals.hp(state)), U32.to_nat(damage)) : Nat}
law Vitals.upkeep_hero_ok provedsource · line 283 · raw
@+state:Vitals.State -> @+amount:U32 -> @+hero:0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Hero -> @+ceiling:U32 -> @+valid:Vitals.OK<state, 0x6f51b0319916bc200dd5f3949f31668e/rewards.Rewards.maximum(hero, ceiling)> -> @+limit_positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(ceiling)) == True{} : Bool} -> Vitals.OK<Vitals.upkeep_state(Vitals.upkeep_hero(state, amount, hero, ceiling)), 0x6f51b0319916bc200dd5f3949f31668e/rewards.Rewards.maximum(hero, ceiling)>
law Vitals.spawn_ok provedsource · line 298 · raw
@+maximum:U32 -> @+positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(maximum)) == True{} : Bool} -> Vitals.OK<Vitals.spawn(maximum), maximum>
law Vitals.spawn_hero_ok provedsource · line 306 · raw
@+hero:0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Hero -> @+ceiling:U32 -> @+limit_positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(ceiling)) == True{} : Bool} -> Vitals.OK<Vitals.spawn(0x6f51b0319916bc200dd5f3949f31668e/rewards.Rewards.maximum(hero, ceiling)), 0x6f51b0319916bc200dd5f3949f31668e/rewards.Rewards.maximum(hero, ceiling)>
law Vitals.finish_hit_fell_dead provedsource · line 320 · raw
@+remaining:Nat -> @+word:U32 -> @+state:Vitals.State -> @+timer:U32 -> @+fell:{Vitals.fell(Vitals.finish_hit(remaining, word, state, timer)) == True{} : Bool} -> {Vitals.dead(Vitals.hit_state(Vitals.finish_hit(remaining, word, state, timer))) == 1 : U32}
law Vitals.hit_gate_fell_dead provedsource · line 339 · raw
@+is_dead:Bool -> @+state:Vitals.State -> @+damage:U32 -> @+timer:U32 -> @+fell:{Vitals.fell(Vitals.hit_gate(is_dead, state, damage, timer)) == True{} : Bool} -> {Vitals.dead(Vitals.hit_state(Vitals.hit_gate(is_dead, state, damage, timer))) == 1 : U32}
law Vitals.lethal_hit_reports_death provedsource · line 354 · raw
@+state:Vitals.State -> @+damage:U32 -> @+timer:U32 -> @+lethal:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(U32.to_nat(Vitals.hp(state)), U32.to_nat(damage)) == True{} : Bool} -> {Vitals.fell(Vitals.hit_gate(False{}, state, damage, timer)) == True{} : Bool}
Types
type Vitals.State source · line 7 · raw
Data
Vitals.State@hp:U32 -> @xp:U32 -> @dead:U32 -> @respawn:U32 -> @attack:U32 -> @spin:U32 -> Vitals.State
type Vitals.Life source · line 20 · raw
@-hp:U32 -> @-dead:U32 -> Data
Vitals.Alive@-hp:U32 -> @-dead:U32 -> @flag:{dead == 0 : U32} -> @positive:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(1n, U32.to_nat(hp)) == True{} : Bool} -> Vitals.Life<hp, dead>Vitals.Dead@-hp:U32 -> @-dead:U32 -> @flag:{dead == 1 : U32} -> @zero:{hp == 0 : U32} -> Vitals.Life<hp, dead>
type Vitals.OK source · line 24 · raw
@-state:Vitals.State -> @-maximum:U32 -> Data
Vitals.OK@-state:Vitals.State -> @-maximum:U32 -> @bound:{0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Nat.le(U32.to_nat(Vitals.hp(state)), U32.to_nat(maximum)) == True{} : Bool} -> @life:Vitals.Life<Vitals.hp(state), Vitals.dead(state)> -> Vitals.OK<state, maximum>
type Vitals.Hit source · line 59 · raw
Data
Vitals.Hit@state:Vitals.State -> @fell:Bool -> Vitals.Hit
type Vitals.Upkeep source · line 148 · raw
Data
Vitals.Upkeep@state:Vitals.State -> @revived:Bool -> @walk:Bool -> Vitals.Upkeep
Definitions
def Vitals.hp source · line 10 · raw
@state:Vitals.State -> U32
def Vitals.dead source · line 15 · raw
@state:Vitals.State -> U32
def Vitals.fall source · line 27 · raw
@state:Vitals.State -> @timer:U32 -> Vitals.State
def Vitals.revive source · line 32 · raw
@state:Vitals.State -> @maximum:U32 -> Vitals.State
def Vitals.hit_state source · line 62 · raw
@hit:Vitals.Hit -> Vitals.State
def Vitals.finish_hit source · line 67 · raw
@remaining:Nat -> @word:U32 -> @state:Vitals.State -> @timer:U32 -> Vitals.Hit
def Vitals.hit_gate source · line 76 · raw
@is_dead:Bool -> @+state:Vitals.State -> @damage:U32 -> @timer:U32 -> Vitals.Hit
def Vitals.hit source · line 84 · raw
@+state:Vitals.State -> @damage:U32 -> @timer:U32 -> Vitals.Hit
def Vitals.dec source · line 135 · raw
@word:U32 -> U32
def Vitals.wait source · line 138 · raw
@state:Vitals.State -> Vitals.State
def Vitals.live_tick source · line 143 · raw
@state:Vitals.State -> @amount:U32 -> @maximum:U32 -> Vitals.State
def Vitals.upkeep_state source · line 151 · raw
@upkeep:Vitals.Upkeep -> Vitals.State
def Vitals.dead_tick source · line 156 · raw
@ready:Bool -> @state:Vitals.State -> @maximum:U32 -> Vitals.Upkeep
def Vitals.upkeep_gate source · line 163 · raw
@is_dead:Bool -> @ready:Bool -> @state:Vitals.State -> @amount:U32 -> @maximum:U32 -> Vitals.Upkeep
def Vitals.upkeep source · line 170 · raw
@+state:Vitals.State -> @amount:U32 -> @maximum:U32 -> Vitals.Upkeep
def Vitals.upkeep_hero source · line 280 · raw
@state:Vitals.State -> @amount:U32 -> @+hero:0x6f51b0319916bc200dd5f3949f31668e/game.Bq.Hero -> @ceiling:U32 -> Vitals.Upkeep
The live server uses this entry with the U32 ceiling.
def Vitals.spawn source · line 295 · raw
@maximum:U32 -> Vitals.State
def Vitals.fell source · line 315 · raw
@hit:Vitals.Hit -> Bool