-
Notifications
You must be signed in to change notification settings - Fork 367
Implement damage reflection skill #479
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 3 commits
729b7e4
c652cf3
18cdaca
c52d326
b56df53
d613980
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// <copyright file="ReflectionEffectInitializer.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.Skills; | ||
|
||
using MUnique.OpenMU.AttributeSystem; | ||
using MUnique.OpenMU.DataModel.Attributes; | ||
using MUnique.OpenMU.DataModel.Configuration; | ||
using MUnique.OpenMU.GameLogic.Attributes; | ||
|
||
/// <summary> | ||
/// Initializer for the reflection buff effect. | ||
/// </summary> | ||
public class ReflectionEffectInitializer : InitializerBase | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ReflectionEffectInitializer"/> class. | ||
/// </summary> | ||
/// <param name="context">The context.</param> | ||
/// <param name="gameConfiguration">The game configuration.</param> | ||
public ReflectionEffectInitializer(IContext context, GameConfiguration gameConfiguration) | ||
: base(context, gameConfiguration) | ||
{ | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
var magicEffect = this.Context.CreateNew<MagicEffectDefinition>(); | ||
this.GameConfiguration.MagicEffects.Add(magicEffect); | ||
magicEffect.Number = (byte)MagicEffectNumber.Reflection; | ||
magicEffect.Name = "Reflection"; | ||
magicEffect.InformObservers = true; | ||
magicEffect.SendDuration = false; | ||
magicEffect.StopByDeath = true; | ||
var powerUpDefinition = this.Context.CreateNew<PowerUpDefinition>(); | ||
magicEffect.PowerUpDefinitions.Add(powerUpDefinition); | ||
powerUpDefinition.TargetAttribute = Stats.DamageReflection.GetPersistent(this.GameConfiguration); | ||
magicEffect.Duration = this.Context.CreateNew<PowerUpDefinitionValue>(); | ||
magicEffect.Duration.ConstantValue.Value = 60; | ||
var durationPerEnergy = this.Context.CreateNew<AttributeRelationship>(); | ||
durationPerEnergy.InputAttribute = Stats.TotalEnergy.GetPersistent(this.GameConfiguration); | ||
durationPerEnergy.InputOperator = InputOperator.Multiply; | ||
durationPerEnergy.InputOperand = 1f / 5f; // 5 energy adds 1 second duration | ||
magicEffect.Duration.RelatedValues.Add(durationPerEnergy); | ||
|
||
// one percent per 42 energy | ||
var boostPerEnergy = this.Context.CreateNew<AttributeRelationship>(); | ||
boostPerEnergy.InputAttribute = Stats.TotalEnergy.GetPersistent(this.GameConfiguration); | ||
boostPerEnergy.InputOperator = InputOperator.ExponentiateByAttribute; | ||
boostPerEnergy.InputOperand = 1 - (0.01f / 42f); | ||
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. InputOperand = 0.01f / 40f 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. Considering that it's 1% for every 42 energy points, is there a reason why it has to be divided by 40? 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. Oh okay, I found this one: https://guidescroll.com/2011/08/mu-online-summoner-guide/ 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. I found this in the published sources: |
||
|
||
// Reflection % = 30 + (Energi / 42) | ||
powerUpDefinition.Boost = this.Context.CreateNew<PowerUpDefinitionValue>(); | ||
powerUpDefinition.Boost.ConstantValue.Value = 0.29f; | ||
powerUpDefinition.Boost.ConstantValue.AggregateType = AggregateType.Multiplicate; | ||
bernatvadell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
powerUpDefinition.Boost.RelatedValues.Add(boostPerEnergy); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.