Brooch jewel effects.

This commit is contained in:
MobiusDev 2016-12-24 14:06:20 +00:00
parent f4a18e1403
commit 0a2fb60ddd
10 changed files with 209 additions and 10 deletions

View File

@ -121,7 +121,15 @@ public class BeastSoulShot implements IItemHandler
if (!pet.isChargedShot(ShotType.SOULSHOTS))
{
pet.setChargedShot(ShotType.SOULSHOTS, true);
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Ruby lvl 3 or higher
if (activeOwner.getActiveRubyJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, activeOwner.getActiveRubyJewel().getEffectId(), 1, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
}
}
@ -130,7 +138,15 @@ public class BeastSoulShot implements IItemHandler
if (!s.isChargedShot(ShotType.SOULSHOTS))
{
s.setChargedShot(ShotType.SOULSHOTS, true);
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Ruby lvl 3 or higher
if (activeOwner.getActiveRubyJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, activeOwner.getActiveRubyJewel().getEffectId(), 1, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
}
});
return true;

View File

@ -123,7 +123,15 @@ public class BeastSpiritShot implements IItemHandler
if (!pet.isChargedShot(shotType))
{
pet.setChargedShot(shotType, true);
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Sapphire lvl 3 or higher
if (activeOwner.getActiveShappireJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, activeOwner.getActiveShappireJewel().getEffectId(), 2, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(pet, pet, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
}
}
@ -132,7 +140,15 @@ public class BeastSpiritShot implements IItemHandler
if (!s.isChargedShot(shotType))
{
s.setChargedShot(shotType, true);
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Sapphire lvl 3 or higher
if (activeOwner.getActiveShappireJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, activeOwner.getActiveShappireJewel().getEffectId(), 2, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(s, s, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
}
});
return true;

View File

@ -101,7 +101,17 @@ public class BlessedSpiritShot implements IItemHandler
{
activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED);
}
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Sapphire lvl 3 or higher
if (activeChar.getActiveShappireJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, activeChar.getActiveShappireJewel().getEffectId(), 1, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
return true;
}
}

View File

@ -113,7 +113,16 @@ public class SoulShots implements IItemHandler
{
activeChar.sendPacket(SystemMessageId.YOUR_SOULSHOTS_ARE_ENABLED);
}
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Ruby lvl 3 or higher
if (activeChar.getActiveRubyJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, activeChar.getActiveRubyJewel().getEffectId(), 1, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
return true;
}
}

View File

@ -101,7 +101,17 @@ public class SpiritShot implements IItemHandler
{
activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED);
}
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
// Visual effect change if player has equipped Sapphire lvl 3 or higher
if (activeChar.getActiveShappireJewel() != null)
{
Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, activeChar.getActiveShappireJewel().getEffectId(), 1, 0, 0), 600);
}
else
{
skills.forEach(holder -> Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, holder.getSkillId(), holder.getSkillLevel(), 0, 0), 600));
}
return true;
}
}

View File

@ -0,0 +1,56 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.enums;
/**
* @author Mobius
*/
public enum BroochJewel
{
RUBY_LV3(38857, 17815, 0.075),
RUBY_LV4(38858, 17816, 0.125),
RUBY_LV5(38859, 17817, 0.2),
SHAPPHIRE_LV3(38929, 17819, 0.075),
SHAPPHIRE_LV4(38930, 17820, 0.125),
SHAPPHIRE_LV5(38931, 17821, 0.2);
private int _itemId;
private int _effectId;
private double _bonus;
private BroochJewel(int itemId, int effectId, double bonus)
{
_itemId = itemId;
_effectId = effectId;
_bonus = bonus;
}
public int getItemId()
{
return _itemId;
}
public int getEffectId()
{
return _effectId;
}
public double getBonus()
{
return _bonus;
}
}

View File

@ -76,6 +76,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SkillData;
import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.AdminTeleportType;
import com.l2jmobius.gameserver.enums.BroochJewel;
import com.l2jmobius.gameserver.enums.CastleSide;
import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.ChatType;
@ -711,6 +712,9 @@ public final class L2PcInstance extends L2Playable
private final Map<Integer, CubicInstance> _cubics = new ConcurrentSkipListMap<>();
/** Active shots. */
protected Set<Integer> _activeSoulShots = ConcurrentHashMap.newKeySet();
/** Active Brooch Jewels **/
private BroochJewel _activeRubyJewel = null;
private BroochJewel _activeShappireJewel = null;
public final ReentrantLock soulShotLock = new ReentrantLock();
@ -8650,6 +8654,26 @@ public final class L2PcInstance extends L2Playable
_activeSoulShots.clear();
}
public BroochJewel getActiveRubyJewel()
{
return _activeRubyJewel;
}
public void setActiveRubyJewel(BroochJewel jewel)
{
_activeRubyJewel = jewel;
}
public BroochJewel getActiveShappireJewel()
{
return _activeShappireJewel;
}
public void setActiveShappireJewel(BroochJewel jewel)
{
_activeShappireJewel = jewel;
}
private ScheduledFuture<?> _taskWarnUserTakeBreak;
public EnumIntBitmask<ClanPrivilege> getClanPrivileges()
@ -13870,5 +13894,4 @@ public final class L2PcInstance extends L2Playable
addStatusUpdateValue(StatusUpdateType.MAX_CP);
addStatusUpdateValue(StatusUpdateType.CUR_CP);
}
}

View File

@ -39,6 +39,7 @@ import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.BroochJewel;
import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.enums.ItemSkillType;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
@ -388,6 +389,11 @@ public abstract class Inventory extends ItemContainer
{
player.sendPacket(new SkillCoolTime(player));
}
if ((item.getItem().getBodyPart() == L2Item.SLOT_BROOCH_JEWEL) || (item.getItem().getBodyPart() == L2Item.SLOT_BROOCH))
{
updateActiveBroochJewel(player);
}
}
@Override
@ -471,6 +477,49 @@ public abstract class Inventory extends ItemContainer
{
player.handleAutoShots(Config.ENABLE_AUTO_SHOTS);
}
if ((item.getItem().getBodyPart() == L2Item.SLOT_BROOCH_JEWEL) || (item.getItem().getBodyPart() == L2Item.SLOT_BROOCH))
{
updateActiveBroochJewel(player);
}
}
private void updateActiveBroochJewel(L2PcInstance player)
{
// Update active Ruby jewel.
if ((player.getInventory().getItemByItemId(BroochJewel.RUBY_LV5.getItemId()) != null) && (player.getInventory().getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
{
player.setActiveRubyJewel(BroochJewel.RUBY_LV5);
}
else if ((player.getInventory().getItemByItemId(BroochJewel.RUBY_LV4.getItemId()) != null) && (player.getInventory().getItemByItemId(BroochJewel.RUBY_LV4.getItemId()).isEquipped()))
{
player.setActiveRubyJewel(BroochJewel.RUBY_LV4);
}
else if ((player.getInventory().getItemByItemId(BroochJewel.RUBY_LV3.getItemId()) != null) && (player.getInventory().getItemByItemId(BroochJewel.RUBY_LV5.getItemId()).isEquipped()))
{
player.setActiveRubyJewel(BroochJewel.RUBY_LV3);
}
else
{
player.setActiveRubyJewel(null);
}
// Update active Sapphire jewel.
if ((player.getInventory().getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()) != null) && (player.getInventory().getItemByItemId(BroochJewel.SHAPPHIRE_LV5.getItemId()).isEquipped()))
{
player.setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV5);
}
else if ((player.getInventory().getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()) != null) && (player.getInventory().getItemByItemId(BroochJewel.SHAPPHIRE_LV4.getItemId()).isEquipped()))
{
player.setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV4);
}
else if ((player.getInventory().getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()) != null) && (player.getInventory().getItemByItemId(BroochJewel.SHAPPHIRE_LV3.getItemId()).isEquipped()))
{
player.setActiveShappireJewel(BroochJewel.SHAPPHIRE_LV3);
}
else
{
player.setActiveShappireJewel(null);
}
}
}

View File

@ -862,7 +862,12 @@ public final class Formulas
// Bonus Spiritshot
final double shotsBonus = attacker.getStat().getValue(Stats.SHOTS_BONUS);
mAtk *= bss ? 4 * shotsBonus : sps ? 2 * shotsBonus : 1;
double sapphireBonus = 0;
if (attacker.isPlayer() && (attacker.getActingPlayer().getActiveShappireJewel() != null))
{
sapphireBonus = attacker.getActingPlayer().getActiveShappireJewel().getBonus();
}
mAtk *= bss ? 4 * (shotsBonus + sapphireBonus) : sps ? 2 * (shotsBonus + sapphireBonus) : 1;
double damage = (Math.sqrt(mAtk) * power * (mp / 97)) / mDef;
damage *= calcGeneralTraitBonus(attacker, target, skill.getTraitType(), false);

View File

@ -36,6 +36,7 @@ public class ShotsBonusFinalizer implements IStatsFunction
throwIfPresent(base);
double baseValue = 1;
double rubyBonus = 0;
final L2PcInstance player = creature.getActingPlayer();
if (player != null)
{
@ -44,7 +45,11 @@ public class ShotsBonusFinalizer implements IStatsFunction
{
baseValue += (weapon.getEnchantLevel() * 0.7) / 100;
}
if (player.getActiveRubyJewel() != null)
{
rubyBonus = player.getActiveRubyJewel().getBonus();
}
}
return CommonUtil.constrain(baseValue, 1.0, 1.21);
return Stats.defaultValue(creature, stat, CommonUtil.constrain(baseValue, 1.0, 1.21) + rubyBonus);
}
}