L2JMobius

Crusader TriggerSkillByStat

petryxa · 2 · 907

Online petryxa

  • Viscount
  • *****
    • Posts: 389
For skills, for example - https://l2central.info/essence/skills/ghost_sentinel/47417_1_0.html?lang=en

Need more test.

Code: [Select]
Subject: [PATCH] TriggerSkillByStat
---
Index: L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByStat.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByStat.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByStat.java
new file mode 100644
--- /dev/null (date 1691130855307)
+++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByStat.java (date 1691130855307)
@@ -0,0 +1,108 @@
+package handlers.effecthandlers;
+
+import org.l2jmobius.commons.threads.ThreadPool;
+import org.l2jmobius.gameserver.data.xml.SkillData;
+import org.l2jmobius.gameserver.enums.SkillFinishType;
+import org.l2jmobius.gameserver.enums.StatModifierType;
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Playable;
+import org.l2jmobius.gameserver.model.effects.AbstractEffect;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.model.skill.Skill;
+import org.l2jmobius.gameserver.model.skill.SkillCaster;
+import org.l2jmobius.gameserver.model.stats.BaseStat;
+import org.l2jmobius.gameserver.model.stats.Stat;
+
+public class TriggerSkillByStat extends AbstractEffect {
+    private final BaseStat _baseStat;
+    private final int _min;
+    private final int _max;
+    private final int _skillId;
+
+    public TriggerSkillByStat (StatSet params)
+    {
+        _baseStat = params.getEnum("baseStat", BaseStat.class);
+        _min = params.getInt("min", 0);
+        _max = params.getInt("max", 2147483647);
+        _skillId = params.getInt("skillId", 0);
+    }
+
+    @Override
+    public boolean canPump(Creature effector, Creature effected, Skill skill)
+    {
+        if(effected.isAffectedBySkill(_skillId)) {
+            int currentValue = 0;
+            switch (_baseStat) {
+                case STR: {
+                    currentValue = effected.getSTR();
+                    break;
+                }
+                case INT: {
+                    currentValue = effected.getINT();
+                    break;
+                }
+                case DEX: {
+                    currentValue = effected.getDEX();
+                    break;
+                }
+                case WIT: {
+                    currentValue = effected.getWIT();
+                    break;
+                }
+                case CON: {
+                    currentValue = effected.getCON();
+                    break;
+                }
+                case MEN: {
+                    currentValue = effected.getMEN();
+                    break;
+                }
+            }
+            if (currentValue < _min || currentValue > _max) {
+                effected.getEffectList().stopSkillEffects(SkillFinishType.REMOVED,_skillId);
+            }
+        }
+        return effected.isPlayer() && !effected.isAffectedBySkill(_skillId);
+    }
+    @Override
+    public void pump(Creature effected, Skill skill)
+    {
+
+            int currentValue = 0;
+            switch (_baseStat) {
+                case STR: {
+                    currentValue = effected.getSTR();
+                    break;
+                }
+                case INT: {
+                    currentValue = effected.getINT();
+                    break;
+                }
+                case DEX: {
+                    currentValue = effected.getDEX();
+                    break;
+                }
+                case WIT: {
+                    currentValue = effected.getWIT();
+                    break;
+                }
+                case CON: {
+                    currentValue = effected.getCON();
+                    break;
+                }
+                case MEN: {
+                    currentValue = effected.getMEN();
+                    break;
+                }
+            }
+
+            if ((currentValue >= _min) && (currentValue <= _max))
+            {
+                SkillCaster.triggerCast(effected, effected, SkillData.getInstance().getSkill(_skillId, 1));
+            }
+
+    }
+
+
+}
Index: L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java
--- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java (revision c4d1110cbe5adae21c66e27372ede2a106411147)
+++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/scripts/handlers/EffectMasterHandler.java (date 1691141368151)
@@ -406,6 +406,7 @@
  EffectHandler.getInstance().registerHandler("TriggerSkillByMagicType", TriggerSkillByMagicType::new);
  EffectHandler.getInstance().registerHandler("TriggerSkillBySkill", TriggerSkillBySkill::new);
  EffectHandler.getInstance().registerHandler("TriggerSkillBySkillAttack", TriggerSkillBySkillAttack::new);
+ EffectHandler.getInstance().registerHandler("TriggerSkillByStat", TriggerSkillByStat::new);
  EffectHandler.getInstance().registerHandler("TwoHandedBluntBonus", TwoHandedBluntBonus::new);
  EffectHandler.getInstance().registerHandler("TwoHandedStance", TwoHandedStance::new);
  EffectHandler.getInstance().registerHandler("TwoHandedSwordBonus", TwoHandedSwordBonus::new);
Index: L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/47400-47499.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/47400-47499.xml b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/47400-47499.xml
--- a/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/47400-47499.xml (revision c4d1110cbe5adae21c66e27372ede2a106411147)
+++ b/L2J_Mobius_Essence_6.3_Crusader/dist/game/data/stats/skills/47400-47499.xml (date 1691141368145)
@@ -923,9 +923,30 @@
  <operateType>A1</operateType>
  </skill>
  <skill id="47417" toLevel="1" name="Dexterous Body">
- <!-- Additional effects are affected by DEX. <DEX 65-74> - When using a bow, P. Atk. +5% <DEX 75-84> - When using a bow, P. Atk. +10% - When using the Stun Shot and Mental Panic Shot skills, with a 50% chance, increases attack rate and power. <DEX 85+> - When using a bow, P. Atk. +20% - Received P. Skill Critical Rate -5% - Received P. Skill Critical Damage -5% - When using the Stun Shot and Mental Panic Shot skills, with a certain chance, increases attack rate and power. -->
- <icon>icon.skill0000</icon>
- <operateType>A1</operateType>
+ <icon>icon.s_agile</icon>
+ <operateType>P</operateType>
+ <magicLevel>76</magicLevel>
+ <magicCriticalRate>5</magicCriticalRate>
+ <effects>
+ <effect name="TriggerSkillByStat">
+ <baseStat>DEX</baseStat>
+ <min>65</min>
+ <max>74</max>
+ <skillId>47419</skillId>
+ </effect>
+ <effect name="TriggerSkillByStat">
+ <baseStat>DEX</baseStat>
+ <min>75</min>
+ <max>84</max>
+ <skillId>47420</skillId>
+ </effect>
+ <effect name="TriggerSkillByStat">
+ <baseStat>DEX</baseStat>
+ <min>85</min>
+ <max>99</max>
+ <skillId>47421</skillId>
+ </effect>
+ </effects>
  </skill>
  <skill id="47418" toLevel="1" name="Dexterous Body">
  <!-- Additional effects are affected by DEX. <DEX 65-74> - When using a bow, P. Atk. +5% <DEX 75-84> - When using a bow, P. Atk. +10% - When using the Stun Shot and Mental Panic Shot skills, with a 50% chance, increases attack rate and power. <DEX 85+> - When using a bow, P. Atk. +20% - Received P. Skill Critical Rate -5% - Received P. Skill Critical Damage -5% - When using the Stun Shot and Mental Panic Shot skills, with a certain chance, increases attack rate and power. -->
@@ -933,19 +954,75 @@
  <operateType>A1</operateType>
  </skill>
  <skill id="47419" toLevel="1" name="Dexterous Body Lv. 1">
- <!-- <DEX 65-74> - When using a bow, P. Atk. +5% -->
  <icon>icon.skill0000</icon>
- <operateType>A1</operateType>
+ <isTriggeredSkill>true</isTriggeredSkill>
+ <abnormalLevel>1</abnormalLevel>
+ <operateType>A2</operateType>
+ <castRange>-1</castRange>
+ <isMagic>1</isMagic>
+ <abnormalTime>-1</abnormalTime>
+ <basicProperty>NONE</basicProperty>
+ <targetType>SELF</targetType>
+ <affectScope>SINGLE</affectScope>
+ <effects>
+ <effect name="PAtk">
+ <amount>5</amount>
+ <mode>PER</mode>
+ <weaponType>
+ <item>BOW</item>
+ </weaponType>
+ </effect>
+ </effects>
  </skill>
  <skill id="47420" toLevel="1" name="Dexterous Body Lv. 2">
- <!-- <DEX 75-84> - When using a bow, P. Atk. +10% - When using the Stun Shot and Mental Panic Shot skills, with a 50% chance, increases attack rate and power. -->
  <icon>icon.skill0000</icon>
- <operateType>A1</operateType>
+ <isTriggeredSkill>true</isTriggeredSkill>
+ <abnormalLevel>2</abnormalLevel>
+ <operateType>A2</operateType>
+ <castRange>-1</castRange>
+ <isMagic>1</isMagic>
+ <abnormalTime>-1</abnormalTime>
+ <basicProperty>NONE</basicProperty>
+ <targetType>SELF</targetType>
+ <affectScope>SINGLE</affectScope>
+ <effects>
+ <effect name="PAtk">
+ <amount>10</amount>
+ <mode>PER</mode>
+ <weaponType>
+ <item>BOW</item>
+ </weaponType>
+ </effect>
+ </effects>
  </skill>
  <skill id="47421" toLevel="1" name="Dexterous Body Lv. 3">
- <!-- <DEX 85+> - When using a bow, P. Atk. +20% - Received P. Skill Critical Rate -5% - Received P. Skill Critical Damage -5% - When using the Stun Shot and Mental Panic Shot skills, with a certain chance, increases attack rate and power. -->
  <icon>icon.skill0000</icon>
- <operateType>A1</operateType>
+ <isTriggeredSkill>true</isTriggeredSkill>
+ <abnormalLevel>3</abnormalLevel>
+ <operateType>A2</operateType>
+ <castRange>-1</castRange>
+ <isMagic>1</isMagic>
+ <abnormalTime>-1</abnormalTime>
+ <basicProperty>NONE</basicProperty>
+ <targetType>SELF</targetType>
+ <affectScope>SINGLE</affectScope>
+ <effects>
+ <effect name="PAtk">
+ <amount>20</amount>
+ <mode>PER</mode>
+ <weaponType>
+ <item>BOW</item>
+ </weaponType>
+ </effect>
+ <effect name="DefenceCriticalRate">
+ <amount>-5</amount>
+ <mode>PER</mode>
+ </effect>
+ <effect name="DefenceCriticalDamage">
+ <amount>-5</amount>
+ <mode>PER</mode>
+ </effect>
+ </effects>
  </skill>
  <skill id="47422" toLevel="12" name="Stun Shot">
  <!-- <Shock skill> A stunning shot that deals damage to the target with $s1 power. Stuns for $s2 -->


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16067
We already have this on subscriber version.