L2JMobius

Free Users => Solved/Invalid Bug Reports => Topic started by: bim on March 21, 2022, 07:43:39 PM

Title: VampiricAttack.java no work skill
Post by: bim on March 21, 2022, 07:43:39 PM
in assembly 338, the vampiric on skills does not work, game\data\scripts\handlers\effecthandlers VampiricAttack.java I tried to fix it but I don't understand what's wrong, can you fix it?these options don't work       
<effect name="VampiricAttack" fromLevel="3" toLevel="6">
                <amount>8</amount>
                <chance>100</chance>
   </effect>
Title: Re: VampiricAttack.java no work skill
Post by: Mobius on March 21, 2022, 08:17:36 PM
See Creature.java Config.VAMPIRIC_ATTACK_AFFECTS_PVP
Title: Re: VampiricAttack.java no work skill
Post by: Mobius on March 22, 2022, 03:35:18 PM
Should I assume this is for all non Classic clients? (Essence only?)

Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/actor/Creature.java
===================================================================
--- java/org/l2jmobius/gameserver/model/actor/Creature.java (revision 9980)
+++ java/org/l2jmobius/gameserver/model/actor/Creature.java (working copy)
@@ -4642,17 +4642,14 @@
  final boolean isPvP = isPlayable() && target.isPlayable();
  if (!isPvP || Config.VAMPIRIC_ATTACK_AFFECTS_PVP)
  {
- if (skill == null) // Classic: Skills counted with the Vampiric Rage effect was introduced on GoD chronicles.
+ final double absorbHpPercent = getStat().getValue(Stat.ABSORB_DAMAGE_PERCENT, 0) * target.getStat().getValue(Stat.ABSORB_DAMAGE_DEFENCE, 1);
+ if ((absorbHpPercent > 0) && (Rnd.nextDouble() < _stat.getValue(Stat.ABSORB_DAMAGE_CHANCE)))
  {
- final double absorbHpPercent = getStat().getValue(Stat.ABSORB_DAMAGE_PERCENT, 0) * target.getStat().getValue(Stat.ABSORB_DAMAGE_DEFENCE, 1);
- if ((absorbHpPercent > 0) && (Rnd.nextDouble() < _stat.getValue(Stat.ABSORB_DAMAGE_CHANCE)))
+ int absorbDamage = (int) Math.min(absorbHpPercent * damage, _stat.getMaxRecoverableHp() - _status.getCurrentHp());
+ absorbDamage = Math.min(absorbDamage, (int) target.getCurrentHp());
+ if (absorbDamage > 0)
  {
- int absorbDamage = (int) Math.min(absorbHpPercent * damage, _stat.getMaxRecoverableHp() - _status.getCurrentHp());
- absorbDamage = Math.min(absorbDamage, (int) target.getCurrentHp());
- if (absorbDamage > 0)
- {
- setCurrentHp(_status.getCurrentHp() + absorbDamage);
- }
+ setCurrentHp(_status.getCurrentHp() + absorbDamage);
  }
  }
  }
@@ -4660,20 +4657,14 @@
  // Absorb MP from the damage inflicted.
  if (!isPvP || Config.MP_VAMPIRIC_ATTACK_AFFECTS_PVP)
  {
- if (skill != null) // Classic: Used to reduce skill MP consumption. See Orfen's Earring.
+ final double absorbMpPercent = _stat.getValue(Stat.ABSORB_MANA_DAMAGE_PERCENT, 0);
+ if (absorbMpPercent > 0)
  {
- if (Rnd.get(10) < 3) // Classic: Static 30% change.
+ int absorbDamage = (int) Math.min((absorbMpPercent / 100.) * damage, _stat.getMaxRecoverableMp() - _status.getCurrentMp());
+ absorbDamage = Math.min(absorbDamage, (int) target.getCurrentMp());
+ if (absorbDamage > 0)
  {
- final double absorbMpPercent = _stat.getValue(Stat.ABSORB_MANA_DAMAGE_PERCENT, 0);
- if (absorbMpPercent > 0)
- {
- int absorbDamage = (int) Math.min((absorbMpPercent / 100.) * damage, _stat.getMaxRecoverableMp() - _status.getCurrentMp());
- absorbDamage = Math.min(absorbDamage, (int) target.getCurrentMp());
- if (absorbDamage > 0)
- {
- setCurrentMp(_status.getCurrentMp() + absorbDamage);
- }
- }
+ setCurrentMp(_status.getCurrentMp() + absorbDamage);
  }
  }
  }
Title: Re: VampiricAttack.java no work skill
Post by: Index on March 22, 2022, 03:42:39 PM
It for all verisons after GOD
Essence and Classic going after GOD
Title: Re: VampiricAttack.java no work skill
Post by: Mobius on March 22, 2022, 04:29:13 PM
Related post.
https://l2jmobius.org/forum/index.php?topic=2705

Made a configuration for it.
Code: [Select]
Index: dist/game/config/Character.ini
===================================================================
--- dist/game/config/Character.ini (revision 9974)
+++ dist/game/config/Character.ini (working copy)
@@ -144,7 +144,13 @@
 # Stand when fake death is active and taking damage.
 FakeDeathDamageStand = True
 
+# Vampiric attack work with skills.
+VampiricAttackWorkWithSkills = True
 
+# MP vampiric attacks work with melee.
+MpVampiricAttackWorkWithMelee = False
+
+
 # ---------------------------------------------------------------------------
 # Class, Sub-class and skill learning options
 # ---------------------------------------------------------------------------
Index: java/org/l2jmobius/Config.java
===================================================================
--- java/org/l2jmobius/Config.java (revision 9974)
+++ java/org/l2jmobius/Config.java (working copy)
@@ -198,6 +198,8 @@
  public static long EFFECT_TICK_RATIO;
  public static boolean FAKE_DEATH_UNTARGET;
  public static boolean FAKE_DEATH_DAMAGE_STAND;
+ public static boolean VAMPIRIC_ATTACK_WORKS_WITH_SKILLS;
+ public static boolean MP_VAMPIRIC_ATTACK_WORKS_WITH_MELEE;
  public static boolean LIFE_CRYSTAL_NEEDED;
  public static boolean DIVINE_SP_BOOK_NEEDED;
  public static boolean ALT_GAME_SUBCLASS_WITHOUT_QUESTS;
@@ -1763,6 +1765,8 @@
  EFFECT_TICK_RATIO = characterConfig.getLong("EffectTickRatio", 666);
  FAKE_DEATH_UNTARGET = characterConfig.getBoolean("FakeDeathUntarget", true);
  FAKE_DEATH_DAMAGE_STAND = characterConfig.getBoolean("FakeDeathDamageStand", false);
+ VAMPIRIC_ATTACK_WORKS_WITH_SKILLS = characterConfig.getBoolean("VampiricAttackWorkWithSkills", true);
+ MP_VAMPIRIC_ATTACK_WORKS_WITH_MELEE = characterConfig.getBoolean("MpVampiricAttackWorkWithMelee", false);
  LIFE_CRYSTAL_NEEDED = characterConfig.getBoolean("LifeCrystalNeeded", true);
  DIVINE_SP_BOOK_NEEDED = characterConfig.getBoolean("DivineInspirationSpBookNeeded", true);
  ALT_GAME_SUBCLASS_WITHOUT_QUESTS = characterConfig.getBoolean("AltSubClassWithoutQuests", false);
Index: java/org/l2jmobius/gameserver/model/actor/Creature.java
===================================================================
--- java/org/l2jmobius/gameserver/model/actor/Creature.java (revision 9980)
+++ java/org/l2jmobius/gameserver/model/actor/Creature.java (working copy)
@@ -4642,7 +4642,7 @@
  final boolean isPvP = isPlayable() && target.isPlayable();
  if (!isPvP || Config.VAMPIRIC_ATTACK_AFFECTS_PVP)
  {
- if (skill == null) // Classic: Skills counted with the Vampiric Rage effect was introduced on GoD chronicles.
+ if ((skill == null) || Config.VAMPIRIC_ATTACK_WORKS_WITH_SKILLS)
  {
  final double absorbHpPercent = getStat().getValue(Stat.ABSORB_DAMAGE_PERCENT, 0) * target.getStat().getValue(Stat.ABSORB_DAMAGE_DEFENCE, 1);
  if ((absorbHpPercent > 0) && (Rnd.nextDouble() < _stat.getValue(Stat.ABSORB_DAMAGE_CHANCE)))
@@ -4660,7 +4660,7 @@
  // Absorb MP from the damage inflicted.
  if (!isPvP || Config.MP_VAMPIRIC_ATTACK_AFFECTS_PVP)
  {
- if (skill != null) // Classic: Used to reduce skill MP consumption. See Orfen's Earring.
+ if ((skill != null) || Config.MP_VAMPIRIC_ATTACK_WORKS_WITH_MELEE)
  {
  if (Rnd.get(10) < 3) // Classic: Static 30% change.
  {
Title: Re: VampiricAttack.java no work skill
Post by: bim on March 22, 2022, 04:57:40 PM
Everything works thank you very much
Title: Re: VampiricAttack.java no work skill
Post by: Iris on March 23, 2022, 07:24:14 PM
Some clarifications about Vampiric Atack on official Classic servers as of Innova (EU).

Title: Re: VampiricAttack.java no work skill
Post by: Mobius on March 24, 2022, 01:28:11 AM
Configurations committed with https://bitbucket.org/MobiusDev/l2j_mobius/commits/16ede492bae405358d366173e3173fcb2b358274