Mystery item implementation

This commit is contained in:
2025-03-26 23:13:01 -07:00
parent 114ff35630
commit 9d3621dd2c
58 changed files with 860 additions and 309 deletions

View File

@@ -60,6 +60,10 @@ public class EffectService
public void TurnAllEnemiesInRoomIntoHealingItem()
{
var currentRoom = _map.GetPlayersCurrentRoom();
if (currentRoom is not MonsterRoom)
return;
var currentEnemies = currentRoom.EnemiesInRoom;
foreach (var enemy in currentEnemies)
{
@@ -86,6 +90,10 @@ public class EffectService
public void HealAllEnemiesAndPlayerInRoomToFull()
{
var currentRoom = _map.GetPlayersCurrentRoom();
if (currentRoom is not MonsterRoom)
return;
var currentEnemies = currentRoom.EnemiesInRoom;
foreach (var enemy in currentEnemies)
enemy.SetCurrentHP(enemy.GetMaximumHP());
@@ -95,6 +103,10 @@ public class EffectService
public void AbsorbHPFromAllEnemiesInRoom()
{
var currentRoom = _map.GetPlayersCurrentRoom();
if (currentRoom is not MonsterRoom)
return;
var currentEnemies = currentRoom.EnemiesInRoom;
var hpToAbsorb = 0.0;
foreach (var enemy in currentEnemies)
@@ -106,6 +118,10 @@ public class EffectService
public void DealElementalDamageToAllEnemiesInRoom(ElementType elementType)
{
var currentRoom = _map.GetPlayersCurrentRoom();
if (currentRoom is not MonsterRoom)
return;
var currentEnemies = currentRoom.EnemiesInRoom;
foreach (var enemy in currentEnemies)
enemy.TakeDamage(20, elementType);
@@ -132,20 +148,22 @@ public class EffectService
public void RaiseCurrentWeaponAttack()
{
if (_player.EquippedWeapon.Value.ItemName == string.Empty)
if (string.IsNullOrEmpty(_player.EquippedWeapon.Value.ItemName))
return;
var currentWeapon = (Weapon)_player.EquippedWeapon.Value;
currentWeapon.IncreaseWeaponAttack(1);
_player.ModifyBonusAttack(1);
}
public void RaiseCurrentArmorDefense()
{
if (_player.EquippedArmor.Value.ItemName == string.Empty)
if (string.IsNullOrEmpty(_player.EquippedArmor.Value.ItemName))
return;
var currentArmor = (Armor)_player.EquippedArmor.Value;
currentArmor.IncreaseArmorDefense(1);
_player.ModifyBonusDefense(1);
}
public void RaiseLevel()
@@ -197,12 +215,15 @@ public class EffectService
public void ChangeAffinity(ThrowableItem throwableItem)
{
var maximumElements = Enum.GetNames(typeof(ElementType)).Length;
throwableItem.SetElementType(throwableItem.ElementType + 1 % maximumElements);
var newElement = ((int)throwableItem.ElementType + 1) % maximumElements;
throwableItem.SetElementType((ElementType)newElement);
// TODO: Make this an inventory animation to cycle through elements.
throwableItem.SetDescription(
$"Inflicts {throwableItem.ElementType} damage when thrown." +
$"{System.Environment.NewLine}Use item to change Affinity.");
throwableItem.SetCount(throwableItem.Count + 1);
}
public void WarpToExit(IPlayer player)