115 lines
3.1 KiB
C#
115 lines
3.1 KiB
C#
namespace Zennysoft.Ma.Adapter;
|
|
|
|
using Chickensoft.Collections;
|
|
using Godot;
|
|
|
|
public class PlayerStats
|
|
{
|
|
public PlayerStats(AutoProp<int> currentHP,
|
|
AutoProp<int> maximumHP,
|
|
AutoProp<int> currentVT,
|
|
AutoProp<int> maximumVT,
|
|
AutoProp<int> currentAttack,
|
|
AutoProp<int> maxAttack,
|
|
AutoProp<int> bonusAttack,
|
|
AutoProp<int> currentDefense,
|
|
AutoProp<int> maxDefense,
|
|
AutoProp<int> bonusDefense,
|
|
AutoProp<double> currentExp,
|
|
AutoProp<int> expToNextLevel,
|
|
AutoProp<int> currentLevel,
|
|
AutoProp<double> luck)
|
|
{
|
|
CurrentHP = currentHP;
|
|
MaximumHP = maximumHP;
|
|
CurrentVT = currentVT;
|
|
MaximumVT = maximumVT;
|
|
CurrentAttack = currentAttack;
|
|
MaxAttack = maxAttack;
|
|
BonusAttack = bonusAttack;
|
|
CurrentDefense = currentDefense;
|
|
MaxDefense = maxDefense;
|
|
BonusDefense = bonusDefense;
|
|
CurrentExp = currentExp;
|
|
ExpToNextLevel = expToNextLevel;
|
|
CurrentLevel = currentLevel;
|
|
Luck = luck;
|
|
}
|
|
|
|
public AutoProp<int> CurrentHP { get; init; }
|
|
public AutoProp<int> MaximumHP { get; init; }
|
|
public AutoProp<int> CurrentVT { get; init; }
|
|
public AutoProp<int> MaximumVT { get; init; }
|
|
public AutoProp<int> CurrentAttack { get; init; }
|
|
public AutoProp<int> MaxAttack { get; init; }
|
|
public AutoProp<int> BonusAttack { get; init; }
|
|
public AutoProp<int> CurrentDefense { get; init; }
|
|
public AutoProp<int> MaxDefense { get; init; }
|
|
public AutoProp<int> BonusDefense { get; init; }
|
|
public AutoProp<double> CurrentExp { get; init; }
|
|
public AutoProp<int> ExpToNextLevel { get; init; }
|
|
public AutoProp<int> CurrentLevel { get; init; }
|
|
public AutoProp<double> Luck { get; init; }
|
|
|
|
public void SetCurrentHP(int newValue)
|
|
{
|
|
var clampedValue = Mathf.Clamp(newValue, 0, MaximumHP.Value);
|
|
CurrentHP.OnNext(clampedValue);
|
|
}
|
|
public void SetMaximumHP(int newValue)
|
|
{
|
|
MaximumHP.OnNext(newValue);
|
|
}
|
|
public void SetCurrentVT(int newValue)
|
|
{
|
|
var clampedValue = Mathf.Clamp(newValue, 0, MaximumVT.Value);
|
|
CurrentVT.OnNext(clampedValue);
|
|
}
|
|
public void SetMaximumVT(int newValue)
|
|
{
|
|
MaximumVT.OnNext(newValue);
|
|
}
|
|
public void SetCurrentExp(double newValue)
|
|
{
|
|
CurrentExp.OnNext(newValue);
|
|
}
|
|
public void SetCurrentLevel(int newValue)
|
|
{
|
|
CurrentLevel.OnNext(newValue);
|
|
}
|
|
public void SetCurrentAttack(int newValue)
|
|
{
|
|
var clampedValue = Mathf.Clamp(newValue, 0, MaxAttack.Value);
|
|
CurrentAttack.OnNext(clampedValue);
|
|
}
|
|
public void SetBonusAttack(int newValue)
|
|
{
|
|
BonusAttack.OnNext(newValue);
|
|
}
|
|
public void SetMaxAttack(int newValue)
|
|
{
|
|
MaxAttack.OnNext(newValue);
|
|
}
|
|
public void SetCurrentDefense(int newValue)
|
|
{
|
|
var clampedValue = Mathf.Clamp(newValue, 0, MaxDefense.Value);
|
|
CurrentDefense.OnNext(clampedValue);
|
|
}
|
|
public void SetBonusDefense(int newValue)
|
|
{
|
|
BonusDefense.OnNext(newValue);
|
|
}
|
|
public void SetMaxDefense(int newValue)
|
|
{
|
|
MaxDefense.OnNext(newValue);
|
|
}
|
|
public void SetExpToNextLevel(int newValue)
|
|
{
|
|
ExpToNextLevel.OnNext(newValue);
|
|
}
|
|
public void SetLuck(double newValue)
|
|
{
|
|
var clampedValue = Mathf.Clamp(newValue, 0, 1.0);
|
|
Luck.OnNext(clampedValue);
|
|
}
|
|
} |