// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // 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; /// /// Initializer which initializes the wizardry enhance mastery effect. /// public class WizardryEnhanceMasteryEffectInitializer : InitializerBase { /// /// Initializes a new instance of the class. /// /// The context. /// The game configuration. public WizardryEnhanceMasteryEffectInitializer(IContext context, GameConfiguration gameConfiguration) : base(context, gameConfiguration) { } /// public override void Initialize() { var magicEffect = this.Context.CreateNew(); this.GameConfiguration.MagicEffects.Add(magicEffect); magicEffect.Number = (byte)MagicEffectNumber.WizEnhanceMastery; magicEffect.Name = "Wizardry Enhance Mastery Skill Effect"; var wizardryEnhanceEffect = this.GameConfiguration.MagicEffects.First(e => e.Number == (short)MagicEffectNumber.WizEnhanceStrengthener); magicEffect.InformObservers = wizardryEnhanceEffect.InformObservers; magicEffect.SubType = wizardryEnhanceEffect.SubType; magicEffect.SendDuration = wizardryEnhanceEffect.SendDuration; magicEffect.StopByDeath = wizardryEnhanceEffect.StopByDeath; magicEffect.Duration = this.Context.CreateNew(); magicEffect.Duration.ConstantValue.Value = wizardryEnhanceEffect.Duration!.ConstantValue.Value; magicEffect.Duration.MaximumValue = wizardryEnhanceEffect.Duration.MaximumValue; foreach (var powerUp in wizardryEnhanceEffect.PowerUpDefinitions) { var powerUpCopy = this.Context.CreateNew(); magicEffect.PowerUpDefinitions.Add(powerUpCopy); powerUpCopy.TargetAttribute = powerUp.TargetAttribute!.GetPersistent(this.GameConfiguration); powerUpCopy.Boost = this.Context.CreateNew(); powerUpCopy.Boost.ConstantValue.Value = powerUp.Boost!.ConstantValue.Value; powerUpCopy.Boost.ConstantValue.AggregateType = powerUp.Boost.ConstantValue.AggregateType; powerUpCopy.Boost.MaximumValue = powerUp.Boost.MaximumValue; foreach (var boostRelatedValue in powerUp.Boost.RelatedValues) { var boostRelatedValueCopy = this.Context.CreateNew(); boostRelatedValueCopy.InputAttribute = boostRelatedValue.InputAttribute!.GetPersistent(this.GameConfiguration); boostRelatedValueCopy.InputOperator = boostRelatedValue.InputOperator; boostRelatedValueCopy.InputOperand = boostRelatedValue.InputOperand; boostRelatedValueCopy.AggregateType = boostRelatedValue.AggregateType; powerUpCopy.Boost.RelatedValues.Add(boostRelatedValueCopy); } } var critChancePowerUp = this.Context.CreateNew(); magicEffect.PowerUpDefinitions.Add(critChancePowerUp); critChancePowerUp.TargetAttribute = Stats.CriticalDamageChance.GetPersistent(this.GameConfiguration); critChancePowerUp.Boost = this.Context.CreateNew(); } }