chore: version Zelda 1 port and engineering records
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import { Enemies } from @zelda1:enemies/octorok;
|
||||
import { Link, LinkCombatChecks } from @zelda1:link;
|
||||
import { Stage } from @zelda1:stage;
|
||||
import { Inventory } from @zelda1:inventory;
|
||||
import { WorldFlags } from @zelda1:world;
|
||||
import { Loot } from @zelda1:loot;
|
||||
declare global test_rock: Rock = new Rock(0,0,0,0,0);
|
||||
declare global enemy_check_failures: int = 0;
|
||||
declare global enemy_check_count: int = 0;
|
||||
declare service EnemyCombatChecks {
|
||||
fn check(passed: bool) -> void { enemy_check_count+=1; if !passed { enemy_check_failures+=1; } }
|
||||
fn bounce_case(facing: int, incoming: int, dx: int, dy: int) -> void {
|
||||
Inventory.reset(); LinkCombatChecks.place(120,141,facing);
|
||||
let x=120; let y=141;
|
||||
if incoming==1 { x-=6; } else if incoming==2 { x+=6; }
|
||||
else if incoming==4 { y-=6; } else { y+=6; }
|
||||
test_rock.launch(x,y,incoming); test_rock.update();
|
||||
EnemyCombatChecks.check(test_rock.direction!=0 && test_rock.bounce==facing && test_rock.distance==0);
|
||||
x=test_rock.x; y=test_rock.y; test_rock.update();
|
||||
EnemyCombatChecks.check(test_rock.x==x+dx && test_rock.y==y+dy && test_rock.distance==2);
|
||||
for tick: int from 0 until 14 { test_rock.update(); }
|
||||
EnemyCombatChecks.check(test_rock.direction!=0 && test_rock.distance==30);
|
||||
test_rock.update(); EnemyCombatChecks.check(test_rock.direction==0);
|
||||
let partial=Inventory.read_slot(25); EnemyCombatChecks.check(partial==255);
|
||||
}
|
||||
fn run() -> int {
|
||||
Stage.reset(); EnemyCombatChecks.bounce_case(8,4,1,-2); EnemyCombatChecks.bounce_case(4,8,-1,2);
|
||||
EnemyCombatChecks.bounce_case(2,1,-2,-1); EnemyCombatChecks.bounce_case(1,2,2,-1);
|
||||
Inventory.reset(); LinkCombatChecks.place(120,141,8);
|
||||
test_rock.launch(120,147,8); test_rock.update();
|
||||
let partial=Inventory.read_slot(25); EnemyCombatChecks.check(partial==127 && test_rock.direction==0);
|
||||
test_rock.launch(120,147,8); test_rock.update();
|
||||
partial=Inventory.read_slot(25); EnemyCombatChecks.check(partial==127 && test_rock.direction!=0);
|
||||
// Visit the northern stage with the player at its actual entrance.
|
||||
Inventory.reset(); WorldFlags.reset(); Enemies.reset(); Loot.reset(); Stage.reset(); Link.start_game();
|
||||
let command=Stage.advance(120,61,8,0,0,false,true);
|
||||
for tick: int from 0 until 44 { command=Stage.advance(120,61,8,0,0,false,false); }
|
||||
command=Stage.advance(120,221,8,0,0,false,false); LinkCombatChecks.place(120,221,8);
|
||||
Enemies.update(); let alive=Enemies.alive_count(); EnemyCombatChecks.check(alive==4);
|
||||
EnemyCombatChecks.check(e0.x==80 && e0.y==93 && e1.x==80 && e1.y==157);
|
||||
// A completed death advances room/cycle/drop; leaving clears the drop.
|
||||
e0.hp=0; e0.dying=0; Loot.monster_killed(1); Enemies.update();
|
||||
alive=Enemies.alive_count(); EnemyCombatChecks.check(alive==3 && room_killed==1 && loot0.id==24);
|
||||
WorldFlags.mark_room_item_taken(103); Enemies.leave_room();
|
||||
EnemyCombatChecks.check(loot0.id<0);
|
||||
let count=WorldFlags.kill_count(103); EnemyCombatChecks.check(count==1);
|
||||
Enemies.update(); alive=Enemies.alive_count(); EnemyCombatChecks.check(alive==3 && e3.hp<0 && e3.dying==0);
|
||||
// Killing the remaining three keeps the room empty on immediate reentry.
|
||||
e0.hp=0; e0.dying=0; e1.hp=0; e1.dying=0; e2.hp=0; e2.dying=0;
|
||||
Enemies.update(); Enemies.leave_room(); count=WorldFlags.kill_count(103); EnemyCombatChecks.check(count==7);
|
||||
Enemies.update(); alive=Enemies.alive_count(); EnemyCombatChecks.check(alive==0);
|
||||
let taken=WorldFlags.room_item_taken(103); EnemyCombatChecks.check(taken);
|
||||
WorldFlags.clear_history(); Enemies.abandon_room(); Enemies.update();
|
||||
alive=Enemies.alive_count(); EnemyCombatChecks.check(alive==4);
|
||||
// Death abandons this visit; it does not save its in-room kill count.
|
||||
e0.hp=0; e0.dying=0; Enemies.update(); Enemies.abandon_room(); Enemies.update();
|
||||
alive=Enemies.alive_count(); EnemyCombatChecks.check(alive==4);
|
||||
Enemies.abandon_room(); return enemy_check_failures;
|
||||
}
|
||||
fn count() -> int { return enemy_check_count; }
|
||||
fn draw_bounces(clock: int) -> void {
|
||||
for col: int from 0 until 4 {
|
||||
let facing=if col==0 { 8 } else if col==1 { 4 } else if col==2 { 2 } else { 1 };
|
||||
test_rock.launch(48+col*48,208,1); test_rock.bounce=facing;
|
||||
for tick: int from 0 until clock%16 { test_rock.update(); }
|
||||
test_rock.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Link } from @zelda1:link;
|
||||
import { Inventory } from @zelda1:inventory;
|
||||
import { Stage } from @zelda1:stage;
|
||||
declare global test_beam: SwordBeam = new SwordBeam(0,0,0,0,0);
|
||||
declare global link_check_failures: int = 0;
|
||||
declare global link_check_count: int = 0;
|
||||
declare service LinkCombatChecks {
|
||||
fn check(passed: bool) -> void { link_check_count+=1; if !passed { link_check_failures+=1; } }
|
||||
fn place(x: int, y: int, facing: int) -> void { controller.place_for_stage(state,x,y,facing,true); vitals.reset(); }
|
||||
fn run() -> int {
|
||||
Inventory.reset(); Stage.reset(); Link.start_game();
|
||||
let full=Inventory.full_hearts(); LinkCombatChecks.check(full);
|
||||
let damage=Inventory.damage_life(128); full=Inventory.full_hearts(); LinkCombatChecks.check(!full);
|
||||
let launched=test_beam.launch(120,141,8); LinkCombatChecks.check(!launched && test_beam.phase==0);
|
||||
Inventory.reset(); damage=Inventory.damage_life(127);
|
||||
full=Inventory.full_hearts(); LinkCombatChecks.check(full);
|
||||
launched=test_beam.launch(120,141,8); LinkCombatChecks.check(launched && test_beam.x==120 && test_beam.y==125);
|
||||
launched=test_beam.launch(120,141,8); LinkCombatChecks.check(!launched);
|
||||
test_beam.update(); LinkCombatChecks.check(test_beam.y==122);
|
||||
let hit=test_beam.hits(160,122,8); LinkCombatChecks.check(!hit);
|
||||
hit=test_beam.hits(120,122,8); LinkCombatChecks.check(hit && test_beam.phase==17 && test_beam.radius==2);
|
||||
hit=test_beam.hits(120,122,8); LinkCombatChecks.check(!hit);
|
||||
for tick: int from 0 until 21 { test_beam.update(); }
|
||||
LinkCombatChecks.check(test_beam.phase==17 && test_beam.radius==23);
|
||||
test_beam.update(); LinkCombatChecks.check(test_beam.phase==0);
|
||||
Inventory.reset();
|
||||
launched=test_beam.launch(120,141,1); LinkCombatChecks.check(launched && test_beam.x==136 && test_beam.y==141);
|
||||
test_beam.update(); LinkCombatChecks.check(test_beam.x==139);
|
||||
test_beam.reset(); launched=test_beam.launch(120,141,2); LinkCombatChecks.check(launched && test_beam.x==104);
|
||||
test_beam.reset(); launched=test_beam.launch(120,141,4); LinkCombatChecks.check(launched && test_beam.y==157);
|
||||
test_beam.reset(); launched=test_beam.launch(4,141,2); LinkCombatChecks.check(!launched && test_beam.phase==0);
|
||||
launched=test_beam.launch(120,141,8);
|
||||
for tick: int from 0 until 22 { test_beam.update(); }
|
||||
LinkCombatChecks.check(test_beam.phase==17);
|
||||
// Actual weapon timing: the beam begins when extended state 2 reaches 3.
|
||||
Link.start_game(); let taken=Inventory.take_sword(1); LinkCombatChecks.check(taken);
|
||||
for tick: int from 0 until 12 { Link.update(false,false,false,false,tick==0); Link.draw(); }
|
||||
LinkCombatChecks.check(beam.phase==0 && state.sword_state==2);
|
||||
Link.update(false,false,false,false,false); Link.draw();
|
||||
LinkCombatChecks.check(beam.phase==16 && beam.y==125 && state.sword_state==3);
|
||||
// Stage reposition invalidates the shot; a partial heart suppresses the next.
|
||||
Link.start_game(); LinkCombatChecks.check(beam.phase==0);
|
||||
damage=Inventory.damage_life(128);
|
||||
for tick: int from 0 until 13 { Link.update(false,false,false,false,tick==0); Link.draw(); }
|
||||
LinkCombatChecks.check(beam.phase==0);
|
||||
Link.start_game(); return link_check_failures;
|
||||
}
|
||||
fn count() -> int { return link_check_count; }
|
||||
}
|
||||
Reference in New Issue
Block a user