summaryrefslogtreecommitdiffstats
path: root/src/game-server/being.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Simplified BeingComponent::updateDirectionThorbjørn Lindeijer2013-04-251-73/+6
| | | | Same as in the client.
* Fixed uninitialised variable warning in valgrindErik Schilling2013-04-121-0/+1
|
* Moved Actor into an ComponentErik Schilling2013-04-121-52/+31
| | | | This was the final step to remove the hierachy with Entity on the top.
* Converted Being into a ComponentErik Schilling2013-04-111-99/+146
| | | | | | I did not really care too much about staying consistent with the use of static_casts to Actors since they are only temporary anyway until Actor is a component too.
* Converted the Character class into a componentErik Schilling2013-04-111-0/+2
| | | | | A CharacterData was created as a proxy class in order to allow using the old serialization method.
* Moved the Monster class to a ComponentErik Schilling2013-04-031-0/+7
| | | | | | | Things done: - Allowed to create new Attributes outside of the protected scope of Being - Moved Monster to MonsterComponent - Some minor cleanup in the Attribute setting code of monsters
* Moved fighting code into a componentErik Schilling2013-04-021-156/+15
| | | | | | | | | | | | | | | | | | | | | | | | | All damage dealing is now handeled via CombatComponent. Monsters use a derived MonsterCombatComponent since they can have a damage mutation and have a seperate script callback. The wirering with Being is still not optional since most of the stuff does not exist as components. Things done: - Seperated the fighting code from Being and only let Characters and Monsters add the Component (less overhead for npcs) - Added a getter for Attribute values to prevent searching it all the time in non Being members - Fixed the type if the damage mutation to double (no idea why it was int) I did not want to copy it over incorrectly - Removed the addAttack/removeAttack overrides in Character and made the knuckleAttack being added based on newly added signals Future TODOS: - Remove depedency on Being as soon all needed dependencies are available as components of Entity - Move the monster script callback into the general combatcomponent and make it usuable for characters too
* Changed NPC to an NpcComponent added to a BeingThorbjørn Lindeijer2013-03-251-0/+2
|
* Introduced Script::ContextErik Schilling2013-02-211-4/+2
| | | | | | | | This should allow to finally call functions to lua without having to care about working around situations where a lua call causes a c++ call which needs to call to lua again. Tested against the source of tales repository data.
* Moved attribute (re)calculation to the scriptsErik Schilling2013-02-041-45/+39
| | | | | | | | | | | | | | | | | | | | | | This introduces two callbacks: - on_update_derived_attribute -> Called to recalculate other derived attributes. - on_recalculate_base_attribute -> Called to recalculate a base attribute (only called for characters. However the function passed as callback can be useful for recalculating the derived attributes as well) Monsters no longer block recalculation of attributes except HP and Speed. I saw no sense to keep this. Fixed constant value in libmana-constants.lua Dropped bool type of the recalculation functions. It would be difficult to keep it while pushing all to the script engine and it was unused anyway. All in all this adds a LOT more flexibillity to projects since they can now adapt all attributes in the way they want.
* Added emote support.Yohann Ferreira2013-02-011-1/+10
|
* Silenced some eclipse warningsErik Schilling2013-01-291-0/+1
|
* Replaced EventListener with signals based on libsigc++Thorbjørn Lindeijer2013-01-091-17/+10
| | | | | | | | | | | | | This replaces the rather hard to understand event dispatcher with a probably even harder to understand templated library, but fortunately we can rely on the available documentation. Hopefully it will also help with the readability of our code and with adding additional signals to other classes. Added libsigc++ to README and Travis CI configuration. Reviewed-by: Erik Schilling
* Replaced 'unsigned int' with 'unsigned'Thorbjørn Lindeijer2013-01-091-10/+10
| | | | Same thing, but shorter.
* Work on (Auto)Attack system.Erik Schilling2013-01-081-16/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the implementation bjorn and I agreed to limit the number of attacks that can be used in the same tick to one. This makes a lot of stuff easier and the client cannot display two frames at the same time Things done: - Implemented setting of attacks when equipping/unequipping items - Single place where the xml attack node is parsed - Finished attack logic - Unified the attack handling of monsters and characters - Added a global cooldown after attack use (not only for next use of same attack) - Removed the temponary attributes for the monster attack values - Priorities for all attacks - Rewrote the attack core: - Attacks now have this attributes: - warmup -> time a attack needs after starting it to actually deal the damage - cooldown -> time a attack needs after dealing damage before another attack can be used - reuse -> time before the same attack can be used again - If no attack is performed at the moment the following is done: - make a list with all ready attacks - check for attack that has the necessarily range and highest priority - start this attack (inform client about it) - when warmup is finished -> trigger damage - when cooldown is finished -> allow to use other (or the same if reusetimer allows) attacks TODO: - sync client with this to allow better timed animations
* Rename AutoAttack to AttackErik Schilling2013-01-081-1/+1
|
* Correct updating the old position of beings.Stefan Beller2012-08-051-4/+4
| | | | | Reviewed-by: bjorn acked-by: Ablu
* Introduced a Timeout class for counting down without countingThorbjørn Lindeijer2012-04-141-45/+4
| | | | | | | | The timeout remembers a reference point of time against which it can check how much time is remaining. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
* Renamed Thing to EntityThorbjørn Lindeijer2012-04-041-1/+1
| | | | | | | | In preparation for using an entity/component system for the entities in the game world, this name will be more recognizable and easier to talk about. Reviewed-by: Yohann Ferreira
* Some general cleanups and merged Being::perform() into update()Thorbjørn Lindeijer2012-03-261-3/+5
| | | | | | | | The main change here is to remove the separate calling of 'perform' on all beings, and rather rely on the beings to do whatever they were doing in that function when the virtual 'update' function is called. Reviewed-by: Yohann Ferreira
* Fixed remaining compiler warningsThorbjørn Lindeijer2012-03-161-1/+1
| | | | | | | These were unused parameters and one return type with an ignored 'const' qualifier. Reviewed-by: Yohann Ferreira
* Fixed bug with erasing the last status effectThorbjørn Lindeijer2012-02-281-3/+9
| | | | | | | It's not nice to use ++ on an iterator that may be std::map::end(), in my case this caused it to hang indefinitely. Reviewed-by: Yohann Ferreira
* Prevent calculating movement of being further if it does not moveErik Schilling2012-02-271-0/+4
| | | | Reviewed-by: bjorn.
* Added a way to specify the min and max attributes values.Yohann Ferreira2012-02-021-2/+2
| | | | | | | | | This can now be done in attributes.xml through the minimum and maximum attribute parameters. I also changed the AttributeInfo struct as requested by bjorn. Reviewed-by: Erik Schilling, Thorbjørn Lindeijer
* Made all beings capable of having a genderErik Schilling2012-01-021-0/+5
| | | | Reviewed-by: o11c, bjorn, Bertram.
* Removed inappropriate assignment to mOld in Being::findPathThorbjørn Lindeijer2011-10-191-5/+7
| | | | | | | | | | | | Being::findPath doesn't change the position of a being, and so should not be syncing mOld to the current position. When invoked on the wrong moment, this could cause MapComposite::update to fail to realize that a being has moved into another zone. Also removed some other usages of mOld that were not necessary, to make its purpose clearer and make a potential cleanup easier. Reviewed-by: Yohann Ferreira
* Fixed autoattacks basic handling.Yohann Ferreira2011-06-241-0/+4
| | | | | | | | | | | | | | | | The server is now using the autoattacks system to perform damage based on the attack's timer. I also added a default bare knuckle attack when the character is unequipped. As a result, maggots can be killed again with bare hands now. Known issues left: This isn't tested against equipment changes for now, and the client isn't in sync with the attacks speed. Reviewed-by: Crush.
* Added of precised some info I found very useful while debugging.Yohann Ferreira2011-04-171-5/+20
| | | | Reviewed-by: Jaxad0127.
* Removed useless calls to updateDerivedAttributes().Yohann Ferreira2011-04-171-1/+0
| | | | | | The setAttribute() already takes care of updating them. Reviewed-by: Jaxad0127.
* Fix beings raw speed calculation when obtaining the TPS speed.Yohann Ferreira2011-04-171-1/+6
| | | | | | The bug made the monsters unable to move. Reviewed-by: Jaxad0127.
* Fixed crash on first map updateThorbjørn Lindeijer2011-04-151-0/+12
| | | | | | | | | | | | The crash happened when it was trying to move an NPC from its old zone to its new zone. The old zone was based on the old position, which was (0,0). That crashed since its zone didn't match its old position, but its new one. This fix makes sure to update the old position to be in sync with the zone, by resetting it after being inserted into the MapComposite. Reviewed-by: Yohann Ferreira
* Renaming stuff to make the code more readableThorbjørn Lindeijer2011-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | SCOPE_TYPES -> ScopeType (plural was confusing) ATTR_BEING -> BeingScope ATTR_CHAR -> CharacterScope ATTR_MOD -> MonsterScope ATTR_MAX -> MaxScope AttributeScopes -> AttributeScope (A single scope seems to include multiple lists of attributes. Seems wrong to me to name this type in plural form.) getAttributeInfoForType -> getAttributeScope (just naming it after what it is actually returning) Reviewed-by: Freeyorp
* Moved defines.h and manaserv_protocol.h into 'common'Thorbjørn Lindeijer2011-03-201-1/+1
| | | | Just seems a bit more organized to me.
* Eliminated one version of Being::performAttackThorbjørn Lindeijer2011-03-151-11/+11
| | | | | There was a version taking an attack range, but the range was always the same as the one specified in the Damage class.
* Revert "Fixed the money handling."Jared Adams2011-01-301-5/+0
| | | | | | This reverts commit b2209cbe93aa12dcd4e4e3b9a7cd8b13ed5713e9. Money should be handled through attributes, not magic numbers.
* Fixed the money handling.Yohann Ferreira2011-01-311-0/+5
| | | | | - At character's attributes recalculation when necessary. - In the lua scripting functions.
* Made the being direction be updated only at the end of the movement.Yohann Ferreira2011-01-221-3/+3
| | | | | | | This saves a bit of cpu and make use of pixel points where tile points where used before and could lead to discrepancies. Reviewed-by: Thorbjorn.
* Made the servers report their protocol version.Yohann Ferreira2011-01-111-2/+2
| | | | | | | | | | | | | As the protocol version isn't something the maintainers should set, I removed the net_clientVersion irrelevant option, replaced by the corresponding define PROTOCOL_VERSION in the manaserv_protocol.h file. A corresponding change in the client will be made. N.B.: Now, the Enet version is also reported in the log. Reviewed-by: Jaxad.
* Fix being direction discrepancies by syncing the BeingDirection.Yohann Ferreira2011-01-091-6/+94
| | | | | | | | | The server was actually using the bitmask enum while the the client still sent another one, creating discrepancies. A second problem is that the being direction was not properly initialized and not updated while it was moving. Reviewed-by: Jaxad.
* Removed the superfluous point struct.Yohann Ferreira2011-01-091-2/+3
| | | | | | | | It was too close from the Position class and it leads to making the server handle one or another type through the code. Still bugged me many times while making changes. Reviewed-by: Jaxad.
* Get rid of the server tick magic number.Yohann Ferreira2011-01-061-4/+4
| | | | Reviewed-by: CodyMartin.
* Change Actor::mActionTime to mMoveTime member to reflect more its actual use.Yohann Ferreira2011-01-031-8/+8
| | | | Trivial.
* Cleaned up and document a bit more the speed conversion functions.Yohann Ferreira2011-01-031-1/+2
| | | | Trivial fix.
* Moved parts needing to be in sync with the client in protocol.h.Yohann Ferreira2010-12-291-4/+4
| | | | Trivial fix.
* Fix many compiler warnings.Freeyorp2010-12-081-1/+1
| | | | Reviewed-by: Bertram
* Renamed .hpp files into .h for consistency.Yohann Ferreira2010-11-141-11/+11
| | | | | | Also added an header to the autoattack.{h,cpp} files. Big but trivial fix.
* Fully shift being scope attributes into being.Freeyorp2010-11-041-4/+66
| | | | | | Also split updateDerivedAttributes and remove the calc check workaround. Reviewed-by: Bertram.
* Dehardcode the tileWidth and height, except for the speed conversion.Yohann Ferreira2010-10-171-14/+23
| | | | | | | | The speed conversion needs a standard tile length anyway and can be improved later once the movement code will start to handle beings size. Reviewed-by: Crush.
* Get rid of some unneeded direct calls to setBase for attributes.Freeyorp2010-10-171-8/+5
| | | | | | | setAttribute should be used for this, which also calls updateDerivedAttributes as needed. Reviewed-by: Bertram
* Reordered the manaserv.xml.example file and made related code cleanups.Yohann Ferreira2010-09-151-7/+18
| | | | Reviewed-by: Thorbjorn.