Implement plasma sword instakill
This commit is contained in:
26
Zennysoft.Game.Ma/src/player/PlayerEffectService.cs
Normal file
26
Zennysoft.Game.Ma/src/player/PlayerEffectService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
using Zennysoft.Ma.Adapter.Entity;
|
||||
|
||||
internal class PlayerEffectService
|
||||
{
|
||||
private IPlayer _player;
|
||||
public PlayerEffectService(IPlayer player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public void TakeSelfDamage(int damage)
|
||||
{
|
||||
_player.TakeDamage(new AttackData(5, ElementType.None, true, true));
|
||||
}
|
||||
|
||||
public void Instakill(IEnemy enemy)
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var rand = rng.RandiRange(1, 100);
|
||||
if (rand <= _player.TotalLuck)
|
||||
enemy.Die();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user