Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions src/GameLogic/Attributes/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1472,24 +1472,31 @@ public class Stats
public static AttributeDefinition MaximumAllianceSize { get; } = new(new Guid("B3C7E9D2-5A1F-4E8B-92C7-6D3F8A4B7E5C"), "Maximum Alliance Size", string.Empty);

/// <summary>
/// Gets the fully recover mana after hit chance definition.
/// Gets the fully recover mana after hit (received) chance definition.
/// </summary>
public static AttributeDefinition FullyRecoverManaAfterHitChance { get; } = new(new Guid("EB06D3A2-DA82-4B81-81B9-A16D39974531"), "Chance to fully recover mana when getting hit", "3rd Wing Option");

/// <summary>
/// Gets the fully recover health after hit chance definition.
/// Gets the fully recover health after hit (received) chance definition.
/// </summary>
public static AttributeDefinition FullyRecoverHealthAfterHitChance { get; } = new(new Guid("3CA72C07-9C2C-4FC5-8BCB-9BD737F83664"), "Chance to fully recover health when getting hit", "3rd Wing Option");

/// <summary>
/// Gets the fully reflect damage after hit chance definition.
/// Gets the fully reflect damage after hit (received) chance definition.
/// </summary>
public static AttributeDefinition FullyReflectDamageAfterHitChance { get; } = new(new Guid("1F7C1E04-4FBD-4FCB-A6C2-EB51A91D8C3E"), "Chance to fully reflect damage when getting hit", "3rd Wing Option");

/// <summary>
/// Gets the health loss after hit definition.
/// Gets the health loss after hit (received) definition.
/// </summary>
public static AttributeDefinition HealthLossAfterHit { get; } = new(new Guid("D84A719B-D18E-433E-BF55-9F08A214AB00"), "Health loss after hitting a target", "Caused by wearing wings");
/// <remarks>A health toll apart from received damage (e.g., by equipping a dark horse).</remarks>
public static AttributeDefinition HealthLossAfterHit { get; } = new(new Guid("E6EB76C4-4464-42E7-9BEB-6E192D0F15EE"), "Health loss after getting hit", "Caused by equipping a dark horse");

/// <summary>
/// Gets the health loss after dealt hit definition.
/// </summary>
/// <remarks>Wings, imp, dinorant impose a health toll to their user.</remarks>
public static AttributeDefinition HealthLossAfterDealtHit { get; } = new(new Guid("D84A719B-D18E-433E-BF55-9F08A214AB00"), "Health loss after hitting a target", "Caused by wearing wings, imp, dinorant");

/// <summary>
/// Gets the skill extra mana cost definition.
Expand All @@ -1499,7 +1506,12 @@ public class Stats
/// <summary>
/// Gets the CanFly attribute for warping to icarus.
/// </summary>
public static AttributeDefinition CanFly { get; } = new(new Guid("EC34C673-84DE-4811-8962-CD2164A2248C"), "Requirement of the Icarus map.", "You can enter Icarus only with wings, dinorant, fenrir.");
public static AttributeDefinition CanFly { get; } = new(new Guid("EC34C673-84DE-4811-8962-CD2164A2248C"), "Requirement of the Icarus map.", "You can enter Icarus only with wings, dinorant, horse, fenrir.");

/// <summary>
/// Gets the is wing equipped attribute.
/// </summary>
public static AttributeDefinition IsWingEquipped { get; } = new(new Guid("7C4A2E91-D58B-4F3A-8B6D-9E1C5F2A7B40"), "Is Wing Equipped", string.Empty);

/// <summary>
/// Gets the hit shock chance attribute definition.
Expand Down Expand Up @@ -1535,6 +1547,17 @@ public class Stats
/// </summary>
public static AttributeDefinition IsDinorantEquipped { get; } = new(new Guid("C52B5CA4-34BA-4E31-963B-E37089671C37"), "Is Dinorant Equipped", string.Empty);

/// <summary>
/// Gets the target has dinorant health toll.
/// </summary>
/// <remarks>The health loss caused by attacking a player wearing a dinorant.</remarks>
public static AttributeDefinition TargetHasDinorantHealthToll { get; } = new(new Guid("E937BDF8-3DDB-40AF-BA0C-E18E7C69B7E9"), "Target Has Dinorant Health Toll", "The health loss caused by attacking a player wearing a dinorant");

/// <summary>
/// Gets the is imp equipped attribute definition.
/// </summary>
public static AttributeDefinition IsImpEquipped { get; } = new(new Guid("947DED52-3141-45AA-8D6E-F4C549ED5B36"), "Is Imp Equipped", string.Empty);

/// <summary>
/// Gets the is pet skeleton equipped attribute definition.
/// </summary>
Expand Down Expand Up @@ -1716,6 +1739,11 @@ public class Stats
MaximumValue = 1,
};

/// <summary>
/// Gets the skill health loss after dealt hit definition.
/// </summary>
public static AttributeDefinition SkillHealthLossAfterDealtHit { get; } = new(new Guid("BF8D6F29-7083-490F-978B-CCEBEEF139A1"), "Skill health loss after hitting a target", string.Empty);

/// <summary>
/// Gets the dictionary which relates the jewelry element resistance attribute to the correspondent DMG bonus attribute.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion src/GameLogic/NPC/AttackableNpcBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public int Health
public async ValueTask<HitInfo?> AttackByAsync(IAttacker attacker, SkillEntry? skill, bool isCombo, double damageFactor = 1.0, bool? isFinalStreakHit = null)
{
if (this.Definition.ObjectKind == NpcObjectKind.Guard
|| !this.IsAlive
|| this.IsAttackBlockedBySafezone(attacker)
|| !this.CanBeAttackedBy(attacker))
{
Expand Down Expand Up @@ -145,7 +146,7 @@ public int Health

if (attacker is Player player)
{
await player.AfterHitTargetAsync(this.Attributes[Stats.DefensePvm], skill?.Skill?.DamageType).ConfigureAwait(false);
await player.AfterHitTargetAsync(this.Attributes[Stats.DefensePvm], skill).ConfigureAwait(false);

if (this.IsAlive && Rand.NextRandomBool(player.Attributes![Stats.MaceMasteryStunChance]))
{
Expand Down
31 changes: 25 additions & 6 deletions src/GameLogic/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -862,6 +863,7 @@ public async ValueTask KillInstantlyAsync()
await this.MagicEffectList.ClearAllEffectsProducingSpecificStatAsync(Stats.IsAsleep).ConfigureAwait(false);
}

this.Attributes[Stats.CurrentHealth] -= this.Attributes[Stats.HealthLossAfterHit];

Copy link
Copy Markdown
Contributor Author

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

if (Rand.NextRandomBool(this.Attributes[Stats.FullyRecoverHealthAfterHitChance]))
{
this.Attributes[Stats.CurrentHealth] = this.Attributes[Stats.MaximumHealth];
Expand All @@ -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]))
{
Expand All @@ -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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ private void AddCommonAttributeRelationships(ICollection<AttributeRelationship>
attributeRelationships.Add(this.CreateAttributeRelationship(Stats.ManaRecoveryMultiplier, 0.03f, Stats.IsResting));
attributeRelationships.Add(this.CreateAttributeRelationship(Stats.AbilityRecoveryAbsolute, 3, Stats.IsInSafezone));

attributeRelationships.Add(this.CreateAttributeRelationship(Stats.CanFly, 1, Stats.IsWingEquipped));

if (this.UseClassicPvp)
{
attributeRelationships.Add(this.CreateAttributeRelationship(Stats.DefenseRatePvp, 1, Stats.DefenseRatePvm));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!this.UseClassicPvp)
{
result.StatAttributes.Add(this.CreateStatAttributeDefinition(Stats.CurrentShield, 1, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ private CharacterClass CreateDarkLord(CharacterClassNumber number, LocalizedStri
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 3, Stats.TotalEnergy));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 3, Stats.TotalLeadership));

result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.HealthLossAfterDealtHit, 3, Stats.IsWingEquipped));

result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.RavenMinimumDamage, 1.0f / 8, Stats.TotalLeadership));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.RavenMinimumDamage, 15, Stats.RavenLevel));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.RavenMaximumDamage, 1.0f / 4, Stats.TotalLeadership));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ protected CharacterClass CreateDarkWizard(CharacterClassNumber number, Localized
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 7, Stats.TotalVitality));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 3, Stats.TotalEnergy));

result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.HealthLossAfterDealtHit, 1, Stats.IsWingEquipped));

if (!this.UseClassicPvp)
{
result.StatAttributes.Add(this.CreateStatAttributeDefinition(Stats.CurrentShield, 1, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ protected CharacterClass CreateFairyElf(CharacterClassNumber number, LocalizedSt
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 7, Stats.TotalVitality));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 5, Stats.TotalEnergy));

result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.HealthLossAfterDealtHit, 1, Stats.IsWingEquipped));

if (!this.UseClassicPvp)
{
result.StatAttributes.Add(this.CreateStatAttributeDefinition(Stats.CurrentShield, 1, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ protected CharacterClass CreateMagicGladiator(CharacterClassNumber number, Local
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));

if (!this.UseClassicPvp)
{
result.StatAttributes.Add(this.CreateStatAttributeDefinition(Stats.CurrentShield, 1, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ private CharacterClass CreateRageFighter(CharacterClassNumber number, LocalizedS
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 3, Stats.TotalVitality));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 7, Stats.TotalEnergy));

result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.HealthLossAfterDealtHit, 3, Stats.IsWingEquipped));

result.BaseAttributeValues.Add(this.CreateConstValueAttribute(57, Stats.MaximumHealth));
result.BaseAttributeValues.Add(this.CreateConstValueAttribute(7, Stats.MaximumMana));
result.BaseAttributeValues.Add(this.CreateConstValueAttribute(0.5f, Stats.SkillMultiplier));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ private CharacterClass CreateSummoner(CharacterClassNumber number, LocalizedStri
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 7, Stats.TotalVitality));
result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.FenrirBaseDmg, 1.0f / 3, Stats.TotalEnergy));

result.AttributeCombinations.Add(this.CreateAttributeRelationship(Stats.HealthLossAfterDealtHit, 1, Stats.IsWingEquipped));

result.BaseAttributeValues.Add(this.CreateConstValueAttribute(39, Stats.MaximumHealth));
result.BaseAttributeValues.Add(this.CreateConstValueAttribute(6, Stats.MaximumMana));
result.BaseAttributeValues.Add(this.CreateConstValueAttribute(1, Stats.SkillMultiplier));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Up @@ -942,6 +942,12 @@
<data name="AddHitShockSettingsPlugIn_Description" xml:space="preserve">
<value>Fügt die globalen Einstellungen für Treffer-Schock-Chance und Schadensschwelle sowie die Uniria-Kennzeichnung hinzu, damit Spieler mit ausgerüsteter Uniria keinen Treffer-Schock erleiden.</value>
</data>
<data name="UpdateWingAndPetHitTollsPlugIn_Name" xml:space="preserve">
<value>Flügel- und Begleiter-Zoll aktualisieren</value>
</data>
<data name="UpdateWingAndPetHitTollsPlugIn_Description" xml:space="preserve">
<value>Aktualisiert Flugattribute für Flügel, Trefferabzüge für Begleiter und fertigkeitsabhängige Trefferabzüge für Season Six.</value>
</data>
<data name="AddSealItemDropRateUpdatePlugIn_Name" xml:space="preserve">
<value>Item-Droprate der Siegel hinzufügen</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@
<data name="AddSantaVillageInvitationUpdatePlugIn_Description" xml:space="preserve"><value>This update adds the invitation to the santa village, which warps the player to the santa village, and a spawn gate to the santa village.</value></data>
<data name="AddHitShockSettingsPlugIn_Name" xml:space="preserve"><value>Add hit-shock settings</value></data>
<data name="AddHitShockSettingsPlugIn_Description" xml:space="preserve"><value>Adds the global hit-shock chance and damage threshold settings, and the Uniria marker so Uniria-equipped players are excluded from hit shock.</value></data>
<data name="UpdateWingAndPetHitTollsPlugIn_Name" xml:space="preserve"><value>Update wing and pet hit tolls</value></data>
<data name="UpdateWingAndPetHitTollsPlugIn_Description" xml:space="preserve"><value>Updates wing flight attributes, pet hit tolls, and skill-specific hit tolls for Season Six.</value></data>
<data name="FixKanturuRuins3LandingUpdatePlugIn_Name" xml:space="preserve"><value>Fix Kanturu Ruins 3 landing area</value></data>
<data name="FixKanturuRuins3LandingUpdatePlugIn_Description" xml:space="preserve"><value>Narrows the original Kanturu Ruins 3 warp landing area to walkable terrain. Customized destinations and unrelated settings are kept.</value></data>
<data name="AddSealItemDropRateUpdatePlugIn_Name" xml:space="preserve"><value>Add the item drop rate of seals</value></data>
Expand Down
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;
}
Loading