diff options
Diffstat (limited to 'scripts/entities/actors')
| -rw-r--r-- | scripts/entities/actors/Actor.cs | 2 | ||||
| -rw-r--r-- | scripts/entities/actors/Inventory.cs | 4 | ||||
| -rw-r--r-- | scripts/entities/actors/Player.cs | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/scripts/entities/actors/Actor.cs b/scripts/entities/actors/Actor.cs index 1717cfa..1cb1f37 100644 --- a/scripts/entities/actors/Actor.cs +++ b/scripts/entities/actors/Actor.cs @@ -139,7 +139,7 @@ public partial class Actor : Entity public int Heal(int amount) { int neoHp = Hp + amount; - if (amount > MaxHp) neoHp = MaxHp; + if (neoHp > MaxHp) neoHp = MaxHp; int recovered = neoHp - Hp; Hp = neoHp; diff --git a/scripts/entities/actors/Inventory.cs b/scripts/entities/actors/Inventory.cs index ea9569f..f1cff2a 100644 --- a/scripts/entities/actors/Inventory.cs +++ b/scripts/entities/actors/Inventory.cs @@ -32,4 +32,8 @@ public partial class Inventory : Node { Items.Add(item); } + + public void RemoveItem(ConsumableItem item) { + Items.Remove(item); + } }
\ No newline at end of file diff --git a/scripts/entities/actors/Player.cs b/scripts/entities/actors/Player.cs index d1c4c7f..71812e8 100644 --- a/scripts/entities/actors/Player.cs +++ b/scripts/entities/actors/Player.cs @@ -7,10 +7,12 @@ using System; [GlobalClass] public partial class Player : Actor { + private PlayerDefinition definition; public Inventory inventory; public Player(Vector2I initialPosition, MapData map, PlayerDefinition definition) : base(initialPosition, map, definition) { + this.definition = definition; SetDefinition(definition); } |
