wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3eda72e8c2
commit
5ffe50ed02
463 changed files with 72045 additions and 67421 deletions
|
|
@ -12,15 +12,13 @@ program CombatKit {
|
|||
model Hero { Position, Body, Collider, TopDown, Weapon, Faction, Stats, Dash, Melee }
|
||||
model Creature { Position, Body, Collider, Faction, Stats, Foe }
|
||||
model WorldRules { Solids }
|
||||
state CombatkitState {
|
||||
frames: int = 0
|
||||
hero: int = -1
|
||||
}
|
||||
var frames: int = 0
|
||||
var hero: int = -1
|
||||
@On(MeleeHit) handler H { print(5000 + target) }
|
||||
@On(Crit) handler C { print(6000) }
|
||||
handler Tick(combatkit_st: mut CombatkitState) phase Update {
|
||||
combatkit_st.frames += 1
|
||||
if combatkit_st.frames == 1 {
|
||||
handler Tick phase Update {
|
||||
frames += 1
|
||||
if frames == 1 {
|
||||
Map.size(20, 15)
|
||||
Dungeon.arena(Dungeon.random_style(), '#', '.')
|
||||
Dungeon.set_exit(Side.North, 'D')
|
||||
|
|
@ -30,19 +28,19 @@ program CombatKit {
|
|||
print(e.x * 1000 + e.y) # 153196
|
||||
print(Dungeon.opposite(Side.West) * 10 + Dungeon.at_edge(IVec2.make(0, 3))) # 31
|
||||
Weapon.def(name: "p", fire_rate: 10, damage: 10, speed: 8, spread: 0, pellets: 1, pattern: 0)
|
||||
combatkit_st.hero = spawn Hero { Position { x: 100, y: 100 }, Collider { w: 14, h: 20 }, Body { policy: 1 }, TopDown { move_speed: 4, aim_mode: AimMode.Manual, aim_angle: 0 }, Faction { id: 1 },
|
||||
hero = spawn Hero { Position { x: 100, y: 100 }, Collider { w: 14, h: 20 }, Body { policy: 1 }, TopDown { move_speed: 4, aim_mode: AimMode.Manual, aim_angle: 0 }, Faction { id: 1 },
|
||||
Stats { hp: 100, max_hp: 100 }, Dash { frames: 3, speed: 9, cooldown_frames: 5 }, Melee { range: 30, damage: 7, knockback: 4 } }
|
||||
Stats.add(combatkit_st.hero, StatKind.CritPct, 100)
|
||||
Stats.add(combatkit_st.hero, StatKind.DamagePct, 50)
|
||||
let c = Collider.center(combatkit_st.hero); print(c.x * 1000 + c.y) # 107110
|
||||
Stats.add(hero, StatKind.CritPct, 100)
|
||||
Stats.add(hero, StatKind.DamagePct, 50)
|
||||
let c = Collider.center(hero); print(c.x * 1000 + c.y) # 107110
|
||||
spawn Creature { Position { x: 120, y: 100 }, Collider { w: 14, h: 20 }, Body { policy: 1 }, Faction { id: 2 }, Stats { hp: 100, max_hp: 100, thorns: 3 }, Foe { n: 1 } }
|
||||
Faction.set(1, 2, 2)
|
||||
print(Melee.swing(combatkit_st.hero)) # 1 hit (after 6000 and 5002)
|
||||
print(Melee.swing(hero)) # 1 hit (after 6000 and 5002)
|
||||
for (s, f) in query [Stats, Foe] { print(s.hp) } # 80: 7 * 150% doubled by the crit
|
||||
print(Stats.of(combatkit_st.hero).hp) # 97: thorns
|
||||
print(Dash.start(combatkit_st.hero, 0, 0) * 10 + Dash.active(combatkit_st.hero)) # 11
|
||||
print(Stats.of(hero).hp) # 97: thorns
|
||||
print(Dash.start(hero, 0, 0) * 10 + Dash.active(hero)) # 11
|
||||
print(Prefs.max("best", 5) * 10 + Prefs.max("best", 3)) # 10
|
||||
}
|
||||
if combatkit_st.frames == 7 { print(700 + Dash.active(combatkit_st.hero)); print(Position.of(combatkit_st.hero).x); quit() } # 700 110
|
||||
if frames == 7 { print(700 + Dash.active(hero)); print(Position.of(hero).x); quit() } # 700 110
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue