-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #471 from bernatvadell/feat/skill-drain-life
- Loading branch information
Showing
13 changed files
with
118 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/GameLogic/PlayerActions/Skills/DrainLifeSkillPlugIn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// <copyright file="DrainLifeSkillPlugIn.cs" company="MUnique"> | ||
// Licensed under the MIT License. See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
|
||
namespace MUnique.OpenMU.GameLogic.PlayerActions.Skills; | ||
|
||
using System.Runtime.InteropServices; | ||
using MUnique.OpenMU.GameLogic.Attributes; | ||
using MUnique.OpenMU.GameLogic.PlugIns; | ||
using MUnique.OpenMU.GameLogic.Views.Character; | ||
using MUnique.OpenMU.Pathfinding; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// Handles the drain life skill of the summoner class. Additionally to the attacked target, it regains life for damage dealt. | ||
/// </summary> | ||
[PlugIn(nameof(ChainLightningSkillPlugIn), "Handles the drain life skill of the summoner class. Additionally to the attacked target, it regains life for damage dealt.")] | ||
[Guid("9A5A5671-3A8C-4C01-984F-1A8F8E0E7BDA")] | ||
public class DrainLifeSkillPlugIn : IAreaSkillPlugIn | ||
{ | ||
/// <inheritdoc/> | ||
public short Key => 214; | ||
|
||
/// <inheritdoc/> | ||
public async ValueTask AfterTargetGotAttackedAsync(IAttacker attacker, IAttackable target, SkillEntry skillEntry, Point targetAreaCenter, HitInfo? hitInfo) | ||
{ | ||
if (attacker is Player attackerPlayer && hitInfo != null && hitInfo.Value.HealthDamage > 0) | ||
{ | ||
var playerAttributes = attackerPlayer.Attributes; | ||
|
||
if (playerAttributes != null) | ||
{ | ||
playerAttributes[Stats.CurrentHealth] = (uint)Math.Min(playerAttributes[Stats.MaximumHealth], playerAttributes[Stats.CurrentHealth] + hitInfo.Value.HealthDamage); | ||
await attackerPlayer.InvokeViewPlugInAsync<IUpdateCurrentHealthPlugIn>(p => p.UpdateCurrentHealthAsync()).ConfigureAwait(false); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/Persistence/Initialization/Updates/FixDrainLifeSkillUpdate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// <copyright file="FixDrainLifeSkillUpdate.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.DataModel.Configuration; | ||
using MUnique.OpenMU.DataModel.Configuration.Items; | ||
using MUnique.OpenMU.GameLogic; | ||
using MUnique.OpenMU.Persistence.Initialization.Skills; | ||
using MUnique.OpenMU.PlugIns; | ||
|
||
/// <summary> | ||
/// This adds the items required to enter the kalima map. | ||
/// </summary> | ||
[PlugIn(PlugInName, PlugInDescription)] | ||
[Guid("A8827A3C-7F52-47CF-9EA5-562A9C06B986")] | ||
public class FixDrainLifeSkillUpdate : UpdatePlugInBase | ||
{ | ||
/// <summary> | ||
/// The plug in name. | ||
/// </summary> | ||
internal const string PlugInName = "Fix Drain Life Skill"; | ||
|
||
/// <summary> | ||
/// The plug in description. | ||
/// </summary> | ||
internal const string PlugInDescription = "Updates the attributes of the summoner's Drain Life skill to make it work properly."; | ||
|
||
/// <inheritdoc /> | ||
public override UpdateVersion Version => UpdateVersion.FixDrainLifeSkill; | ||
|
||
/// <inheritdoc /> | ||
public override string DataInitializationKey => VersionSeasonSix.DataInitialization.Id; | ||
|
||
/// <inheritdoc /> | ||
public override string Name => PlugInName; | ||
|
||
/// <inheritdoc /> | ||
public override string Description => PlugInDescription; | ||
|
||
/// <inheritdoc /> | ||
public override bool IsMandatory => false; | ||
|
||
/// <inheritdoc /> | ||
public override DateTime CreatedAt => new(2024, 08, 29, 18, 0, 0, DateTimeKind.Utc); | ||
|
||
/// <inheritdoc /> | ||
protected override async ValueTask ApplyAsync(IContext context, GameConfiguration gameConfiguration) | ||
{ | ||
var drainLife = gameConfiguration.Skills.First(x => x.Number == (short)SkillNumber.DrainLife); | ||
drainLife.SkillType = SkillType.AreaSkillExplicitTarget; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters