Skip to content

Commit

Permalink
Merge branch 'main' into quick-update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFragger authored Apr 1, 2023
2 parents 73d63d0 + 06c413b commit 887ce06
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public static GameLinesConfig Default()
public SchrodingersString? HintLocationHasUsefulItem { get; init; }
= new SchrodingersString("{0} has something nice, but it's not vital.", "{0} may be useful, but it's not required.");

/// <summary>
/// Hints for stating that a location has a sword
/// </summary>
public SchrodingersString? HintLocationHasSword { get; init; }
= new SchrodingersString("{0} has a sword", "You can find a sword in {0}.");

/// <summary>
/// Hints for stating that a location has no useful items
/// </summary>
Expand Down
15 changes: 10 additions & 5 deletions src/Randomizer.Data/Configuration/Yaml/Templates/game.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ HintLocationIsMandatory:
# {0} is replaced with the room, dungeon, or region name
HintLocationHasUsefulItem:

# The list of possibilities for hint messages for a given room, dungeon,
# or region that is not required but has a sword in it.
# {0} is replaced with the room, dungeon, or region name
HintLocationHasSword:

# The list of possibilities for hint messages for a given room, dungeon,
# or region that has nothing required or useful in it.
# {0} is replaced with the room, dungeon, or region name
Expand All @@ -46,22 +51,22 @@ HintLocationHasItem:
# {0} is replaced with the item name.
KingZora:

# The list of possibilities for the bottle merchant to say when asking
# The list of possibilities for the bottle merchant to say when asking
# the player if the want to buy an item.
# {0} is replaced with the item name.
BottleMerchant:

# The list of possibilities for the Yes response when the player is
# presented with a yes or no choice.
# Limited to a max of 12 characters.
ChoiceYes:
ChoiceYes:

# The list of possibilities for the No response when the player is
# presented with a yes or no choice.
# Limited to a max of 12 characters.
ChoiceNo:
ChoiceNo:

# The list of possibilities for Ganon to hint at the location of
# The list of possibilities for Ganon to hint at the location of
# the silver arrows
# {0} is replaced with the player name (or the text "you")
# {1} is replaced with the general area name
Expand All @@ -82,4 +87,4 @@ SahasrahlaReveal:
BombShopReveal:

# The list of possibilities for the guy in the Kakariko tavern
TavernMan:
TavernMan:
2 changes: 2 additions & 0 deletions src/Randomizer.Data/Logic/ILogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public interface ILogic

public bool CanParlorSpeedBoost(Progression items);

public bool CanMoatSpeedBoost(Progression items);

public bool CanMoveAtHighSpeeds(Progression items);

public bool CanPassSwordOnlyDarkRooms(Progression items);
Expand Down
5 changes: 5 additions & 0 deletions src/Randomizer.Data/Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ public bool CanParlorSpeedBoost(Progression items)
return items.SpeedBooster && World.Config.LogicConfig.ParlorSpeedBooster;
}

public bool CanMoatSpeedBoost(Progression items)
{
return items.SpeedBooster && World.Config.LogicConfig.MoatSpeedBooster;
}

public bool CanMoveAtHighSpeeds(Progression items)
{
return items.SpeedBooster || (items.Morph && World.Config.LogicConfig.MockBall);
Expand Down
5 changes: 5 additions & 0 deletions src/Randomizer.Data/Logic/LogicConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public class LogicConfig
[Category("Tricks")]
public bool ParlorSpeedBooster { get; set; }

[DisplayName("Moat Speed Booster Fly By")]
[Description("You're expected to be able to use the speed booster to shine spark over the moat in order to get to the Wrecked Ship.")]
[Category("Tricks")]
public bool MoatSpeedBooster { get; set; }

[DisplayName("Mockball")]
[Description("You're expected to be able to use to mockball to avoid having the speed booster at the entrance to Green Brinstar and Upper Norfair West.")]
[Category("Tricks")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public EastCrateria(World world, Config config, IMetadataService? metadata, Trac

private bool CanAccessFloodedCavernUnderWater(Progression items, bool requireRewards)
=> items.Morph && (
items.SpeedBooster
Logic.CanMoatSpeedBoost(items)
|| items.Grapple
|| items.SpaceJump
|| (items.Gravity && (Logic.CanIbj(items) || items.HiJump))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public override bool CanEnter(Progression items, bool requireRewards)
return items.Super && (
/* Over the Moat */
((Config.MetroidKeysanity ? items.CardCrateriaL2 : Logic.CanUsePowerBombs(items)) && (
items.SpeedBooster || items.Grapple || items.SpaceJump ||
Logic.CanMoatSpeedBoost(items) || items.Grapple || items.SpaceJump ||
(items.Gravity && (Logic.CanIbj(items) || (items.HiJump && Logic.CanWallJump(WallJumpDifficulty.Easy))))
|| Logic.CanWallJump(WallJumpDifficulty.Insane)
)) ||
Expand Down
41 changes: 34 additions & 7 deletions src/Randomizer.SMZ3/Generation/GameHintService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,24 @@ private IEnumerable<string> GetDungeonHints(World hintPlayerWorld, ICollection<W
foreach (var dungeon in dungeons)
{
var dungeonRegion = (Region)dungeon;
var usefulNess = CheckIfLocationsAreImportant(allWorlds, importantLocations, dungeonRegion.Locations);
var usefulness = CheckIfLocationsAreImportant(allWorlds, importantLocations, dungeonRegion.Locations);
var dungeonName = GetDungeonName(hintPlayerWorld, dungeon, dungeonRegion);

if (usefulNess == LocationUsefulness.Mandatory)
if (usefulness == LocationUsefulness.Mandatory)
{
var hint = _gameLines.HintLocationIsMandatory?.Format(dungeonName);
if (!string.IsNullOrEmpty(hint)) hints.Add(hint);
}
else if (usefulNess == LocationUsefulness.NiceToHave)
else if (usefulness == LocationUsefulness.NiceToHave)
{
var hint = _gameLines.HintLocationHasUsefulItem?.Format(dungeonName);
if (!string.IsNullOrEmpty(hint)) hints.Add(hint);
}
else if (usefulness == LocationUsefulness.Sword)
{
var hint = _gameLines.HintLocationHasSword?.Format(dungeonName);
if (!string.IsNullOrEmpty(hint)) hints.Add(hint);
}
else
{
var hint = _gameLines.HintLocationEmpty?.Format(dungeonName);
Expand Down Expand Up @@ -233,6 +238,11 @@ private void AddLocationHint(List<string> hints, World hintPlayerWorld, ICollect
var hint = _gameLines.HintLocationHasUsefulItem?.Format(areaName);
if (hint != null) hints.Add(hint);
}
else if (usefulness == LocationUsefulness.Sword)
{
var hint = _gameLines.HintLocationHasSword?.Format(areaName);
if (hint != null) hints.Add(hint);
}
else
{
var hint = _gameLines.HintLocationEmpty?.Format(areaName);
Expand All @@ -259,16 +269,32 @@ private LocationUsefulness CheckIfLocationsAreImportant(IEnumerable<World> allWo
var canBeatRidley = CheckSphereLocationCount(sphereLocations, locations, 78, allWorlds.Count());
var allCrateriaBosSKeys = CheckSphereCrateriaBossKeys(sphereLocations);

if (!canBeatGT || !canBeatKraid || !canBeatPhantoon || !canBeatDraygon || !canBeatRidley || !allCrateriaBosSKeys)
// Make sure all players have the silver arrows
if (sphereLocations.Count(x => x.Item.Type == ItemType.SilverArrows) < allWorlds.Count())
{
return LocationUsefulness.Mandatory;
}

if (locations.Any(x => x.Item.Type == ItemType.SilverArrows))
// Make sure all players have the master sword
foreach (var world in allWorlds)
{
if (sphereLocations.Count(x => x.Item.Type == ItemType.ProgressiveSword && x.Item.World == world) <
2)
{
return LocationUsefulness.Mandatory;
}
}

if (!canBeatGT || !canBeatKraid || !canBeatPhantoon || !canBeatDraygon || !canBeatRidley || !allCrateriaBosSKeys)
{
return LocationUsefulness.Mandatory;
}

if (locations.Any(x => x.Item.Type == ItemType.ProgressiveSword))
{
return LocationUsefulness.Sword;
}

var usefulItems = locations.Where(x => (x.Item.Progression && !x.Item.Type.IsInCategory(ItemCategory.Junk)) || x.Item.Type.IsInCategory(ItemCategory.Nice) || x.Item.Type == ItemType.ProgressiveSword).Select(x => x.Item);
return usefulItems.Any() ? LocationUsefulness.NiceToHave : LocationUsefulness.Useless;
}
Expand Down Expand Up @@ -394,7 +420,7 @@ private IEnumerable<Location> GetImportantLocations(IEnumerable<World> allWorlds
return allWorlds.SelectMany(w => w.Locations)
.Where(l => s_importantLocations.Contains(l.Id) || l.Item.Progression ||
l.Item.Type.IsInAnyCategory(ItemCategory.SmallKey, ItemCategory.BigKey,
ItemCategory.Keycard) || l.Item.Type is ItemType.Super or ItemType.PowerBomb)
ItemCategory.Keycard) || l.Item.Type is ItemType.Super or ItemType.PowerBomb or ItemType.ProgressiveSword or ItemType.SilverArrows)
.Concat(ammoLocations)
.Distinct();
}
Expand All @@ -403,7 +429,8 @@ private enum LocationUsefulness
{
Useless,
NiceToHave,
Mandatory
Mandatory,
Sword
}
}
}

0 comments on commit 887ce06

Please sign in to comment.