From 15183e84b696d58610e1cb6d907f5da12e2f2dfd Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Mon, 25 Jan 2021 23:08:37 +0000
Subject: [PATCH] Addition of SoulType enum.
---
.../handlers/effecthandlers/FocusSouls.java | 9 ++-
.../effecthandlers/MagicalSoulAttack.java | 22 ++++++-
.../effecthandlers/PhysicalSoulAttack.java | 24 ++++++-
.../handlers/effecthandlers/SoulBlow.java | 19 ++++--
.../handlers/effecthandlers/SoulEating.java | 7 +-
.../OpSoulMaxSkillCondition.java | 6 +-
.../SoulSavedSkillCondition.java | 5 +-
.../game/data/stats/skills/00300-00399.xml | 33 ++++++++--
.../game/data/stats/skills/45100-45199.xml | 66 +++++++++++++++++--
.../dist/game/data/xsd/skills.xsd | 1 +
.../l2jmobius/gameserver/enums/SoulType.java | 26 ++++++++
.../model/actor/instance/PlayerInstance.java | 58 +++++++++-------
.../conditions/ConditionPlayerSouls.java | 8 ++-
.../gameserver/model/skills/Skill.java | 15 +++--
.../gameserver/model/skills/SkillCaster.java | 7 +-
.../serverpackets/EtcStatusUpdate.java | 21 ++----
.../gameserver/util/DocumentBase.java | 4 +-
.../handlers/effecthandlers/FocusSouls.java | 9 ++-
.../effecthandlers/MagicalSoulAttack.java | 22 ++++++-
.../effecthandlers/PhysicalSoulAttack.java | 24 ++++++-
.../handlers/effecthandlers/SoulBlow.java | 19 ++++--
.../handlers/effecthandlers/SoulEating.java | 7 +-
.../OpSoulMaxSkillCondition.java | 6 +-
.../SoulSavedSkillCondition.java | 5 +-
.../game/data/stats/skills/00300-00399.xml | 33 ++++++++--
.../game/data/stats/skills/45100-45199.xml | 66 +++++++++++++++++--
.../dist/game/data/xsd/skills.xsd | 1 +
.../l2jmobius/gameserver/enums/SoulType.java | 26 ++++++++
.../model/actor/instance/PlayerInstance.java | 58 +++++++++-------
.../conditions/ConditionPlayerSouls.java | 8 ++-
.../gameserver/model/skills/Skill.java | 15 +++--
.../gameserver/model/skills/SkillCaster.java | 7 +-
.../serverpackets/EtcStatusUpdate.java | 21 ++----
.../gameserver/util/DocumentBase.java | 4 +-
34 files changed, 510 insertions(+), 152 deletions(-)
create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/SoulType.java
create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/SoulType.java
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
index a7e87642b1..346c52f935 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
@@ -16,6 +16,7 @@
*/
package handlers.effecthandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@@ -32,10 +33,12 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
public class FocusSouls extends AbstractEffect
{
private final int _charge;
+ private final SoulType _type;
public FocusSouls(StatSet params)
{
_charge = params.getInt("charge", 0);
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
}
@Override
@@ -57,10 +60,10 @@ public class FocusSouls extends AbstractEffect
if (maxSouls > 0)
{
final int amount = _charge;
- if ((target.getChargedSouls() < maxSouls))
+ if ((target.getChargedSouls(_type) < maxSouls))
{
- final int count = ((target.getChargedSouls() + amount) <= maxSouls) ? amount : (maxSouls - target.getChargedSouls());
- target.increaseSouls(count);
+ final int count = ((target.getChargedSouls(_type) + amount) <= maxSouls) ? amount : (maxSouls - target.getChargedSouls(_type));
+ target.increaseSouls(count, _type);
}
else
{
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
index 6c3883b5c2..1328b4d1fd 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
@@ -66,8 +66,26 @@ public class MagicalSoulAttack extends AbstractEffect
effected.stopFakeDeath(true);
}
- final int chargedSouls = Math.min(skill.getMaxSoulConsumeCount(), effector.getActingPlayer().getCharges());
- if (!effector.getActingPlayer().decreaseCharges(chargedSouls))
+ final int chargedLightSouls = Math.min(skill.getMaxLightSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedLightSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedLightSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedShadowSouls = Math.min(skill.getMaxShadowSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedShadowSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedShadowSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedSouls = chargedLightSouls + chargedShadowSouls;
+ if (chargedSouls < 1)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(skill);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
index ba871f582c..78cb28fa9d 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
@@ -86,8 +86,26 @@ public class PhysicalSoulAttack extends AbstractEffect
effected.stopFakeDeath(true);
}
- final int souls = Math.min(skill.getMaxSoulConsumeCount(), effector.getActingPlayer().getCharges());
- if (!effector.getActingPlayer().decreaseCharges(souls))
+ final int chargedLightSouls = Math.min(skill.getMaxLightSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedLightSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedLightSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedShadowSouls = Math.min(skill.getMaxShadowSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedShadowSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedShadowSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedSouls = chargedLightSouls + chargedShadowSouls;
+ if (chargedSouls < 1)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(skill);
@@ -150,7 +168,7 @@ public class PhysicalSoulAttack extends AbstractEffect
ssmod = 4 * effector.getStat().getValue(Stat.SHOTS_BONUS);
}
}
- final double soulsMod = 1 + (souls * 0.04); // Souls Formula (each soul increase +4%)
+ final double soulsMod = 1 + (chargedSouls * 0.04); // Souls Formula (each soul increase +4%)
// ...................____________Melee Damage_____________......................................___________________Ranged Damage____________________
// ATTACK CALCULATION 77 * ((pAtk * lvlMod) + power) / pdef RANGED ATTACK CALCULATION 70 * ((pAtk * lvlMod) + power + patk + power) / pdef
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java
index 1a755668a0..e6b6f6c701 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java
@@ -17,6 +17,7 @@
package handlers.effecthandlers;
import org.l2jmobius.gameserver.enums.ShotType;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
@@ -83,11 +84,21 @@ public class SoulBlow extends AbstractEffect
final boolean ss = skill.useSoulShot() && (effector.isChargedShot(ShotType.SOULSHOTS) || effector.isChargedShot(ShotType.BLESSED_SOULSHOTS));
final byte shld = Formulas.calcShldUse(effector, effected);
double damage = Formulas.calcBlowDamage(effector, effected, skill, false, _power, shld, ss);
- if ((skill.getMaxSoulConsumeCount() > 0) && effector.isPlayer())
+
+ if (effector.isPlayer())
{
- // Souls Formula (each soul increase +4%)
- final int chargedSouls = (effector.getActingPlayer().getChargedSouls() <= skill.getMaxSoulConsumeCount()) ? effector.getActingPlayer().getChargedSouls() : skill.getMaxSoulConsumeCount();
- damage *= 1 + (chargedSouls * 0.04);
+ if (skill.getMaxLightSoulConsumeCount() > 0)
+ {
+ // Souls Formula (each soul increase +4%)
+ final int chargedSouls = (effector.getActingPlayer().getChargedSouls(SoulType.LIGHT) <= skill.getMaxLightSoulConsumeCount()) ? effector.getActingPlayer().getChargedSouls(SoulType.LIGHT) : skill.getMaxLightSoulConsumeCount();
+ damage *= 1 + (chargedSouls * 0.04);
+ }
+ if (skill.getMaxShadowSoulConsumeCount() > 0)
+ {
+ // Souls Formula (each soul increase +4%)
+ final int chargedSouls = (effector.getActingPlayer().getChargedSouls(SoulType.SHADOW) <= skill.getMaxShadowSoulConsumeCount()) ? effector.getActingPlayer().getChargedSouls(SoulType.SHADOW) : skill.getMaxShadowSoulConsumeCount();
+ damage *= 1 + (chargedSouls * 0.04);
+ }
}
effector.doAttack(damage, effected, skill, false, false, true, false);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java
index 599a681e87..c263bf65ec 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java
@@ -16,6 +16,7 @@
*/
package handlers.effecthandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -37,11 +38,13 @@ import org.l2jmobius.gameserver.network.serverpackets.ExSpawnEmitter;
*/
public class SoulEating extends AbstractEffect
{
+ private final SoulType _type;
private final int _expNeeded;
private final int _maxSouls;
public SoulEating(StatSet params)
{
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
_expNeeded = params.getInt("expNeeded");
_maxSouls = params.getInt("maxSouls");
}
@@ -77,13 +80,13 @@ public class SoulEating extends AbstractEffect
{
final PlayerInstance player = playable.getActingPlayer();
final int maxSouls = (int) player.getStat().getValue(Stat.MAX_SOULS, 0);
- if (player.getChargedSouls() >= maxSouls)
+ if (player.getChargedSouls(_type) >= maxSouls)
{
playable.sendPacket(SystemMessageId.SOUL_CANNOT_BE_ABSORBED_ANYMORE);
return;
}
- player.increaseSouls(1);
+ player.increaseSouls(1, _type);
if ((player.getTarget() != null) && player.getTarget().isNpc())
{
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java
index 6b18727121..9b3bbfc3d3 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java
@@ -16,6 +16,7 @@
*/
package handlers.skillconditionhandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
@@ -28,14 +29,17 @@ import org.l2jmobius.gameserver.model.stats.Stat;
*/
public class OpSoulMaxSkillCondition implements ISkillCondition
{
+ private final SoulType _type;
+
public OpSoulMaxSkillCondition(StatSet params)
{
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
final int maxSouls = (int) caster.getStat().getValue(Stat.MAX_SOULS);
- return caster.isPlayable() && (caster.getActingPlayer().getChargedSouls() < maxSouls);
+ return caster.isPlayable() && (caster.getActingPlayer().getChargedSouls(_type) < maxSouls);
}
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java
index e44fca0141..89c1b938ce 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java
@@ -16,6 +16,7 @@
*/
package handlers.skillconditionhandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
@@ -27,16 +28,18 @@ import org.l2jmobius.gameserver.model.skills.Skill;
*/
public class SoulSavedSkillCondition implements ISkillCondition
{
+ private final SoulType _type;
private final int _amount;
public SoulSavedSkillCondition(StatSet params)
{
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
_amount = params.getInt("amount");
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
- return caster.isPlayer() && (caster.getActingPlayer().getChargedSouls() >= _amount);
+ return caster.isPlayer() && (caster.getActingPlayer().getChargedSouls(_type) >= _amount);
}
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/00300-00399.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/00300-00399.xml
index b8dc0890bf..97b0ab07ce 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/00300-00399.xml
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/00300-00399.xml
@@ -3652,19 +3652,40 @@
SELF
SINGLE
-
+
+ LIGHT
2
-
- 1
+ 150
+ 500
+ 30
+
+ 40
+ 49
+ 58
+ 66
+ 72
+
A1
+ 2000
5
+ SELF
+ SINGLE
+
+
+
+
+
+ SHADOW
+ 2
+
+
@@ -3780,7 +3801,8 @@
1
- 30
+ 60
+ BR_EVENT_BUF1
4
20
@@ -3858,7 +3880,8 @@
1
- 30
+ 60
+ BR_EVENT_BUF1
4
20
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/45100-45199.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/45100-45199.xml
index 4007759dfd..bc29be2b66 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/45100-45199.xml
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/45100-45199.xml
@@ -390,10 +390,11 @@
SELF
SINGLE
-
+
+ SHADOW
70
100
@@ -415,10 +416,11 @@
SELF
SINGLE
-
+
+ LIGHT
70
100
@@ -1700,6 +1702,7 @@
5
+ LIGHT
100
100
@@ -1734,8 +1737,45 @@
icon.skill_jinkama_black1
+
+ 20
+ 60
+
P
- 4
+ 5
+
+
+ SHADOW
+
+ 100
+ 100
+
+
+ 294
+ 2160
+
+
+
+ true
+ 45181
+ 1
+ ALL
+ Creature
+ SELF
+ 1
+ 30
+
+
+ false
+ 45181
+ 1
+ ALL
+ Creature
+ SELF
+ 1
+ 15
+
+
@@ -1748,17 +1788,33 @@
SELF
SINGLE
-
+
+ LIGHT
1
-
+ true
+ 20
A1
+ 10000
+ -5
+ 0
+ SELF
+ SINGLE
+
+
+
+
+
+ SHADOW
+ 1
+
+
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/skills.xsd b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/skills.xsd
index 799660fd80..32d1b88820 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/skills.xsd
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/skills.xsd
@@ -461,6 +461,7 @@
+
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/SoulType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/SoulType.java
new file mode 100644
index 0000000000..e4ccdb2818
--- /dev/null
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/enums/SoulType.java
@@ -0,0 +1,26 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum SoulType
+{
+ LIGHT,
+ SHADOW
+}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 00d2cb517c..dfed9c409f 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -101,6 +101,7 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.enums.Race;
import org.l2jmobius.gameserver.enums.Sex;
import org.l2jmobius.gameserver.enums.ShortcutType;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.enums.StatusUpdateType;
import org.l2jmobius.gameserver.enums.SubclassInfoType;
import org.l2jmobius.gameserver.enums.Team;
@@ -669,7 +670,7 @@ public class PlayerInstance extends Playable
private final static int KAMAEL_SHADOW_MASTER = 45179;
private final static int KAMAEL_LIGHT_TRANSFORMATION = 397;
private final static int KAMAEL_SHADOW_TRANSFORMATION = 398;
- private int _souls = 0;
+ private final Map _souls = new ConcurrentHashMap<>(2);
private ScheduledFuture> _soulTask = null;
// WorldPosition used by TARGET_SIGNET_GROUND
@@ -11226,48 +11227,53 @@ public class PlayerInstance extends Playable
}
/**
- * Returns the Number of Souls this PlayerInstance got.
+ * Returns the Number of souls.
+ * @param type the type of souls.
* @return
*/
- public int getChargedSouls()
+ public int getChargedSouls(SoulType type)
{
- return _souls;
+ return _souls.getOrDefault(type, 0).intValue();
}
/**
* Increase Souls
* @param count
+ * @param type
*/
- public void increaseSouls(int count)
+ public void increaseSouls(int count, SoulType type)
{
- _souls += count;
+ final int newCount = getChargedSouls(type) + count;
+ _souls.put(type, newCount);
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_SOUL_COUNT_HAS_INCREASED_BY_S1_IT_IS_NOW_AT_S2);
sm.addInt(count);
- sm.addInt(_souls);
+ sm.addInt(newCount);
sendPacket(sm);
restartSoulTask();
sendPacket(new EtcStatusUpdate(this));
- // TODO: Unhardcode?
- if ((getRace() == Race.KAMAEL) && (_souls >= 100))
+ if ((getRace() == Race.KAMAEL) && (newCount >= 100) && !isTransformed())
{
- int skillLevel = getShadowMasterLevel();
- if (skillLevel > 0)
+ if (type == SoulType.LIGHT)
{
- abortCast();
- decreaseSouls(100);
- SkillData.getInstance().getSkill(KAMAEL_SHADOW_TRANSFORMATION, skillLevel).applyEffects(this, this);
- }
- else
- {
- skillLevel = getLightMasterLevel();
+ final int skillLevel = getLightMasterLevel();
if (skillLevel > 0)
{
abortCast();
- decreaseSouls(100);
+ decreaseSouls(100, type);
SkillData.getInstance().getSkill(KAMAEL_LIGHT_TRANSFORMATION, skillLevel).applyEffects(this, this);
}
}
+ else // Shadow.
+ {
+ final int skillLevel = getShadowMasterLevel();
+ if (skillLevel > 0)
+ {
+ abortCast();
+ decreaseSouls(100, type);
+ SkillData.getInstance().getSkill(KAMAEL_SHADOW_TRANSFORMATION, skillLevel).applyEffects(this, this);
+ }
+ }
}
}
@@ -11284,17 +11290,19 @@ public class PlayerInstance extends Playable
/**
* Decreases existing Souls.
* @param count
+ * @param type
* @return
*/
- public boolean decreaseSouls(int count)
+ public boolean decreaseSouls(int count, SoulType type)
{
- _souls -= count;
- if (_souls < 0)
+ int newCount = getChargedSouls(type) - count;
+ if (newCount < 0)
{
- _souls = 0;
+ newCount = 0;
}
+ _souls.put(type, newCount);
- if (_souls == 0)
+ if (newCount == 0)
{
stopSoulTask();
}
@@ -11312,7 +11320,7 @@ public class PlayerInstance extends Playable
*/
public void clearSouls()
{
- _souls = 0;
+ _souls.clear();
stopSoulTask();
sendPacket(new EtcStatusUpdate(this));
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java
index cb126a72f4..4adeca586e 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java
@@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.model.conditions;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.items.Item;
import org.l2jmobius.gameserver.model.skills.Skill;
@@ -26,19 +27,22 @@ import org.l2jmobius.gameserver.model.skills.Skill;
public class ConditionPlayerSouls extends Condition
{
private final int _souls;
+ private final SoulType _type;
/**
* Instantiates a new condition player souls.
* @param souls the souls
+ * @param type the soul type
*/
- public ConditionPlayerSouls(int souls)
+ public ConditionPlayerSouls(int souls, SoulType type)
{
_souls = souls;
+ _type = type;
}
@Override
public boolean testImpl(Creature effector, Creature effected, Skill skill, Item item)
{
- return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getChargedSouls() >= _souls);
+ return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getChargedSouls(_type) >= _souls);
}
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/Skill.java
index a724577b1f..41571ac094 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/Skill.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/Skill.java
@@ -161,7 +161,8 @@ public class Skill implements IIdentifiable
private final BasicProperty _basicProperty;
private final int _minPledgeClass;
- private final int _soulMaxConsume;
+ private final int _lightSoulMaxConsume;
+ private final int _shadowSoulMaxConsume;
private final int _chargeConsume;
private final boolean _isTriggeredSkill; // If true the skill will take activation buff slot instead of a normal buff slot
@@ -345,7 +346,8 @@ public class Skill implements IIdentifiable
_basicProperty = set.getEnum("basicProperty", BasicProperty.class, BasicProperty.NONE);
_isSuicideAttack = set.getBoolean("isSuicideAttack", false);
_minPledgeClass = set.getInt("minPledgeClass", 0);
- _soulMaxConsume = set.getInt("soulMaxConsumeCount", 0);
+ _lightSoulMaxConsume = set.getInt("lightSoulMaxConsume", 0);
+ _shadowSoulMaxConsume = set.getInt("shadowSoulMaxConsume", 0);
_chargeConsume = set.getInt("chargeConsume", 0);
_isTriggeredSkill = set.getBoolean("isTriggeredSkill", false);
_effectPoint = set.getInt("effectPoint", 0);
@@ -1022,9 +1024,14 @@ public class Skill implements IIdentifiable
return _abnormalType == AbnormalType.HP_RECOVER;
}
- public int getMaxSoulConsumeCount()
+ public int getMaxLightSoulConsumeCount()
{
- return _soulMaxConsume;
+ return _lightSoulMaxConsume;
+ }
+
+ public int getMaxShadowSoulConsumeCount()
+ {
+ return _shadowSoulMaxConsume;
}
public int getChargeConsumeCount()
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java
index ac590e6978..dab8fe5599 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.xml.ActionData;
import org.l2jmobius.gameserver.enums.ItemSkillType;
import org.l2jmobius.gameserver.enums.NextActionType;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.enums.StatusUpdateType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.QuestManager;
@@ -490,7 +491,11 @@ public class SkillCaster implements Runnable
if (caster.isPlayer())
{
// Consume Souls if necessary.
- if ((_skill.getMaxSoulConsumeCount() > 0) && !caster.getActingPlayer().decreaseSouls(_skill.getMaxSoulConsumeCount()))
+ if ((_skill.getMaxLightSoulConsumeCount() > 0) && !caster.getActingPlayer().decreaseSouls(_skill.getMaxLightSoulConsumeCount(), SoulType.LIGHT))
+ {
+ return false;
+ }
+ if ((_skill.getMaxShadowSoulConsumeCount() > 0) && !caster.getActingPlayer().decreaseSouls(_skill.getMaxShadowSoulConsumeCount(), SoulType.SHADOW))
{
return false;
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java
index 4175c6dd57..a0e60eaa3e 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java
@@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
-import org.l2jmobius.gameserver.enums.Race;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.OutgoingPackets;
@@ -28,8 +28,6 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
public class EtcStatusUpdate implements IClientOutgoingPacket
{
private final PlayerInstance _player;
- private final boolean _isLight;
- private final boolean _isShadow;
private int _mask;
public EtcStatusUpdate(PlayerInstance player)
@@ -38,17 +36,6 @@ public class EtcStatusUpdate implements IClientOutgoingPacket
_mask = _player.getMessageRefusal() || _player.isChatBanned() || _player.isSilenceMode() ? 1 : 0;
_mask |= _player.isInsideZone(ZoneId.DANGER_AREA) ? 2 : 0;
_mask |= _player.hasCharmOfCourage() ? 4 : 0;
-
- if (_player.getRace() == Race.KAMAEL)
- {
- _isShadow = _player.getShadowMasterLevel() > 0;
- _isLight = !_isShadow && (_player.getLightMasterLevel() > 0);
- }
- else
- {
- _isLight = false;
- _isShadow = false;
- }
}
@Override
@@ -61,10 +48,10 @@ public class EtcStatusUpdate implements IClientOutgoingPacket
packet.writeC(0); // Weapon Grade Penalty [1-4]
packet.writeC(0); // Armor Grade Penalty [1-4]
packet.writeC(0); // Death Penalty [1-15, 0 = disabled)], not used anymore in Ertheia
- packet.writeC(!_isShadow && !_isLight ? _player.getChargedSouls() : 0);
+ packet.writeC(0); // Old count for charged souls.
packet.writeC(_mask);
- packet.writeC(_isShadow ? _player.getChargedSouls() : 0); // Shadow souls
- packet.writeC(_isLight ? _player.getChargedSouls() : 0); // Light souls
+ packet.writeC(_player.getChargedSouls(SoulType.SHADOW)); // Shadow souls
+ packet.writeC(_player.getChargedSouls(SoulType.LIGHT)); // Light souls
return true;
}
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/DocumentBase.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/DocumentBase.java
index ab7570016e..736a021362 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/DocumentBase.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/DocumentBase.java
@@ -39,6 +39,7 @@ import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.PlayerState;
import org.l2jmobius.gameserver.enums.Race;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.conditions.ConditionCategoryType;
@@ -537,7 +538,8 @@ public abstract class DocumentBase
case "souls":
{
final int value = Integer.decode(getValue(a.getNodeValue(), template));
- cond = joinAnd(cond, new ConditionPlayerSouls(value));
+ final SoulType type = Enum.valueOf(SoulType.class, a.getNodeValue());
+ cond = joinAnd(cond, new ConditionPlayerSouls(value, type));
break;
}
case "weight":
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
index a7e87642b1..346c52f935 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/FocusSouls.java
@@ -16,6 +16,7 @@
*/
package handlers.effecthandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@@ -32,10 +33,12 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
public class FocusSouls extends AbstractEffect
{
private final int _charge;
+ private final SoulType _type;
public FocusSouls(StatSet params)
{
_charge = params.getInt("charge", 0);
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
}
@Override
@@ -57,10 +60,10 @@ public class FocusSouls extends AbstractEffect
if (maxSouls > 0)
{
final int amount = _charge;
- if ((target.getChargedSouls() < maxSouls))
+ if ((target.getChargedSouls(_type) < maxSouls))
{
- final int count = ((target.getChargedSouls() + amount) <= maxSouls) ? amount : (maxSouls - target.getChargedSouls());
- target.increaseSouls(count);
+ final int count = ((target.getChargedSouls(_type) + amount) <= maxSouls) ? amount : (maxSouls - target.getChargedSouls(_type));
+ target.increaseSouls(count, _type);
}
else
{
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
index 6c3883b5c2..1328b4d1fd 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/MagicalSoulAttack.java
@@ -66,8 +66,26 @@ public class MagicalSoulAttack extends AbstractEffect
effected.stopFakeDeath(true);
}
- final int chargedSouls = Math.min(skill.getMaxSoulConsumeCount(), effector.getActingPlayer().getCharges());
- if (!effector.getActingPlayer().decreaseCharges(chargedSouls))
+ final int chargedLightSouls = Math.min(skill.getMaxLightSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedLightSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedLightSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedShadowSouls = Math.min(skill.getMaxShadowSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedShadowSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedShadowSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedSouls = chargedLightSouls + chargedShadowSouls;
+ if (chargedSouls < 1)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(skill);
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
index ba871f582c..78cb28fa9d 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/PhysicalSoulAttack.java
@@ -86,8 +86,26 @@ public class PhysicalSoulAttack extends AbstractEffect
effected.stopFakeDeath(true);
}
- final int souls = Math.min(skill.getMaxSoulConsumeCount(), effector.getActingPlayer().getCharges());
- if (!effector.getActingPlayer().decreaseCharges(souls))
+ final int chargedLightSouls = Math.min(skill.getMaxLightSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedLightSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedLightSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedShadowSouls = Math.min(skill.getMaxShadowSoulConsumeCount(), effector.getActingPlayer().getCharges());
+ if ((chargedShadowSouls > 0) && !effector.getActingPlayer().decreaseCharges(chargedShadowSouls))
+ {
+ final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
+ sm.addSkillName(skill);
+ effector.sendPacket(sm);
+ return;
+ }
+
+ final int chargedSouls = chargedLightSouls + chargedShadowSouls;
+ if (chargedSouls < 1)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
sm.addSkillName(skill);
@@ -150,7 +168,7 @@ public class PhysicalSoulAttack extends AbstractEffect
ssmod = 4 * effector.getStat().getValue(Stat.SHOTS_BONUS);
}
}
- final double soulsMod = 1 + (souls * 0.04); // Souls Formula (each soul increase +4%)
+ final double soulsMod = 1 + (chargedSouls * 0.04); // Souls Formula (each soul increase +4%)
// ...................____________Melee Damage_____________......................................___________________Ranged Damage____________________
// ATTACK CALCULATION 77 * ((pAtk * lvlMod) + power) / pdef RANGED ATTACK CALCULATION 70 * ((pAtk * lvlMod) + power + patk + power) / pdef
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java
index 1a755668a0..e6b6f6c701 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulBlow.java
@@ -17,6 +17,7 @@
package handlers.effecthandlers;
import org.l2jmobius.gameserver.enums.ShotType;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
@@ -83,11 +84,21 @@ public class SoulBlow extends AbstractEffect
final boolean ss = skill.useSoulShot() && (effector.isChargedShot(ShotType.SOULSHOTS) || effector.isChargedShot(ShotType.BLESSED_SOULSHOTS));
final byte shld = Formulas.calcShldUse(effector, effected);
double damage = Formulas.calcBlowDamage(effector, effected, skill, false, _power, shld, ss);
- if ((skill.getMaxSoulConsumeCount() > 0) && effector.isPlayer())
+
+ if (effector.isPlayer())
{
- // Souls Formula (each soul increase +4%)
- final int chargedSouls = (effector.getActingPlayer().getChargedSouls() <= skill.getMaxSoulConsumeCount()) ? effector.getActingPlayer().getChargedSouls() : skill.getMaxSoulConsumeCount();
- damage *= 1 + (chargedSouls * 0.04);
+ if (skill.getMaxLightSoulConsumeCount() > 0)
+ {
+ // Souls Formula (each soul increase +4%)
+ final int chargedSouls = (effector.getActingPlayer().getChargedSouls(SoulType.LIGHT) <= skill.getMaxLightSoulConsumeCount()) ? effector.getActingPlayer().getChargedSouls(SoulType.LIGHT) : skill.getMaxLightSoulConsumeCount();
+ damage *= 1 + (chargedSouls * 0.04);
+ }
+ if (skill.getMaxShadowSoulConsumeCount() > 0)
+ {
+ // Souls Formula (each soul increase +4%)
+ final int chargedSouls = (effector.getActingPlayer().getChargedSouls(SoulType.SHADOW) <= skill.getMaxShadowSoulConsumeCount()) ? effector.getActingPlayer().getChargedSouls(SoulType.SHADOW) : skill.getMaxShadowSoulConsumeCount();
+ damage *= 1 + (chargedSouls * 0.04);
+ }
}
effector.doAttack(damage, effected, skill, false, false, true, false);
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java
index c8bae9b4e2..4833afa715 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SoulEating.java
@@ -16,6 +16,7 @@
*/
package handlers.effecthandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
@@ -37,11 +38,13 @@ import org.l2jmobius.gameserver.network.serverpackets.ExSpawnEmitter;
*/
public class SoulEating extends AbstractEffect
{
+ private final SoulType _type;
private final int _expNeeded;
private final int _maxSouls;
public SoulEating(StatSet params)
{
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
_expNeeded = params.getInt("expNeeded");
_maxSouls = params.getInt("maxSouls");
}
@@ -77,13 +80,13 @@ public class SoulEating extends AbstractEffect
{
final PlayerInstance player = playable.getActingPlayer();
final int maxSouls = (int) player.getStat().getValue(Stat.MAX_SOULS, 0);
- if (player.getChargedSouls() >= maxSouls)
+ if (player.getChargedSouls(_type) >= maxSouls)
{
playable.sendPacket(SystemMessageId.YOU_CAN_T_ABSORB_MORE_SOULS);
return;
}
- player.increaseSouls(1);
+ player.increaseSouls(1, _type);
if ((player.getTarget() != null) && player.getTarget().isNpc())
{
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java
index 6b18727121..9b3bbfc3d3 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/OpSoulMaxSkillCondition.java
@@ -16,6 +16,7 @@
*/
package handlers.skillconditionhandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
@@ -28,14 +29,17 @@ import org.l2jmobius.gameserver.model.stats.Stat;
*/
public class OpSoulMaxSkillCondition implements ISkillCondition
{
+ private final SoulType _type;
+
public OpSoulMaxSkillCondition(StatSet params)
{
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
final int maxSouls = (int) caster.getStat().getValue(Stat.MAX_SOULS);
- return caster.isPlayable() && (caster.getActingPlayer().getChargedSouls() < maxSouls);
+ return caster.isPlayable() && (caster.getActingPlayer().getChargedSouls(_type) < maxSouls);
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java
index e44fca0141..89c1b938ce 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/skillconditionhandlers/SoulSavedSkillCondition.java
@@ -16,6 +16,7 @@
*/
package handlers.skillconditionhandlers;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
@@ -27,16 +28,18 @@ import org.l2jmobius.gameserver.model.skills.Skill;
*/
public class SoulSavedSkillCondition implements ISkillCondition
{
+ private final SoulType _type;
private final int _amount;
public SoulSavedSkillCondition(StatSet params)
{
+ _type = params.getEnum("type", SoulType.class, SoulType.LIGHT);
_amount = params.getInt("amount");
}
@Override
public boolean canUse(Creature caster, Skill skill, WorldObject target)
{
- return caster.isPlayer() && (caster.getActingPlayer().getChargedSouls() >= _amount);
+ return caster.isPlayer() && (caster.getActingPlayer().getChargedSouls(_type) >= _amount);
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/00300-00399.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/00300-00399.xml
index 9281ed0589..617b8c6367 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/00300-00399.xml
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/00300-00399.xml
@@ -3678,19 +3678,40 @@
SELF
SINGLE
-
+
+ LIGHT
2
-
- 1
+ 150
+ 500
+ 30
+
+ 40
+ 49
+ 58
+ 66
+ 72
+
A1
+ 2000
5
+ SELF
+ SINGLE
+
+
+
+
+
+ SHADOW
+ 2
+
+
@@ -3806,7 +3827,8 @@
1
- 30
+ 60
+ BR_EVENT_BUF1
4
20
@@ -3884,7 +3906,8 @@
1
- 30
+ 60
+ BR_EVENT_BUF1
4
20
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/45100-45199.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/45100-45199.xml
index eecb92bd69..9b15c48278 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/45100-45199.xml
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/45100-45199.xml
@@ -2235,10 +2235,11 @@
SELF
SINGLE
-
+
+ LIGHT
70
100
@@ -2260,10 +2261,11 @@
SELF
SINGLE
-
+
+ SHADOW
70
100
@@ -3595,6 +3597,7 @@
5
+ LIGHT
100
100
@@ -3629,8 +3632,45 @@
icon.skill_jinkama_black1
+
+ 20
+ 60
+
P
- 4
+ 5
+
+
+ SHADOW
+
+ 100
+ 100
+
+
+ 294
+ 2160
+
+
+
+ true
+ 45181
+ 1
+ ALL
+ Creature
+ SELF
+ 1
+ 30
+
+
+ false
+ 45181
+ 1
+ ALL
+ Creature
+ SELF
+ 1
+ 15
+
+
@@ -3643,17 +3683,33 @@
SELF
SINGLE
-
+
+ LIGHT
1
-
+ true
+ 20
A1
+ 10000
+ -5
+ 0
+ SELF
+ SINGLE
+
+
+
+
+
+ SHADOW
+ 1
+
+
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/skills.xsd b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/skills.xsd
index 1e0fa83135..ba3ca1a9b4 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/skills.xsd
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/skills.xsd
@@ -462,6 +462,7 @@
+
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/SoulType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/SoulType.java
new file mode 100644
index 0000000000..e4ccdb2818
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/SoulType.java
@@ -0,0 +1,26 @@
+/*
+ * 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 .
+ */
+package org.l2jmobius.gameserver.enums;
+
+/**
+ * @author Mobius
+ */
+public enum SoulType
+{
+ LIGHT,
+ SHADOW
+}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index b843dffccd..6cd368625f 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -101,6 +101,7 @@ import org.l2jmobius.gameserver.enums.PrivateStoreType;
import org.l2jmobius.gameserver.enums.Race;
import org.l2jmobius.gameserver.enums.Sex;
import org.l2jmobius.gameserver.enums.ShortcutType;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.enums.StatusUpdateType;
import org.l2jmobius.gameserver.enums.SubclassInfoType;
import org.l2jmobius.gameserver.enums.Team;
@@ -675,7 +676,7 @@ public class PlayerInstance extends Playable
private final static int KAMAEL_SHADOW_MASTER = 45179;
private final static int KAMAEL_LIGHT_TRANSFORMATION = 397;
private final static int KAMAEL_SHADOW_TRANSFORMATION = 398;
- private int _souls = 0;
+ private final Map _souls = new ConcurrentHashMap<>(2);
private ScheduledFuture> _soulTask = null;
// Death Points
@@ -11317,48 +11318,53 @@ public class PlayerInstance extends Playable
}
/**
- * Returns the Number of Souls this PlayerInstance got.
+ * Returns the Number of souls.
+ * @param type the type of souls.
* @return
*/
- public int getChargedSouls()
+ public int getChargedSouls(SoulType type)
{
- return _souls;
+ return _souls.getOrDefault(type, 0).intValue();
}
/**
* Increase Souls
* @param count
+ * @param type
*/
- public void increaseSouls(int count)
+ public void increaseSouls(int count, SoulType type)
{
- _souls += count;
+ final int newCount = getChargedSouls(type) + count;
+ _souls.put(type, newCount);
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_SOUL_COUNT_HAS_INCREASED_BY_S1_IT_IS_NOW_AT_S2);
sm.addInt(count);
- sm.addInt(_souls);
+ sm.addInt(newCount);
sendPacket(sm);
restartSoulTask();
sendPacket(new EtcStatusUpdate(this));
- // TODO: Unhardcode?
- if ((getRace() == Race.KAMAEL) && (_souls >= 100))
+ if ((getRace() == Race.KAMAEL) && (newCount >= 100) && !isTransformed())
{
- int skillLevel = getShadowMasterLevel();
- if (skillLevel > 0)
+ if (type == SoulType.LIGHT)
{
- abortCast();
- decreaseSouls(100);
- SkillData.getInstance().getSkill(KAMAEL_SHADOW_TRANSFORMATION, skillLevel).applyEffects(this, this);
- }
- else
- {
- skillLevel = getLightMasterLevel();
+ final int skillLevel = getLightMasterLevel();
if (skillLevel > 0)
{
abortCast();
- decreaseSouls(100);
+ decreaseSouls(100, type);
SkillData.getInstance().getSkill(KAMAEL_LIGHT_TRANSFORMATION, skillLevel).applyEffects(this, this);
}
}
+ else // Shadow.
+ {
+ final int skillLevel = getShadowMasterLevel();
+ if (skillLevel > 0)
+ {
+ abortCast();
+ decreaseSouls(100, type);
+ SkillData.getInstance().getSkill(KAMAEL_SHADOW_TRANSFORMATION, skillLevel).applyEffects(this, this);
+ }
+ }
}
}
@@ -11375,17 +11381,19 @@ public class PlayerInstance extends Playable
/**
* Decreases existing Souls.
* @param count
+ * @param type
* @return
*/
- public boolean decreaseSouls(int count)
+ public boolean decreaseSouls(int count, SoulType type)
{
- _souls -= count;
- if (_souls < 0)
+ int newCount = getChargedSouls(type) - count;
+ if (newCount < 0)
{
- _souls = 0;
+ newCount = 0;
}
+ _souls.put(type, newCount);
- if (_souls == 0)
+ if (newCount == 0)
{
stopSoulTask();
}
@@ -11403,7 +11411,7 @@ public class PlayerInstance extends Playable
*/
public void clearSouls()
{
- _souls = 0;
+ _souls.clear();
stopSoulTask();
sendPacket(new EtcStatusUpdate(this));
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java
index cb126a72f4..4adeca586e 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/conditions/ConditionPlayerSouls.java
@@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.model.conditions;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.items.Item;
import org.l2jmobius.gameserver.model.skills.Skill;
@@ -26,19 +27,22 @@ import org.l2jmobius.gameserver.model.skills.Skill;
public class ConditionPlayerSouls extends Condition
{
private final int _souls;
+ private final SoulType _type;
/**
* Instantiates a new condition player souls.
* @param souls the souls
+ * @param type the soul type
*/
- public ConditionPlayerSouls(int souls)
+ public ConditionPlayerSouls(int souls, SoulType type)
{
_souls = souls;
+ _type = type;
}
@Override
public boolean testImpl(Creature effector, Creature effected, Skill skill, Item item)
{
- return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getChargedSouls() >= _souls);
+ return (effector.getActingPlayer() != null) && (effector.getActingPlayer().getChargedSouls(_type) >= _souls);
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/Skill.java
index a724577b1f..41571ac094 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/Skill.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/Skill.java
@@ -161,7 +161,8 @@ public class Skill implements IIdentifiable
private final BasicProperty _basicProperty;
private final int _minPledgeClass;
- private final int _soulMaxConsume;
+ private final int _lightSoulMaxConsume;
+ private final int _shadowSoulMaxConsume;
private final int _chargeConsume;
private final boolean _isTriggeredSkill; // If true the skill will take activation buff slot instead of a normal buff slot
@@ -345,7 +346,8 @@ public class Skill implements IIdentifiable
_basicProperty = set.getEnum("basicProperty", BasicProperty.class, BasicProperty.NONE);
_isSuicideAttack = set.getBoolean("isSuicideAttack", false);
_minPledgeClass = set.getInt("minPledgeClass", 0);
- _soulMaxConsume = set.getInt("soulMaxConsumeCount", 0);
+ _lightSoulMaxConsume = set.getInt("lightSoulMaxConsume", 0);
+ _shadowSoulMaxConsume = set.getInt("shadowSoulMaxConsume", 0);
_chargeConsume = set.getInt("chargeConsume", 0);
_isTriggeredSkill = set.getBoolean("isTriggeredSkill", false);
_effectPoint = set.getInt("effectPoint", 0);
@@ -1022,9 +1024,14 @@ public class Skill implements IIdentifiable
return _abnormalType == AbnormalType.HP_RECOVER;
}
- public int getMaxSoulConsumeCount()
+ public int getMaxLightSoulConsumeCount()
{
- return _soulMaxConsume;
+ return _lightSoulMaxConsume;
+ }
+
+ public int getMaxShadowSoulConsumeCount()
+ {
+ return _shadowSoulMaxConsume;
}
public int getChargeConsumeCount()
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java
index 6aefb92636..05a74789bd 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skills/SkillCaster.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.data.ItemTable;
import org.l2jmobius.gameserver.data.xml.ActionData;
import org.l2jmobius.gameserver.enums.ItemSkillType;
import org.l2jmobius.gameserver.enums.NextActionType;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.enums.StatusUpdateType;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.QuestManager;
@@ -490,7 +491,11 @@ public class SkillCaster implements Runnable
if (caster.isPlayer())
{
// Consume Souls if necessary.
- if ((_skill.getMaxSoulConsumeCount() > 0) && !caster.getActingPlayer().decreaseSouls(_skill.getMaxSoulConsumeCount()))
+ if ((_skill.getMaxLightSoulConsumeCount() > 0) && !caster.getActingPlayer().decreaseSouls(_skill.getMaxLightSoulConsumeCount(), SoulType.LIGHT))
+ {
+ return false;
+ }
+ if ((_skill.getMaxShadowSoulConsumeCount() > 0) && !caster.getActingPlayer().decreaseSouls(_skill.getMaxShadowSoulConsumeCount(), SoulType.SHADOW))
{
return false;
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java
index 4175c6dd57..a0e60eaa3e 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/EtcStatusUpdate.java
@@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.network.serverpackets;
import org.l2jmobius.commons.network.PacketWriter;
-import org.l2jmobius.gameserver.enums.Race;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.OutgoingPackets;
@@ -28,8 +28,6 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
public class EtcStatusUpdate implements IClientOutgoingPacket
{
private final PlayerInstance _player;
- private final boolean _isLight;
- private final boolean _isShadow;
private int _mask;
public EtcStatusUpdate(PlayerInstance player)
@@ -38,17 +36,6 @@ public class EtcStatusUpdate implements IClientOutgoingPacket
_mask = _player.getMessageRefusal() || _player.isChatBanned() || _player.isSilenceMode() ? 1 : 0;
_mask |= _player.isInsideZone(ZoneId.DANGER_AREA) ? 2 : 0;
_mask |= _player.hasCharmOfCourage() ? 4 : 0;
-
- if (_player.getRace() == Race.KAMAEL)
- {
- _isShadow = _player.getShadowMasterLevel() > 0;
- _isLight = !_isShadow && (_player.getLightMasterLevel() > 0);
- }
- else
- {
- _isLight = false;
- _isShadow = false;
- }
}
@Override
@@ -61,10 +48,10 @@ public class EtcStatusUpdate implements IClientOutgoingPacket
packet.writeC(0); // Weapon Grade Penalty [1-4]
packet.writeC(0); // Armor Grade Penalty [1-4]
packet.writeC(0); // Death Penalty [1-15, 0 = disabled)], not used anymore in Ertheia
- packet.writeC(!_isShadow && !_isLight ? _player.getChargedSouls() : 0);
+ packet.writeC(0); // Old count for charged souls.
packet.writeC(_mask);
- packet.writeC(_isShadow ? _player.getChargedSouls() : 0); // Shadow souls
- packet.writeC(_isLight ? _player.getChargedSouls() : 0); // Light souls
+ packet.writeC(_player.getChargedSouls(SoulType.SHADOW)); // Shadow souls
+ packet.writeC(_player.getChargedSouls(SoulType.LIGHT)); // Light souls
return true;
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/util/DocumentBase.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/util/DocumentBase.java
index ab7570016e..736a021362 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/util/DocumentBase.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/util/DocumentBase.java
@@ -39,6 +39,7 @@ import org.l2jmobius.gameserver.enums.CategoryType;
import org.l2jmobius.gameserver.enums.InstanceType;
import org.l2jmobius.gameserver.enums.PlayerState;
import org.l2jmobius.gameserver.enums.Race;
+import org.l2jmobius.gameserver.enums.SoulType;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.conditions.ConditionCategoryType;
@@ -537,7 +538,8 @@ public abstract class DocumentBase
case "souls":
{
final int value = Integer.decode(getValue(a.getNodeValue(), template));
- cond = joinAnd(cond, new ConditionPlayerSouls(value));
+ final SoulType type = Enum.valueOf(SoulType.class, a.getNodeValue());
+ cond = joinAnd(cond, new ConditionPlayerSouls(value, type));
break;
}
case "weight":