summaryrefslogtreecommitdiff
path: root/src/map/mob.c
AgeCommit message (Collapse)AuthorFilesLines
2014-10-25HPM Hooks UpdateHercules.ws1-12/+12
Signed-off-by: HerculesWSAPI <Hercules@efficiently.awesome>
2014-10-25Sight Blaster and other skill fixes, magic reflect, crash, trap display and ↵Michieru1-11/+15
monster behavior fixes - Fixed cast time of Sightrasher in pre-renewal (700ms -> 500ms) - Official Sight Blaster behavior (bugreport:6945, partially bugreport:144) * Sight Blaster's AoE is now 3x3 even in pre-renewal (it was originally larger so it hits traps before they trigger) * Sight Blaster will now prevent traps from triggering as long as they are knocked back * Fixed a bug that caused Sight Blaster to not work on traps and ice walls at all * Sight Blaster will no longer expire when the attack was reflected * Sight Blaster will now expire when hitting an ice wall * Sight Blaster will now properly protect you from being attacked from its AoE range - Sight, Ruwach and Sight Blaster will now check for a target every 20ms (previously every 250ms) - Step action will now be canceled when being knocked back (skills won't be executed anymore when knocked out of range) - When knock back magic is reflected it will no longer lead to the caster being knocked back (related to bugreport:6945) - Activated traps can no longer be hit - Fixed a problem that left "trap ghosts" forever on the screen when a trap was knocked out of the screen - Monster behavior fixes * Monsters will no longer be able to do normal attacks when hiding * If out of any reason a monster on "attack" state can't move and can't do normal attacks, it will now use "attack" state skills * The order of monster thought processing is now equal to official servers - Fixed some potential map server crashes Mega thanks to Playtester (rathena b88e95381d6a7)
2014-10-18Fix bug:7454Michieru1-18/+9
* Official Icewall implementation and other fixes - Reverted all the icewall-related changes done in SVN r15777 and following as testing shows they aren't official and are actually pretty exploitable (bugreport:7412) - Instead implemented the official icewall characteristic that monsters can only leave an icewall cell to the west or south, the changes include: * The "sight" path check no longer checks for the current cell so standing on an icewall allows you to see/attack into any direction * The path finding will still ignore the current cell as before but the walk routine will not allow to walk east or north while standing on an icewall cell * This leads monsters in the situation where they go through an AI loop not allowing them to escape the icewall (if their target is north or east of them) * Monster in this situation will use idle skills and if they get attacked will use their rudeattacked skills if available, similar to traps like Spiderweb * Added a configuration icewall_walk_block that allows to configure how long a monster should go through the AI loop before the server allows it any movement, this "safety" system is official and seems to equal about 75 AI loops; if you want to disable the whole icewall system so that monsters don't get stuck in icewall at all, just set this to 0 * Here are videos from jRO showing how this system works: http://ragdo.blog56.fc2.com/blog-entry-763.html - Implemented the official calculation for "direction"; now you will be considered horizontal/vertical/diagonally aligned with a target cell in the exact same way as on official servers, this is for example used to determine whether an icewall or a firewall should be horizontal, vertical or diagonal; the only thing that is still unofficial is the default direction (officially always "west"); effectively now there are more situations considered diagonal than before - Further cleanups on the idle skill use code for immobile monsters and monsters near a player but without a target (now skill using will always go via mob_unlocktarget) * This also fixes that monsters switched to idle mode and start to use idle skills one second too late Mega thanks to Playtester (rathena 5540d89cb0e)
2014-10-13* Monster skill use behavior, ranges, position lag fixesMichieru1-36/+42
- Updated monster skill use behavior so monsters use skills the same way and at the same rhythm as official servers (bugreport:009326), the changes include: * Unified the "monster can't move by default" and the "monster trapped" code as it really should behave exactly the same * Fixed a bug that caused the "monster skill use" routine to be called 20 times more often than it should in some situations * When a monster attacks you and you run away from it, the monster will now check if it has a ranged skill on "attack" state before switching to chase state * Monsters will now always do a normal attack before using "attack" state skills * Fixed a bug that caused monsters to switch to idle mode and never use their chase skills when they get hit continuously * Changed default for skillrange_from_weapon from 30 (all but player) to 0 (none); monsters will now use all skills at the skill range and not at their own attack range, if they get tanked from farther away than skill range, they won't use these skills - Updated ranges to work as on official servers (bugreport:009326), the changes include: * Implemented new functions "check_distance_client" and "distance_client", that instead of the server-sided square range system use the circular one that the client uses; these functions should be used for units that send their commands via the client (players mostly) * Applied the new distance algorithm to some player-specific range checks, players will now have a circular attack range that reflects their attack range on the client; this makes it impossible to hack the client for more diagonal range * Removed the arbitrary +1 range bonus at range checks; as monsters now react fluently, they won't need it anymore, that means a monster with for example 4 attack range will now only attack targets within a 9x9 area around it, the moment you step out of this area, the attacks will stop (if the monster can move it will follow you); as for players, the extra cell attack range when on a linear line to the target now is integrated into the distance algorithm, that means a player with attack range 4 can attack from 5 cells away when directly on line with a monster, but no longer diagonally as range is circular for players now * Implemented a new "step action" feature to reflect official chase range behavior; when an attack or skill is used inside the attack range, it will act exactly as now, the skill is used once the signal from the client was received; however, if an attack or skill is used outside the attack range, the player should move into the chase area which is 1 cell inside the attack range border; the client actually sends us where to use the attack / skill from, but previously we just dropped that information the moment an attack request came; now instead of stopping the player instantly on an attack request, the player will continue moving to the target cell and then automatically use the command received earlier (it will be remembered); this change was absolutely necessary as the client sends the attack request slightly before attack range is reached, execution on official servers only takes place on every full cell moved; the new system copies this behavior - Implemented an improved hit-lock system (bugreport:007460), the changes include: * MVPs are no longer immune to being stopped by a hit unless they used Endure * When hitting any unit, it will stop for its "dMotion" interval, exactly at the end of "dMotion" it will continue walking (official behavior); this helps getting more "move" packets to be displayed * The unit that was hit will be immune to being stopped for another "dMotion" interval, this allows to slow down any units by hitting them frequently, but makes it almost impossible to completely stop them forever (depends a lot of ASPD and dMotion value); this does not affect special hit-lock properties (some skills and events should set delay anyway) * The unit that was hit will no longer be "pulled" to the next cell; this caused a lot of position lag, it should be much better now * Random walking, monster target dropping - Implemented official behavior for random walking of monsters (bugreport:9340) * Updated the interval between walks from 3-6 seconds to 4-5 seconds * Added a define MIN_RANDOMWALKTIME that is now used anywhere the interval is applied so it's easier to change * Monsters will no longer attempt to walk to the cell they are currently standing on (note: still requires a proper "no cell stacking" implementation) * Monsters will only target a cell within a 15x15 area around them - Moved the "mob_ai" 0x008 configuration setting to mob_unlocktarget, so it applies to all cases of monsters unlocking targets - Cleaned up the unit_stop_attack and unit_stop_stepaction functions * unit_stop_attack now makes sure that the target is always set to 0, even if no attack timer currently exists * replaced several calls of unit_set_target that set target to 0 with unit_stop_attack, this is important because the attack timer should always be deleted at the same time the target is set to 0 * this also fixes the problem that caused monsters to sometimes drop their target after an attack * Minor monster walk and skill use fixes - Fixed a bug that caused monsters to never use their idle skills even if the define MOB_LAZYSKILLPERC was set * The default value of the define is now 100% for spotted mobs and 0% for non-spotted mobs as on official servers - Monsters now use complex path searching for their random walk, so they can also walk around corners now (OFFICIAL_WALKPATH still applies!) - Fixed spotted monsters using their "walk" skills even if nobody is on the map - Monsters will no longer stop when using "walk" skills (they are supposed to be used while walking) * Monster idle skills, chase, final cleanups - Spotted monsters will now use their idle skills even if no players are on the map * This is official behavior and allows them to metamorph and heal up even if nobody is on the map * I originally had concerns about the performance, but as the dynamic mobs option is enabled by default and set to 5 minutes, monsters will only stay "spotted" for 5 minutes when nobody is on the map anyway, this doesn't cost much extra performance - Increased chase range of monsters by 2 * Tested this thoroughly and the effective chase range is actually 2 cells larger than listed in the "Range3" column * Special thanks to ultramage and Michieru for helping me testing this - Some final cleanups in the unit_stop_attack and unit_stop_stepaction functions * Special thanks to icxbb-xx for pointing these out Super ultra mega thanks to Playtester (rAthena 2c86ee435670168,ebd3dc97bc7e,f3916c1baf1,b1330a4c6,c2377c8f54,464dd4586380)
2014-10-02* Rewrote the hard monster AI. Monsters will now behave a lot closer to ↵Michieru1-30/+36
official servers: * Monsters will now attack immediately when they are chasing a target and it comes into attack range (bugreport:7370) * Monsters will now chase their target during their aDelay, but they still have to wait for aMotion to be able to move again (bugreport:9269) * Monsters will now rethink their chase in a configurable interval (see monster_chase_refresh in monster.conf), official value is once per cell, previously it was once per 3 cells * Monsters will now stop when they rethink their chase and their target is gone (player hides or target loot was picked), regardless of the monster_ai setting (note: if you want the old, stupid behavior, just increase monster_chase_refresh instead) Thanks to Playtester (rathena: cfef8a0088c3)
2014-09-20Replaced hardcoded values with constants for status_change_start's flagHaru1-1/+2
- Please use the values from enum scstart_flag when calling status_change_start or related functions. - This also applies to the sc_start script commands. Signed-off-by: Haru <haru@dotalux.com>
2014-09-16Follow: ↵Michieru1-3/+3
https://github.com/HerculesWS/Hercules/commit/8ab61745b81d1cf0602c7998f590aac8749187da This fixed all mob size problem :) Fix estin estun not working properly (bug:7891)
2014-08-07Corrected several format-string errors through the codeHaru1-4/+4
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
2014-07-08Removed redundant data from guardian_data, saving up to 40 bytes per ↵panikon1-53/+40
guardian (10240 bytes total)
2014-06-17Fixed issue where a crash would occur in mobs with MD_RANDOMTARGET, issue: ↵panikon1-2/+5
8231 http://hercules.ws/board/tracker/issue-8231-server-received-crash-signal/
2014-05-30Fixed typos inside src/Shido1-12/+12
2014-05-29Implemented MD_RANDOMTARGET, see doc/mob_db_mode_list.txt for more informationpanikon1-7/+19
2014-05-13Removed trailing whitespace (sources)Haru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Re-commit of "Fixed order of includes in all source files"Haru1-33/+36
This reverts commit 94657284973f4037596bae468ebfbee5c217e02b.
2014-05-10Revert "Fixed order of includes in all source files"panikon1-36/+33
This reverts commit b6b3f58795288701d0e162d43fa6f0a47af913b3. Fixes issue 8184 http://hercules.ws/board/tracker/issue-8184-cart-related/
2014-05-09Fixed order of includes in all source filesHaru1-33/+36
- Changed order according to the (upcoming) code style guidelines. - Fixes several issues caused by missing headers when their include order is changed or in plugins. Signed-off-by: Haru <haru@dotalux.com>
2014-02-27Cleaned up messages.confHaru1-1/+1
- Removed some unused messages. - Re-mapped some duplicate IDs - fixes bugreport:8057, thanks to AnnieRuru http://hercules.ws/board/tracker/issue-8057-jobname-with-invalid-id-return-tomb/ - Fixed some issues with the message range loaded by the char server. - Reworded some messages, fixed typos in others. Note for translation users: some messages have been remapped to new IDs. You'll need to remap them in your custom translations as well. The list of changes is as follows: - Removed messages (you can safely remove them from your translations): 15, 26-27, 35, 48-52, 57-58, 65-69, 82-83, 86-87, 91, 101, 140-142, 164, 189-194, 199-200, 202-203, 209-211, 215-218, 267-268, 275, 289-290, 380-385, 387-388, 401, 497, 499, 535-537, 922, 995, 1063, 1079, 1291-1294 - New messages (you need to add them to your translations): 15 - Moved messages (you need to change their IDs in your translations file): * [Unknown Job] 656 -> 620, * [Job names] 681~693 -> 656~668 * [Tombstone related] 656~661 -> 856~861 * [Etc messages] 662~680 -> 862~880 * [@version] 1436 -> 1294 * [Hercules Chat] 1475 -> 1436 Signed-off-by: Haru <haru@dotalux.com>
2014-02-22Changed function types related to SG days in date.cpanikon1-2/+2
Changed types in clif.c: bool clif_setip -> map:ip_set, map: char_ip_set changed as well bool clif_setbindip bool clif_send bool clif_spawn void clif_homskillinfoblock bool clif_sub_guild_invite Note that return values of those types have changed, so if any modification uses their return values it should be changed. clif_disp_onlyself replaced as a macro clif_viewequip_fail replaced as a macro Merged clif_skillup and clif_guild_skillup as they were using the same packet Added packet_len() values in clif_updatestatus
2014-02-14sc sourcesshennetsind1-6/+6
Signed-off-by: shennetsind <ind@henn.et>
2014-02-14Renewal mechanics rebalance mega-updateMichieru1-3/+4
- More info on the forums, at http://hercules.ws/board/topic/4428-michierus-renewal-update/ Signed-off-by: Haru <haru@dotalux.com>
2014-02-11Fixed bug 7977 as in rAthena revf488861298d50afb41f8418700ae164e63bee070panikon1-1/+1
2014-02-09Improved script case check reports to include more accurate source info.Haru1-0/+6
- Fixes bugreport:8013, thanks to Dastgir Pojee http://hercules.ws/board/tracker/issue-8013-script-add-str-problem/ Signed-off-by: Haru <haru@dotalux.com>
2014-01-18Socket interfacedshennetsind1-1/+1
We designed this one with having as little changes required elsewhere in mind, thus the way most socket-related things are called has not changed. Plugins may now take a greater advantage of the socket features. Signed-off-by: shennetsind <ind@henn.et>
2014-01-11Hercules 1st 2014 MegaPatchshennetsind1-2/+2
http://hercules.ws/board/topic/3886-hercules-1st-2014-megapatch/ Signed-off-by: shennetsind <ind@henn.et>
2013-12-17Speed up of several procedures that rely on ERS, _mreallocz ('z'ero)shennetsind1-2/+1
Made Possible Thanks to the Woonderful Haruna! <3 Commit also fixes an inconsistency in the ERS, where it'd start with clear memory but would use garbage upon resizing, also implements a new ERS option that clears entries as soon as pass by ers_free, so that they'll be all shinny for when ers_alloc reuses them. Signed-off-by: shennetsind <ind@henn.et>
2013-12-17Fixed several compiler warningsHaru1-9/+10
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
2013-12-09Fixed some logic errorsshennetsind1-1/+1
Special Thanks to Haru Signed-off-by: shennetsind <ind@henn.et>
2013-12-04Follow-up to 6e9c385b8fa2fbca97ca23e35f0b8e5dabd13526Haru1-8/+14
- Case-sensitive AegisName and Sprite ID lookups are now optional, controlled by the case_sensitive_aegisnames battle config flag (you can set it to "no" to restore the case insensitive behavior.) - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-12-01Changed item Aegis ID and mob Sprite ID lookups to case sensitive.Haru1-3/+3
Signed-off-by: Haru <haru@dotalux.com>
2013-11-30Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-1/+1
2013-11-29Minor improvementshennetsind1-30/+29
pc_checkitem is now triggered by @reloaditemdb to ensure modified conditions are respected, also a performance boost that causes the itemlist/cartlist/storagelist/gstoragelist lookups to only be triggered on demand instead of on every teleport. Closes #219 Fixed ancient monster ai bug that caused mobs to consider themselves elegible targets, which would waste status_check_skilluse and battle_check_target calls. Signed-off-by: shennetsind <ind@henn.et>
2013-11-29Corrected an uninitialized variable when adding an itemHaru1-1/+1
- The .favorite field of newly added inventory items wasn't correctly initialized to zero, potentially causing data loss (fixes bugreport:7854, thanks to Vincent, GrumpyPanda). Signed-off-by: Haru <haru@dotalux.com>
2013-11-27Fixed Bug 7858shennetsind1-0/+8
Official item drop announce support, currently hardcoded list -- we'll be following up shortly with a decent way of storing it. Special Thanks to Yommy, Beret, kyeme. http://hercules.ws/board/tracker/issue-7858-monster-rare-drop-announcement/ Signed-off-by: shennetsind <ind@henn.et>
2013-11-27Dropped emperium spawn restrictionsshennetsind1-3/+9
Thanks to kyeme for bringing it to our attention. Signed-off-by: shennetsind <ind@henn.et>
2013-11-26Fixed Bug 7794shennetsind1-0/+13
monster's healing now refreshes their hp bar accordingly. Special Thanks to Beret. http://hercules.ws/board/tracker/issue-7794-healing-in-monsters/ Signed-off-by: shennetsind <ind@henn.et>
2013-11-19Sanitized and improved several macros through the codeHaru1-1/+1
- Sanitized all potentially unsafe macros (related eA:15259) - Improved some function-like macros to evaluate their argument only once and keep it in a temporary variable. This improves performance in the damage calculation related code. Signed-off-by: Haru <haru@dotalux.com>
2013-11-18Corrected size-related constant names and cleaned up comments (closes #222).Mumbles1-3/+3
2013-11-08Added support for monster spritename constantsHaru1-0/+11
- Follow-up to 124ab2a1cdb344f24170a4d91f7000ebabf39b40 - Replaced numeric IDs in NPC definitions and setnpcdisplay calls with the appropriate constants - Made possible thanks to Ind Signed-off-by: Haru <haru@dotalux.com>
2013-11-06Merge remote-tracking branch 'upstream/master'shennetsind1-9/+17
Signed-off-by: shennetsind <ind@henn.et> Conflicts: src/map/pc.c
2013-11-06Merge pull request #217 from HerculesWS/script-checkershennetsind1-6/+14
Introducing the Hercules Standalone Script Syntax Checker
2013-11-06Modified status_calc_shennetsind1-3/+3
Replaces the previous 'first' flag with a multi-option flag capable of selectively determining calls where the recalculation must not be hold by delayed damage, and therefore must take place immediately. This fixes issues caused by actions that require immediate recalculation e.g. on-level-up max_hp update, also modified @baselevel where status_calc was being called after the heal and not before, causing it not to be fully healed. Special Thanks to Haruna! <3 Signed-off-by: shennetsind <ind@henn.et>
2013-11-05Introducing the Hercules Standalone Script Syntax CheckerHaru1-6/+14
- Added a command line argument '--script-check' to check a script's syntax without running the server (and without requiring a SQL connection). Usage: ./map-server --script-check /path/to/the/script.txt - For convenience, a script-checker bash script is provided, to set the path correctly when called from a different directory. Usage: /path/to/Hercules/script-checker /path/to/the/script/to/check.txt - While the script checker will supposedly work under windows as well, no convenience scripts are currently provided for platforms other than UNIX (feel free to open a pull request with a .bat launcher or whatever you like) - Integration with IDEs or text editors is possible. In fact, I already have a fully functional plugin for vim (through vim-syntastic), and if there's enough interest, I'll publish it. - screenshot: http://d.pr/i/NOBD - If you want an online checker, http://haru.ws/scriptchecker/ is running this code, without modifications and will be kept up to date (without any warranty though.) - Special thanks to Ind, Yommy, Streusel, who helped making this possible, in a way or another.
2013-10-30Account-wide Exp/Drop/Death Modifiersshennetsind1-0/+6
Attempting to mimic the official as suggested in http://hercules.ws/board/topic/250-official-vip-system/ The variables can be read and modified thru scripting as well as sql, the patch introduces 3 new pc-arams 'ModExp','ModDrop' and 'ModDeath' for that purpose. The OnLogin modifier display is not the real deal though -- wasn't able to get it to output properly (though that might have been my client files failt) Up for review. Signed-off-by: shennetsind <ind@henn.et>
2013-10-26Changed 'tick' variables to 64 bitHaru1-45/+36
- This fixes an issue with timers that stop working after about 24-49 days when the tick overflows (note that this may happen much earlier than that, and at hard to predict times, on some systems) - Updated the RDTSC help message in the configure script to also warn users about issues with SpeedStep enabled systems. - On Windows, tick() still has a resolution of 10~15ms (or even as low as 100ms on some systems). A TODO comment (thanks, Ai4rei) was added for a follow-up patch, as I want this one to be as small as possible) - Note: on Windows versions earlier than 6.x (Vista, Server 2008), the tick overflow issue is NOT fixed, since they don't support the function used to retrieve a 64 bit tick. This isn't a big issue, since those platforms are already - or going soon to be - out of their extended support period, and it's already advisable to upgrade, for other reasons. If you're the unfortunate user of such a system, it is recommended that you reboot your machine at least once every 49 days for Hercules to work reliably. - Note: To clear some doubts, since I've already been asked, this has absolutely NOTHING to do with 32/64 bit CPUs or OSes. It's all about a variable's size, not the size of registers of your CPU, and your 32bit CPU will be able to handle this just fine. Signed-off-by: Haru <haru@dotalux.com>
2013-10-02HPM: Map.c Completedshennetsind1-44/+44
Fully Interfaced. Moved missing vars and declarations of interest into the interface, removed duplicate mentions of map within calls to shorten wherever it made sense to. Ladies and Gentleman its my pleasure to announce that with this commit we've revised all of map-server, we've learned a hell lot from this, improved many things on the go and have a number of features to be released thanks to this. *cough* hpm hooking *cough*. Signed-off-by: shennetsind <ind@henn.et>
2013-09-28Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-1/+1
2013-09-28HPM: pc.c Completedshennetsind1-4/+4
Moved missing vars and declarations of interest into the interface. Signed-off-by: shennetsind <ind@henn.et>
2013-09-27Corrected mob_warpslave_sub call with CLR_TELEPORT instead of CLR_RESPAWN.cannelle1-1/+1
2013-09-27HPM: Skill.c Completedshennetsind1-4/+4
Moved missing vars and declarations of interest into the interface. Signed-off-by: shennetsind <ind@henn.et>
2013-09-27Renamed iMap interface to mapHaru1-155/+127
Signed-off-by: Haru <haru@dotalux.com>