Add more spell effects
This commit is contained in:
@@ -95,6 +95,7 @@ public class EffectService
|
||||
|
||||
currentRoom.EnemiesInRoom.ForEach(e => e.HealthComponent.SetCurrentHealth(e.HealthComponent.MaximumHP.Value));
|
||||
_player.HealthComponent.SetCurrentHealth(_player.HealthComponent.MaximumHP.Value);
|
||||
SfxDatabase.Instance.Play(SoundEffect.HealHP);
|
||||
}
|
||||
|
||||
public void AbsorbHPFromAllEnemiesInRoom()
|
||||
@@ -108,7 +109,7 @@ public class EffectService
|
||||
var hpToAbsorb = 0.0;
|
||||
foreach (var enemy in currentEnemies)
|
||||
{
|
||||
var absorbAmount = enemy.HealthComponent.MaximumHP.Value * 0.05;
|
||||
var absorbAmount = enemy.HealthComponent.CurrentHP.Value * 0.25;
|
||||
enemy.HealthComponent.Damage((int)absorbAmount);
|
||||
hpToAbsorb += absorbAmount;
|
||||
enemy.OnAbsorb();
|
||||
@@ -134,22 +135,24 @@ public class EffectService
|
||||
|
||||
public void SwapHPandVT()
|
||||
{
|
||||
var oldHp = _player.HealthComponent.CurrentHP.Value;
|
||||
var oldVt = _player.VTComponent.CurrentVT.Value;
|
||||
var oldHp = Mathf.Max(1, _player.HealthComponent.CurrentHP.Value);
|
||||
var oldVt = Mathf.Max(1, _player.VTComponent.CurrentVT.Value);
|
||||
|
||||
_player.HealthComponent.SetCurrentHealth(oldVt);
|
||||
_player.VTComponent.SetVT(oldHp);
|
||||
SfxDatabase.Instance.Play(SoundEffect.SwapHPAndVT);
|
||||
}
|
||||
|
||||
public void RandomEffect(EffectItem item)
|
||||
public void RandomEffect()
|
||||
{
|
||||
var itemEffects = Enum.GetValues<UsableItemTag>().ToList();
|
||||
itemEffects.Remove(UsableItemTag.RandomEffect);
|
||||
itemEffects.Remove(UsableItemTag.None);
|
||||
var randomEffect = new Godot.Collections.Array<UsableItemTag>(itemEffects).PickRandom();
|
||||
item.SetEffectTag(randomEffect);
|
||||
_game.UseItem(item);
|
||||
var spells = _player.Inventory.Items.OfType<EffectItem>().Where(x => x.UsableItemTag != UsableItemTag.RandomEffect).ToList();
|
||||
if (spells.Count > 0)
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var index = rng.RandiRange(0, spells.Count - 1);
|
||||
_game.UseItem(spells[index]);
|
||||
}
|
||||
}
|
||||
|
||||
public void DoubleExp()
|
||||
@@ -308,7 +311,7 @@ public class EffectService
|
||||
var roomsGodotCollection = new Godot.Collections.Array<MonsterRoom>(validRooms);
|
||||
var randomRoom = roomsGodotCollection.PickRandom();
|
||||
var spawnPoint = randomRoom.PlayerSpawn;
|
||||
player.TeleportPlayer((spawnPoint.Rotation, new Vector3(spawnPoint.Position.X, 0, spawnPoint.Position.Z)));
|
||||
player.TeleportPlayer((spawnPoint.Rotation, new Vector3(spawnPoint.GlobalPosition.X, _player.GlobalPosition.Y, spawnPoint.GlobalPosition.Z)));
|
||||
SfxDatabase.Instance.Play(SoundEffect.TeleportToRandomRoom);
|
||||
}
|
||||
|
||||
@@ -318,7 +321,8 @@ public class EffectService
|
||||
if (exitRoom.PlayerDiscoveredRoom)
|
||||
{
|
||||
SfxDatabase.Instance.Play(SoundEffect.TeleportToExit);
|
||||
_player.TeleportPlayer((exitRoom.PlayerSpawn.Rotation, exitRoom.PlayerSpawn.Position));
|
||||
var exitPoint = exitRoom.PlayerSpawn.GlobalPosition;
|
||||
_player.TeleportPlayer((exitRoom.PlayerSpawn.Rotation, new Vector3(exitPoint.X, _player.GlobalPosition.Y, exitPoint.Z)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,9 +340,14 @@ public class EffectService
|
||||
public T GetRandomItemOfType<T>(params T[] itemsToExclude)
|
||||
where T : IBaseInventoryItem => ItemDatabase.Instance.PickItem(itemsToExclude);
|
||||
|
||||
public void RandomSpell()
|
||||
public void RandomSpell(EffectItem item)
|
||||
{
|
||||
throw new NotImplementedException("Spells not implemented yet.");
|
||||
var itemEffects = Enum.GetValues<UsableItemTag>().ToList();
|
||||
itemEffects.Remove(UsableItemTag.RandomEffect);
|
||||
itemEffects.Remove(UsableItemTag.None);
|
||||
var randomEffect = new Godot.Collections.Array<UsableItemTag>(itemEffects).PickRandom();
|
||||
item.SetEffectTag(randomEffect);
|
||||
_game.UseItem(item);
|
||||
}
|
||||
|
||||
public void DropTo1HPAndGainRareItem<T>()
|
||||
|
||||
Reference in New Issue
Block a user