diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-09 19:09:34 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-09 19:09:34 -0300 |
| commit | c6bbb834f7758027c0df338f1520f34fad3befea (patch) | |
| tree | 1818cd23c24be16fbe19b16dd0a510874d440d83 /scripts/entities/items | |
| parent | f1b51bed52ffbd90b5b7cc8dcfc6f0484bbbeb3c (diff) | |
Organização
Diffstat (limited to 'scripts/entities/items')
| -rw-r--r-- | scripts/entities/items/ConsumableItem.cs | 37 | ||||
| -rw-r--r-- | scripts/entities/items/ConsumableItem.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/entities/items/ConsumableItemDefinition.cs | 7 | ||||
| -rw-r--r-- | scripts/entities/items/ConsumableItemDefinition.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/entities/items/HealingConsumable.cs | 28 | ||||
| -rw-r--r-- | scripts/entities/items/HealingConsumable.cs.uid | 1 | ||||
| -rw-r--r-- | scripts/entities/items/HealingConsumableDefinition.cs | 11 | ||||
| -rw-r--r-- | scripts/entities/items/HealingConsumableDefinition.cs.uid | 1 |
8 files changed, 0 insertions, 87 deletions
diff --git a/scripts/entities/items/ConsumableItem.cs b/scripts/entities/items/ConsumableItem.cs deleted file mode 100644 index 82fab49..0000000 --- a/scripts/entities/items/ConsumableItem.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Godot; - -/// <summary> -/// Classe para itens consumíveis. -/// Itens consumíveis são itens de uso limitado. -/// </summary> -public abstract partial class ConsumableItem : Entity -{ - public ConsumableItem(Vector2I initialPosition, MapData map, EntityDefinition definition) : base(initialPosition, map, definition) - { - } - - /// <summary> - /// Gera uma ação onde o ator consome o item. - /// </summary> - /// <param name="consumer"></param> - /// <returns></returns> - public Action GetAction(Player consumer) - { - return new ItemAction(consumer, this); - } - - /// <summary> - /// Ativa a função deste item. - /// Este método é chamado pela ação gerada por ele mesmo. - /// Este método permite definir condições para a sua ativação. - /// </summary> - /// <param name="action">Ação gerada pelo item.</param> - /// <returns>Se a ação foi realizada ou não.</returns> - public abstract bool Activate(ItemAction action); - - public void ConsumedBy(Player consumer) { - Inventory inventory = consumer.inventory; - inventory.RemoveItem(this); - QueueFree(); - } -}
\ No newline at end of file diff --git a/scripts/entities/items/ConsumableItem.cs.uid b/scripts/entities/items/ConsumableItem.cs.uid deleted file mode 100644 index e6c452a..0000000 --- a/scripts/entities/items/ConsumableItem.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://hpppt5k743x diff --git a/scripts/entities/items/ConsumableItemDefinition.cs b/scripts/entities/items/ConsumableItemDefinition.cs deleted file mode 100644 index 74340d2..0000000 --- a/scripts/entities/items/ConsumableItemDefinition.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Godot; - -/// <summary> -/// Esta classe só existe para agrupar seus descendentes. -/// </summary> -[GlobalClass] -public abstract partial class ConsumableItemDefinition : EntityDefinition;
\ No newline at end of file diff --git a/scripts/entities/items/ConsumableItemDefinition.cs.uid b/scripts/entities/items/ConsumableItemDefinition.cs.uid deleted file mode 100644 index 9ddc0f6..0000000 --- a/scripts/entities/items/ConsumableItemDefinition.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dpdju2ucehsb0 diff --git a/scripts/entities/items/HealingConsumable.cs b/scripts/entities/items/HealingConsumable.cs deleted file mode 100644 index 2104693..0000000 --- a/scripts/entities/items/HealingConsumable.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Godot; - -public partial class HealingConsumable : ConsumableItem -{ - private HealingConsumableDefinition definition; - public float HealingPercentage { get; private set; } - public HealingConsumable(Vector2I initialPosition, MapData map, HealingConsumableDefinition definition) : base(initialPosition, map, definition) - { - this.definition = definition; - HealingPercentage = definition.healingPercentage; - } - - public override bool Activate(ItemAction action) - { - Player consumer = (Player) action.ThisActor; - int intendedAmount = (int)(HealingPercentage / 100 * consumer.MaxHp); - int recovered = consumer.Heal(intendedAmount); - - // Se não tinha o que curar, a ativação falhou. - if (recovered == 0) { - MessageLogData.Instance.AddMessage("Você já está saudável."); - return false; - } - MessageLogData.Instance.AddMessage($"Você consome {DisplayName} e recupera {recovered} de HP"); - ConsumedBy(consumer); - return true; - } -}
\ No newline at end of file diff --git a/scripts/entities/items/HealingConsumable.cs.uid b/scripts/entities/items/HealingConsumable.cs.uid deleted file mode 100644 index 8f8f942..0000000 --- a/scripts/entities/items/HealingConsumable.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ct20rmjhaukge diff --git a/scripts/entities/items/HealingConsumableDefinition.cs b/scripts/entities/items/HealingConsumableDefinition.cs deleted file mode 100644 index 2562e9e..0000000 --- a/scripts/entities/items/HealingConsumableDefinition.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Godot; - -[GlobalClass] -public partial class HealingConsumableDefinition : ConsumableItemDefinition { - ///<summary> - /// Porcentagem da vida do ator para restaurar. - ///</summary> - [ExportCategory("Item Mechanics")] - [Export] - public float healingPercentage = 10; -}
\ No newline at end of file diff --git a/scripts/entities/items/HealingConsumableDefinition.cs.uid b/scripts/entities/items/HealingConsumableDefinition.cs.uid deleted file mode 100644 index 2fd311d..0000000 --- a/scripts/entities/items/HealingConsumableDefinition.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b3qy4gtjfci14 |
