mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Warn when sending faction leader on Suppress Beasts command (#5695)
* Warn when sending faction leader on Suppress Beasts command Add warning when the player is about to send their faction leader on a beast suppression mission. Losing the faction leader ends the game. Three warning cases: - No battalion: "Your hero may be killed" - Faction leader with battalion: "You're risking your faction leader!" - Faction leader without battalion: Combined warning for both risks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix: Use TryGetValue instead of GetValueOrDefault Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update warning text to use sworn brother/sister title Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+36
-3
@@ -20,9 +20,42 @@ namespace eagle {
|
||||
public override string HeaderString =>
|
||||
$"Suppress {DisplayNames.Capitalized(BeastTypeName)}";
|
||||
public override string CommitButtonString => "Commit Suppression";
|
||||
public override bool WarnOnCommitButton => !SelectedBattalionId.HasValue;
|
||||
public override string CommitWarningText =>
|
||||
"You aren't sending a battalion. Your hero may be killed.";
|
||||
public override bool WarnOnCommitButton =>
|
||||
!SelectedBattalionId.HasValue || IsSendingFactionLeader;
|
||||
public override string CommitWarningText {
|
||||
get {
|
||||
if (!SelectedBattalionId.HasValue && IsSendingFactionLeader) {
|
||||
return $"You aren't sending a battalion, and you're risking your {FactionLeaderTitle}!";
|
||||
}
|
||||
if (!SelectedBattalionId.HasValue) {
|
||||
return "You aren't sending a battalion. Your hero may be killed.";
|
||||
}
|
||||
if (IsSendingFactionLeader) { return $"You're risking your {FactionLeaderTitle}!"; }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private string FactionLeaderTitle {
|
||||
get {
|
||||
if (_model?.Heroes == null ||
|
||||
!_model.Heroes.TryGetValue(SelectedHeroId, out var hero)) {
|
||||
return "faction leader";
|
||||
}
|
||||
return $"sworn {DisplayNames.SiblingDescription(hero.PronounGender)}";
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsSendingFactionLeader {
|
||||
get {
|
||||
if (_model?.PlayerId == null) return false;
|
||||
if (!_model.ActiveFactions.TryGetValue(
|
||||
_model.PlayerId.Value,
|
||||
out var playerFaction)) {
|
||||
return false;
|
||||
}
|
||||
return SelectedHeroId == playerFaction.FactionHeadId;
|
||||
}
|
||||
}
|
||||
|
||||
public override List<HeroId> TargetedHeroIds => new List<HeroId> { SelectedHeroId };
|
||||
public override bool HeroIsTargetable(HeroId heroId) =>
|
||||
|
||||
Reference in New Issue
Block a user