Item spawning

This commit is contained in:
2024-09-08 14:19:30 -07:00
parent 29a6d1072c
commit a47d1306b9
417 changed files with 17412 additions and 1019 deletions

View File

@@ -125,10 +125,11 @@ namespace GameJamDungeon
})
.Handle((in PlayerLogic.Output.Animations.Attack output) =>
{
var attackSpeed = (float)GameRepo.EquippedWeapon.WeaponInfo.AttackSpeed;
var weaponInfo = (WeaponInfo)GameRepo.EquippedWeapon.Info;
var attackSpeed = (float)weaponInfo.AttackSpeed;
AnimationPlayer.SetSpeedScale(attackSpeed);
AnimationPlayer.Play("attack");
if (GameRepo.EquippedWeapon.WeaponInfo.WeaponTags.Contains(WeaponTag.SelfDamage))
if (weaponInfo.WeaponTags.Contains(WeaponTag.SelfDamage))
_currentHP.OnNext(_currentHP.Value - 5);
})
.Handle((in PlayerLogic.Output.ThrowItem output) =>
@@ -160,7 +161,7 @@ namespace GameJamDungeon
var roll = rng.Randf();
if (roll <= enemy.EnemyStatInfo.Luck)
isCriticalHit = true;
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor, isCriticalHit);
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor.ArmorInfo, isCriticalHit);
_currentHP.OnNext(_currentHP.Value - damage);
GD.Print($"Player hit for {damage} damage.");
}
@@ -215,7 +216,7 @@ namespace GameJamDungeon
AnimationPlayer.AnimationFinished -= OnAnimationFinished;
}
private void OnEquippedWeaponChanged(Weapon info) => Hitbox.Damage = info.WeaponInfo.Damage;
private void OnEquippedWeaponChanged(Weapon info) => Hitbox.Damage = ((WeaponInfo)info.Info).Damage;
private void OnHPChanged(double newHP)
{