Repository navigation
feat(damage): Health hit tolls #1616
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: master
Are you sure you want to change the base?
Changes from all commits
d35a639
d15f879
b0252c0
4b74dd8
d25c0ce
d28af7e
55344db
ba355fd
86e00f7
a2b2e34
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 |
|---|---|---|
|
|
@@ -816,7 +816,8 @@ public async ValueTask KillInstantlyAsync() | |
| throw new InvalidOperationException("AttributeSystem not set."); | ||
| } | ||
|
|
||
| if (this.IsAttackBlockedBySafezone(attacker) | ||
| if (!this.IsAlive | ||
| || this.IsAttackBlockedBySafezone(attacker) | ||
| || this.IsAttackPreventedByPlugIns(attacker)) | ||
| { | ||
| return null; | ||
|
|
@@ -862,6 +863,7 @@ public async ValueTask KillInstantlyAsync() | |
| await this.MagicEffectList.ClearAllEffectsProducingSpecificStatAsync(Stats.IsAsleep).ConfigureAwait(false); | ||
| } | ||
|
|
||
| this.Attributes[Stats.CurrentHealth] -= this.Attributes[Stats.HealthLossAfterHit]; | ||
| if (Rand.NextRandomBool(this.Attributes[Stats.FullyRecoverHealthAfterHitChance])) | ||
| { | ||
| this.Attributes[Stats.CurrentHealth] = this.Attributes[Stats.MaximumHealth]; | ||
|
|
@@ -886,7 +888,7 @@ public async ValueTask KillInstantlyAsync() | |
|
|
||
| if (attacker is Player attackerPlayer) | ||
| { | ||
| await attackerPlayer.AfterHitTargetAsync(this.Attributes[Stats.DefenseFinal], skill?.Skill?.DamageType).ConfigureAwait(false); | ||
| await attackerPlayer.AfterHitTargetAsync(this.Attributes[Stats.DefenseFinal], skill, this).ConfigureAwait(false); | ||
|
|
||
| if (this.IsAlive && Rand.NextRandomBool(attackerPlayer.Attributes![Stats.MaceMasteryStunChance])) | ||
| { | ||
|
|
@@ -901,12 +903,29 @@ public async ValueTask KillInstantlyAsync() | |
| /// Is called after the player successfully hit a target. | ||
| /// </summary> | ||
| /// <param name="targetDefense">The target's defense.</param> | ||
| /// <param name="damageType">The damage type.</param> | ||
| public async ValueTask AfterHitTargetAsync(float targetDefense, DamageType? damageType) | ||
| /// <param name="skill">The attacking skill.</param> | ||
| /// <param name="target">The target player.</param> | ||
| public async ValueTask AfterHitTargetAsync(float targetDefense, SkillEntry? skill, Player? target = null) | ||
| { | ||
| this.Attributes![Stats.CurrentHealth] = Math.Max(this.Attributes[Stats.CurrentHealth] - this.Attributes[Stats.HealthLossAfterHit], 1); | ||
| var healthLossAfterDealtHit = this.Attributes![Stats.HealthLossAfterDealtHit]; | ||
| if (skill?.EnsureSkillAttributes(this.Attributes) is { } skillAttributes && skillAttributes[Stats.SkillHealthLossAfterDealtHit] > 0) | ||
| { | ||
| healthLossAfterDealtHit = skillAttributes[Stats.SkillHealthLossAfterDealtHit]; | ||
| } | ||
|
|
||
| if (target?.Attributes?[Stats.IsDinorantEquipped] > 0) | ||
| { | ||
| healthLossAfterDealtHit += this.Attributes[Stats.TargetHasDinorantHealthToll]; | ||
| } | ||
|
Comment on lines
+916
to
+919
Contributor
Author
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.Attributes[Stats.CurrentHealth] -= healthLossAfterDealtHit; | ||
| if (this.Attributes[Stats.CurrentHealth] < 1) | ||
| { | ||
| this.LastDeath = new DeathInformation(0, string.Empty, default, 0); | ||
| await this.OnDeathAsync(null).ConfigureAwait(false); | ||
| } | ||
|
|
||
| await this.DecreaseWeaponDurabilityAfterHitAsync(targetDefense, damageType ?? DamageType.Physical).ConfigureAwait(false); | ||
| await this.DecreaseWeaponDurabilityAfterHitAsync(targetDefense, skill?.Skill?.DamageType ?? DamageType.Physical).ConfigureAwait(false); | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,8 @@ protected CharacterClass CreateDarkKnight(CharacterClassNumber number, Localized | |
| result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 5, Stats.TotalVitality)); | ||
| result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 7, Stats.TotalEnergy)); | ||
|
|
||
| result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.HealthLossAfterDealtHit, 3, Stats.IsWingEquipped)); | ||
|
|
||
|
Contributor
Author
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. |
||
| if (!this.UseClassicPvp) | ||
| { | ||
| result.StatAttributes.Add(this.CreateStatAttributeDefinition(Stats.CurrentShield, 1, false)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -319,5 +319,8 @@ private void AddGlobalBaseAttributeValues() | |
|
|
||
| var hitShockDamageThreshold = this.Context.CreateNew<ConstValueAttribute>(5f, Stats.HitShockDamageThreshold.GetPersistent(this.GameConfiguration), AggregateType.AddRaw); | ||
| this.GameConfiguration.GlobalBaseAttributeValues.Add(hitShockDamageThreshold); | ||
|
|
||
| var targetHasDinorantHealthToll = this.Context.CreateNew<ConstValueAttribute>(1f, Stats.TargetHasDinorantHealthToll.GetPersistent(this.GameConfiguration), AggregateType.AddRaw); | ||
| this.GameConfiguration.GlobalBaseAttributeValues.Add(targetHasDinorantHealthToll); | ||
|
Contributor
Author
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. |
||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // <copyright file="UpdateWingAndPetHitTollsPlugIn075.cs" company="MUnique"> | ||
| // Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
| // </copyright> | ||
|
|
||
| namespace MUnique.OpenMU.Persistence.Initialization.Updates; | ||
|
|
||
| using System.Runtime.InteropServices; | ||
| using MUnique.OpenMU.Persistence.Initialization.Properties; | ||
| using MUnique.OpenMU.PlugIns; | ||
|
|
||
| /// <summary> | ||
| /// Updates wing and pet hit toll configuration for version 0.75. | ||
| /// </summary> | ||
| [PlugIn] | ||
| [Display(Name = nameof(PlugInResources.UpdateWingAndPetHitTollsPlugIn_Name), Description = nameof(PlugInResources.UpdateWingAndPetHitTollsPlugIn_Description), ResourceType = typeof(PlugInResources))] | ||
| [Guid("6C3AA59D-83A9-45E7-A07F-B5CC77D7F528")] | ||
| public class UpdateWingAndPetHitTollsPlugIn075 : UpdateWingAndPetHitTollsPlugInBase | ||
| { | ||
| /// <inheritdoc /> | ||
| public override string DataInitializationKey => Version075.DataInitialization.Id; | ||
| } |
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.
For equipped dark horse: zTeamS6.3, emu