summaryrefslogtreecommitdiff
path: root/src/game-server/monstermanager.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-02-17Monsters no longer load their script filesErik Schilling1-6/+0
Before monsters loaded their script file on *each* spawn. This is rather wrong since the script state keeps growing for each monster. However all of this was unnessecary since the main.lua can simply require the script file. If you do not want to spam the main.lua (or any other file) with all the requires: I guess we can add script binds to iterate over all monsters and add some custom properties to the monsters.xml (See Mana-Mantis #356)
2013-01-08Added Vulnerabilities for monstersErik Schilling1-0/+7
You can now actually use the already used node in the monsters.xml Monsters can have different vulnerabillities against elements: <vulnerabillity element="earth" factor="2.0" /> This will double damage of the element earth to this monster.
2013-01-08Work on (Auto)Attack system.Erik Schilling1-70/+8
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
2012-08-06Allow monster name in <drop> tagErik Schilling1-3/+17
Reviewed-by: Stefan Beller.
2012-03-03Use callbacks for items, monsters and status effectsThorbjørn Lindeijer1-3/+2
Previously, global function names were defined in the respective XML definitions of items, monsters and status effects. This was reasonable when they all had the same state, but now they're sharing the single global Lua state. Now the Lua API provides access to the ItemClass, MonsterClass and StatusEffect instances, on which callbacks for both standard and custom events can be explicitly set. Reviewed-by: Erik Schilling
2012-02-02Added a way to specify the min and max attributes values.Yohann Ferreira1-3/+3
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
2012-01-02Made all beings capable of having a genderErik Schilling1-0/+5
Reviewed-by: o11c, bjorn, Bertram.
2011-10-20Return a const & from NameMap to avoid potential deep copiesThorbjørn Lindeijer1-1/+1
When I introduced NameMap it was only used with pointers, but now it is also used with std::string so it probably makes sense to keep a default- constructed value around so that a reference can be returned rather than a copy. NameMap::find was renamed to NameMap::value to make it more clear that it doesn't return an iterator, like std::map::find. Reviewed-by: Yohann Ferreira Reviewed-by: Ben Longbons
2011-09-28Clarified the role of initialize() and reload() functions in the monsterYohann Ferreira1-3/+4
and item managers. ack-by: o11c. note: The managers still need to auto deinit when already loaded. This will be done in another trivial commit.
2011-04-04Fixing reading of drop rate from monsters.xmlStefan Dombrowski1-2/+2
The xml gives the drop rate as a floating point number. Also added 0.5 for correct rounding. (Without it 0.7% calculates to 69.) Reviewed-by: Jaxad0127
2011-03-24Rely more on the functionality in XML::DocumentThorbjørn Lindeijer1-11/+3
By default XML::Document will use the ResourceManager to resolve the file name you pass to it. There is no point in disabling that functionality only to resolve it manually. Reviewed-by: Jared Adams
2011-03-24Use a map to quickly find items and monsters by their nameThorbjørn Lindeijer1-27/+21
Introduced a template class NameMap, which provides a nice API for mapping any custom types by their name. This change also makes any duplicate item or monster definitions be complete ignored, rather than being merged into the first definition. Reviewed-by: Philipp Sehmisch Reviewed-by: Yohann Ferreira
2011-03-20Renaming stuff to make the code more readableThorbjørn Lindeijer1-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
2011-03-17Micro-optimizations related to std::stringThorbjørn Lindeijer1-1/+2
* Rely on the fact that a std::string is empty by default * Use std::string::empty() rather than comparing to "" * Construct with std::string() rather than from "" Reviewed-by: Bertram
2011-03-16Allowed monster names in @spawn commandPhilipp Sehmisch1-0/+21
I rewrote the @spawn command to allow two new things: 1. The monster ID can be replaced with the name of the monster. 2. The amount of monsters can be omitted. In that case a single monster is spawned. Reviewed by: Jaxad and Thorbjorn
2011-02-24Fixing dead born monstersStefan Dombrowski1-2/+5
Reviewed-by: Bertram
2011-01-30Made the code tell a bit more when a monster is lacking values.Yohann Ferreira1-14/+30
2011-01-30Trivial code format fixes in monstermanager.cpp.Yohann Ferreira1-28/+45
2011-01-30Added the missing Magical dodge monster property.Yohann Ferreira1-0/+2
Now this can be loaded with the 'magic-evade' xml tag.
2011-01-30Made the monsters' attributes compute fine again.Yohann Ferreira1-5/+8
As a consequence, the monsters can spawn again. Reviewed-by: Freeyorp.
2010-11-14Renamed .hpp files into .h for consistency.Yohann Ferreira1-6/+6
Also added an header to the autoattack.{h,cpp} files. Big but trivial fix.
2010-10-22Made the servers check for positive id in xml db loading.Yohann Ferreira1-8/+29
Also fixed a memleak when loading an invalid monster attack. Resolves: Mana-Mantis #215. Reviewed-by: Thorbjorn.
2010-10-17Dehardcode the tileWidth and height, except for the speed conversion.Yohann Ferreira1-1/+1
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.
2010-07-10New attribute system and major changes to many low-level areas.Freeyorp1-44/+44
Attribute system: Structure is no longer completely hardcoded. Attributes and structure is defined by new xml file (defaulting to stats.xml) Structure defines non-base modifications to an attribute, to be used by modifiers from items, effects, etc. Calculating the base value for core attributes is still done in C++ (and for such fundamental elements the only reason I can think of to do it any other way is perhaps being able to quickly change scripts without a compile could be useful for testing, but such things are a low priority anyway) Item structure: Modifiers are now through triggers rather than single events. This also removes hardcoded types - an item could be both able to be equipped and be able to be activated. Item activation no longer consumes by default, this must be specified by the property <consumes /> inside the trigger. Currently only attribute modifications, autoattacks, and consumes are defined as effects, but stubs for others do exist. Autoattacks are currently non-functional, and this should be rectified with some urgency. Auto Attacks: AutoAttacks are now separate entities, though not fully complete, nor fully integrated with all beings yet. Integration with the Character class is urgent, integration with other Being children less so. When fully integrated this will allow for multiple autoattacks, through equipping multiple items with this as an equip effect or even through other means if needed. Equipment structure: As ItemClass types are no longer hardcoded, so too are equip types. An item have multiple ways to be equipped across multiple equipment slots with any number in each slot. Character maximums are global but configurable. Miscellaneous: Speed, money, and weight are now attributes. Some managers have been changed into classes such that their associated classes can have them as friends, to avoid (ab)use of public accessors. The serialise procedure should also be set as a friend of Character (both in the account- and game- server) as well; having public accessors returning iterators is simply ridiculous. Some start for such cleanups have been made, but this is not the primary focus here. Significant work will need to be done before this is resolved completely, but the start is there. BuySell::registerPlayerItems() has been completely disabled temporarily. The previous function iterated through equipment, yet in the context I think it is intended to fill items? I have been unable to update this function to fit the modifications made to the Inventory/Equipment/Possessions, as I am unsure what exactly what it should be doing. ItemClass::mSpriteId was previously unused, so had been removed, but I notice that it was used when transmitting equipment to nearby clients. Experimentation showed that this value was never set to anything other than 0, and so has been left out of the ItemManager rewrite. I am not entirely sure what is happening here, but it should be worth looking into at a later time, as I am not sure how equipment appearences would be sent otherwise.
2010-06-06Arbitrary cleanups and marked GameHandler::getClientByNameSlow constThorbjørn Lindeijer1-3/+2
2010-05-30Use XML::Document to automate memory cleanupThorbjørn Lindeijer1-27/+8
Makes the code a little nicer.
2010-05-29Only skip the UTF-8 BOM for Lua scriptsThorbjørn Lindeijer1-2/+1
libxml2 should be able to handle files with a BOM fine. Reviewed-by: Bertram
2010-05-28Added some more log infos, and made small cleanups.Yohann Ferreira1-18/+22
Reviewed-by: Thorbjorn, Jaxad0127
2010-05-16Changed and split up the default location for loading dataThorbjørn Lindeijer1-3/+3
Instead of loading data from a 'data' directory in the current working directory, the server now uses clientDataPath and serverDataPath as specified in the configuration. This removes the need to set up symbolic links in order to merge these two types of data. The default values point to example/clientdata and example/serverdata, where a minimal example world can be developed to make setting up an initial server quick and easy. The XML::Document convenience class was copied over from the client. Also, the ResourceManager is now shared between both servers, since the account client is reading items.xml. Reviewed-by: Jared Adams
2010-04-25Added a Byte Order Mask (BOM) filter to the ResourceManager.Bertram1-1/+2
Reviewed by: Jaxad0127
2010-02-07Update Copyright date for Manaserv.Bertram1-1/+1
2009-12-06Fixed name of the project in copyright headersThorbjørn Lindeijer1-7/+6
Also updated the headers to refer to the GPL by URL instead of suggesting to contact the FSF by snail mail, as per the latest GPL usage instructions.
2009-10-26Added optional optimal level mechanic which reduces exp gain of certain ↵Philipp Sehmisch1-0/+1
sources after a certain skill level.
2009-10-15Speed code unification part 1: Made the server accept speed values in tiles ↵Bertram1-7/+5
per second.
2009-10-09Synced the protocol file with client in protocol.h, letting other defines in ↵Bertram1-1/+0
defines.h, and removing some overheading along the way.
2009-09-23added script functions for monster attacksPhilipp Sehmisch1-0/+1
2009-09-17Added the possibility to define a monster script for a whole monster class ↵Philipp Sehmisch1-0/+6
in monsters.xml
2009-08-20Removed remnants of attack zones. Monsters AI now works properly again.Philipp Sehmisch1-7/+1
2009-04-26Standardize on the position of the const keywordBjørn Lindeijer1-1/+1
Same as for the client.
2008-11-16Got rid of CVS/Subversion $Id$ markersBjørn Lindeijer1-2/+0
2008-09-27Implemented getting the attack zone of weapons from the item database and ↵Philipp Sehmisch1-2/+7
implemented single target attacks useful for projectile weapons like bows.
2008-08-13Don't ignore monster with ID 0, since our maggot uses that.Bjørn Lindeijer1-2/+2
2008-02-21Moved the functions which translate strings into enumerations from the XML ↵Philipp Sehmisch1-1/+23
library into the item and monstermanager modules and reimplemented them using std::maps.
2008-02-20Implemented different monster attacks read from monsters.xmlPhilipp Sehmisch1-0/+43
2008-02-13Implemented monster mutation.Philipp Sehmisch1-1/+11
2008-02-12Movement speed in monsters.xml is now interpreted as pixels per second ↵Philipp Sehmisch1-3/+3
instead of tiles per second.
2008-02-11Implemented getting size and speed from monster.xmlPhilipp Sehmisch1-2/+18
2008-02-07arts of monster behavior are now read from monsters.xml.Philipp Sehmisch1-3/+19
2008-02-06Exp reward for killing monsters is now read from monster database.Philipp Sehmisch1-0/+11
2008-02-06obeying "80 characters per row" coding style rule.Philipp Sehmisch1-10/+21