Index: scripts/globals/abilities/call_wyvern.lua =================================================================== --- scripts/globals/abilities/call_wyvern.lua (revision 3266) +++ scripts/globals/abilities/call_wyvern.lua (working copy) @@ -13,6 +13,8 @@ function OnAbilityCheck(player,target,ability) if (player:getPet() ~= nil) then return MSGBASIC_ALREADY_HAS_A_PET,0; + elseif(player:hasStatusEffect(EFFECT_SPIRIT_SURGE) == true) then + return MSGBASIC_UNABLE_TO_USE_JA,0; else return 0,0; end Index: scripts/globals/abilities/jump.lua =================================================================== --- scripts/globals/abilities/jump.lua (revision 3266) +++ scripts/globals/abilities/jump.lua (working copy) @@ -14,4 +14,10 @@ end; function OnUseAbility(player, target, ability) + -- Under Spirit Surge, Jump also decreases target defense by 20% for 60 seconds + if(player:hasStatusEffect(EFFECT_SPIRIT_SURGE) == true) then + if(target:hasStatusEffect(EFFECT_DEFENSE_DOWN) == false) then + target:addStatusEffect(EFFECT_DEFENSE_DOWN, 20, 0, 60); + end + end end; \ No newline at end of file Index: scripts/globals/abilities/spirit_surge.lua =================================================================== --- scripts/globals/abilities/spirit_surge.lua (revision 0) +++ scripts/globals/abilities/spirit_surge.lua (working copy) @@ -0,0 +1,36 @@ +----------------------------------- +-- Ability: Spirit Surge +----------------------------------- + +require("scripts/globals/status"); + +----------------------------------- +-- OnUseAbility +----------------------------------- + +function OnAbilityCheck(player,target,ability) + -- The wyvern must be present in order to use Spirit Surge + if (target:getPet() == nil) then + return MSGBASIC_REQUIRES_A_PET,0; + else + return 0,0; + end +end; + +function OnUseAbility(player, target, ability) + -- Spirit Surge gives a Strength boost dependant of DRG level + local strBoost = 0; + if(target:getMainJob()==JOB_DRG) then + strBoost = (1 + target:getMainLvl()/5); -- Use Mainjob Lvl + elseif(target:getSubJob()==JOB_DRG) then + strBoost = (1 + target:getSubLvl()/5); -- Use Subjob Lvl + end + + -- Spirit Surge lasts 60 seconds, or 20 more if Wyrm Mail+2 is equipped + local duration = 60; + if(target:getEquipID(SLOT_BODY)==10683) then + duration = duration + 20; + end + + target:addStatusEffect(EFFECT_SPIRIT_SURGE, strBoost, 0, duration); +end; \ No newline at end of file Index: scripts/globals/effects/spirit_surge.lua =================================================================== --- scripts/globals/effects/spirit_surge.lua (revision 3266) +++ scripts/globals/effects/spirit_surge.lua (working copy) @@ -1,7 +1,7 @@ ----------------------------------- -- +-- EFFECT_SPIRIT_SURGE -- --- ----------------------------------- ----------------------------------- @@ -9,6 +9,34 @@ ----------------------------------- function onEffectGain(target,effect) + -- TODO: The dragoon's MAX HP increases by (25% of wyvern MAXHP) + -- local petMaxHP = target:getPet():getMaxHP(); + -- ... but there's no LUA function to change MAX HP ... + + -- The dragoon is healed by wyvern's remaining HP + local petHP = target:getPet():getHP(); + target:addHP(petHP); + + -- The wyvern's current TP is transfered to the dragoon + local petTP = target:getPet():getTP(); + target:addTP(petTP); + + -- The wyvern is "absorbed" into the dragoon (Call Wyvern will not allow a resummon during the effect) + target:getPet():despawnPet(); + + -- All Jump recast times are reset + target:resetAbilityRecast(158); -- Jump + target:resetAbilityRecast(159); -- High Jump + target:resetAbilityRecast(160); -- Super Jump + + -- The dragoon gets a Strength boost relative to his level + target:addMod(MOD_STR,effect:getPower()); + + -- The dragoon gets a 50 Accuracy boost + target:addMod(MOD_ACC,50); + + -- The dragoon gets 25% Haste (256/1024, see http://wiki.bluegartr.com/bg/Job_Ability_Haste for haste calculation) + target:addMod(MOD_HASTE_ABILITY,256); end; ----------------------------------- @@ -23,4 +51,14 @@ ----------------------------------- function onEffectLose(target,effect) + -- TODO: The dragoon's MAX HP returns to normal (when the MAXHP boost in onEffectGain() gets implemented) + + -- The dragoon loses the Strength boost + target:delMod(MOD_STR,effect:getPower()); + + -- The dragoon loses the 50 Accuracy boost + target:delMod(MOD_ACC,50); + + -- The dragoon loses 25% Haste + target:delMod(MOD_HASTE_ABILITY,256); end; \ No newline at end of file Index: src/map/battleutils.cpp =================================================================== --- src/map/battleutils.cpp (revision 3266) +++ src/map/battleutils.cpp (working copy) @@ -3604,6 +3604,9 @@ ((CMobEntity*)PVictim)->PEnmityContainer->LowerEnmityByPercent(PAttacker , enmityReduction, NULL); } + // Under Spirit Surge, High Jump lowers the target's TP proportionately to the amount of damage dealt (TP is reduced by damage * 2) + if (tier == 2 && PAttacker->StatusEffectContainer->HasStatusEffect(EFFECT_SPIRIT_SURGE)) + PVictim->addTP(-(totalDamage * 2)); // try skill up (CharEntity only) if (PAttacker->objtype == TYPE_PC) Index: src/map/lua/lua_baseentity.cpp =================================================================== --- src/map/lua/lua_baseentity.cpp (revision 3266) +++ src/map/lua/lua_baseentity.cpp (working copy) @@ -5490,6 +5490,28 @@ } /*************************************************************** + Resets the caller's ability recast time for the specified RecastID + INPUT: + The RecastID of the ability to make available +****************************************************************/ +inline int32 CLuaBaseEntity::resetAbilityRecast(lua_State *L) +{ + DSP_DEBUG_BREAK_IF(m_PBaseEntity == NULL); + DSP_DEBUG_BREAK_IF(lua_isnil(L,-1) || !lua_isnumber(L,-1)); + + // Only reset for players + if(m_PBaseEntity->objtype == TYPE_PC){ + CCharEntity* PChar = (CCharEntity*)m_PBaseEntity; + + PChar->PRecastContainer->Del(RECAST_ABILITY, lua_tointeger(L,-1)); + + PChar->pushPacket(new CCharSkillsPacket(PChar)); + } + return 0; +} + + +/*************************************************************** Attempts to register a BCNM or Dynamis instance. INPUT: The BCNM ID to register. OUTPUT: The instance number assigned, or -1 if it's all full. @@ -6877,6 +6899,7 @@ LUNAR_DECLARE_METHOD(CLuaBaseEntity,addAllSpells), LUNAR_DECLARE_METHOD(CLuaBaseEntity,getMeleeHitDamage), LUNAR_DECLARE_METHOD(CLuaBaseEntity,resetRecasts), + LUNAR_DECLARE_METHOD(CLuaBaseEntity,resetAbilityRecast), LUNAR_DECLARE_METHOD(CLuaBaseEntity,bcnmRegister), LUNAR_DECLARE_METHOD(CLuaBaseEntity,bcnmEnter), LUNAR_DECLARE_METHOD(CLuaBaseEntity,bcnmLeave), Index: src/map/lua/lua_baseentity.h =================================================================== --- src/map/lua/lua_baseentity.h (revision 3266) +++ src/map/lua/lua_baseentity.h (working copy) @@ -367,6 +367,7 @@ int32 openDoor(lua_State*); // открываем дверь int32 hideNPC(lua_State*); // hide an NPC int32 resetRecasts(lua_State*); // Reset recasts for the caller + int32 resetAbilityRecast(lua_State*); // Resets the caller's ability recast time for the specified RecastID int32 addCP(lua_State*); // Add CP int32 getCP(lua_State*); // Get CP