Index: src/map/ai/ai_char_normal.cpp =================================================================== --- src/map/ai/ai_char_normal.cpp (revision 4073) +++ src/map/ai/ai_char_normal.cpp (working copy) @@ -3015,15 +3013,17 @@ if (Action.reaction != REACTION_EVADE && Action.reaction != REACTION_PARRY) { - battleutils::HandleEnspell(m_PChar, m_PBattleTarget, &Action, i, WeaponDelay, damage); + battleutils::HandleEnspell(m_PChar, m_PBattleTarget, &Action, i, WeaponDelay, damage); + if( Action.additionalEffect == SUBEFFECT_NONE && rand()%100 < PWeapon->getModifier(MOD_ADDITIONAL_EFFECT) ) + luautils::OnAdditionalEffect(m_PChar, m_PBattleTarget, PWeapon, &Action); battleutils::HandleSpikesDamage(m_PChar, m_PBattleTarget, &Action, damage); - } + } + if (Action.speceffect == SPECEFFECT_HIT && Action.param > 0) Action.speceffect = SPECEFFECT_RECOIL; m_PChar->m_ActionList.push_back(Action); - // to catch high damage bugs if (damage > 8000) ShowError(CL_RED"Warning: %s did 8000+ melee damage, job = %u \n" CL_RESET, m_PChar->GetName(), m_PChar->GetMJob()); Index: src/map/lua/luautils.h =================================================================== --- src/map/lua/luautils.h (revision 4073) +++ src/map/lua/luautils.h (working copy) @@ -156,6 +156,8 @@ int32 SetDropRate(lua_State*); // Set drop rate of a mob setDropRate(dropid,itemid,newrate) int32 UpdateTreasureSpawnPoint(lua_State* L); // Update the spawn point of an Treasure int32 UpdateServerMessage(lua_State*); // update server message, first modify in conf and update + + int32 OnAdditionalEffect(CCharEntity* PAttacker, CBattleEntity* PDefender, CItemWeapon* PItem, apAction_t* Action); // for items with additional effects }; #endif //- _LUAUTILS_H - Index: src/map/lua/luautils.cpp =================================================================== --- src/map/lua/luautils.cpp (revision 4073) +++ src/map/lua/luautils.cpp (working copy) @@ -1442,6 +1442,61 @@ return 0; } +int32 OnAdditionalEffect(CCharEntity* PAttacker, CBattleEntity* PDefender, CItemWeapon* PItem, apAction_t* Action) +{ + int8 File[255]; + memset(File,0,sizeof(File)); + int32 oldtop = lua_gettop(LuaHandle); + + lua_pushnil(LuaHandle); + lua_setglobal(LuaHandle, "onAdditionalEffect"); + + snprintf(File, sizeof(File), "scripts/globals/items/%s.lua", PItem->getName()); + + if( luaL_loadfile(LuaHandle,File) || lua_pcall(LuaHandle,0,0,0) ) + { + ShowError("luautils::OnAdditionalEffect: %s\n",lua_tostring(LuaHandle,-1)); + lua_pop(LuaHandle, 1); + return -1; + } + + lua_getfield(LuaHandle, LUA_GLOBALSINDEX, "onAdditionalEffect"); + + if( lua_isnil(LuaHandle,-1) ) + { + ShowError("luautils::OnAdditionalEffect: undefined procedure onAdditionalEffect\n"); + lua_pop(LuaHandle, 1); + return -1; + } + + CLuaBaseEntity LuaBaseEntity(PAttacker); + Lunar::push(LuaHandle,&LuaBaseEntity); + + CLuaBaseEntity LuaMobEntity(PDefender); + Lunar::push(LuaHandle,&LuaMobEntity); + + if( lua_pcall(LuaHandle,2,LUA_MULTRET,0) ) + { + ShowError("luautils::OnAdditionalEffect: %s\n",lua_tostring(LuaHandle,-1)); + lua_pop(LuaHandle, 1); + return -1; + } + int32 returns = lua_gettop(LuaHandle) - oldtop; + if (returns < 3) + { + ShowError("luatils::OnAdditionalEffect (%s): 3 returns expected, got %d\n", File, returns); + lua_pop(LuaHandle, returns); + } + Action->additionalEffect = (SUBEFFECT)((uint8)lua_tonumber(LuaHandle,-3)); + Action->addEffectMessage = lua_tonumber(LuaHandle,-2); + Action->addEffectParam = lua_tonumber(LuaHandle,-1); + if( returns > 3 ) + { + ShowError("luautils::OnAdditionalEffect (%s): 3 returns expected, got %d\n", File, returns ); + lua_pop(LuaHandle, returns-3); + } + return 0; +} /************************************************************************ * * * Начало работы статус-эффекта. Возвращаемое значение 0 или номер * Index: sql/item_mods.sql =================================================================== --- sql/item_mods.sql (revision 4073) +++ sql/item_mods.sql (working copy) @@ -37,6 +37,7 @@ -- Contenu de la table `item_mods` -- +INSERT INTO `item_mods` VALUES(17605, 411, 100); INSERT INTO `item_mods` VALUES(11265, 1, 1); INSERT INTO `item_mods` VALUES(11266, 1, 1); INSERT INTO `item_mods` VALUES(11267, 1, 1); Index: src/map/modifier.h =================================================================== --- src/map/modifier.h (revision 4073) +++ src/map/modifier.h (working copy) @@ -441,13 +441,50 @@ MOD_WYVERN_BREATH =0x192, MOD_STEP_ACCURACY =0x193,// Bonus accuracy for Dancer's steps + MOD_MAG_BURST_BONUS =0x198, + MOD_EAT_RAW_FISH =0x199, // not implemented + MOD_EAT_RAW_MEAT =0x19A, // not implemented - MOD_MAG_BURST_BONUS =408, - MOD_EAT_RAW_FISH = 409, // not implemented - MOD_EAT_RAW_MEAT = 410 // not implemented + MOD_ADDITIONAL_EFFECT =0x19B // for items with an additional effect that needs calling +}; -#define MAX_MODIFIER 415 +#define MAX_MODIFIER 412 Index: scripts/globals/status.lua =================================================================== --- scripts/globals/status.lua (revision 4073) +++ scripts/globals/status.lua (working copy) @@ -37,6 +37,62 @@ STATUS_SHUTDOWN = 20; ----------------------------------- +-- These codes represent the subeffects for +-- additional effects animations from battleentity.h +----------------------------------- +--ATTACKS + SUBEFFECT_FIRE_DAMAGE = 1; -- 110000 3 + SUBEFFECT_ICE_DAMAGE = 2; -- 1-01000 5 + SUBEFFECT_WIND_DAMAGE = 3; -- 111000 7 + SUBEFFECT_EARTH_DAMAGE = 4; -- 1-00100 9 + SUBEFFECT_LIGHTNING_DAMAGE = 5; -- 110100 11 + SUBEFFECT_WATER_DAMAGE = 6; -- 1-01100 13 + SUBEFFECT_LIGHT_DAMAGE = 7; -- 111100 15 + SUBEFFECT_DARKNESS_DAMAGE = 8; -- 1-00010 17 + SUBEFFECT_SLEEP = 9; -- 110010 19 + SUBEFFECT_POISON = 10; -- 1-01010 21 + SUBEFFECT_PARALYSIS = 11; + SUBEFFECT_BLIND = 12; -- 1-00110 25 + SUBEFFECT_SILENCE = 13; + SUBEFFECT_PETRIFY = 14; + SUBEFFECT_PLAGUE = 15; + SUBEFFECT_STUN = 16; + SUBEFFECT_CURSE = 17; + SUBEFFECT_DEFENSE_DOWN = 18; -- 1-01001 37 + SUBEFFECT_SHIELD = 20; + SUBEFFECT_HP_DRAIN = 21; -- 1-10101 43 + SUBEFFECT_TP_DRAIN = 22; + SUBEFFECT_HASTE = 23; +--SPIKES + SUBEFFECT_BLAZE_SPIKES = 1; -- 01-1000 6 + SUBEFFECT_ICE_SPIKES = 2; -- 01-0100 10 + SUBEFFECT_DREAD_SPIKES = 3; -- 01-1100 14 + SUBEFFECT_CURSE_SPIKES = 4; -- 01-0010 18 + SUBEFFECT_SHOCK_SPIKES = 5; -- 01-1010 22 + SUBEFFECT_REPRISAL = 6; -- 01-0110 26 + SUBEFFECT_WIND_SPIKES = 7; + SUBEFFECT_STONE_SPIKES = 8; + SUBEFFECT_COUNTER = 63; +--SKILLCHAINS + SUBEFFECT_LIGHT = 1; + SUBEFFECT_DARKNESS = 2; + SUBEFFECT_GRAVITATION = 3; + SUBEFFECT_FRAGMENTATION = 4; + SUBEFFECT_DISTORTION = 5; + SUBEFFECT_FUSION = 6; + SUBEFFECT_COMPRESSION = 7; + SUBEFFECT_LIQUEFACATION = 8; + SUBEFFECT_INDURATION = 9; + SUBEFFECT_REVERBERATION = 10; + SUBEFFECT_TRANSFIXION = 11; + SUBEFFECT_SCISSION = 12; + SUBEFFECT_DETONATION = 13; + SUBEFFECT_IMPACTION = 14; + + SUBEFFECT_NONE = 0; + + +----------------------------------- -- These codes represent the actual status effects. -- They are simply for convenience. -----------------------------------