Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PlayableInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PlayableInstance.java (revision 1283)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PlayableInstance.java (working copy)
@@ -39,6 +39,7 @@
{
private boolean _isNoblesseBlessed = false; // for Noblesse Blessing skill, restores buffs after death
+ private boolean _getCharmOfLuck = false; // Charm of Luck - During a Raid/Boss war, decreased chance for death penalty
/**
* Constructor of L2PlayableInstance (use L2Character constructor).
*
@@ -178,4 +179,25 @@
public abstract boolean destroyItemByItemId(String process, int itemId, int count, L2Object reference, boolean sendMessage);
public abstract boolean destroyItem(String process, int objectId, int count, L2Object reference, boolean sendMessage);
+
+ //Charm of Luck - During a Raid/Boss war, decreased chance for death penalty
+ public final boolean getCharmOfLuck() { return _getCharmOfLuck; }
+ public final void setCharmOfLuck(boolean value) { _getCharmOfLuck = value; }
+
+ public final void startCharmOfLuck()
+ {
+ setCharmOfLuck(true);
+ updateAbnormalEffect();
+ }
+
+ public final void stopCharmOfLuck(L2Effect effect)
+ {
+ if (effect == null)
+ stopEffects(L2Effect.EffectType.CHARM_OF_LUCK);
+ else
+ removeEffect(effect);
+
+ setCharmOfLuck(false);
+ updateAbnormalEffect();
+ }
}
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 1283)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -10005,7 +10005,9 @@
public void calculateDeathPenaltyBuffLevel(L2Character killer)
{
- if(Rnd.get(100) <= Config.DEATH_PENALTY_CHANCE && !(killer instanceof L2PcInstance))
+ if(Rnd.get(100) <= Config.DEATH_PENALTY_CHANCE && !(killer instanceof L2PcInstance) &&
+ (!(killer instanceof L2BossInstance) && !(this.getCharmOfLuck()))||
+ (!(killer instanceof L2RaidBossInstance) && !(this.getCharmOfLuck())))
increaseDeathPenaltyBuffLevel();
}
Index: java/net/sf/l2j/gameserver/model/L2Effect.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Effect.java (revision 1283)
+++ java/net/sf/l2j/gameserver/model/L2Effect.java (working copy)
@@ -81,7 +81,8 @@
PETRIFICATION,
BLUFF,
BATTLE_FORCE,
- SPELL_FORCE
+ SPELL_FORCE,
+ CHARM_OF_LUCK
}
private static final Func[] _emptyFunctionSet = new Func[0];
Index: java/net/sf/l2j/gameserver/model/L2Character.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Character.java (revision 1283)
+++ java/net/sf/l2j/gameserver/model/L2Character.java (working copy)
@@ -1448,7 +1448,11 @@
// Stop all active skills effects in progress on the L2Character,
// if the Character isn't a Noblesse Blessed L2PlayableInstance
if (this instanceof L2PlayableInstance && ((L2PlayableInstance)this).isNoblesseBlessed())
- ((L2PlayableInstance)this).stopNoblesseBlessing(null);
+ {
+ ((L2PlayableInstance)this).stopNoblesseBlessing(null);
+ if (((L2PlayableInstance)this).getCharmOfLuck()) //remove Lucky Charm if player have Nobless blessing buff
+ ((L2PlayableInstance)this).stopCharmOfLuck(null);
+ }
else
stopAllEffects();
Index: java/net/sf/l2j/gameserver/skills/effects/EffectCharmOfLuck.java
===================================================================
--- java/net/sf/l2j/gameserver/skills/effects/EffectCharmOfLuck.java (revision 0)
+++ java/net/sf/l2j/gameserver/skills/effects/EffectCharmOfLuck.java (revision 0)
@@ -0,0 +1,61 @@
+/* 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 2, 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.skills.effects;
+
+import net.sf.l2j.gameserver.model.L2Effect;
+import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
+import net.sf.l2j.gameserver.skills.Env;
+
+/**
+ * @author kerberos_20
+ *
+ */
+public class EffectCharmOfLuck extends L2Effect
+{
+ public EffectCharmOfLuck(Env env, EffectTemplate template)
+ {
+ super(env, template);
+ }
+
+ @Override
+ public EffectType getEffectType()
+ {
+ return EffectType.CHARM_OF_LUCK;
+ }
+
+ /** Notify started */
+ @Override
+ public void onStart() {
+ if (getEffected() instanceof L2PlayableInstance)
+ ((L2PlayableInstance)getEffected()).startCharmOfLuck();
+ }
+
+ /** Notify exited */
+ @Override
+ public void onExit() {
+ if (getEffected() instanceof L2PlayableInstance)
+ ((L2PlayableInstance)getEffected()).stopCharmOfLuck (this);
+ }
+
+ @Override
+ public boolean onActionTime()
+ {
+ // just stop this effect
+ return false;
+ }
+}
Index: java/net/sf/l2j/gameserver/handler/itemhandlers/Scrolls.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/itemhandlers/Scrolls.java (revision 1283)
+++ java/net/sf/l2j/gameserver/handler/itemhandlers/Scrolls.java (working copy)
@@ -39,6 +39,7 @@
{
private static final int[] ITEM_IDS = { 3926, 3927, 3928, 3929, 3930, 3931, 3932,
3933, 3934, 3935, 4218, 5593, 5594, 5595, 6037,
+ 5703, 5803, 5804, 5805, 5806, 5807, // lucky charm
8515, 8516, 8517, 8518, 8519, 8520, // charm of courage
8594, 8595, 8596, 8597, 8598, 8599, // scrolls of recovery
8954, 8955, 8956, // primeval crystal
@@ -90,6 +91,25 @@
activeChar.sendPacket(new SystemMessage(SystemMessageId.INCOMPATIBLE_ITEM_GRADE));
return;
}
+ else if (itemId == 5703 || itemId >= 5803 && itemId <= 5807)
+ {
+ if ((itemId == 5703 && activeChar.getExpertiseIndex()==0) || // Lucky Charm (No Grade)
+ (itemId == 5803 && activeChar.getExpertiseIndex()==1) || // Lucky Charm (D Grade)
+ (itemId == 5804 && activeChar.getExpertiseIndex()==2) || // Lucky Charm (C Grade)
+ (itemId == 5805 && activeChar.getExpertiseIndex()==3) || // Lucky Charm (B Grade)
+ (itemId == 5806 && activeChar.getExpertiseIndex()==4) || // Lucky Charm (A Grade)
+ (itemId == 5807 && activeChar.getExpertiseIndex()==5)) // Lucky Charm (S Grade)
+ {
+ if (!playable.destroyItem("Consume", item.getObjectId(), 1, null, false))
+ return;
+ activeChar.broadcastPacket(new MagicSkillUser(playable, playable, 2168, activeChar.getExpertiseIndex()+1, 1, 0));
+ useScroll(activeChar, 2168, activeChar.getExpertiseIndex()+1);
+ activeChar.setCharmOfLuck(true);
+ }
+ else
+ activeChar.sendPacket(new SystemMessage(SystemMessageId.INCOMPATIBLE_ITEM_GRADE));
+ return;
+ }
else if (itemId >= 8515 && itemId <= 8520) // Charm of Courage XML: 5041
{
if ((itemId == 8515 && activeChar.getExpertiseIndex()==0) || // Charm of Courage (No Grade)
Index: java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java (revision 1283)
+++ java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java (working copy)
@@ -458,7 +458,8 @@
for (L2Effect e : effects)
{
if (e.getSkill().getId() != 4082 && e.getSkill().getId() != 4215 &&
- e.getSkill().getId() != 4515 && e.getSkill().getId() != 110 && e.getSkill().getId() != 111) // Cannot cancel skills 4082, 4215, 4515
+ e.getSkill().getId() != 4515 && e.getSkill().getId() != 110 && e.getSkill().getId() != 111 &&
+ e.getSkill().getId() != 1323 && e.getSkill().getId() != 1325) // Cannot cancel skills 4082, 4215, 4515, 110, 111, 1323, 1325
{
if(e.getSkill().getSkillType() != SkillType.BUFF) //sleep, slow, surrenders etc
e.exit();