Add rust immunity to rusted plate
Throw items in spray pattern for trickster's box
This commit is contained in:
@@ -3,5 +3,6 @@
|
|||||||
public enum ArmorTag
|
public enum ArmorTag
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
DegradeOnHit
|
DegradeOnHit,
|
||||||
|
ImmuneToRust
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,6 +313,16 @@ public partial class Game : Node3D, IGame
|
|||||||
RemoveItemOrSubtractFromItemCount(item);
|
RemoveItemOrSubtractFromItemCount(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ThrowItem(IBaseInventoryItem item, double throwAngle)
|
||||||
|
{
|
||||||
|
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
|
||||||
|
var thrown = thrownScene.Instantiate<ThrownItem>();
|
||||||
|
thrown.ItemThatIsThrown = item;
|
||||||
|
_map.AddChild(thrown);
|
||||||
|
thrown.Throw(_effectService, throwAngle);
|
||||||
|
RemoveItemOrSubtractFromItemCount(item);
|
||||||
|
}
|
||||||
|
|
||||||
public void DoubleExp()
|
public void DoubleExp()
|
||||||
{
|
{
|
||||||
GameRepo.AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
|
GameRepo.AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
|
||||||
@@ -596,11 +606,21 @@ public partial class Game : Node3D, IGame
|
|||||||
_player.Unequip(_player.EquipmentComponent.EquippedAccessory.Value);
|
_player.Unequip(_player.EquipmentComponent.EquippedAccessory.Value);
|
||||||
|
|
||||||
_player.Inventory.Items.Remove(boxItem);
|
_player.Inventory.Items.Remove(boxItem);
|
||||||
foreach (var item in _player.Inventory.Items.ToList())
|
|
||||||
ThrowItem(item);
|
|
||||||
_player.Inventory.Items.Clear();
|
|
||||||
GameRepo.CloseInventory();
|
GameRepo.CloseInventory();
|
||||||
|
var itemsToThrow = _player.Inventory.Items.ToList();
|
||||||
|
_player.Inventory.Items.Clear();
|
||||||
|
double[] throwAngles = [0, -5, 5, -15, -25, 25];
|
||||||
|
var throwIndex = 0;
|
||||||
|
var arrayDirection = 1;
|
||||||
BroadcastMessage($"All items have been ejected from inventory.");
|
BroadcastMessage($"All items have been ejected from inventory.");
|
||||||
|
foreach (var item in itemsToThrow)
|
||||||
|
{
|
||||||
|
ThrowItem(item, throwAngles[throwIndex]);
|
||||||
|
throwIndex += (1 * arrayDirection);
|
||||||
|
if (throwIndex >= throwAngles.Length - 1 || throwIndex <= 0)
|
||||||
|
arrayDirection *= -1;
|
||||||
|
await ToSignal(GetTree().CreateTimer(0.2f), "timeout");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ public partial class ThrownItem : RigidBody3D, IThrownItem
|
|||||||
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * ItemThatIsThrown.ThrowSpeed);
|
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized() * ItemThatIsThrown.ThrowSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Throw(EffectService effectService, double throwAngle)
|
||||||
|
{
|
||||||
|
_effectService = effectService;
|
||||||
|
ApplyCentralImpulse(-Player.GlobalBasis.Z.Normalized().Rotated(Vector3.Up, (float)Mathf.DegToRad(throwAngle)) * ItemThatIsThrown.ThrowSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
public void RescueItem()
|
public void RescueItem()
|
||||||
{
|
{
|
||||||
if (!Game.RescuedItems.TryAdd(ItemThatIsThrown))
|
if (!Game.RescuedItems.TryAdd(ItemThatIsThrown))
|
||||||
|
|||||||
@@ -942,7 +942,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
rng.Randomize();
|
rng.Randomize();
|
||||||
if (rng.Randf() <= rustChance)
|
if (rng.Randf() <= rustChance)
|
||||||
{
|
{
|
||||||
if (rng.Randf() >= 0.5f && ((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag != AccessoryTag.StatusEffectImmunity)
|
if (rng.Randf() >= 0.5f && ((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag != AccessoryTag.StatusEffectImmunity && ((Armor)EquipmentComponent.EquippedArmor.Value).ArmorTag != ArmorTag.ImmuneToRust)
|
||||||
StatusEffectComponent.Rust.OnNext(true);
|
StatusEffectComponent.Rust.OnNext(true);
|
||||||
else
|
else
|
||||||
enemy.StatusEffectComponent.Rust.OnNext(true);
|
enemy.StatusEffectComponent.Rust.OnNext(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user