-
Notifications
You must be signed in to change notification settings - Fork 19
Spawn, merchant, and formula tweaks #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
0e029e6
fe76a0d
9343282
7cfab76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,4 +117,14 @@ public void NoDuplicateTargets() | |
| var targets2 = Fixture.TestUser.GetTargets(castable, bait2); | ||
| Assert.Single(targets2); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ConeRadiusNotCappedByViewport() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test needs to test the actual expected behavior versus checking for what is effectively a regression, and also doing it in a way that is fragile? |
||
| { | ||
| var source = System.IO.File.ReadAllText( | ||
| System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, | ||
| "..", "..", "..", "..", "hybrasyl", "Objects", "Creature.cs")); | ||
|
|
||
| Assert.DoesNotContain("Math.Min(tile.Radius, Game.ActiveConfiguration.Constants.ViewportSize / 2)", source); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,24 +200,24 @@ public Creature GetDirectionalTarget(Direction direction) | |
|
|
||
| switch (direction) | ||
| { | ||
| case Direction.East: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X + 1 && x.Y == Y && x is Creature); | ||
| case Direction.East: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this just tab / spacing changes? |
||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X + 1 && x.Y == Y && x is Creature); | ||
| } | ||
| break; | ||
| case Direction.West: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X - 1 && x.Y == Y && x is Creature); | ||
| case Direction.West: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X - 1 && x.Y == Y && x is Creature); | ||
| } | ||
| break; | ||
| case Direction.North: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X && x.Y == Y - 1 && x is Creature); | ||
| case Direction.North: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X && x.Y == Y - 1 && x is Creature); | ||
| } | ||
| break; | ||
| case Direction.South: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X && x.Y == Y + 1 && x is Creature); | ||
| case Direction.South: | ||
| { | ||
| obj = Map.EntityTree.FirstOrDefault(predicate: x => x.X == X && x.Y == Y + 1 && x is Creature); | ||
| } | ||
| break; | ||
| default: | ||
|
|
@@ -241,24 +241,24 @@ public List<Creature> GetDirectionalTargets(Direction direction, int radius = 1) | |
|
|
||
| switch (direction) | ||
| { | ||
| case Direction.East: | ||
| { | ||
| rect = new Rectangle(X + 1, Y, radius, 1); | ||
| case Direction.East: | ||
| { | ||
| rect = new Rectangle(X + 1, Y, radius, 1); | ||
| } | ||
| break; | ||
| case Direction.West: | ||
| { | ||
| rect = new Rectangle(X - radius, Y, radius, 1); | ||
| case Direction.West: | ||
| { | ||
| rect = new Rectangle(X - radius, Y, radius, 1); | ||
| } | ||
| break; | ||
| case Direction.South: | ||
| { | ||
| rect = new Rectangle(X, Y + 1, 1, radius); | ||
| case Direction.South: | ||
| { | ||
| rect = new Rectangle(X, Y + 1, 1, radius); | ||
| } | ||
| break; | ||
| case Direction.North: | ||
| { | ||
| rect = new Rectangle(X, Y - radius, 1, radius); | ||
| case Direction.North: | ||
| { | ||
| rect = new Rectangle(X, Y - radius, 1, radius); | ||
| } | ||
| break; | ||
| } | ||
|
|
@@ -400,7 +400,7 @@ public virtual List<Creature> GetTargets(Castable castable, Creature target = nu | |
|
|
||
| foreach (var tile in intent.Cone) | ||
| { | ||
| var radius = Math.Min(tile.Radius, Game.ActiveConfiguration.Constants.ViewportSize / 2); | ||
| var radius = tile.Radius; | ||
| if (radius == 0) | ||
| continue; | ||
| var coneDirection = tile.Direction.Resolve(Direction); | ||
|
|
@@ -434,50 +434,50 @@ public virtual List<Creature> GetTargets(Castable castable, Creature target = nu | |
| switch (this) | ||
| { | ||
| // No hostile flag: remove players | ||
| case Monster when Condition.Charmed: | ||
| { | ||
| if (intent.Flags.Contains(IntentFlags.Hostile)) | ||
| finalTargets.AddRange(actualTargets.OfType<Monster>()); | ||
| // No friendly flag, or not charmed - remove monsters | ||
| if (intent.Flags.Contains(IntentFlags.Friendly)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>()); | ||
| break; | ||
| case Monster when Condition.Charmed: | ||
| { | ||
| if (intent.Flags.Contains(IntentFlags.Hostile)) | ||
| finalTargets.AddRange(actualTargets.OfType<Monster>()); | ||
|
|
||
| // No friendly flag, or not charmed - remove monsters | ||
| if (intent.Flags.Contains(IntentFlags.Friendly)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>()); | ||
| break; | ||
| } | ||
| // Group / pvp: n/a | ||
| case Monster: | ||
| { | ||
| if (intent.Flags.Contains(IntentFlags.Hostile)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>()); | ||
| // No friendly flag, or not charmed - remove monsters | ||
| if (intent.Flags.Contains(IntentFlags.Friendly)) | ||
| finalTargets.AddRange(actualTargets.OfType<Monster>()); | ||
| break; | ||
| case Monster: | ||
| { | ||
| if (intent.Flags.Contains(IntentFlags.Hostile)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>()); | ||
|
|
||
| // No friendly flag, or not charmed - remove monsters | ||
| if (intent.Flags.Contains(IntentFlags.Friendly)) | ||
| finalTargets.AddRange(actualTargets.OfType<Monster>()); | ||
| break; | ||
| } | ||
| case User userobj: | ||
| { | ||
| // No PVP flag: remove PVP flagged players | ||
| // No hostile flag: remove monsters | ||
| // No friendly flag: remove non-PVP flagged players | ||
| // No group flag: remove group members | ||
| if (intent.Flags.Contains(IntentFlags.Hostile)) | ||
| finalTargets.AddRange(actualTargets.OfType<Monster>()); | ||
| if (intent.Flags.Contains(IntentFlags.Friendly)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>() | ||
| .Where(predicate: e => e.Condition.PvpEnabled == false && e.Id != Id)); | ||
| if (intent.Flags.Contains(IntentFlags.Pvp)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>() | ||
| .Where(predicate: e => e.Condition.PvpEnabled && e.Id != Id)); | ||
| if (intent.Flags.Contains(IntentFlags.Group)) | ||
| // Remove group members | ||
| if (userobj.Group != null) | ||
| finalTargets.AddRange(actualTargets.OfType<User>() | ||
| .Where(predicate: e => userobj.Group.Contains(e))); | ||
| break; | ||
| case User userobj: | ||
| { | ||
| // No PVP flag: remove PVP flagged players | ||
| // No hostile flag: remove monsters | ||
| // No friendly flag: remove non-PVP flagged players | ||
| // No group flag: remove group members | ||
| if (intent.Flags.Contains(IntentFlags.Hostile)) | ||
| finalTargets.AddRange(actualTargets.OfType<Monster>()); | ||
|
|
||
| if (intent.Flags.Contains(IntentFlags.Friendly)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>() | ||
| .Where(predicate: e => e.Condition.PvpEnabled == false && e.Id != Id)); | ||
|
|
||
| if (intent.Flags.Contains(IntentFlags.Pvp)) | ||
| finalTargets.AddRange(actualTargets.OfType<User>() | ||
| .Where(predicate: e => e.Condition.PvpEnabled && e.Id != Id)); | ||
|
|
||
| if (intent.Flags.Contains(IntentFlags.Group)) | ||
| // Remove group members | ||
| if (userobj.Group != null) | ||
| finalTargets.AddRange(actualTargets.OfType<User>() | ||
| .Where(predicate: e => userobj.Group.Contains(e))); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -523,13 +523,13 @@ public virtual bool UseCastable(Castable castableXml, Creature target = null) | |
| if (castableXml.Effects?.Animations?.OnCast != null) | ||
| { | ||
| if (castableXml.Effects?.Animations?.OnCast.Target != null) | ||
| foreach (var tar in targets) | ||
| foreach (var user in tar.viewportUsers.ToList()) | ||
| { | ||
| GameLog.UserActivityInfo( | ||
| $"UseCastable: Sending {user.Name} effect for {Name}: {castableXml.Effects.Animations.OnCast.Target.Id}"); | ||
| user.SendEffect(tar.Id, castableXml.Effects.Animations.OnCast.Target.Id, | ||
| castableXml.Effects.Animations.OnCast.Target.Speed); | ||
| foreach (var tar in targets) | ||
| foreach (var user in tar.viewportUsers.ToList()) | ||
| { | ||
| GameLog.UserActivityInfo( | ||
| $"UseCastable: Sending {user.Name} effect for {Name}: {castableXml.Effects.Animations.OnCast.Target.Id}"); | ||
| user.SendEffect(tar.Id, castableXml.Effects.Animations.OnCast.Target.Id, | ||
| castableXml.Effects.Animations.OnCast.Target.Speed); | ||
| } | ||
|
|
||
| if (castableXml.Effects?.Animations?.OnCast?.SpellEffect != null) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this test? Either something has an attribute or it doesn't - removing an attribute isn't very likely. Is this just to ensure there aren't any unnoticeable scripting changes?