45 lines
1.3 KiB
C#
Executable File
45 lines
1.3 KiB
C#
Executable File
using LiveSplit.Model;
|
|
using LiveSplit.TZA.Util;
|
|
|
|
namespace LiveSplit.TZA.Splits;
|
|
|
|
internal class KillBoss : ISplit {
|
|
private uint[] Stage { get; }
|
|
private ushort Location { get; }
|
|
private uint HpRemaining { get; }
|
|
|
|
internal KillBoss(uint stage, ushort location, uint hpRemaining = 0) {
|
|
this.Stage = new[] { stage };
|
|
this.Location = location;
|
|
this.HpRemaining = hpRemaining;
|
|
}
|
|
|
|
internal KillBoss(uint[] stage, ushort location, uint hpRemaining = 0) {
|
|
this.Stage = stage;
|
|
this.Location = location;
|
|
this.HpRemaining = hpRemaining;
|
|
}
|
|
|
|
public LogicResult Calculate(TimerPhase phase, GameMemory memory) {
|
|
if (phase != TimerPhase.Running) {
|
|
return LogicResult.None;
|
|
}
|
|
|
|
if (!this.Stage.Contains(memory.Stage.Current)) {
|
|
return LogicResult.None;
|
|
}
|
|
|
|
if (memory.Location.Current != this.Location) {
|
|
return LogicResult.None;
|
|
}
|
|
|
|
if (!memory.BossHp.Changed || memory.BossHp.Current > this.HpRemaining) {
|
|
return LogicResult.None;
|
|
}
|
|
|
|
return LogicResult.Split;
|
|
}
|
|
|
|
public string GetHumanName() => $"When boss in {LocationNames.Get(this.Location)} has {this.HpRemaining:N0} HP remaining";
|
|
}
|