Skip to content

Commit a78a3bf

Browse files
authored
Merge pull request #1807 from blkerby/shinecharge-tests
Shinecharge tests
2 parents 084089d + 43408fa commit a78a3bf

5 files changed

Lines changed: 58 additions & 6 deletions

File tree

region/crateria/east/West Ocean.json

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@
466466
"HiJump",
467467
"canTrickyDashJump",
468468
"canWalljump",
469+
{"canShineCharge": {"usedTiles": 25, "openEnd": 1, "steepUpTiles": 4}},
469470
"canShinechargeMovementComplex",
470471
{"shineChargeFrames": 125}
471472
],
@@ -481,8 +482,9 @@
481482
"requires": [
482483
"HiJump",
483484
"SpaceJump",
485+
{"canShineCharge": {"usedTiles": 25, "openEnd": 1, "steepUpTiles": 4}},
484486
"canShinechargeMovementComplex",
485-
{"shineChargeFrames": 150}
487+
{"shineChargeFrames": 135}
486488
],
487489
"exitCondition": {
488490
"leaveShinecharged": {}
@@ -495,9 +497,10 @@
495497
"name": "Leave Shinecharged (HiJump)",
496498
"requires": [
497499
"HiJump",
500+
{"canShineCharge": {"usedTiles": 23, "openEnd": 1, "steepUpTiles": 4}},
498501
"canTrickyDashJump",
499502
"canShinechargeMovementComplex",
500-
{"shineChargeFrames": 160}
503+
{"shineChargeFrames": 150}
501504
],
502505
"exitCondition": {
503506
"leaveShinecharged": {}
@@ -507,16 +510,40 @@
507510
{
508511
"id": 11,
509512
"link": [2, 2],
510-
"name": "Leave With Spark",
513+
"name": "Leave With Spark (Tricky Dash Jump, Wall Jump)",
511514
"requires": [
515+
{"canShineCharge": {"usedTiles": 32, "openEnd": 1, "steepUpTiles": 4}},
512516
"canTrickyDashJump",
513517
"canWalljump",
514-
"canShinechargeMovementComplex",
515-
{"shinespark": {"frames": 20}}
518+
"canShinechargeMovementTricky",
519+
{"shinespark": {"frames": 10}}
516520
],
517521
"exitCondition": {
518522
"leaveWithSpark": {}
519-
}
523+
},
524+
"note": [
525+
"Gain a shinecharge while bonking the door below the top-right door.",
526+
"Then turn around, run a precise distance of 7 tiles, and jump and walljump to approach the top-right door and shinespark out."
527+
]
528+
},
529+
{
530+
"link": [2, 2],
531+
"name": "Leave Shinecharged (Tricky Dash Jump, Wall Jump)",
532+
"requires": [
533+
{"canShineCharge": {"usedTiles": 18, "openEnd": 1, "steepUpTiles": 4}},
534+
"canTrickyDashJump",
535+
"canWalljump",
536+
"canShinechargeMovementTricky",
537+
"canInsaneJump",
538+
{"shineChargeFrames": 170}
539+
],
540+
"exitCondition": {
541+
"leaveShinecharged": {}
542+
},
543+
"note": [
544+
"Gain a shinecharge while running left-to-right.",
545+
"Continue running right for a precise distance of 7 tiles, then jump and walljump to reach the top-right door with shinecharge frames remaining."
546+
]
520547
},
521548
{
522549
"id": 12,

region/crateria/west/Gauntlet Energy Tank Room.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@
922922
"requires": [
923923
{"notable": "R-Mode Blue Suit"},
924924
{"obstaclesCleared": ["D"]},
925+
"h_canShineChargeMaxRunway",
925926
{"shineChargeFrames": 0}
926927
],
927928
"exitCondition": {

region/lowernorfair/east/Plowerhouse Room.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
"link": [1, 2],
181181
"name": "Acid Leave Shinecharged",
182182
"requires": [
183+
{"canShineCharge": {"usedTiles": 38, "openEnd": 0}},
183184
{"heatFrames": 300},
184185
{"acidFrames": 133},
185186
"Gravity",
@@ -461,6 +462,7 @@
461462
"link": [2, 1],
462463
"name": "Acid Leave Shinecharged",
463464
"requires": [
465+
{"canShineCharge": {"usedTiles": 38, "openEnd": 0}},
464466
{"heatFrames": 390},
465467
{"acidFrames": 133},
466468
"Gravity",

region/norfair/crocomire/Post Crocomire Jump Room.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@
660660
"name": "Leave with Shinecharge - Power Bomb Blocks Destroyed",
661661
"requires": [
662662
{"obstaclesCleared": ["A", "B"]},
663+
{"canShineCharge": {"usedTiles": 38, "openEnd": 2, "gentleDownTiles": 6}},
663664
"canShinechargeMovement",
664665
{"shineChargeFrames": 45}
665666
],

tests/asserts/keywords.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ def check_shinespark_req(req):
262262
if "or" in req:
263263
return all(check_shinespark_req(v) for v in req["or"])
264264

265+
def check_shinecharge_req(req):
266+
if isinstance(req, str):
267+
if req in ["h_canShineChargeMaxRunway", "canStutterWaterShineCharge"]:
268+
return True
269+
if isinstance(req, dict):
270+
if "canShineCharge" in req:
271+
return True
272+
if "and" in req:
273+
return any(check_shinecharge_req(v) for v in req["and"])
274+
if "or" in req:
275+
return all(check_shinecharge_req(v) for v in req["or"])
276+
265277
def check_heat_req(req):
266278
if isinstance(req, str):
267279
if req in ["h_heatProof", "h_canHeatedCrystalFlash", "h_canHeatedLavaCrystalFlash", "h_LowerNorfairElevatorDownwardFrames",
@@ -848,6 +860,15 @@ def covers_shinecharge_frames(req):
848860
msg = f"🔴ERROR: Strat has leaveWithSpark exitCondition but is lacking a shinespark requirement:{stratRef}"
849861
messages["reds"].append(msg)
850862
messages["counts"]["reds"] += 1
863+
if ("exitCondition" in strat and "leaveShinecharged" in strat["exitCondition"]) or strat.get("endsWithShineCharge") is True:
864+
has_shinecharge_req = check_shinecharge_req({"and": strat["requires"]})
865+
starts_shinecharged = strat.get("startsWithShineCharge") is True
866+
comes_in_shinecharged = "entranceCondition" in strat and "comeInShinecharged" in strat["entranceCondition"]
867+
comes_in_shinecharging = "entranceCondition" in strat and "comeInShinecharging" in strat["entranceCondition"]
868+
if not (has_shinecharge_req or starts_shinecharged or comes_in_shinecharged or comes_in_shinecharging):
869+
msg = f"🔴ERROR: Strat ends or leaves shinecharged but obtains no shinecharge:{stratRef}"
870+
messages["reds"].append(msg)
871+
messages["counts"]["reds"] += 1
851872

852873
node_subtype = node_lookup[toNode]["nodeSubType"]
853874
door_unlocked_nodes = find_door_unlocked_nodes(strat, node_subtype, nodes_without_implicit_unlocks)

0 commit comments

Comments
 (0)