Rust
This commit is contained in:
@@ -37,6 +37,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
public IEquipmentComponent EquipmentComponent { get; private set; }
|
||||
|
||||
public IStatusEffectComponent StatusEffectComponent { get; private set; }
|
||||
|
||||
public Vector3 CurrentPosition => GlobalPosition;
|
||||
|
||||
public Basis CurrentBasis => Transform.Basis;
|
||||
@@ -70,6 +72,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
[Export(PropertyHint.Range, "1, 100, 1")] public int InitialLuck { get; set; } = 8;
|
||||
|
||||
[Export(PropertyHint.Range, "1, 60, 1")] public double RustDuration { get; set; } = 30;
|
||||
|
||||
[Export]
|
||||
private bool HealthTimerIsActive = false;
|
||||
#endregion
|
||||
@@ -149,6 +153,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
ExperiencePointsComponent = new ExperiencePointsComponent();
|
||||
LuckComponent = new LuckComponent(InitialLuck);
|
||||
EquipmentComponent = new EquipmentComponent();
|
||||
StatusEffectComponent = new StatusEffectComponent(RustDuration);
|
||||
|
||||
_itemReroller = new ItemReroller(ItemDatabase.Instance);
|
||||
_playerEffectService = new PlayerEffectService(this);
|
||||
@@ -872,6 +877,19 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
_playerEffectService.TakeSelfDamage(weapon.Stats.SelfDamage);
|
||||
if (weapon.WeaponTag == WeaponTag.Instakill)
|
||||
_playerEffectService.Instakill(enemy);
|
||||
if (weapon.WeaponTag == WeaponTag.RustChanceSelfAndEnemy)
|
||||
{
|
||||
var rustChance = 0.15f;
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
if (rng.Randf() <= rustChance)
|
||||
{
|
||||
if (rng.Randf() >= 0.5f && ((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag != AccessoryTag.StatusEffectImmunity)
|
||||
StatusEffectComponent.Rust.OnNext(true);
|
||||
else
|
||||
enemy.StatusEffectComponent.Rust.OnNext(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void CollisionDetector_AreaEntered(Area3D area)
|
||||
|
||||
Reference in New Issue
Block a user