Add rust immunity to rusted plate
Throw items in spray pattern for trickster's box
This commit is contained in:
@@ -313,6 +313,16 @@ public partial class Game : Node3D, IGame
|
||||
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()
|
||||
{
|
||||
GameRepo.AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
|
||||
@@ -596,11 +606,21 @@ public partial class Game : Node3D, IGame
|
||||
_player.Unequip(_player.EquipmentComponent.EquippedAccessory.Value);
|
||||
|
||||
_player.Inventory.Items.Remove(boxItem);
|
||||
foreach (var item in _player.Inventory.Items.ToList())
|
||||
ThrowItem(item);
|
||||
_player.Inventory.Items.Clear();
|
||||
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.");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,12 @@ public partial class ThrownItem : RigidBody3D, IThrownItem
|
||||
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()
|
||||
{
|
||||
if (!Game.RescuedItems.TryAdd(ItemThatIsThrown))
|
||||
|
||||
@@ -916,7 +916,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
if (SigilComponent.Sigil.ElementType == weapon.WeaponElement)
|
||||
totalDamage = Mathf.RoundToInt(totalDamage * 1.15f);
|
||||
|
||||
totalDamage = Mathf.RoundToInt(totalDamage * (1 + SigilComponent.Sigil.AttackModifier));
|
||||
totalDamage = Mathf.RoundToInt(totalDamage * (1 + SigilComponent.Sigil.AttackModifier));
|
||||
|
||||
if (isCriticalHit)
|
||||
{
|
||||
@@ -942,7 +942,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
rng.Randomize();
|
||||
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);
|
||||
else
|
||||
enemy.StatusEffectComponent.Rust.OnNext(true);
|
||||
|
||||
Reference in New Issue
Block a user