r2mods/ilspy_dump/ror2_csproj/RoR2.Achievements/BasePerSurvivorClearGameMon...

29 lines
736 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2.Achievements;
public class BasePerSurvivorClearGameMonsoonAchievement : BaseAchievement
{
protected override void OnBodyRequirementMet()
{
base.OnBodyRequirementMet();
Run.onClientGameOverGlobal += OnClientGameOverGlobal;
}
protected override void OnBodyRequirementBroken()
{
Run.onClientGameOverGlobal -= OnClientGameOverGlobal;
base.OnBodyRequirementBroken();
}
private void OnClientGameOverGlobal(Run run, RunReport runReport)
{
if ((bool)runReport.gameEnding && runReport.gameEnding.isWin)
{
DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty());
if (difficultyDef != null && difficultyDef.countsAsHardMode)
{
Grant();
}
}
}
}