Skip to content

Commit

Permalink
fix max enemy health, add blank option for not having to replace enem…
Browse files Browse the repository at this point in the history
…y type
  • Loading branch information
codengine committed Mar 28, 2024
1 parent 85c7be0 commit 091a299
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SOTFEdit/Model/Actors/ActorModifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void Modify(JToken vailWorldSim, List<JToken> matchedActors, UpdateActor
}
}

if (data.ModifyOptions.ReplaceType is { } replaceType)
if (data.ModifyOptions.ReplaceType is { } replaceType and not EmptyActorType)
{
actor["TypeId"] = replaceType.Id;
}
Expand Down
5 changes: 5 additions & 0 deletions SOTFEdit/Model/Actors/ActorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ public bool IsFollower()
{
return Id is Constants.Actors.KelvinTypeId or Constants.Actors.VirginiaTypeId;
}
}

internal record EmptyActorType() : ActorType(-1, "")
{
public new string Name => "";
}
2 changes: 1 addition & 1 deletion SOTFEdit/View/EditActorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
Content="{infrastructure:Translate 'generic.update'}" />
<TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource LabelStyle}"
Text="{infrastructure:Translate 'actors.stats.health'}" />
<mah:NumericUpDown Margin="0 0 10 0" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="100"
<mah:NumericUpDown Margin="0 0 10 0" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="99999"
NumericInputMode="Numbers" Interval="10"
Value="{Binding ModifyOptions.ActorHealth, UpdateSourceTrigger=PropertyChanged}" />
<CheckBox Grid.Row="1" Grid.Column="2" IsChecked="{Binding ModifyOptions.UpdateHealth}"
Expand Down
1 change: 1 addition & 0 deletions SOTFEdit/View/EditActorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public EditActorWindow(Window owner, Actor messageActor)
Owner = owner;
SetupListeners();
var allActorTypes = Ioc.Default.GetRequiredService<GameData>().ActorTypes.OrderBy(type => type.Name).ToList();
allActorTypes.Insert(0, new EmptyActorType());
DataContext = new EditActorViewModel(messageActor, allActorTypes);
InitializeComponent();
}
Expand Down
2 changes: 1 addition & 1 deletion SOTFEdit/ViewModel/EditActorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public EditActorViewModel(Actor actor, List<ActorType> allActorTypes)
Actor = actor;
AllActorTypes = allActorTypes;
ActorSelection = AllActorSelections.FirstOrDefault()?.Value;
ModifyOptions.ReplaceType = Actor.ActorType;
ModifyOptions.ReplaceType = allActorTypes.First();
ModifyOptions.ActorEnergy = Actor.Stats?.GetValueOrDefault("Energy", 100f) ?? 100f;
ModifyOptions.UpdateEnergy = !Actor.Stats?.ContainsKey("Energy") ?? true;
ModifyOptions.ActorHealth = Actor.Stats?.GetValueOrDefault("Health", 100f) ?? 100f;
Expand Down
1 change: 1 addition & 0 deletions SOTFEdit/ViewModel/NpcsPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private void LoadNpcs(Savegame? savegame)

AllActors.Clear();
AllActors.AddRange(vailWorldSim["Actors"]?.ToObject<List<Actor>>() ?? Enumerable.Empty<Actor>().ToList());

foreach (var actor in AllActors)
{
if (actor is { GraphMask: { } graphMask, Position: { } position })
Expand Down

0 comments on commit 091a299

Please sign in to comment.