> cat /wizhelp/wizcoding3
========================================================================
MUD Coding Tutorial - Part 3
========================================================================
Creating weapons, armor, and consumables.
WEAPON EXAMPLE:
```python
# /lib/objects/weapons/flame_blade.py
from lib.models.objects import Weapon
def load():
return Weapon(
name="flame blade",
description="This sword burns with eternal fire.",
damage=45,
weight=12,
value=800
)
```
ARMOR EXAMPLE:
```python
# /lib/objects/armor/dragon_scale.py
from lib.models.objects import Armor
def load():
return Armor(
name="dragon scale vest",
description="Scales shimmer with inner heat.",
armor_class=8,
weight=25,
value=1200,
wear_slot="body"
)
```
CONSUMABLE - Healing:
```python
from lib.models.objects import Consumable
class MegaHeal(Consumable):
def __init__(self):
super().__init__(
name="Mega Heal [500]",
description="Powerful healing elixir.",
heal_amount=500,
charges=1,
value=1000
)
def load():
return MegaHeal()
```
SPECIAL ITEM - Teleporter:
```python
class Teleporter(Consumable):
def __init__(self):
super().__init__(
name="Teleporter",
command_name="tele",
destinations={
'arena': 'backbone_arena',
'shop': 'backbone_shop',
'entrance': 'backbone_1'
}
)
def use(self, player, destination):
if destination in self.destinations:
player.move(self.destinations[destination])
return True, f"You teleport to {destination}!"
return False, "Unknown destination."
```
PLACING IN ROOMS:
```python
def load():
room = Room(...)
# Clone existing object
sword = game_state.object_loader.create_object('battle_sword')
room.inventory.add_item(sword)
# Create money
from lib.special_rooms import MoneyObject
money = MoneyObject(1000)
room.inventory.add_item(money)
return room
```
Continue with help wizcoding4
========================================================================
>
_