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

29 lines
736 B
C#

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();
}
}
}
}