L2Skill.java 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213
  1. /*
  2. * Copyright (C) 2004-2013 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.model.skills;
  20. import java.util.ArrayList;
  21. import java.util.List;
  22. import java.util.Map;
  23. import java.util.StringTokenizer;
  24. import java.util.logging.Level;
  25. import java.util.logging.Logger;
  26. import javolution.util.FastMap;
  27. import com.l2jserver.Config;
  28. import com.l2jserver.gameserver.GeoData;
  29. import com.l2jserver.gameserver.datatables.ItemTable;
  30. import com.l2jserver.gameserver.datatables.SkillTable;
  31. import com.l2jserver.gameserver.datatables.SkillTreesData;
  32. import com.l2jserver.gameserver.handler.ITargetTypeHandler;
  33. import com.l2jserver.gameserver.handler.TargetHandler;
  34. import com.l2jserver.gameserver.model.ChanceCondition;
  35. import com.l2jserver.gameserver.model.L2ExtractableProductItem;
  36. import com.l2jserver.gameserver.model.L2ExtractableSkill;
  37. import com.l2jserver.gameserver.model.L2Object;
  38. import com.l2jserver.gameserver.model.PcCondOverride;
  39. import com.l2jserver.gameserver.model.StatsSet;
  40. import com.l2jserver.gameserver.model.actor.L2Attackable;
  41. import com.l2jserver.gameserver.model.actor.L2Character;
  42. import com.l2jserver.gameserver.model.actor.L2Playable;
  43. import com.l2jserver.gameserver.model.actor.L2Summon;
  44. import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
  45. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  46. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  47. import com.l2jserver.gameserver.model.actor.instance.L2SiegeFlagInstance;
  48. import com.l2jserver.gameserver.model.conditions.Condition;
  49. import com.l2jserver.gameserver.model.effects.EffectTemplate;
  50. import com.l2jserver.gameserver.model.effects.L2Effect;
  51. import com.l2jserver.gameserver.model.entity.TvTEvent;
  52. import com.l2jserver.gameserver.model.holders.ItemHolder;
  53. import com.l2jserver.gameserver.model.interfaces.IChanceSkillTrigger;
  54. import com.l2jserver.gameserver.model.items.L2Armor;
  55. import com.l2jserver.gameserver.model.items.type.L2ArmorType;
  56. import com.l2jserver.gameserver.model.skills.funcs.Func;
  57. import com.l2jserver.gameserver.model.skills.funcs.FuncTemplate;
  58. import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
  59. import com.l2jserver.gameserver.model.stats.BaseStats;
  60. import com.l2jserver.gameserver.model.stats.Env;
  61. import com.l2jserver.gameserver.model.stats.Formulas;
  62. import com.l2jserver.gameserver.model.stats.Stats;
  63. import com.l2jserver.gameserver.model.zone.ZoneId;
  64. import com.l2jserver.gameserver.network.SystemMessageId;
  65. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  66. import com.l2jserver.gameserver.util.Util;
  67. public abstract class L2Skill implements IChanceSkillTrigger
  68. {
  69. protected static final Logger _log = Logger.getLogger(L2Skill.class.getName());
  70. private static final L2Object[] _emptyTargetList = new L2Object[0];
  71. public static final int SKILL_CREATE_DWARVEN = 172;
  72. public static final int SKILL_LUCKY = 194;
  73. public static final int SKILL_EXPERTISE = 239;
  74. public static final int SKILL_CRYSTALLIZE = 248;
  75. public static final int SKILL_CLAN_LUCK = 390;
  76. public static final int SKILL_ONYX_BEAST_TRANSFORMATION = 617;
  77. public static final int SKILL_CREATE_COMMON = 1320;
  78. public static final int SKILL_DIVINE_INSPIRATION = 1405;
  79. public static final int SKILL_NPC_RACE = 4416;
  80. public static final boolean geoEnabled = Config.GEODATA > 0;
  81. // conditional values
  82. public static final int COND_RUNNING = 0x0001;
  83. public static final int COND_WALKING = 0x0002;
  84. public static final int COND_SIT = 0x0004;
  85. public static final int COND_BEHIND = 0x0008;
  86. public static final int COND_CRIT = 0x0010;
  87. public static final int COND_LOWHP = 0x0020;
  88. public static final int COND_ROBES = 0x0040;
  89. public static final int COND_CHARGES = 0x0080;
  90. public static final int COND_SHIELD = 0x0100;
  91. private static final Func[] _emptyFunctionSet = new Func[0];
  92. private static final L2Effect[] _emptyEffectSet = new L2Effect[0];
  93. // these two build the primary key
  94. private final int _id;
  95. private final int _level;
  96. /** Identifier for a skill that client can't display */
  97. private int _displayId;
  98. // not needed, just for easier debug
  99. private final String _name;
  100. private final L2SkillOpType _operateType;
  101. private final int _magic;
  102. private final L2TraitType _traitType;
  103. private final boolean _staticReuse;
  104. private final boolean _staticDamage; // Damage dealing skills do static damage based on the power value.
  105. private final int _mpConsume;
  106. private final int _mpInitialConsume;
  107. private final int _hpConsume;
  108. private final int _cpConsume;
  109. private final int _targetConsume;
  110. private final int _targetConsumeId;
  111. private final int _itemConsume;
  112. private final int _itemConsumeId;
  113. private final int _castRange;
  114. private final int _effectRange;
  115. // Abnormal levels for skills and their canceling, e.g. poison vs negate
  116. private final int _abnormalLvl; // e.g. poison or bleed lvl 2
  117. // Note: see also _effectAbnormalLvl
  118. private final int _negateLvl; // abnormalLvl is negated with negateLvl
  119. private final int[] _negateId; // cancels the effect of skill ID
  120. private final L2SkillType[] _negateStats; // lists the effect types that are canceled
  121. private final Map<String, Byte> _negateAbnormals; // lists the effect abnormal types with order below the presented that are canceled
  122. private final int _maxNegatedEffects; // maximum number of effects to negate
  123. private final boolean _stayAfterDeath; // skill should stay after death
  124. private final boolean _stayOnSubclassChange; // skill should stay on subclass change
  125. // kill by damage over time
  126. private final boolean _killByDOT;
  127. private final int _refId;
  128. // all times in milliseconds
  129. private final int _hitTime;
  130. private final int[] _hitTimings;
  131. // private final int _skillInterruptTime;
  132. private final int _coolTime;
  133. private final int _reuseHashCode;
  134. private final int _reuseDelay;
  135. /** Target type of the skill : SELF, PARTY, CLAN, PET... */
  136. private final L2TargetType _targetType;
  137. private final int _feed;
  138. // base success chance
  139. private final double _power;
  140. private final double _pvpPower;
  141. private final double _pvePower;
  142. private final int _magicLevel;
  143. private final int _lvlBonusRate;
  144. private final boolean _ignoreResists;
  145. private final int _minChance;
  146. private final int _maxChance;
  147. private final int _blowChance;
  148. private final boolean _isNeutral;
  149. // Effecting area of the skill, in radius.
  150. // The radius center varies according to the _targetType:
  151. // "caster" if targetType = AURA/PARTY/CLAN or "target" if targetType = AREA
  152. private final int _affectRange;
  153. private final L2SkillType _skillType;
  154. private final L2SkillType _effectType; // additional effect has a type
  155. private final int _effectAbnormalLvl; // abnormal level for the additional effect type, e.g. poison lvl 1
  156. private final int _effectId;
  157. private final int _effectLvl; // normal effect level
  158. private final boolean _nextActionIsAttack;
  159. private final boolean _removedOnAnyActionExceptMove;
  160. private final boolean _removedOnDamage;
  161. private final byte _element;
  162. private final int _elementPower;
  163. private final Stats _stat;
  164. private final BaseStats _saveVs;
  165. private final int _condition;
  166. private final int _conditionValue;
  167. private final boolean _overhit;
  168. private final int _weaponsAllowed;
  169. private final int _armorsAllowed;
  170. private final int _minPledgeClass;
  171. private final boolean _isOffensive;
  172. private final int _chargeConsume;
  173. private final int _triggeredId;
  174. private final int _triggeredLevel;
  175. private final String _chanceType;
  176. private final int _soulMaxConsume;
  177. private final int _numSouls;
  178. private final int _expNeeded;
  179. private final int _critChance;
  180. private final boolean _dependOnTargetBuff;
  181. private final int _transformId;
  182. private final int _transformDuration;
  183. private final int _afterEffectId;
  184. private final int _afterEffectLvl;
  185. private final boolean _isHeroSkill; // If true the skill is a Hero Skill
  186. private final boolean _isGMSkill; // True if skill is GM skill
  187. private final int _baseCritRate; // percent of success for skill critical hit (especially for PDAM & BLOW - they're not affected by rCrit values or buffs). Default loads -1 for all other skills but 0 to PDAM & BLOW
  188. private final int _lethalEffect1; // percent of success for lethal 1st effect (hit cp to 1 or if mob hp to 50%) (only for PDAM skills)
  189. private final int _lethalEffect2; // percent of success for lethal 2nd effect (hit cp,hp to 1 or if mob hp to 1) (only for PDAM skills)
  190. private final boolean _directHpDmg; // If true then dmg is being make directly
  191. private final boolean _isTriggeredSkill; // If true the skill will take activation buff slot instead of a normal buff slot
  192. private final float _sSBoost; // If true skill will have SoulShot boost (power*2)
  193. private final int _aggroPoints;
  194. protected List<Condition> _preCondition;
  195. protected List<Condition> _itemPreCondition;
  196. protected FuncTemplate[] _funcTemplates;
  197. public EffectTemplate[] _effectTemplates;
  198. protected EffectTemplate[] _effectTemplatesSelf;
  199. protected EffectTemplate[] _effectTemplatesPassive;
  200. protected ChanceCondition _chanceCondition = null;
  201. // Flying support
  202. private final String _flyType;
  203. private final int _flyRadius;
  204. private final float _flyCourse;
  205. private final boolean _isDebuff;
  206. private final String _attribute;
  207. private final boolean _ignoreShield;
  208. private final boolean _isSuicideAttack;
  209. private final boolean _canBeReflected;
  210. private final boolean _canBeDispeled;
  211. private final boolean _isClanSkill;
  212. private final boolean _excludedFromCheck;
  213. private final boolean _simultaneousCast;
  214. private L2ExtractableSkill _extractableItems = null;
  215. private final int _maxTargets;
  216. private final boolean _isStaticHeal;
  217. private int _npcId = 0;
  218. // Appearance
  219. private final int _faceId;
  220. private final int _hairColorId;
  221. private final int _hairStyleId;
  222. protected L2Skill(StatsSet set)
  223. {
  224. _id = set.getInteger("skill_id");
  225. _level = set.getInteger("level");
  226. _refId = set.getInteger("referenceId", 0);
  227. _displayId = set.getInteger("displayId", _id);
  228. _name = set.getString("name");
  229. _operateType = set.getEnum("operateType", L2SkillOpType.class);
  230. _magic = set.getInteger("isMagic", 0);
  231. _traitType = set.getEnum("trait", L2TraitType.class, L2TraitType.NONE);
  232. _staticReuse = set.getBool("staticReuse", false);
  233. _staticDamage = set.getBool("staticDamage", false);
  234. _mpConsume = set.getInteger("mpConsume", 0);
  235. _mpInitialConsume = set.getInteger("mpInitialConsume", 0);
  236. _hpConsume = set.getInteger("hpConsume", 0);
  237. _cpConsume = set.getInteger("cpConsume", 0);
  238. _targetConsume = set.getInteger("targetConsumeCount", 0);
  239. _targetConsumeId = set.getInteger("targetConsumeId", 0);
  240. _itemConsume = set.getInteger("itemConsumeCount", 0);
  241. _itemConsumeId = set.getInteger("itemConsumeId", 0);
  242. _afterEffectId = set.getInteger("afterEffectId", 0);
  243. _afterEffectLvl = set.getInteger("afterEffectLvl", 1);
  244. _castRange = set.getInteger("castRange", -1);
  245. _effectRange = set.getInteger("effectRange", -1);
  246. _abnormalLvl = set.getInteger("abnormalLvl", -1);
  247. _effectAbnormalLvl = set.getInteger("effectAbnormalLvl", -1); // support for a separate effect abnormal lvl, e.g. poison inside a different skill
  248. _negateLvl = set.getInteger("negateLvl", -1);
  249. _attribute = set.getString("attribute", "");
  250. String str = set.getString("negateStats", "");
  251. if (str.isEmpty())
  252. {
  253. _negateStats = new L2SkillType[0];
  254. }
  255. else
  256. {
  257. String[] stats = str.split(" ");
  258. L2SkillType[] array = new L2SkillType[stats.length];
  259. for (int i = 0; i < stats.length; i++)
  260. {
  261. L2SkillType type = null;
  262. try
  263. {
  264. type = Enum.valueOf(L2SkillType.class, stats[i]);
  265. }
  266. catch (Exception e)
  267. {
  268. throw new IllegalArgumentException("SkillId: " + _id + "Enum value of type " + L2SkillType.class.getName() + "required, but found: " + stats[i]);
  269. }
  270. array[i] = type;
  271. }
  272. _negateStats = array;
  273. }
  274. String negateAbnormals = set.getString("negateAbnormals", null);
  275. if ((negateAbnormals != null) && !negateAbnormals.isEmpty())
  276. {
  277. _negateAbnormals = new FastMap<>();
  278. for (String ngtStack : negateAbnormals.split(";"))
  279. {
  280. String[] ngt = ngtStack.split(",");
  281. if (ngt.length == 1) // Only abnormalType is present, without abnormalLvl
  282. {
  283. _negateAbnormals.put(ngt[0], Byte.MAX_VALUE);
  284. }
  285. else if (ngt.length == 2) // Both abnormalType and abnormalLvl are present
  286. {
  287. try
  288. {
  289. _negateAbnormals.put(ngt[0], Byte.parseByte(ngt[1]));
  290. }
  291. catch (Exception e)
  292. {
  293. throw new IllegalArgumentException("SkillId: " + _id + " Byte value required, but found: " + ngt[1]);
  294. }
  295. }
  296. else
  297. {
  298. throw new IllegalArgumentException("SkillId: " + _id + ": Incorrect negate Abnormals for " + ngtStack + ". Lvl: abnormalType1,abnormalLvl1;abnormalType2,abnormalLvl2;abnormalType3,abnormalLvl3... or abnormalType1;abnormalType2;abnormalType3...");
  299. }
  300. }
  301. }
  302. else
  303. {
  304. _negateAbnormals = null;
  305. }
  306. String negateId = set.getString("negateId", null);
  307. if (negateId != null)
  308. {
  309. String[] valuesSplit = negateId.split(",");
  310. _negateId = new int[valuesSplit.length];
  311. for (int i = 0; i < valuesSplit.length; i++)
  312. {
  313. _negateId[i] = Integer.parseInt(valuesSplit[i]);
  314. }
  315. }
  316. else
  317. {
  318. _negateId = new int[0];
  319. }
  320. _maxNegatedEffects = set.getInteger("maxNegated", 0);
  321. _stayAfterDeath = set.getBool("stayAfterDeath", false);
  322. _stayOnSubclassChange = set.getBool("stayOnSubclassChange", true);
  323. _killByDOT = set.getBool("killByDOT", false);
  324. _isNeutral = set.getBool("neutral", false);
  325. _hitTime = set.getInteger("hitTime", 0);
  326. String hitTimings = set.getString("hitTimings", null);
  327. if (hitTimings != null)
  328. {
  329. try
  330. {
  331. String[] valuesSplit = hitTimings.split(",");
  332. _hitTimings = new int[valuesSplit.length];
  333. for (int i = 0; i < valuesSplit.length; i++)
  334. {
  335. _hitTimings[i] = Integer.parseInt(valuesSplit[i]);
  336. }
  337. }
  338. catch (Exception e)
  339. {
  340. throw new IllegalArgumentException("SkillId: " + _id + " invalid hitTimings value: " + hitTimings + ", \"percent,percent,...percent\" required");
  341. }
  342. }
  343. else
  344. {
  345. _hitTimings = new int[0];
  346. }
  347. _coolTime = set.getInteger("coolTime", 0);
  348. _isDebuff = set.getBool("isDebuff", false);
  349. _feed = set.getInteger("feed", 0);
  350. _reuseHashCode = SkillTable.getSkillHashCode(_id, _level);
  351. if (Config.ENABLE_MODIFY_SKILL_REUSE && Config.SKILL_REUSE_LIST.containsKey(_id))
  352. {
  353. if (Config.DEBUG)
  354. {
  355. _log.info("*** Skill " + _name + " (" + _level + ") changed reuse from " + set.getInteger("reuseDelay", 0) + " to " + Config.SKILL_REUSE_LIST.get(_id) + " seconds.");
  356. }
  357. _reuseDelay = Config.SKILL_REUSE_LIST.get(_id);
  358. }
  359. else
  360. {
  361. _reuseDelay = set.getInteger("reuseDelay", 0);
  362. }
  363. _affectRange = set.getInteger("affectRange", 0);
  364. _targetType = set.getEnum("target", L2TargetType.class);
  365. _power = set.getFloat("power", 0.f);
  366. _pvpPower = set.getFloat("pvpPower", (float) getPower());
  367. _pvePower = set.getFloat("pvePower", (float) getPower());
  368. _magicLevel = set.getInteger("magicLvl", 0);
  369. _lvlBonusRate = set.getInteger("lvlBonusRate", 0);
  370. _ignoreResists = set.getBool("ignoreResists", false);
  371. _minChance = set.getInteger("minChance", Config.MIN_ABNORMAL_STATE_SUCCESS_RATE);
  372. _maxChance = set.getInteger("maxChance", Config.MAX_ABNORMAL_STATE_SUCCESS_RATE);
  373. _stat = set.getEnum("stat", Stats.class, null);
  374. _ignoreShield = set.getBool("ignoreShld", false);
  375. _skillType = set.getEnum("skillType", L2SkillType.class, L2SkillType.DUMMY);
  376. _effectType = set.getEnum("effectType", L2SkillType.class, null);
  377. _effectId = set.getInteger("effectId", 0);
  378. _effectLvl = set.getInteger("effectLevel", 0);
  379. _nextActionIsAttack = set.getBool("nextActionAttack", false);
  380. _removedOnAnyActionExceptMove = set.getBool("removedOnAnyActionExceptMove", false);
  381. _removedOnDamage = set.getBool("removedOnDamage", _skillType == L2SkillType.SLEEP);
  382. _element = set.getByte("element", (byte) -1);
  383. _elementPower = set.getInteger("elementPower", 0);
  384. _saveVs = set.getEnum("saveVs", BaseStats.class, BaseStats.NULL);
  385. _condition = set.getInteger("condition", 0);
  386. _conditionValue = set.getInteger("conditionValue", 0);
  387. _overhit = set.getBool("overHit", false);
  388. _isSuicideAttack = set.getBool("isSuicideAttack", false);
  389. String weaponsAllowedString = set.getString("weaponsAllowed", null);
  390. if ((weaponsAllowedString != null) && !weaponsAllowedString.trim().isEmpty())
  391. {
  392. int mask = 0;
  393. StringTokenizer st = new StringTokenizer(weaponsAllowedString, ",");
  394. while (st.hasMoreTokens())
  395. {
  396. int old = mask;
  397. String item = st.nextToken().trim();
  398. if (ItemTable._weaponTypes.containsKey(item))
  399. {
  400. mask |= ItemTable._weaponTypes.get(item).mask();
  401. }
  402. if (ItemTable._armorTypes.containsKey(item))
  403. {
  404. mask |= ItemTable._armorTypes.get(item).mask();
  405. }
  406. if (old == mask)
  407. {
  408. _log.info("[weaponsAllowed] Unknown item type name: " + item);
  409. }
  410. }
  411. _weaponsAllowed = mask;
  412. }
  413. else
  414. {
  415. _weaponsAllowed = 0;
  416. }
  417. _armorsAllowed = set.getInteger("armorsAllowed", 0);
  418. _minPledgeClass = set.getInteger("minPledgeClass", 0);
  419. _isOffensive = set.getBool("offensive", isSkillTypeOffensive());
  420. _chargeConsume = set.getInteger("chargeConsume", 0);
  421. _triggeredId = set.getInteger("triggeredId", 0);
  422. _triggeredLevel = set.getInteger("triggeredLevel", 1);
  423. _chanceType = set.getString("chanceType", "");
  424. if (!_chanceType.isEmpty() && !_chanceType.isEmpty())
  425. {
  426. _chanceCondition = ChanceCondition.parse(set);
  427. }
  428. _numSouls = set.getInteger("num_souls", 0);
  429. _soulMaxConsume = set.getInteger("soulMaxConsumeCount", 0);
  430. _blowChance = set.getInteger("blowChance", 0);
  431. _expNeeded = set.getInteger("expNeeded", 0);
  432. _critChance = set.getInteger("critChance", 0);
  433. _transformId = set.getInteger("transformId", 0);
  434. _transformDuration = set.getInteger("transformDuration", 0);
  435. _isHeroSkill = SkillTreesData.getInstance().isHeroSkill(_id, _level);
  436. _isGMSkill = SkillTreesData.getInstance().isGMSkill(_id, _level);
  437. _baseCritRate = set.getInteger("baseCritRate", ((_skillType == L2SkillType.PDAM) || (_skillType == L2SkillType.BLOW)) ? 0 : -1);
  438. _lethalEffect1 = set.getInteger("lethal1", 0);
  439. _lethalEffect2 = set.getInteger("lethal2", 0);
  440. _directHpDmg = set.getBool("dmgDirectlyToHp", false);
  441. _isTriggeredSkill = set.getBool("isTriggeredSkill", false);
  442. _sSBoost = set.getFloat("SSBoost", 0.f);
  443. _aggroPoints = set.getInteger("aggroPoints", 0);
  444. _flyType = set.getString("flyType", null);
  445. _flyRadius = set.getInteger("flyRadius", 0);
  446. _flyCourse = set.getFloat("flyCourse", 0);
  447. _canBeReflected = set.getBool("canBeReflected", true);
  448. _canBeDispeled = set.getBool("canBeDispeled", true);
  449. _isClanSkill = set.getBool("isClanSkill", false);
  450. _excludedFromCheck = set.getBool("excludedFromCheck", false);
  451. _dependOnTargetBuff = set.getBool("dependOnTargetBuff", false);
  452. _simultaneousCast = set.getBool("simultaneousCast", false);
  453. String capsuled_items = set.getString("capsuled_items_skill", null);
  454. if (capsuled_items != null)
  455. {
  456. if (capsuled_items.isEmpty())
  457. {
  458. _log.warning("Empty Extractable Item Skill data in Skill Id: " + _id);
  459. }
  460. _extractableItems = parseExtractableSkill(_id, _level, capsuled_items);
  461. }
  462. _maxTargets = set.getInteger("maxTargets", -1);
  463. _isStaticHeal = set.getBool("isStaticHeal", false);
  464. _npcId = set.getInteger("npcId", 0);
  465. _faceId = set.getInteger("faceId", -1);
  466. _hairColorId = set.getInteger("hairColorId", -1);
  467. _hairStyleId = set.getInteger("hairStyleId", -1);
  468. }
  469. public abstract void useSkill(L2Character caster, L2Object[] targets);
  470. public final int getArmorsAllowed()
  471. {
  472. return _armorsAllowed;
  473. }
  474. public final int getConditionValue()
  475. {
  476. return _conditionValue;
  477. }
  478. public final L2SkillType getSkillType()
  479. {
  480. return _skillType;
  481. }
  482. public final L2TraitType getTraitType()
  483. {
  484. return _traitType;
  485. }
  486. public final byte getElement()
  487. {
  488. return _element;
  489. }
  490. public final int getElementPower()
  491. {
  492. return _elementPower;
  493. }
  494. /**
  495. * Return the target type of the skill : SELF, PARTY, CLAN, PET...
  496. * @return
  497. */
  498. public final L2TargetType getTargetType()
  499. {
  500. return _targetType;
  501. }
  502. public final int getCondition()
  503. {
  504. return _condition;
  505. }
  506. public final boolean isOverhit()
  507. {
  508. return _overhit;
  509. }
  510. public final boolean killByDOT()
  511. {
  512. return _killByDOT;
  513. }
  514. public final boolean isSuicideAttack()
  515. {
  516. return _isSuicideAttack;
  517. }
  518. public final boolean allowOnTransform()
  519. {
  520. return isPassive();
  521. }
  522. /**
  523. * Return the power of the skill.
  524. * @param activeChar
  525. * @param target
  526. * @param isPvP
  527. * @param isPvE
  528. * @return
  529. */
  530. public final double getPower(L2Character activeChar, L2Character target, boolean isPvP, boolean isPvE)
  531. {
  532. if (activeChar == null)
  533. {
  534. return getPower(isPvP, isPvE);
  535. }
  536. switch (_skillType)
  537. {
  538. case DEATHLINK:
  539. {
  540. return getPower(isPvP, isPvE) * (-((activeChar.getCurrentHp() * 2) / activeChar.getMaxHp()) + 2);
  541. }
  542. case FATAL:
  543. {
  544. return getPower(isPvP, isPvE) * (-((target.getCurrentHp() * 2) / target.getMaxHp()) + 2);
  545. }
  546. default:
  547. {
  548. return getPower(isPvP, isPvE);
  549. }
  550. }
  551. }
  552. public final double getPower()
  553. {
  554. return _power;
  555. }
  556. public final double getPower(boolean isPvP, boolean isPvE)
  557. {
  558. return isPvE ? _pvePower : isPvP ? _pvpPower : _power;
  559. }
  560. public final L2SkillType[] getNegateStats()
  561. {
  562. return _negateStats;
  563. }
  564. public final Map<String, Byte> getNegateAbnormals()
  565. {
  566. return _negateAbnormals;
  567. }
  568. public final int getAbnormalLvl()
  569. {
  570. return _abnormalLvl;
  571. }
  572. public final int getNegateLvl()
  573. {
  574. return _negateLvl;
  575. }
  576. public final int[] getNegateId()
  577. {
  578. return _negateId;
  579. }
  580. public final int getMagicLevel()
  581. {
  582. return _magicLevel;
  583. }
  584. public final int getMaxNegatedEffects()
  585. {
  586. return _maxNegatedEffects;
  587. }
  588. public final int getLvlBonusRate()
  589. {
  590. return _lvlBonusRate;
  591. }
  592. /**
  593. * Return true if skill should ignore all resistances
  594. * @return
  595. */
  596. public final boolean ignoreResists()
  597. {
  598. return _ignoreResists;
  599. }
  600. /**
  601. * Return custom minimum skill/effect chance.
  602. * @return
  603. */
  604. public final int getMinChance()
  605. {
  606. return _minChance;
  607. }
  608. /**
  609. * Return custom maximum skill/effect chance.
  610. * @return
  611. */
  612. public final int getMaxChance()
  613. {
  614. return _maxChance;
  615. }
  616. /**
  617. * Return true if skill effects should be removed on any action except movement
  618. * @return
  619. */
  620. public final boolean isRemovedOnAnyActionExceptMove()
  621. {
  622. return _removedOnAnyActionExceptMove;
  623. }
  624. /**
  625. * Return true if skill effects should be removed on damage
  626. * @return
  627. */
  628. public final boolean isRemovedOnDamage()
  629. {
  630. return _removedOnDamage;
  631. }
  632. /**
  633. * Return the additional effect Id.
  634. * @return
  635. */
  636. public final int getEffectId()
  637. {
  638. return _effectId;
  639. }
  640. /**
  641. * Return the additional effect level.
  642. * @return
  643. */
  644. public final int getEffectLvl()
  645. {
  646. return _effectLvl;
  647. }
  648. public final int getEffectAbnormalLvl()
  649. {
  650. return _effectAbnormalLvl;
  651. }
  652. /**
  653. * Return the additional effect skill type (ex : STUN, PARALYZE,...).
  654. * @return
  655. */
  656. public final L2SkillType getEffectType()
  657. {
  658. return _effectType;
  659. }
  660. /**
  661. * Return true if character should attack target after skill
  662. * @return
  663. */
  664. public final boolean nextActionIsAttack()
  665. {
  666. return _nextActionIsAttack;
  667. }
  668. /**
  669. * TODO: Zoey76, temp fix until skill reworks is done.
  670. * @return the calculated buff duration used to display buff icons.
  671. */
  672. public final int getBuffDuration()
  673. {
  674. int duration = 0;
  675. final EffectTemplate firstEffect = hasEffects() ? getEffectTemplates()[0] : null;
  676. if (firstEffect != null)
  677. {
  678. duration = firstEffect.abnormalTime * 1000;
  679. if (firstEffect.counter > 1)
  680. {
  681. duration *= firstEffect.counter;
  682. }
  683. }
  684. return duration;
  685. }
  686. /**
  687. * @return Returns the castRange.
  688. */
  689. public final int getCastRange()
  690. {
  691. return _castRange;
  692. }
  693. /**
  694. * @return Returns the cpConsume;
  695. */
  696. public final int getCpConsume()
  697. {
  698. return _cpConsume;
  699. }
  700. /**
  701. * @return Returns the effectRange.
  702. */
  703. public final int getEffectRange()
  704. {
  705. return _effectRange;
  706. }
  707. /**
  708. * @return Returns the hpConsume.
  709. */
  710. public final int getHpConsume()
  711. {
  712. return _hpConsume;
  713. }
  714. /**
  715. * @return Returns the id.
  716. */
  717. public final int getId()
  718. {
  719. return _id;
  720. }
  721. /**
  722. * @return Returns the boolean _isDebuff.
  723. */
  724. public final boolean isDebuff()
  725. {
  726. return _isDebuff;
  727. }
  728. public int getDisplayId()
  729. {
  730. return _displayId;
  731. }
  732. public void setDisplayId(int id)
  733. {
  734. _displayId = id;
  735. }
  736. public int getTriggeredId()
  737. {
  738. return _triggeredId;
  739. }
  740. public int getTriggeredLevel()
  741. {
  742. return _triggeredLevel;
  743. }
  744. public boolean triggerAnotherSkill()
  745. {
  746. return _triggeredId > 1;
  747. }
  748. /**
  749. * Return the skill type (ex : BLEED, SLEEP, WATER...).
  750. * @return
  751. */
  752. public final Stats getStat()
  753. {
  754. return _stat;
  755. }
  756. /**
  757. * Return skill saveVs base stat (STR, INT ...).
  758. * @return
  759. */
  760. public final BaseStats getSaveVs()
  761. {
  762. return _saveVs;
  763. }
  764. /**
  765. * @return Returns the _targetConsumeId.
  766. */
  767. public final int getTargetConsumeId()
  768. {
  769. return _targetConsumeId;
  770. }
  771. /**
  772. * @return Returns the targetConsume.
  773. */
  774. public final int getTargetConsume()
  775. {
  776. return _targetConsume;
  777. }
  778. /**
  779. * @return Returns the itemConsume.
  780. */
  781. public final int getItemConsume()
  782. {
  783. return _itemConsume;
  784. }
  785. /**
  786. * @return Returns the itemConsumeId.
  787. */
  788. public final int getItemConsumeId()
  789. {
  790. return _itemConsumeId;
  791. }
  792. /**
  793. * @return Returns the level.
  794. */
  795. public final int getLevel()
  796. {
  797. return _level;
  798. }
  799. /**
  800. * @return Returns true to set physical skills.
  801. */
  802. public final boolean isPhysical()
  803. {
  804. return _magic == 0;
  805. }
  806. /**
  807. * @return Returns true to set magic skills.
  808. */
  809. public final boolean isMagic()
  810. {
  811. return _magic == 1;
  812. }
  813. /**
  814. * @return Returns true to set static skills.
  815. */
  816. public final boolean isStatic()
  817. {
  818. return _magic == 2;
  819. }
  820. /**
  821. * @return Returns true to set static reuse.
  822. */
  823. public final boolean isStaticReuse()
  824. {
  825. return _staticReuse;
  826. }
  827. public final boolean isStaticDamage()
  828. {
  829. return _staticDamage;
  830. }
  831. /**
  832. * @return Returns the mpConsume.
  833. */
  834. public final int getMpConsume()
  835. {
  836. return _mpConsume;
  837. }
  838. /**
  839. * @return Returns the mpInitialConsume.
  840. */
  841. public final int getMpInitialConsume()
  842. {
  843. return _mpInitialConsume;
  844. }
  845. /**
  846. * @return Returns the name.
  847. */
  848. public final String getName()
  849. {
  850. return _name;
  851. }
  852. /**
  853. * @return Returns the reuseDelay.
  854. */
  855. public final int getReuseDelay()
  856. {
  857. return _reuseDelay;
  858. }
  859. public final int getReuseHashCode()
  860. {
  861. return _reuseHashCode;
  862. }
  863. public final int getHitTime()
  864. {
  865. return _hitTime;
  866. }
  867. public final int getHitCounts()
  868. {
  869. return _hitTimings.length;
  870. }
  871. public final int[] getHitTimings()
  872. {
  873. return _hitTimings;
  874. }
  875. /**
  876. * @return Returns the coolTime.
  877. */
  878. public final int getCoolTime()
  879. {
  880. return _coolTime;
  881. }
  882. public final int getAffectRange()
  883. {
  884. return _affectRange;
  885. }
  886. public final boolean isActive()
  887. {
  888. return (_operateType != null) && _operateType.isActive();
  889. }
  890. public final boolean isPassive()
  891. {
  892. return (_operateType != null) && _operateType.isPassive();
  893. }
  894. public final boolean isToggle()
  895. {
  896. return (_operateType != null) && _operateType.isToggle();
  897. }
  898. public final boolean isChance()
  899. {
  900. return (_chanceCondition != null) && isPassive();
  901. }
  902. public final boolean isTriggeredSkill()
  903. {
  904. return _isTriggeredSkill;
  905. }
  906. public final boolean isDance()
  907. {
  908. return _magic == 3;
  909. }
  910. public final float getSSBoost()
  911. {
  912. return _sSBoost;
  913. }
  914. public final int getAggroPoints()
  915. {
  916. return _aggroPoints;
  917. }
  918. public final boolean useSoulShot()
  919. {
  920. switch (getSkillType())
  921. {
  922. case PDAM:
  923. case CHARGEDAM:
  924. case BLOW:
  925. return true;
  926. default:
  927. return false;
  928. }
  929. }
  930. public final boolean useSpiritShot()
  931. {
  932. return _magic == 1;
  933. }
  934. public final boolean useFishShot()
  935. {
  936. return ((getSkillType() == L2SkillType.PUMPING) || (getSkillType() == L2SkillType.REELING));
  937. }
  938. public final int getWeaponsAllowed()
  939. {
  940. return _weaponsAllowed;
  941. }
  942. public int getMinPledgeClass()
  943. {
  944. return _minPledgeClass;
  945. }
  946. public final boolean isOffensive()
  947. {
  948. return _isOffensive;
  949. }
  950. public final boolean isNeutral()
  951. {
  952. return _isNeutral;
  953. }
  954. public final boolean isHeroSkill()
  955. {
  956. return _isHeroSkill;
  957. }
  958. public final boolean isGMSkill()
  959. {
  960. return _isGMSkill;
  961. }
  962. public final int getChargeConsume()
  963. {
  964. return _chargeConsume;
  965. }
  966. public final int getNumSouls()
  967. {
  968. return _numSouls;
  969. }
  970. public final int getMaxSoulConsumeCount()
  971. {
  972. return _soulMaxConsume;
  973. }
  974. public final int getExpNeeded()
  975. {
  976. return _expNeeded;
  977. }
  978. public final int getCritChance()
  979. {
  980. return _critChance;
  981. }
  982. public final int getTransformId()
  983. {
  984. return _transformId;
  985. }
  986. public final int getTransformDuration()
  987. {
  988. return _transformDuration;
  989. }
  990. public final int getBaseCritRate()
  991. {
  992. return _baseCritRate;
  993. }
  994. public final int getLethalChance1()
  995. {
  996. return _lethalEffect1;
  997. }
  998. public final int getLethalChance2()
  999. {
  1000. return _lethalEffect2;
  1001. }
  1002. public final boolean getDmgDirectlyToHP()
  1003. {
  1004. return _directHpDmg;
  1005. }
  1006. public final String getFlyType()
  1007. {
  1008. return _flyType;
  1009. }
  1010. public final int getFlyRadius()
  1011. {
  1012. return _flyRadius;
  1013. }
  1014. public final float getFlyCourse()
  1015. {
  1016. return _flyCourse;
  1017. }
  1018. public final boolean isPvpSkill()
  1019. {
  1020. switch (_skillType)
  1021. {
  1022. case DOT:
  1023. case BLEED:
  1024. case CONFUSION:
  1025. case POISON:
  1026. case DEBUFF:
  1027. case AGGDEBUFF:
  1028. case STUN:
  1029. case ROOT:
  1030. case FEAR:
  1031. case SLEEP:
  1032. case MDOT:
  1033. case MUTE:
  1034. case PARALYZE:
  1035. case CANCEL:
  1036. case BETRAY:
  1037. case DISARM:
  1038. case AGGDAMAGE:
  1039. case STEAL_BUFF:
  1040. case AGGREDUCE_CHAR:
  1041. case MANADAM:
  1042. return true;
  1043. default:
  1044. return false;
  1045. }
  1046. }
  1047. public final boolean isSkillTypeOffensive()
  1048. {
  1049. switch (_skillType)
  1050. {
  1051. case PDAM:
  1052. case MDAM:
  1053. case CPDAM:
  1054. case DOT:
  1055. case CPDAMPERCENT:
  1056. case BLEED:
  1057. case POISON:
  1058. case AGGDAMAGE:
  1059. case DEBUFF:
  1060. case AGGDEBUFF:
  1061. case STUN:
  1062. case ROOT:
  1063. case CONFUSION:
  1064. case ERASE:
  1065. case BLOW:
  1066. case FATAL:
  1067. case FEAR:
  1068. case DRAIN:
  1069. case SLEEP:
  1070. case CHARGEDAM:
  1071. case CONFUSE_MOB_ONLY:
  1072. case DEATHLINK:
  1073. case DETECT_WEAKNESS:
  1074. case MANADAM:
  1075. case MDOT:
  1076. case MUTE:
  1077. case SOULSHOT:
  1078. case SPIRITSHOT:
  1079. case SPOIL:
  1080. case SWEEP:
  1081. case PARALYZE:
  1082. case DRAIN_SOUL:
  1083. case AGGREDUCE:
  1084. case CANCEL:
  1085. case AGGREMOVE:
  1086. case AGGREDUCE_CHAR:
  1087. case BETRAY:
  1088. case DELUXE_KEY_UNLOCK:
  1089. case SOW:
  1090. case DISARM:
  1091. case STEAL_BUFF:
  1092. case INSTANT_JUMP:
  1093. return true;
  1094. default:
  1095. return false;
  1096. }
  1097. }
  1098. public final boolean is7Signs()
  1099. {
  1100. if ((_id > 4360) && (_id < 4367))
  1101. {
  1102. return true;
  1103. }
  1104. return false;
  1105. }
  1106. public final boolean isStayAfterDeath()
  1107. {
  1108. return _stayAfterDeath;
  1109. }
  1110. public final boolean isStayOnSubclassChange()
  1111. {
  1112. return _stayOnSubclassChange;
  1113. }
  1114. // int weapons[] = {L2Weapon.WEAPON_TYPE_ETC, L2Weapon.WEAPON_TYPE_BOW,
  1115. // L2Weapon.WEAPON_TYPE_POLE, L2Weapon.WEAPON_TYPE_DUALFIST,
  1116. // L2Weapon.WEAPON_TYPE_DUAL, L2Weapon.WEAPON_TYPE_BLUNT,
  1117. // L2Weapon.WEAPON_TYPE_SWORD, L2Weapon.WEAPON_TYPE_DAGGER};
  1118. public final boolean getWeaponDependancy(L2Character activeChar)
  1119. {
  1120. if (getWeaponDependancy(activeChar, false))
  1121. {
  1122. return true;
  1123. }
  1124. final SystemMessage message = SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED);
  1125. message.addSkillName(this);
  1126. activeChar.sendPacket(message);
  1127. return false;
  1128. }
  1129. public final boolean getWeaponDependancy(L2Character activeChar, boolean chance)
  1130. {
  1131. int weaponsAllowed = getWeaponsAllowed();
  1132. // check to see if skill has a weapon dependency.
  1133. if (weaponsAllowed == 0)
  1134. {
  1135. return true;
  1136. }
  1137. int mask = 0;
  1138. if (activeChar.getActiveWeaponItem() != null)
  1139. {
  1140. mask |= activeChar.getActiveWeaponItem().getItemType().mask();
  1141. }
  1142. if ((activeChar.getSecondaryWeaponItem() != null) && (activeChar.getSecondaryWeaponItem() instanceof L2Armor))
  1143. {
  1144. mask |= ((L2ArmorType) activeChar.getSecondaryWeaponItem().getItemType()).mask();
  1145. }
  1146. if ((mask & weaponsAllowed) != 0)
  1147. {
  1148. return true;
  1149. }
  1150. return false;
  1151. }
  1152. public boolean checkCondition(L2Character activeChar, L2Object target, boolean itemOrWeapon)
  1153. {
  1154. if (activeChar.canOverrideCond(PcCondOverride.SKILL_CONDITIONS) && !Config.GM_SKILL_RESTRICTION)
  1155. {
  1156. return true;
  1157. }
  1158. if ((getCondition() & L2Skill.COND_SHIELD) != 0)
  1159. {
  1160. // L2ItemInstance dummy = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
  1161. // L2Armor armorPiece = (L2Armor) dummy.getItem();
  1162. // TODO add checks for shield here.
  1163. }
  1164. List<Condition> preCondition = _preCondition;
  1165. if (itemOrWeapon)
  1166. {
  1167. preCondition = _itemPreCondition;
  1168. }
  1169. if ((preCondition == null) || preCondition.isEmpty())
  1170. {
  1171. return true;
  1172. }
  1173. for (Condition cond : preCondition)
  1174. {
  1175. Env env = new Env();
  1176. env.setCharacter(activeChar);
  1177. if (target instanceof L2Character)
  1178. {
  1179. env.setTarget((L2Character) target);
  1180. }
  1181. env.setSkill(this);
  1182. if (!cond.test(env))
  1183. {
  1184. String msg = cond.getMessage();
  1185. int msgId = cond.getMessageId();
  1186. if (msgId != 0)
  1187. {
  1188. SystemMessage sm = SystemMessage.getSystemMessage(msgId);
  1189. if (cond.isAddName())
  1190. {
  1191. sm.addSkillName(_id);
  1192. }
  1193. activeChar.sendPacket(sm);
  1194. }
  1195. else if (msg != null)
  1196. {
  1197. activeChar.sendMessage(msg);
  1198. }
  1199. return false;
  1200. }
  1201. }
  1202. return true;
  1203. }
  1204. public final L2Object[] getTargetList(L2Character activeChar, boolean onlyFirst)
  1205. {
  1206. // Init to null the target of the skill
  1207. L2Character target = null;
  1208. // Get the L2Objcet targeted by the user of the skill at this moment
  1209. L2Object objTarget = activeChar.getTarget();
  1210. // If the L2Object targeted is a L2Character, it becomes the L2Character target
  1211. if (objTarget instanceof L2Character)
  1212. {
  1213. target = (L2Character) objTarget;
  1214. }
  1215. return getTargetList(activeChar, onlyFirst, target);
  1216. }
  1217. /**
  1218. * Return all targets of the skill in a table in function a the skill type.<br>
  1219. * <B><U>Values of skill type</U>:</B>
  1220. * <ul>
  1221. * <li>ONE : The skill can only be used on the L2PcInstance targeted, or on the caster if it's a L2PcInstance and no L2PcInstance targeted</li>
  1222. * <li>SELF</li>
  1223. * <li>HOLY, UNDEAD</li>
  1224. * <li>PET</li>
  1225. * <li>AURA, AURA_CLOSE</li>
  1226. * <li>AREA</li>
  1227. * <li>MULTIFACE</li>
  1228. * <li>PARTY, CLAN</li>
  1229. * <li>CORPSE_PLAYER, CORPSE_MOB, CORPSE_CLAN</li>
  1230. * <li>UNLOCKABLE</li>
  1231. * <li>ITEM</li>
  1232. * <ul>
  1233. * @param activeChar The L2Character who use the skill
  1234. * @param onlyFirst
  1235. * @param target
  1236. * @return
  1237. */
  1238. public final L2Object[] getTargetList(L2Character activeChar, boolean onlyFirst, L2Character target)
  1239. {
  1240. final ITargetTypeHandler handler = TargetHandler.getInstance().getHandler(getTargetType());
  1241. if (handler != null)
  1242. {
  1243. try
  1244. {
  1245. return handler.getTargetList(this, activeChar, onlyFirst, target);
  1246. }
  1247. catch (Exception e)
  1248. {
  1249. _log.log(Level.WARNING, "Exception in L2Skill.getTargetList(): " + e.getMessage(), e);
  1250. }
  1251. }
  1252. activeChar.sendMessage("Target type of skill is not currently handled");
  1253. return _emptyTargetList;
  1254. }
  1255. public final L2Object[] getTargetList(L2Character activeChar)
  1256. {
  1257. return getTargetList(activeChar, false);
  1258. }
  1259. public final L2Object getFirstOfTargetList(L2Character activeChar)
  1260. {
  1261. L2Object[] targets;
  1262. targets = getTargetList(activeChar, true);
  1263. if (targets.length == 0)
  1264. {
  1265. return null;
  1266. }
  1267. return targets[0];
  1268. }
  1269. /**
  1270. * Check if should be target added to the target list false if target is dead, target same as caster,<br>
  1271. * target inside peace zone, target in the same party with caster, caster can see target Additional checks if not in PvP zones (arena, siege):<br>
  1272. * target in not the same clan and alliance with caster, and usual skill PvP check. If TvT event is active - performing additional checks. Caution: distance is not checked.
  1273. * @param caster
  1274. * @param target
  1275. * @param skill
  1276. * @param sourceInArena
  1277. * @return
  1278. */
  1279. public static final boolean checkForAreaOffensiveSkills(L2Character caster, L2Character target, L2Skill skill, boolean sourceInArena)
  1280. {
  1281. if ((target == null) || target.isDead() || (target == caster))
  1282. {
  1283. return false;
  1284. }
  1285. final L2PcInstance player = caster.getActingPlayer();
  1286. final L2PcInstance targetPlayer = target.getActingPlayer();
  1287. if (player != null)
  1288. {
  1289. if (targetPlayer != null)
  1290. {
  1291. if ((targetPlayer == caster) || (targetPlayer == player))
  1292. {
  1293. return false;
  1294. }
  1295. if (targetPlayer.inObserverMode())
  1296. {
  1297. return false;
  1298. }
  1299. if (skill.isOffensive() && (player.getSiegeState() > 0) && player.isInsideZone(ZoneId.SIEGE) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
  1300. {
  1301. return false;
  1302. }
  1303. if (skill.isOffensive() && target.isInsideZone(ZoneId.PEACE))
  1304. {
  1305. return false;
  1306. }
  1307. if (player.isInParty() && targetPlayer.isInParty())
  1308. {
  1309. // Same party
  1310. if (player.getParty().getLeaderObjectId() == targetPlayer.getParty().getLeaderObjectId())
  1311. {
  1312. return false;
  1313. }
  1314. // Same commandchannel
  1315. if ((player.getParty().getCommandChannel() != null) && (player.getParty().getCommandChannel() == targetPlayer.getParty().getCommandChannel()))
  1316. {
  1317. return false;
  1318. }
  1319. }
  1320. if (!TvTEvent.checkForTvTSkill(player, targetPlayer, skill))
  1321. {
  1322. return false;
  1323. }
  1324. if (!sourceInArena && !(targetPlayer.isInsideZone(ZoneId.PVP) && !targetPlayer.isInsideZone(ZoneId.SIEGE)))
  1325. {
  1326. if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
  1327. {
  1328. return false;
  1329. }
  1330. if ((player.getClanId() != 0) && (player.getClanId() == targetPlayer.getClanId()))
  1331. {
  1332. return false;
  1333. }
  1334. if (!player.checkPvpSkill(targetPlayer, skill, (caster instanceof L2Summon)))
  1335. {
  1336. return false;
  1337. }
  1338. }
  1339. }
  1340. }
  1341. else
  1342. {
  1343. // target is mob
  1344. if ((targetPlayer == null) && (target instanceof L2Attackable) && (caster instanceof L2Attackable))
  1345. {
  1346. String casterEnemyClan = ((L2Attackable) caster).getEnemyClan();
  1347. if ((casterEnemyClan == null) || casterEnemyClan.isEmpty())
  1348. {
  1349. return false;
  1350. }
  1351. String targetClan = ((L2Attackable) target).getClan();
  1352. if ((targetClan == null) || targetClan.isEmpty())
  1353. {
  1354. return false;
  1355. }
  1356. if (!casterEnemyClan.equals(targetClan))
  1357. {
  1358. return false;
  1359. }
  1360. }
  1361. }
  1362. if (geoEnabled && !GeoData.getInstance().canSeeTarget(caster, target))
  1363. {
  1364. return false;
  1365. }
  1366. return true;
  1367. }
  1368. public static final boolean addSummon(L2Character caster, L2PcInstance owner, int radius, boolean isDead)
  1369. {
  1370. if (!owner.hasSummon())
  1371. {
  1372. return false;
  1373. }
  1374. return addCharacter(caster, owner.getSummon(), radius, isDead);
  1375. }
  1376. public static final boolean addCharacter(L2Character caster, L2Character target, int radius, boolean isDead)
  1377. {
  1378. if (isDead != target.isDead())
  1379. {
  1380. return false;
  1381. }
  1382. if ((radius > 0) && !Util.checkIfInRange(radius, caster, target, true))
  1383. {
  1384. return false;
  1385. }
  1386. return true;
  1387. }
  1388. public final Func[] getStatFuncs(L2Effect effect, L2Character player)
  1389. {
  1390. if (_funcTemplates == null)
  1391. {
  1392. return _emptyFunctionSet;
  1393. }
  1394. if (!(player instanceof L2Playable) && !(player instanceof L2Attackable))
  1395. {
  1396. return _emptyFunctionSet;
  1397. }
  1398. ArrayList<Func> funcs = new ArrayList<>(_funcTemplates.length);
  1399. Env env = new Env();
  1400. env.setCharacter(player);
  1401. env.setSkill(this);
  1402. Func f;
  1403. for (FuncTemplate t : _funcTemplates)
  1404. {
  1405. f = t.getFunc(env, this); // skill is owner
  1406. if (f != null)
  1407. {
  1408. funcs.add(f);
  1409. }
  1410. }
  1411. if (funcs.isEmpty())
  1412. {
  1413. return _emptyFunctionSet;
  1414. }
  1415. return funcs.toArray(new Func[funcs.size()]);
  1416. }
  1417. public boolean hasEffects()
  1418. {
  1419. return ((_effectTemplates != null) && (_effectTemplates.length > 0));
  1420. }
  1421. public EffectTemplate[] getEffectTemplates()
  1422. {
  1423. return _effectTemplates;
  1424. }
  1425. public EffectTemplate[] getEffectTemplatesPassive()
  1426. {
  1427. return _effectTemplatesPassive;
  1428. }
  1429. public boolean hasSelfEffects()
  1430. {
  1431. return ((_effectTemplatesSelf != null) && (_effectTemplatesSelf.length > 0));
  1432. }
  1433. public boolean hasPassiveEffects()
  1434. {
  1435. return ((_effectTemplatesPassive != null) && (_effectTemplatesPassive.length > 0));
  1436. }
  1437. /**
  1438. * Env is used to pass parameters for secondary effects (shield and ss/bss/bsss)
  1439. * @param effector
  1440. * @param effected
  1441. * @param env
  1442. * @return an array with the effects that have been added to effector
  1443. */
  1444. public final L2Effect[] getEffects(L2Character effector, L2Character effected, Env env)
  1445. {
  1446. if (!hasEffects() || isPassive())
  1447. {
  1448. return _emptyEffectSet;
  1449. }
  1450. // doors and siege flags cannot receive any effects
  1451. if ((effected instanceof L2DoorInstance) || (effected instanceof L2SiegeFlagInstance))
  1452. {
  1453. return _emptyEffectSet;
  1454. }
  1455. if (effector != effected)
  1456. {
  1457. if (isOffensive() || isDebuff())
  1458. {
  1459. if (effected.isInvul())
  1460. {
  1461. return _emptyEffectSet;
  1462. }
  1463. if ((effector instanceof L2PcInstance) && ((L2PcInstance) effector).isGM())
  1464. {
  1465. if (!((L2PcInstance) effector).getAccessLevel().canGiveDamage())
  1466. {
  1467. return _emptyEffectSet;
  1468. }
  1469. }
  1470. }
  1471. }
  1472. ArrayList<L2Effect> effects = new ArrayList<>(_effectTemplates.length);
  1473. if (env == null)
  1474. {
  1475. env = new Env();
  1476. }
  1477. env.setSkillMastery(Formulas.calcSkillMastery(effector, this));
  1478. env.setCharacter(effector);
  1479. env.setTarget(effected);
  1480. env.setSkill(this);
  1481. for (EffectTemplate et : _effectTemplates)
  1482. {
  1483. boolean success = true;
  1484. if (et.effectPower > -1)
  1485. {
  1486. success = Formulas.calcEffectSuccess(effector, effected, et, this, env.getShield(), env.isSoulShot(), env.isSpiritShot(), env.isBlessedSpiritShot());
  1487. }
  1488. if (success)
  1489. {
  1490. L2Effect e = et.getEffect(env);
  1491. if (e != null)
  1492. {
  1493. e.scheduleEffect();
  1494. effects.add(e);
  1495. }
  1496. }
  1497. // display fail message only for effects with icons
  1498. else if (et.icon && (effector instanceof L2PcInstance))
  1499. {
  1500. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_RESISTED_YOUR_S2);
  1501. sm.addCharName(effected);
  1502. sm.addSkillName(this);
  1503. ((L2PcInstance) effector).sendPacket(sm);
  1504. }
  1505. }
  1506. if (effects.isEmpty())
  1507. {
  1508. return _emptyEffectSet;
  1509. }
  1510. return effects.toArray(new L2Effect[effects.size()]);
  1511. }
  1512. /**
  1513. * Warning: this method doesn't consider modifier (shield, ss, sps, bss) for secondary effects
  1514. * @param effector
  1515. * @param effected
  1516. * @return
  1517. */
  1518. public final L2Effect[] getEffects(L2Character effector, L2Character effected)
  1519. {
  1520. return getEffects(effector, effected, null);
  1521. }
  1522. /**
  1523. * This method has suffered some changes in CT2.2 ->CT2.3<br>
  1524. * Effect engine is now supporting secondary effects with independent success/fail calculus from effect skill.<br>
  1525. * Env parameter has been added to pass parameters like soulshot, spiritshots, blessed spiritshots or shield defense.<br>
  1526. * Some other optimizations have been done<br>
  1527. * This new feature works following next rules:
  1528. * <ul>
  1529. * <li>To enable feature, effectPower must be over -1 (check DocumentSkill#attachEffect for further information)</li>
  1530. * <li>If main skill fails, secondary effect always fail</li>
  1531. * </ul>
  1532. * @param effector
  1533. * @param effected
  1534. * @param env
  1535. * @return
  1536. */
  1537. public final L2Effect[] getEffects(L2CubicInstance effector, L2Character effected, Env env)
  1538. {
  1539. if (!hasEffects() || isPassive())
  1540. {
  1541. return _emptyEffectSet;
  1542. }
  1543. if (effector.getOwner() != effected)
  1544. {
  1545. if (isDebuff() || isOffensive())
  1546. {
  1547. if (effected.isInvul())
  1548. {
  1549. return _emptyEffectSet;
  1550. }
  1551. if (effector.getOwner().isGM() && !effector.getOwner().getAccessLevel().canGiveDamage())
  1552. {
  1553. return _emptyEffectSet;
  1554. }
  1555. }
  1556. }
  1557. ArrayList<L2Effect> effects = new ArrayList<>(_effectTemplates.length);
  1558. if (env == null)
  1559. {
  1560. env = new Env();
  1561. }
  1562. env.setCharacter(effector.getOwner());
  1563. env.setCubic(effector);
  1564. env.setTarget(effected);
  1565. env.setSkill(this);
  1566. for (EffectTemplate et : _effectTemplates)
  1567. {
  1568. boolean success = true;
  1569. if (et.effectPower > -1)
  1570. {
  1571. success = Formulas.calcEffectSuccess(effector.getOwner(), effected, et, this, env.getShield(), env.isSoulShot(), env.isSpiritShot(), env.isBlessedSpiritShot());
  1572. }
  1573. if (success)
  1574. {
  1575. L2Effect e = et.getEffect(env);
  1576. if (e != null)
  1577. {
  1578. e.scheduleEffect();
  1579. effects.add(e);
  1580. }
  1581. }
  1582. }
  1583. if (effects.isEmpty())
  1584. {
  1585. return _emptyEffectSet;
  1586. }
  1587. return effects.toArray(new L2Effect[effects.size()]);
  1588. }
  1589. public final L2Effect[] getEffectsSelf(L2Character effector)
  1590. {
  1591. if (!hasSelfEffects() || isPassive())
  1592. {
  1593. return _emptyEffectSet;
  1594. }
  1595. List<L2Effect> effects = new ArrayList<>(_effectTemplatesSelf.length);
  1596. for (EffectTemplate et : _effectTemplatesSelf)
  1597. {
  1598. Env env = new Env();
  1599. env.setCharacter(effector);
  1600. env.setTarget(effector);
  1601. env.setSkill(this);
  1602. L2Effect e = et.getEffect(env);
  1603. if (e != null)
  1604. {
  1605. e.setSelfEffect();
  1606. e.scheduleEffect();
  1607. effects.add(e);
  1608. }
  1609. }
  1610. if (effects.isEmpty())
  1611. {
  1612. return _emptyEffectSet;
  1613. }
  1614. return effects.toArray(new L2Effect[effects.size()]);
  1615. }
  1616. public final L2Effect[] getEffectsPassive(L2Character effector)
  1617. {
  1618. if (!hasPassiveEffects())
  1619. {
  1620. return _emptyEffectSet;
  1621. }
  1622. List<L2Effect> effects = new ArrayList<>(_effectTemplatesPassive.length);
  1623. for (EffectTemplate et : _effectTemplatesPassive)
  1624. {
  1625. Env env = new Env();
  1626. env.setCharacter(effector);
  1627. env.setTarget(effector);
  1628. env.setSkill(this);
  1629. L2Effect e = et.getEffect(env);
  1630. if (e != null)
  1631. {
  1632. e.setPassiveEffect();
  1633. e.scheduleEffect();
  1634. effects.add(e);
  1635. }
  1636. }
  1637. if (effects.isEmpty())
  1638. {
  1639. return _emptyEffectSet;
  1640. }
  1641. return effects.toArray(new L2Effect[effects.size()]);
  1642. }
  1643. public final void attach(FuncTemplate f)
  1644. {
  1645. if (_funcTemplates == null)
  1646. {
  1647. _funcTemplates = new FuncTemplate[]
  1648. {
  1649. f
  1650. };
  1651. }
  1652. else
  1653. {
  1654. int len = _funcTemplates.length;
  1655. FuncTemplate[] tmp = new FuncTemplate[len + 1];
  1656. System.arraycopy(_funcTemplates, 0, tmp, 0, len);
  1657. tmp[len] = f;
  1658. _funcTemplates = tmp;
  1659. }
  1660. }
  1661. public final void attach(EffectTemplate effect)
  1662. {
  1663. if (_effectTemplates == null)
  1664. {
  1665. _effectTemplates = new EffectTemplate[]
  1666. {
  1667. effect
  1668. };
  1669. }
  1670. else
  1671. {
  1672. int len = _effectTemplates.length;
  1673. EffectTemplate[] tmp = new EffectTemplate[len + 1];
  1674. System.arraycopy(_effectTemplates, 0, tmp, 0, len);
  1675. tmp[len] = effect;
  1676. _effectTemplates = tmp;
  1677. }
  1678. }
  1679. public final void attachSelf(EffectTemplate effect)
  1680. {
  1681. if (_effectTemplatesSelf == null)
  1682. {
  1683. _effectTemplatesSelf = new EffectTemplate[]
  1684. {
  1685. effect
  1686. };
  1687. }
  1688. else
  1689. {
  1690. int len = _effectTemplatesSelf.length;
  1691. EffectTemplate[] tmp = new EffectTemplate[len + 1];
  1692. System.arraycopy(_effectTemplatesSelf, 0, tmp, 0, len);
  1693. tmp[len] = effect;
  1694. _effectTemplatesSelf = tmp;
  1695. }
  1696. }
  1697. public final void attachPassive(EffectTemplate effect)
  1698. {
  1699. if (_effectTemplatesPassive == null)
  1700. {
  1701. _effectTemplatesPassive = new EffectTemplate[]
  1702. {
  1703. effect
  1704. };
  1705. }
  1706. else
  1707. {
  1708. int len = _effectTemplatesPassive.length;
  1709. EffectTemplate[] tmp = new EffectTemplate[len + 1];
  1710. System.arraycopy(_effectTemplatesPassive, 0, tmp, 0, len);
  1711. tmp[len] = effect;
  1712. _effectTemplatesPassive = tmp;
  1713. }
  1714. }
  1715. public final void attach(Condition c, boolean itemOrWeapon)
  1716. {
  1717. if (itemOrWeapon)
  1718. {
  1719. if (_itemPreCondition == null)
  1720. {
  1721. _itemPreCondition = new ArrayList<>();
  1722. }
  1723. _itemPreCondition.add(c);
  1724. }
  1725. else
  1726. {
  1727. if (_preCondition == null)
  1728. {
  1729. _preCondition = new ArrayList<>();
  1730. }
  1731. _preCondition.add(c);
  1732. }
  1733. }
  1734. @Override
  1735. public String toString()
  1736. {
  1737. return "" + _name + "[id=" + _id + ",lvl=" + _level + "]";
  1738. }
  1739. /**
  1740. * @return pet food
  1741. */
  1742. public int getFeed()
  1743. {
  1744. return _feed;
  1745. }
  1746. /**
  1747. * used for tracking item id in case that item consume cannot be used
  1748. * @return reference item id
  1749. */
  1750. public int getReferenceItemId()
  1751. {
  1752. return _refId;
  1753. }
  1754. public int getAfterEffectId()
  1755. {
  1756. return _afterEffectId;
  1757. }
  1758. public int getAfterEffectLvl()
  1759. {
  1760. return _afterEffectLvl;
  1761. }
  1762. @Override
  1763. public boolean triggersChanceSkill()
  1764. {
  1765. return (_triggeredId > 0) && isChance();
  1766. }
  1767. @Override
  1768. public int getTriggeredChanceId()
  1769. {
  1770. return _triggeredId;
  1771. }
  1772. @Override
  1773. public int getTriggeredChanceLevel()
  1774. {
  1775. return _triggeredLevel;
  1776. }
  1777. @Override
  1778. public ChanceCondition getTriggeredChanceCondition()
  1779. {
  1780. return _chanceCondition;
  1781. }
  1782. public String getAttributeName()
  1783. {
  1784. return _attribute;
  1785. }
  1786. /**
  1787. * @return the _blowChance
  1788. */
  1789. public int getBlowChance()
  1790. {
  1791. return _blowChance;
  1792. }
  1793. public boolean ignoreShield()
  1794. {
  1795. return _ignoreShield;
  1796. }
  1797. public boolean canBeReflected()
  1798. {
  1799. return _canBeReflected;
  1800. }
  1801. public boolean canBeDispeled()
  1802. {
  1803. return _canBeDispeled;
  1804. }
  1805. public boolean isClanSkill()
  1806. {
  1807. return _isClanSkill;
  1808. }
  1809. public boolean isExcludedFromCheck()
  1810. {
  1811. return _excludedFromCheck;
  1812. }
  1813. public boolean getDependOnTargetBuff()
  1814. {
  1815. return _dependOnTargetBuff;
  1816. }
  1817. public boolean isSimultaneousCast()
  1818. {
  1819. return _simultaneousCast;
  1820. }
  1821. /**
  1822. * @param skillId
  1823. * @param skillLvl
  1824. * @param values
  1825. * @return L2ExtractableSkill
  1826. * @author Zoey76
  1827. */
  1828. private L2ExtractableSkill parseExtractableSkill(int skillId, int skillLvl, String values)
  1829. {
  1830. final String[] prodLists = values.split(";");
  1831. final List<L2ExtractableProductItem> products = new ArrayList<>();
  1832. String[] prodData;
  1833. for (String prodList : prodLists)
  1834. {
  1835. prodData = prodList.split(",");
  1836. if (prodData.length < 3)
  1837. {
  1838. _log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> wrong seperator!");
  1839. }
  1840. List<ItemHolder> items = null;
  1841. double chance = 0;
  1842. int prodId = 0;
  1843. int quantity = 0;
  1844. final int lenght = prodData.length - 1;
  1845. try
  1846. {
  1847. items = new ArrayList<>(lenght / 2);
  1848. for (int j = 0; j < lenght; j++)
  1849. {
  1850. prodId = Integer.parseInt(prodData[j]);
  1851. quantity = Integer.parseInt(prodData[j += 1]);
  1852. if ((prodId <= 0) || (quantity <= 0))
  1853. {
  1854. _log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " wrong production Id: " + prodId + " or wrond quantity: " + quantity + "!");
  1855. }
  1856. items.add(new ItemHolder(prodId, quantity));
  1857. }
  1858. chance = Double.parseDouble(prodData[lenght]);
  1859. }
  1860. catch (Exception e)
  1861. {
  1862. _log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> incomplete/invalid production data or wrong seperator!");
  1863. }
  1864. products.add(new L2ExtractableProductItem(items, chance));
  1865. }
  1866. if (products.isEmpty())
  1867. {
  1868. _log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> There are no production items!");
  1869. }
  1870. return new L2ExtractableSkill(SkillTable.getSkillHashCode(skillId, skillLvl), products);
  1871. }
  1872. public L2ExtractableSkill getExtractableSkill()
  1873. {
  1874. return _extractableItems;
  1875. }
  1876. public int getMaxTargets()
  1877. {
  1878. return _maxTargets;
  1879. }
  1880. public boolean isStaticHeal()
  1881. {
  1882. return _isStaticHeal;
  1883. }
  1884. /**
  1885. * @return the _npcId
  1886. */
  1887. public int getNpcId()
  1888. {
  1889. return _npcId;
  1890. }
  1891. /**
  1892. * @return the _faceId
  1893. */
  1894. public int getFaceId()
  1895. {
  1896. return _faceId;
  1897. }
  1898. /**
  1899. * @return the _hairColorId
  1900. */
  1901. public int getHairColorId()
  1902. {
  1903. return _hairColorId;
  1904. }
  1905. /**
  1906. * @return the _hairStyleId
  1907. */
  1908. public int getHairStyleId()
  1909. {
  1910. return _hairStyleId;
  1911. }
  1912. }