Clean up events, add weapon tag for weaker on swing
This commit is contained in:
@@ -17,6 +17,8 @@ public interface IEquipmentComponent : IEntityComponent
|
|||||||
|
|
||||||
public bool IsItemEquipped(InventoryItem item);
|
public bool IsItemEquipped(InventoryItem item);
|
||||||
|
|
||||||
|
public void UpdateEquipment(EquipableItem equipable);
|
||||||
|
|
||||||
public int BonusAttack { get; }
|
public int BonusAttack { get; }
|
||||||
|
|
||||||
public int BonusDefense { get; }
|
public int BonusDefense { get; }
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ public enum WeaponTag
|
|||||||
Knockback,
|
Knockback,
|
||||||
InverseHPAttackPower,
|
InverseHPAttackPower,
|
||||||
RustChanceSelfAndEnemy,
|
RustChanceSelfAndEnemy,
|
||||||
Instakill
|
Instakill,
|
||||||
|
DegradeOnSwing
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,4 +76,6 @@ public class EquipmentComponent : IEquipmentComponent
|
|||||||
|
|
||||||
return item == _equippedWeapon.Value || item == _equippedArmor.Value || item == _equippedAccessory.Value;
|
return item == _equippedWeapon.Value || item == _equippedArmor.Value || item == _equippedAccessory.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateEquipment(EquipableItem equipable) => EquipmentChanged?.Invoke(equipable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,6 +261,13 @@ public partial class App : Node, IApp
|
|||||||
|
|
||||||
MainMenu.StartGame -= OnStartGame;
|
MainMenu.StartGame -= OnStartGame;
|
||||||
MainMenu.EnemyViewer -= OnEnemyViewer;
|
MainMenu.EnemyViewer -= OnEnemyViewer;
|
||||||
|
MainMenu.Gallery -= OnGallery;
|
||||||
|
MainMenu.Options -= OnOptions;
|
||||||
MainMenu.Quit -= OnQuit;
|
MainMenu.Quit -= OnQuit;
|
||||||
|
|
||||||
|
GalleryMenu.GalleryExited -= GalleryExited;
|
||||||
|
|
||||||
|
OptionsMenu.OptionsMenuExited -= OptionsMenu_OptionsMenuExited;
|
||||||
|
OptionsMenu.DeleteSaveData -= DeleteSaveData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,9 +60,16 @@ public partial class DataViewer : Control, IDataViewer
|
|||||||
DisplayEnemy();
|
DisplayEnemy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnEnterTree() => GetTree().Paused = false;
|
public void OnEnterTree()
|
||||||
|
{
|
||||||
|
GetTree().Paused = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnExitTree() => GetTree().Paused = false;
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
GetTree().Paused = false;
|
||||||
|
BackButton.Pressed -= BackButton_Pressed;
|
||||||
|
}
|
||||||
|
|
||||||
private void BackButton_Pressed() => AppRepo.OnDataViewerExited();
|
private void BackButton_Pressed() => AppRepo.OnDataViewerExited();
|
||||||
|
|
||||||
|
|||||||
@@ -39,4 +39,10 @@ public partial class BossAModelView : EnemyModelView3D, INode3D
|
|||||||
ExplodingModel.Show();
|
ExplodingModel.Show();
|
||||||
DeathAnimation.Play("Animation");
|
DeathAnimation.Play("Animation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
Hitbox.AreaEntered -= Hitbox_AreaEntered;
|
||||||
|
DeathAnimation.AnimationFinished -= DeathAnimation_AnimationFinished;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,5 +180,6 @@ public partial class BossTypeA : Enemy, IHaveEngagePlayerBehavior, IHaveFollowBe
|
|||||||
EngagePlayerBehavior.TakeAction -= PerformAction;
|
EngagePlayerBehavior.TakeAction -= PerformAction;
|
||||||
PlayerDetector.BodyEntered -= PlayerDetector_BodyEntered;
|
PlayerDetector.BodyEntered -= PlayerDetector_BodyEntered;
|
||||||
PlayerDetector.BodyExited -= PlayerDetector_BodyExited;
|
PlayerDetector.BodyExited -= PlayerDetector_BodyExited;
|
||||||
|
(EnemyModelView as BossAModelView).OnDeathAnimationCompleted -= EnemyModelView3D_OnDeathAnimationCompleted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,4 +69,10 @@ public abstract partial class Enemy2D : Enemy
|
|||||||
if (body is IPlayer)
|
if (body is IPlayer)
|
||||||
_enemyLogic.Input(new EnemyLogic.Input.Alert());
|
_enemyLogic.Input(new EnemyLogic.Input.Alert());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new void OnExitTree()
|
||||||
|
{
|
||||||
|
base.OnExitTree();
|
||||||
|
LineOfSight.BodyEntered -= LineOfSight_BodyEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,5 +129,6 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
|||||||
{
|
{
|
||||||
if (AnimationTree != null)
|
if (AnimationTree != null)
|
||||||
AnimationTree.Get(_parametersPlayback).As<AnimationNodeStateMachinePlayback>().Stop();
|
AnimationTree.Get(_parametersPlayback).As<AnimationNodeStateMachinePlayback>().Stop();
|
||||||
|
AnimationTree.AnimationFinished -= AnimationTree_AnimationFinished;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,16 @@ public partial class Michael : Enemy2D, IHavePatrolBehavior, IHaveEngagePlayerBe
|
|||||||
_enemyLogic.Input(new EnemyLogic.Input.Patrol());
|
_enemyLogic.Input(new EnemyLogic.Input.Patrol());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Move() => EnemyModelView.PlayIdleAnimation();
|
public override void Move() => EnemyModelView.PlayIdleAnimation();
|
||||||
|
|
||||||
|
public new void OnExitTree()
|
||||||
|
{
|
||||||
|
base.OnExitTree();
|
||||||
|
PatrolBehavior.OnVelocityComputed -= OnVelocityComputed;
|
||||||
|
FollowBehavior.OnVelocityComputed -= OnVelocityComputed;
|
||||||
|
EngagePlayerBehavior.TakeAction -= EngagePlayerBehavior_TakeAction;
|
||||||
|
EngagePlayerBehavior.AcquireTarget -= EngagePlayerBehavior_AcquireTarget;
|
||||||
|
PlayerDetector.BodyEntered -= PlayerDetector_BodyEntered;
|
||||||
|
PlayerDetector.BodyExited -= PlayerDetector_BodyExited;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,12 @@ public partial class GoldSproingy : Enemy2D, IHavePatrolBehavior, IHaveFleeBehav
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Move() => EnemyModelView.PlayIdleAnimation();
|
public override void Move() => EnemyModelView.PlayIdleAnimation();
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
PatrolBehavior.OnVelocityComputed -= OnVelocityComputed;
|
||||||
|
PlayerDetector.BodyExited -= PlayerDetector_BodyExited;
|
||||||
|
FleeBehavior.OnVelocityComputed -= OnVelocityComputed;
|
||||||
|
PlayerDetector.BodyEntered -= GoldSproingyFlee;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -52,4 +52,9 @@ public partial class DemonWall : Enemy3D
|
|||||||
{
|
{
|
||||||
EnemyModelView.Attack(_maximumWallMoveAmount);
|
EnemyModelView.Attack(_maximumWallMoveAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
_attackTimer.Timeout -= AttackTimer_Timeout;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,9 @@ public partial class DemonWallArm : EnemyModelView
|
|||||||
if (target is IPlayer player)
|
if (target is IPlayer player)
|
||||||
base.OnPlayerHit(new AttackEventArgs(AttackData));
|
base.OnPlayerHit(new AttackEventArgs(AttackData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
Hitbox.AreaEntered -= Hitbox_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -608,13 +608,21 @@ public partial class Game : Node3D, IGame
|
|||||||
LoadNextLevel.Exit -= FloorClearMenu_Exit;
|
LoadNextLevel.Exit -= FloorClearMenu_Exit;
|
||||||
LoadNextLevel.TransitionCompleted -= FloorClearMenu_TransitionCompleted;
|
LoadNextLevel.TransitionCompleted -= FloorClearMenu_TransitionCompleted;
|
||||||
|
|
||||||
_player.Inventory.BroadcastMessage -= BroadcastMessage;
|
OnLoadLevelRequest -= LoadLevel;
|
||||||
|
|
||||||
GameRepo.RestorativePickedUp -= GameEventDepot_RestorativePickedUp;
|
GameRepo.RestorativePickedUp -= GameEventDepot_RestorativePickedUp;
|
||||||
|
GameRepo.CloseInventoryEvent -= ExitInventoryAction;
|
||||||
|
|
||||||
|
_player.Inventory.BroadcastMessage -= BroadcastMessage;
|
||||||
|
|
||||||
|
_map.FloorLoaded -= OnFloorLoadFinished;
|
||||||
|
|
||||||
|
_player.PlayerDied -= GameOver;
|
||||||
GameOverMenu.NewGame -= OnNewGame;
|
GameOverMenu.NewGame -= OnNewGame;
|
||||||
GameOverMenu.QuitGame -= OnQuit;
|
GameOverMenu.QuitGame -= OnQuit;
|
||||||
|
|
||||||
|
PauseMenu.ExitGamePressed -= OnQuit;
|
||||||
|
|
||||||
GameRepo.IsPaused.Sync -= IsPaused_Sync;
|
GameRepo.IsPaused.Sync -= IsPaused_Sync;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,9 @@ public partial class ItemRescue : Area3D
|
|||||||
|
|
||||||
BodyEntered -= OnItemRescueEntered;
|
BodyEntered -= OnItemRescueEntered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
BodyEntered -= OnItemRescueEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,4 +54,10 @@ public partial class SetItem : RigidBody3D
|
|||||||
{
|
{
|
||||||
_stateMachine.Travel("timer");
|
_stateMachine.Travel("timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
ExplosionArea.AreaEntered -= ExplosionArea_AreaEntered;
|
||||||
|
AnimationTree.AnimationFinished -= AnimationTree_AnimationFinished;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,4 +127,10 @@ public partial class ThrownItem : RigidBody3D, IThrownItem
|
|||||||
enemy.HealthComponent.Damage(damageDealt);
|
enemy.HealthComponent.Damage(damageDealt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
BodyEntered -= ThrownItem_BodyEntered;
|
||||||
|
Collision.AreaEntered -= Collision_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,9 @@ public partial class Weapon : EquipableItem
|
|||||||
public void OnReady()
|
public void OnReady()
|
||||||
{
|
{
|
||||||
_sprite.Texture = Stats.Texture;
|
_sprite.Texture = Stats.Texture;
|
||||||
|
_bonusDamage = Stats.BonusAttack;
|
||||||
|
_bonusDefense = Stats.BonusDefense;
|
||||||
|
_bonusLuck = Stats.BonusLuck;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ItemName => Stats.Name;
|
public override string ItemName => Stats.Name;
|
||||||
@@ -51,11 +54,11 @@ public partial class Weapon : EquipableItem
|
|||||||
|
|
||||||
public void SetWeaponDefense(int newBonus) => _bonusDefense = newBonus;
|
public void SetWeaponDefense(int newBonus) => _bonusDefense = newBonus;
|
||||||
|
|
||||||
public override int BonusAttack { get => Stats.BonusAttack + _bonusDamage; }
|
public override int BonusAttack { get => _bonusDamage; }
|
||||||
|
|
||||||
public override int BonusDefense { get => Stats.BonusDefense + _bonusDefense; }
|
public override int BonusDefense { get => _bonusDefense; }
|
||||||
|
|
||||||
public override int BonusLuck { get => Stats.BonusLuck + _bonusLuck; }
|
public override int BonusLuck { get => _bonusLuck; }
|
||||||
|
|
||||||
[Save("weapon_bonus_damage")]
|
[Save("weapon_bonus_damage")]
|
||||||
private int _bonusDamage { get; set; } = 0;
|
private int _bonusDamage { get; set; } = 0;
|
||||||
|
|||||||
@@ -7,14 +7,15 @@
|
|||||||
script = ExtResource("2_vrork")
|
script = ExtResource("2_vrork")
|
||||||
AttackSpeed = 0.75
|
AttackSpeed = 0.75
|
||||||
WeaponElement = 0
|
WeaponElement = 0
|
||||||
WeaponTag = 0
|
WeaponTag = 8
|
||||||
|
SelfDamage = 0
|
||||||
SoundEffect = 23
|
SoundEffect = 23
|
||||||
Name = "Shining Halberd"
|
Name = "Shining Halberd"
|
||||||
Description = "Weapon that gradually becomes weaker."
|
Description = "Weapon that gradually becomes weaker."
|
||||||
SpawnRate = 0.3
|
SpawnRate = 0.3
|
||||||
BonusAttack = 8
|
BonusAttack = 8
|
||||||
BonusDefense = 0
|
BonusDefense = 0
|
||||||
BonusLuck = 0.05
|
BonusLuck = 5
|
||||||
BonusHP = 0
|
BonusHP = 0
|
||||||
BonusVT = 0
|
BonusVT = 0
|
||||||
AeolicResistance = 0
|
AeolicResistance = 0
|
||||||
|
|||||||
@@ -20,4 +20,9 @@ public partial class UnlockableDoor : Node3D, IDoor
|
|||||||
foreach (var child in children)
|
foreach (var child in children)
|
||||||
child.QueueFree();
|
child.QueueFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
UnlockArea.AreaEntered -= UnlockArea_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,4 +61,10 @@ public partial class Altar : SpecialFloor, IDungeonFloor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ExitReached() => Game.FloorExitReached();
|
public void ExitReached() => Game.FloorExitReached();
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
Exit.AreaEntered -= Exit_AreaEntered;
|
||||||
|
NoExitArea.AreaEntered -= NoExitArea_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,4 +72,12 @@ public partial class BossRoomA : SpecialFloor, IBossRoom, IDungeonFloor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawn.Rotation, new Vector3(PlayerSpawn.GlobalPosition.X, -2.5f, PlayerSpawn.GlobalPosition.Z)); }
|
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawn.Rotation, new Vector3(PlayerSpawn.GlobalPosition.X, -2.5f, PlayerSpawn.GlobalPosition.Z)); }
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||||
|
_exit.AreaEntered -= Exit_AreaEntered;
|
||||||
|
OxFace.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||||
|
HorseHead.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Chickensoft.AutoInject;
|
using Chickensoft.AutoInject;
|
||||||
using Chickensoft.Introspection;
|
using Chickensoft.Introspection;
|
||||||
using Godot;
|
using Godot;
|
||||||
using System.Collections.Immutable;
|
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
|
|
||||||
namespace Zennysoft.Game.Ma;
|
namespace Zennysoft.Game.Ma;
|
||||||
@@ -47,4 +46,10 @@ public partial class BossRoomB : SpecialFloor, IBossRoom, IDungeonFloor
|
|||||||
if (area.GetOwner() is IPlayer)
|
if (area.GetOwner() is IPlayer)
|
||||||
ExitReached();
|
ExitReached();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
ActivateTrap.BodyEntered -= ActivateTrap_AreaEntered;
|
||||||
|
_exit.AreaEntered -= Exit_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,4 +27,9 @@ public partial class CorridorRoom : Node3D
|
|||||||
if (!Game.CurrentFloor.FloorIsLoaded)
|
if (!Game.CurrentFloor.FloorIsLoaded)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
_room.BodyEntered -= Room_BodyEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,10 @@ public partial class ExitRoom : DungeonRoom
|
|||||||
if (area.GetOwner() is IPlayer)
|
if (area.GetOwner() is IPlayer)
|
||||||
ExitReached();
|
ExitReached();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new void OnExitTree()
|
||||||
|
{
|
||||||
|
base.OnExitTree();
|
||||||
|
_exit.AreaEntered -= Exit_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Chickensoft.Introspection;
|
|||||||
using Godot;
|
using Godot;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
namespace Zennysoft.Game.Ma;
|
namespace Zennysoft.Game.Ma;
|
||||||
|
|
||||||
@@ -24,4 +25,9 @@ public partial class FinalFloor : SpecialFloor
|
|||||||
{
|
{
|
||||||
_player.Die();
|
_player.Die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
Exit.AreaEntered -= Exit_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,10 @@ public partial class JumpScareRoom : DungeonRoom
|
|||||||
DialogueController.ShowDialogue(Dialogue, "general");
|
DialogueController.ShowDialogue(Dialogue, "general");
|
||||||
JumpScare.SetMonitoring(false);
|
JumpScare.SetMonitoring(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new void OnExitTree()
|
||||||
|
{
|
||||||
|
base.OnExitTree();
|
||||||
|
JumpScare.AreaEntered -= JumpScare_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,4 +85,12 @@ public partial class Overworld : SpecialFloor, IDungeonFloor
|
|||||||
|
|
||||||
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawnPoint.Rotation, new Vector3(PlayerSpawnPoint.GlobalPosition.X, 2.4f, PlayerSpawnPoint.GlobalPosition.Z)); }
|
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawnPoint.Rotation, new Vector3(PlayerSpawnPoint.GlobalPosition.X, 2.4f, PlayerSpawnPoint.GlobalPosition.Z)); }
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
Exit.AreaEntered -= Exit_AreaEntered;
|
||||||
|
RestoreArea.AreaEntered -= RestoreArea_AreaEntered;
|
||||||
|
RestoreArea.AreaExited -= RestoreArea_AreaExited;
|
||||||
|
RestoreTimer.Timeout -= RestoreTimer_Timeout;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,9 @@ public partial class MapRevealerCube : Node3D
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Area3D_AreaEntered(Area3D area) => MeshInstance3D.Hide();
|
private void Area3D_AreaEntered(Area3D area) => MeshInstance3D.Hide();
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
Area3D.AreaEntered -= Area3D_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,4 +35,9 @@ public partial class Minimap : Control
|
|||||||
{
|
{
|
||||||
LayerNumberText.Text = $"{obj:D2}";
|
LayerNumberText.Text = $"{obj:D2}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
_map.CurrentFloorNumber.Sync -= CurrentFloorNumber_Sync;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,14 +71,11 @@ public partial class Npc : Node3D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Gesthemii : Npc
|
public void OnExitTree()
|
||||||
{
|
{
|
||||||
public override void _UnhandledInput(InputEvent @event)
|
DialogueZone.BodyEntered -= DialogueZone_BodyEntered;
|
||||||
{
|
DialogueZone.BodyExited -= DialogueZone_BodyExited;
|
||||||
if (@event.IsActionPressed(GameInputs.Interact) && _isInDialogueZone)
|
DialogueExitZone.BodyExited -= DialogueExitZone_BodyExited;
|
||||||
{
|
Hitbox.AreaEntered -= Hitbox_AreaEntered;
|
||||||
DialogueController.ShowDialogue(Dialogue, "general");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,6 +323,12 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
AnimationPlayer.Play("hit_wall");
|
AnimationPlayer.Play("hit_wall");
|
||||||
else if (!AnimationPlayer.IsPlaying())
|
else if (!AnimationPlayer.IsPlaying())
|
||||||
PlayAttackAnimation();
|
PlayAttackAnimation();
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
var weapon = EquipmentComponent.EquippedWeapon.Value as Weapon;
|
||||||
|
if (weapon.WeaponTag == WeaponTag.DegradeOnSwing)
|
||||||
|
_playerEffectService.Degrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThrowItem()
|
private void ThrowItem()
|
||||||
@@ -367,6 +373,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered;
|
CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered;
|
||||||
HealthComponent.HealthReachedZero -= Die;
|
HealthComponent.HealthReachedZero -= Die;
|
||||||
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
||||||
|
HealthComponent.CurrentHP.Changed -= InverseHPToAttackPowerSync;
|
||||||
|
HealthComponent.HealthReachedZero -= Die;
|
||||||
|
ExperiencePointsComponent.PlayerLevelUp -= OnLevelUp;
|
||||||
|
PlayerFXAnimations.AnimationFinished -= PlayerFXAnimations_AnimationFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Move(float delta)
|
private void Move(float delta)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Zennysoft.Game.Ma;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
using Zennysoft.Ma.Adapter.Entity;
|
using Zennysoft.Ma.Adapter.Entity;
|
||||||
|
|
||||||
@@ -23,4 +24,12 @@ internal class PlayerEffectService
|
|||||||
if (rand <= _player.TotalLuck)
|
if (rand <= _player.TotalLuck)
|
||||||
enemy.Die();
|
enemy.Die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Degrade()
|
||||||
|
{
|
||||||
|
var weapon = _player.EquipmentComponent.EquippedWeapon.Value as Weapon;
|
||||||
|
var newAttack = Mathf.Max(weapon.BonusAttack - 1, 0);
|
||||||
|
weapon.SetWeaponAttack(newAttack);
|
||||||
|
_player.EquipmentComponent.UpdateEquipment(weapon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -22,4 +22,9 @@ public partial class QuestTest : Area3D
|
|||||||
Game.QuestData.QuestMarker1 = true;
|
Game.QuestData.QuestMarker1 = true;
|
||||||
QueueFree();
|
QueueFree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
AreaEntered -= QuestTest_AreaEntered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user