//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.GameLogic.PlugIns;
///
/// Configuration for the .
///
public class MonsterAttributeScalerConfiguration
{
private float _scaleAllPercentage;
private float _damagePercentage = 25.0f;
private float _attackRatePercentage = 25.0f;
private float _defenseRatePercentage = 25.0f;
private float _defensePercentage = 25.0f;
private float _healthPercentage = 25.0f;
///
/// Gets or sets the percentage applied to all stats at once.
/// When set above 0, cascades to all individual fields.
///
public float ScaleAllPercentage
{
get => this._scaleAllPercentage;
set
{
this._scaleAllPercentage = value;
if (value > 0)
{
this._damagePercentage = value;
this._attackRatePercentage = value;
this._defenseRatePercentage = value;
this._defensePercentage = value;
this._healthPercentage = value;
}
}
}
///
/// Gets or sets the percentage by which monster damage (MinPhysBaseDmg, MaxPhysBaseDmg) is increased.
///
public float DamagePercentage
{
get => this.ScaleAllActive ? this._scaleAllPercentage : this._damagePercentage;
set => this.SetIndividualField(ref this._damagePercentage, value);
}
///
/// Gets or sets the percentage by which the monster attack rate is increased.
///
public float AttackRatePercentage
{
get => this.ScaleAllActive ? this._scaleAllPercentage : this._attackRatePercentage;
set => this.SetIndividualField(ref this._attackRatePercentage, value);
}
///
/// Gets or sets the percentage by which monster defense rate is increased.
///
public float DefenseRatePercentage
{
get => this.ScaleAllActive ? this._scaleAllPercentage : this._defenseRatePercentage;
set => this.SetIndividualField(ref this._defenseRatePercentage, value);
}
///
/// Gets or sets the percentage by which monster defense is increased.
///
public float DefensePercentage
{
get => this.ScaleAllActive ? this._scaleAllPercentage : this._defensePercentage;
set => this.SetIndividualField(ref this._defensePercentage, value);
}
///
/// Gets or sets the percentage by which monster maximum health is increased.
///
public float HealthPercentage
{
get => this.ScaleAllActive ? this._scaleAllPercentage : this._healthPercentage;
set => this.SetIndividualField(ref this._healthPercentage, value);
}
private bool ScaleAllActive => this._scaleAllPercentage > 0;
private void SetIndividualField(ref float field, float value)
{
if (this.ScaleAllActive)
{
return;
}
field = value;
}
}