adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] On item slots and equipping items


From: Alexandre Courbot
Subject: Re: [Adonthell-devel] On item slots and equipping items
Date: 12 Mar 2003 20:59:36 +0100

Here are my notes about it (sorry if this is out of date or redundant -
I replied the mails in the train, and had the choice either to read the
other mails or to code this evening - I chosen the second! ;)) No time
neither to run the tests, sorry. Good news is the backend thing is
starting to work and I get nice ideas for the rest. But back to the
topic.

> Equippable items will need a (list) of slots they may go in. That way,
> we can automatically determine where an item should go when equipping it
> and can also take care that items only go into the proper slot. So a
> weapon would go into the "Weapon" slot, while a ring might go into
> either "Left Ring" or "Right Ring" slots, etc.

How about using slots classes? What I'm saying here also probably
applies to other fields (thinking about items and combining). Python has
high introspection capabilities. It is for exemple capable (AFAIK, need
to definitely check) to know whether an object is of a certain class or
is derived from a class). Say we have a Python hierarchy of items. Sword
derives from Weapon. During a usage/combinaison test, we should be able
to check whether the object is of class "Weapon" by simply using normal
Python functions. This could also apply to slots. Say there is a "Ring"
abstract slot class, from which "Left Ring" and "Right Ring" derives.
Instead of having to explicitely list the two slots rings can be
equipped to, we could simply say they equip to anything that is of class
"Ring". That way, we could really dynamically add new rings classes.

Actually, this is a bad example. The correct way to do it would be to
have a "Ring" class with "Left Ring" and "Right Ring" not being 
derived classes, but instances of "Ring". The test would work as well.

The character class could then contain a hash-map of slots which return
the corresponding objects. Then it'd be easy to test their class, to
equip them and to add/remove them. The UI would simply list all the
available slots ans their name and let the user choose where to equip
what, and report the result.

> Another thing worth mentioning is that the character carrying an item
> and the character equipping it need not be the same. If we want, we
> could limit this somewhat in the inventory GUI. For example, we could
> check whether a path no longer than N units exists between the two
> characters.

This should be limited at the lowest-possible level, methinks. It'd not
be fair if a player could be more things just because he twiddled his
client.

Alex.
-- 
http://www.gnurou.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]