|
RpgGame
Console Based RPG game in C#
|
Represents an abstract base class for all equippable weapons. More...
Public Member Functions | |
| bool | TryEquipToLeft (Player player) |
| Attempts to equip the weapon in the player's left hand. | |
| bool | TryEquipToRight (Player player) |
| Attempts to equip the weapon in the player's right hand. | |
| virtual string | GetDescription () |
| Returns a short textual description of the weapon. | |
| bool | OnPickup (Player player, Inventory inventory) |
| Handles pickup interaction for the weapon. | |
| void | OnDrop (Level level, Player player) |
| Drops the weapon onto the current level at the player's position. | |
Protected Member Functions | |
| Weapon (HandOccupation occupation) | |
| Initializes a new instance of the Weapon class with the specified hand occupation strategy. | |
Properties | |
| string | Name [get] |
| Gets the display name of the weapon. | |
| ConsoleColor | color [get] |
| Gets the console color used to render the weapon on the map. | |
| char | Symbol [get] |
| Gets the character symbol used to render the weapon on the map. | |
| int | Damage [get] |
| Gets the damage value dealt by the weapon. | |
Properties inherited from RpgGame.Items.IItem | |
Represents an abstract base class for all equippable weapons.
The Weapon class implements IEquippable and delegates equipment behavior to a HandOccupation strategy object. This design allows different weapons to define whether they occupy one or both hands without using type checks or enumerations.
Concrete weapon types must provide their own name, symbol, and damage value.
|
inlineprotected |
Initializes a new instance of the Weapon class with the specified hand occupation strategy.
| occupation | The strategy that determines how the weapon is equipped (e.g., one-handed or two-handed). |
|
virtual |
Returns a short textual description of the weapon.
Implements RpgGame.Items.IItem.
Drops the weapon onto the current level at the player's position.
| level | The current level. |
| player | The player dropping the weapon. |
Implements RpgGame.Items.IItem.
Handles pickup interaction for the weapon.
| player | The player picking up the weapon. |
| pickUpLeft | Indicates whether the pickup action targets the left hand. If false, the weapon attempts to equip in the right hand. |
Implements RpgGame.Items.IItem.
| bool RpgGame.Items.Weapon.TryEquipToLeft | ( | Player | player | ) |
Attempts to equip the weapon in the player's left hand.
| player | The player attempting to equip the weapon. |
Implements RpgGame.Items.IEquippable.
| bool RpgGame.Items.Weapon.TryEquipToRight | ( | Player | player | ) |
Attempts to equip the weapon in the player's right hand.
| player | The player attempting to equip the weapon. |
Implements RpgGame.Items.IEquippable.
|
getabstract |
Gets the console color used to render the weapon on the map.
Implements RpgGame.Items.IItem.
|
getabstract |
Gets the display name of the weapon.
Implements RpgGame.Items.IItem.
|
getabstract |
Gets the character symbol used to render the weapon on the map.
Implements RpgGame.Items.IItem.