Skip to content

Potion System

Vladyslav Vytrykush edited this page Jul 14, 2026 · 1 revision

Potion System

The Potion System manages all consumable items in Adventure-Game. Potions provide temporary or immediate effects that modify the player's statistics, restore resources, or grant special bonuses. Unlike weapons and armor, potions are consumed upon use and are removed from the player's inventory after their effect has been applied.

The system is designed to be flexible and easily expandable, allowing new potion types and effects to be introduced without modifying the existing architecture. By inheriting from the common Item base class, potions integrate seamlessly with the Inventory System while maintaining their own specialized behavior.


Table of Contents


Overview

Potions are consumable items that temporarily or permanently affect the player's statistics.

Unlike equipment, potions are not worn or equipped. Instead, they are activated directly from the inventory, immediately applying their effects to the Character.

The Potion System is responsible for:

  • Creating potion objects
  • Storing potion properties
  • Applying effects to the player
  • Removing consumed potions
  • Displaying potion information

Potions can be obtained through:

  • Loot chests
  • Random item generation
  • Starting inventory (future)
  • Quest rewards (future)
  • Merchants (future)

Potion Architecture

Potions inherit from the common Item base class.

classDiagram

Item <|-- Potion

Character --> Potion

MyInventory --> Potion

Chest --> Potion
Loading

This architecture allows potions to be stored alongside other items while maintaining unique behavior when used.


Potion Properties

Each potion contains several properties that define its behavior.

Property Description
Name Display name of the potion.
Effect Type Determines which statistic is affected.
Effect Value Amount added or restored.
Value Gold value of the potion.
Is Buff Indicates whether the effect is positive.
Description Short explanation of the potion's purpose.

Each potion object manages its own information independently.


Potion Types

Adventure-Game currently supports several categories of potions.

Potion Type Description
Health Potion Restores health points.
Strength Potion Temporarily increases strength.
Defense Potion Temporarily increases defense.
Agility Potion Temporarily increases agility.
Intelligence Potion Temporarily increases intelligence.
Gold Potion Grants additional gold.

Additional potion types can easily be added in future versions.

Examples include:

  • Mana Potion
  • Experience Potion
  • Luck Potion
  • Speed Potion
  • Critical Hit Potion
  • Resistance Potion
  • Poison Potion
  • Regeneration Potion

Potion Effects

Every potion modifies one or more character attributes.

Current supported effects include:

Effect Description
Health Restores lost health.
Strength Increases attack power.
Defense Improves defensive capabilities.
Agility Improves movement-related statistics.
Intelligence Increases intelligence.
Gold Rewards the player with additional currency.

Effects are applied directly to the Character object after the potion is consumed.


Using Potions

Potions are activated from the inventory.

The general process is shown below.

Open Inventory
        │
        ▼
Select Potion
        │
        ▼
Check Potion Type
        │
        ▼
Apply Effect
        │
        ▼
Remove Potion
        │
        ▼
Update Character Statistics

Unlike equipment, potions disappear after being used.


Potion Lifecycle

The following diagram illustrates the lifecycle of a potion.

flowchart TD

GeneratePotion --> Inventory

Inventory --> SelectPotion

SelectPotion --> ApplyEffect

ApplyEffect --> Character

ApplyEffect --> RemovePotion

RemovePotion --> Inventory
Loading

Every potion exists only until it has been consumed.


Active Effects

Some potion effects may persist beyond the moment they are consumed.

The Character class stores these temporary modifications as Active Effects.

Examples include:

  • Increased Strength
  • Increased Defense
  • Increased Agility
  • Increased Intelligence

Each active effect contains information such as:

  • Effect Type
  • Effect Value
  • Buff or Debuff
  • Duration (planned)

Future versions will introduce timed effects that automatically expire after a certain number of turns or actions.


Applying Effects

Each potion applies its effect directly to the Character.

Example flow:

flowchart LR

Potion --> Character

Character --> UpdateStatistics

UpdateStatistics --> DisplayNewStats
Loading

This approach keeps the Potion class focused on item behavior while allowing the Character to manage its own statistics.


Displaying Potion Information

When viewing a potion, the player can inspect important information.

Displayed properties include:

  • Name
  • Effect Type
  • Effect Value
  • Gold Value
  • Description

Providing clear information helps players decide the best time to use each potion.


Relationships with Other Systems

The Potion System interacts with several gameplay systems.

flowchart LR

Chest --> Potion

Potion --> Inventory

Inventory --> Potion

Potion --> Character

Character --> ActiveEffects
Loading

Potions are generated by the Chest System, stored in the Inventory, and applied to the Character.


Design Decisions

Several architectural decisions influenced the Potion System.

Inheritance

Potions inherit from the abstract Item class.

This allows every potion to be stored inside the inventory using the same interface as weapons and armor.


Immediate Consumption

Unlike equipment, potions are removed after use.

This keeps inventory management simple and reflects traditional RPG mechanics.


Independent Effect Processing

The Potion class determines what effect should occur.

The Character class determines how statistics are updated.

Separating these responsibilities improves modularity and maintainability.


Expandable Effect System

New potion effects can be added without modifying the inventory or equipment systems.

Only the Potion and Character classes require updates when introducing new effect types.


Future Improvements

The Potion System has been designed with future expansion in mind.

Planned additions include:

  • Timed potion effects
  • Cooldown mechanics
  • Stackable potions
  • Potion rarity
  • Brewing and crafting
  • Poison and antidotes
  • Area-of-effect potions
  • Permanent stat boosters
  • Regeneration effects
  • Resistance potions
  • Mana and energy systems
  • Visual effect indicators
  • Potion recipes

The modular architecture allows these features to be integrated while keeping the existing implementation clean and maintainable.


Summary

The Potion System provides Adventure-Game with a flexible framework for consumable items. By combining reusable object-oriented design with independent effect processing, potions integrate naturally with the Character and Inventory systems while remaining easy to extend.

As the project grows, the Potion System will support increasingly advanced mechanics such as timed buffs, crafting, resistance effects, and additional consumable item categories, further enriching the gameplay experience.

Clone this wiki locally