L2Effect.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  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.effects;
  20. import java.util.ArrayList;
  21. import java.util.concurrent.ScheduledFuture;
  22. import java.util.concurrent.TimeUnit;
  23. import java.util.logging.Level;
  24. import java.util.logging.Logger;
  25. import com.l2jserver.gameserver.GameTimeController;
  26. import com.l2jserver.gameserver.ThreadPoolManager;
  27. import com.l2jserver.gameserver.datatables.SkillTable;
  28. import com.l2jserver.gameserver.model.ChanceCondition;
  29. import com.l2jserver.gameserver.model.actor.L2Character;
  30. import com.l2jserver.gameserver.model.actor.L2Summon;
  31. import com.l2jserver.gameserver.model.interfaces.IChanceSkillTrigger;
  32. import com.l2jserver.gameserver.model.skills.L2Skill;
  33. import com.l2jserver.gameserver.model.skills.L2SkillType;
  34. import com.l2jserver.gameserver.model.skills.funcs.Func;
  35. import com.l2jserver.gameserver.model.skills.funcs.FuncTemplate;
  36. import com.l2jserver.gameserver.model.skills.funcs.Lambda;
  37. import com.l2jserver.gameserver.model.stats.Env;
  38. import com.l2jserver.gameserver.network.SystemMessageId;
  39. import com.l2jserver.gameserver.network.serverpackets.AbnormalStatusUpdate;
  40. import com.l2jserver.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
  41. import com.l2jserver.gameserver.network.serverpackets.MagicSkillLaunched;
  42. import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
  43. import com.l2jserver.gameserver.network.serverpackets.PartySpelled;
  44. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  45. public abstract class L2Effect implements IChanceSkillTrigger
  46. {
  47. protected static final Logger _log = Logger.getLogger(L2Effect.class.getName());
  48. private static final Func[] _emptyFunctionSet = new Func[0];
  49. // member _effector is the instance of L2Character that cast/used the spell/skill that is
  50. // causing this effect. Do not confuse with the instance of L2Character that
  51. // is being affected by this effect.
  52. private final L2Character _effector;
  53. // member _effected is the instance of L2Character that was affected
  54. // by this effect. Do not confuse with the instance of L2Character that
  55. // casted/used this effect.
  56. private final L2Character _effected;
  57. // the skill that was used.
  58. private final L2Skill _skill;
  59. // the value of an update
  60. private final Lambda _lambda;
  61. // the current state
  62. private EffectState _state;
  63. // period, seconds
  64. private final int _abnormalTime;
  65. protected int _periodStartTicks;
  66. protected int _periodFirstTime;
  67. private final EffectTemplate _template;
  68. // function templates
  69. private final FuncTemplate[] _funcTemplates;
  70. // initial count
  71. private final int _totalCount;
  72. // counter
  73. private int _count;
  74. // abnormal effect mask
  75. private final AbnormalEffect _abnormalEffect;
  76. // special effect mask
  77. private final AbnormalEffect[] _specialEffect;
  78. // event effect mask
  79. private final AbnormalEffect _eventEffect;
  80. // show icon
  81. private final boolean _icon;
  82. // is self effect?
  83. private boolean _isSelfEffect = false;
  84. // is passive effect?
  85. private boolean _isPassiveEffect = false;
  86. public boolean preventExitUpdate;
  87. protected final class EffectTask implements Runnable
  88. {
  89. @Override
  90. public void run()
  91. {
  92. try
  93. {
  94. _periodFirstTime = 0;
  95. _periodStartTicks = GameTimeController.getInstance().getGameTicks();
  96. scheduleEffect();
  97. }
  98. catch (Exception e)
  99. {
  100. _log.log(Level.SEVERE, "", e);
  101. }
  102. }
  103. }
  104. private ScheduledFuture<?> _currentFuture;
  105. /** The Identifier of the stack group */
  106. private final String _abnormalType;
  107. /** The position of the effect in the stack group */
  108. private final byte _abnormalLvl;
  109. private boolean _inUse = false;
  110. private boolean _startConditionsCorrect = true;
  111. /**
  112. * For special behavior. See Formulas.calcEffectSuccess
  113. */
  114. private double _effectPower;
  115. private L2SkillType _effectSkillType;
  116. /**
  117. * <font color="FF0000"><b>WARNING: scheduleEffect no longer inside constructor</b></font><br>
  118. * So you must call it explicitly
  119. * @param env
  120. * @param template
  121. */
  122. protected L2Effect(Env env, EffectTemplate template)
  123. {
  124. _state = EffectState.CREATED;
  125. _skill = env.getSkill();
  126. _template = template;
  127. _effected = env.getTarget();
  128. _effector = env.getCharacter();
  129. _lambda = template.lambda;
  130. _funcTemplates = template.funcTemplates;
  131. _count = template.counter;
  132. _totalCount = _count;
  133. // Support for retail herbs duration when _effected has a Summon
  134. int temp = template.abnormalTime;
  135. if ((_effected != null) && (((_skill.getId() > 2277) && (_skill.getId() < 2286)) || ((_skill.getId() >= 2512) && (_skill.getId() <= 2514))))
  136. {
  137. final L2Summon summon = _effected.getSummon();
  138. if ((summon != null) && summon.isServitor())
  139. {
  140. temp /= 2;
  141. }
  142. }
  143. if (env.isSkillMastery())
  144. {
  145. temp *= 2;
  146. }
  147. _abnormalTime = temp;
  148. _abnormalEffect = template.abnormalEffect;
  149. _specialEffect = template.specialEffect;
  150. _eventEffect = template.eventEffect;
  151. _abnormalType = template.abnormalType;
  152. _abnormalLvl = template.abnormalLvl;
  153. _periodStartTicks = GameTimeController.getInstance().getGameTicks();
  154. _periodFirstTime = 0;
  155. _icon = template.icon;
  156. _effectPower = template.effectPower;
  157. _effectSkillType = template.effectType;
  158. // Commented out by DrHouse:
  159. // scheduleEffect can call onStart before effect is completely initialized on constructor (child classes constructor)
  160. // scheduleEffect();
  161. }
  162. /**
  163. * Special constructor to "steal" buffs. Must be implemented on every child class that can be stolen.<br>
  164. * <font color="FF0000"><b>WARNING: scheduleEffect no longer inside constructor</b></font><br>
  165. * So you must call it explicitly.
  166. * @param env
  167. * @param effect
  168. */
  169. protected L2Effect(Env env, L2Effect effect)
  170. {
  171. _template = effect._template;
  172. _state = EffectState.CREATED;
  173. _skill = env.getSkill();
  174. _effected = env.getTarget();
  175. _effector = env.getCharacter();
  176. _lambda = _template.lambda;
  177. _funcTemplates = _template.funcTemplates;
  178. _count = effect.getCount();
  179. _totalCount = _template.counter;
  180. _abnormalTime = _template.abnormalTime;
  181. _abnormalEffect = _template.abnormalEffect;
  182. _specialEffect = _template.specialEffect;
  183. _eventEffect = _template.eventEffect;
  184. _abnormalType = _template.abnormalType;
  185. _abnormalLvl = _template.abnormalLvl;
  186. _periodStartTicks = effect.getPeriodStartTicks();
  187. _periodFirstTime = effect.getTime();
  188. _icon = _template.icon;
  189. // Commented out by DrHouse:
  190. // scheduleEffect can call onStart before effect is completly initialized on constructor (child classes constructor)
  191. // scheduleEffect();
  192. }
  193. public int getCount()
  194. {
  195. return _count;
  196. }
  197. public int getTotalCount()
  198. {
  199. return _totalCount;
  200. }
  201. public void setCount(int newcount)
  202. {
  203. _count = Math.min(newcount, _totalCount); // sanity check
  204. }
  205. public void setFirstTime(int newFirstTime)
  206. {
  207. _periodFirstTime = Math.min(newFirstTime, _abnormalTime);
  208. _periodStartTicks -= _periodFirstTime * GameTimeController.TICKS_PER_SECOND;
  209. }
  210. public boolean getShowIcon()
  211. {
  212. return _icon;
  213. }
  214. public int getAbnormalTime()
  215. {
  216. return _abnormalTime;
  217. }
  218. public int getTime()
  219. {
  220. return (GameTimeController.getInstance().getGameTicks() - _periodStartTicks) / GameTimeController.TICKS_PER_SECOND;
  221. }
  222. /**
  223. * Returns the elapsed time of the task.
  224. * @return Time in seconds.
  225. */
  226. public int getTaskTime()
  227. {
  228. if (_count == _totalCount)
  229. {
  230. return 0;
  231. }
  232. return (Math.abs((_count - _totalCount) + 1) * _abnormalTime) + getTime() + 1;
  233. }
  234. public boolean getInUse()
  235. {
  236. return _inUse;
  237. }
  238. public boolean setInUse(boolean inUse)
  239. {
  240. _inUse = inUse;
  241. if (_inUse)
  242. {
  243. _startConditionsCorrect = onStart();
  244. }
  245. else
  246. {
  247. onExit();
  248. }
  249. return _startConditionsCorrect;
  250. }
  251. public String getAbnormalType()
  252. {
  253. return _abnormalType;
  254. }
  255. public byte getAbnormalLvl()
  256. {
  257. return _abnormalLvl;
  258. }
  259. public final L2Skill getSkill()
  260. {
  261. return _skill;
  262. }
  263. public final L2Character getEffector()
  264. {
  265. return _effector;
  266. }
  267. public final L2Character getEffected()
  268. {
  269. return _effected;
  270. }
  271. public boolean isSelfEffect()
  272. {
  273. return _isSelfEffect;
  274. }
  275. public void setSelfEffect()
  276. {
  277. _isSelfEffect = true;
  278. }
  279. public boolean isPassiveEffect()
  280. {
  281. return _isPassiveEffect;
  282. }
  283. public void setPassiveEffect()
  284. {
  285. _isPassiveEffect = true;
  286. }
  287. public final double calc()
  288. {
  289. Env env = new Env();
  290. env.setCharacter(_effector);
  291. env.setTarget(_effected);
  292. env.setSkill(_skill);
  293. return _lambda.calc(env);
  294. }
  295. private final synchronized void startEffectTask()
  296. {
  297. if (_abnormalTime > 0)
  298. {
  299. stopEffectTask();
  300. final int initialDelay = Math.max((_abnormalTime - _periodFirstTime) * 1000, 5);
  301. if (_count > 1)
  302. {
  303. _currentFuture = ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new EffectTask(), initialDelay, _abnormalTime * 1000);
  304. }
  305. else
  306. {
  307. _currentFuture = ThreadPoolManager.getInstance().scheduleEffect(new EffectTask(), initialDelay);
  308. }
  309. }
  310. if (_state == EffectState.ACTING)
  311. {
  312. if (isSelfEffectType())
  313. {
  314. _effector.addEffect(this);
  315. }
  316. else
  317. {
  318. _effected.addEffect(this);
  319. }
  320. }
  321. }
  322. /**
  323. * Stop the L2Effect task and send Server->Client update packet.<br>
  324. * <B><U>Actions</U>:</B>
  325. * <ul>
  326. * <li>Cancel the effect in the the abnormal effect map of the L2Character</li>
  327. * <li>Stop the task of the L2Effect, remove it and update client magic icon</li>
  328. * </ul>
  329. */
  330. public final void exit()
  331. {
  332. exit(false);
  333. }
  334. public final void exit(boolean preventUpdate)
  335. {
  336. preventExitUpdate = preventUpdate;
  337. _state = EffectState.FINISHING;
  338. scheduleEffect();
  339. }
  340. /**
  341. * Stop the task of the L2Effect, remove it and update client magic icon.<br>
  342. * <B><U>Actions</U>:</B>
  343. * <ul>
  344. * <li>Cancel the task</li>
  345. * <li>Stop and remove L2Effect from L2Character and update client magic icon</li>
  346. * </ul>
  347. */
  348. public final synchronized void stopEffectTask()
  349. {
  350. if (_currentFuture != null)
  351. {
  352. // Cancel the task
  353. _currentFuture.cancel(false);
  354. // ThreadPoolManager.getInstance().removeEffect(_currentTask);
  355. _currentFuture = null;
  356. if (isSelfEffectType() && (getEffector() != null))
  357. {
  358. getEffector().removeEffect(this);
  359. }
  360. else if (getEffected() != null)
  361. {
  362. getEffected().removeEffect(this);
  363. }
  364. }
  365. }
  366. /**
  367. * @return effect type
  368. */
  369. public abstract L2EffectType getEffectType();
  370. /**
  371. * Notify started.
  372. * @return {@code true} if all the start conditions are meet, {@code false} otherwise
  373. */
  374. public boolean onStart()
  375. {
  376. if (_abnormalEffect != AbnormalEffect.NULL)
  377. {
  378. getEffected().startAbnormalEffect(_abnormalEffect);
  379. }
  380. if (_specialEffect != null)
  381. {
  382. getEffected().startSpecialEffect(_specialEffect);
  383. }
  384. if ((_eventEffect != AbnormalEffect.NULL) && getEffected().isPlayer())
  385. {
  386. getEffected().getActingPlayer().startEventEffect(_eventEffect);
  387. }
  388. return true;
  389. }
  390. /**
  391. * Cancel the effect in the the abnormal effect map of the effected L2Character.
  392. */
  393. public void onExit()
  394. {
  395. if (_abnormalEffect != AbnormalEffect.NULL)
  396. {
  397. getEffected().stopAbnormalEffect(_abnormalEffect);
  398. }
  399. if (_specialEffect != null)
  400. {
  401. getEffected().stopSpecialEffect(_specialEffect);
  402. }
  403. if ((_eventEffect != AbnormalEffect.NULL) && getEffected().isPlayer())
  404. {
  405. getEffected().getActingPlayer().stopEventEffect(_eventEffect);
  406. }
  407. }
  408. /**
  409. * @return true for continuation of this effect
  410. */
  411. public abstract boolean onActionTime();
  412. public final void scheduleEffect()
  413. {
  414. switch (_state)
  415. {
  416. case CREATED:
  417. {
  418. _state = EffectState.ACTING;
  419. if (_skill.isPvpSkill() && _icon && getEffected().isPlayer())
  420. {
  421. SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
  422. smsg.addSkillName(_skill);
  423. getEffected().sendPacket(smsg);
  424. }
  425. if (_abnormalTime != 0)
  426. {
  427. startEffectTask();
  428. return;
  429. }
  430. // effects not having count or period should start
  431. _startConditionsCorrect = onStart();
  432. }
  433. case ACTING:
  434. {
  435. if (_count > 0)
  436. {
  437. _count--;
  438. if (getInUse())
  439. {
  440. // effect has to be in use
  441. if (onActionTime() && _startConditionsCorrect && (_count >= 0))
  442. {
  443. return; // false causes effect to finish right away
  444. }
  445. }
  446. else if (_count > 0)
  447. {
  448. // do not finish it yet, in case reactivated
  449. return;
  450. }
  451. }
  452. _state = EffectState.FINISHING;
  453. }
  454. case FINISHING:
  455. {
  456. // If the time left is equal to zero, send the message
  457. if ((_count == 0) && _icon && getEffected().isPlayer())
  458. {
  459. SystemMessage smsg3 = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WORN_OFF);
  460. smsg3.addSkillName(_skill);
  461. getEffected().sendPacket(smsg3);
  462. }
  463. // if task is null - stopEffectTask does not remove effect
  464. if ((_currentFuture == null) && (getEffected() != null))
  465. {
  466. getEffected().removeEffect(this);
  467. }
  468. // Stop the task of the L2Effect, remove it and update client magic icon
  469. stopEffectTask();
  470. // Cancel the effect in the the abnormal effect map of the L2Character
  471. if (getInUse() || !((_count > 1) || (_abnormalTime > 0)))
  472. {
  473. if (_startConditionsCorrect)
  474. {
  475. onExit();
  476. }
  477. }
  478. if (_skill.getAfterEffectId() > 0)
  479. {
  480. L2Skill skill = SkillTable.getInstance().getInfo(_skill.getAfterEffectId(), _skill.getAfterEffectLvl());
  481. if (skill != null)
  482. {
  483. getEffected().broadcastPacket(new MagicSkillUse(_effected, skill.getId(), skill.getLevel(), 0, 0));
  484. getEffected().broadcastPacket(new MagicSkillLaunched(_effected, skill.getId(), skill.getLevel()));
  485. skill.getEffects(getEffected(), getEffected());
  486. }
  487. }
  488. }
  489. }
  490. }
  491. public Func[] getStatFuncs()
  492. {
  493. if (_funcTemplates == null)
  494. {
  495. return _emptyFunctionSet;
  496. }
  497. final ArrayList<Func> funcs = new ArrayList<>(_funcTemplates.length);
  498. Env env = new Env();
  499. env.setCharacter(_effector);
  500. env.setTarget(_effected);
  501. env.setSkill(_skill);
  502. Func f;
  503. for (FuncTemplate t : _funcTemplates)
  504. {
  505. f = t.getFunc(env, this); // effect is owner
  506. if (f != null)
  507. {
  508. funcs.add(f);
  509. }
  510. }
  511. if (funcs.isEmpty())
  512. {
  513. return _emptyFunctionSet;
  514. }
  515. return funcs.toArray(new Func[funcs.size()]);
  516. }
  517. public final void addIcon(AbnormalStatusUpdate mi)
  518. {
  519. if (_state != EffectState.ACTING)
  520. {
  521. return;
  522. }
  523. final ScheduledFuture<?> future = _currentFuture;
  524. final L2Skill sk = getSkill();
  525. if (_totalCount > 1)
  526. {
  527. if (sk.isStatic())
  528. {
  529. mi.addEffect(sk.getDisplayId(), getLevel(), sk.getBuffDuration() - (getTaskTime() * 1000));
  530. }
  531. else
  532. {
  533. mi.addEffect(sk.getDisplayId(), getLevel(), -1);
  534. }
  535. }
  536. else if (future != null)
  537. {
  538. mi.addEffect(sk.getDisplayId(), getLevel(), (int) future.getDelay(TimeUnit.MILLISECONDS));
  539. }
  540. else if (_abnormalTime == -1)
  541. {
  542. mi.addEffect(sk.getDisplayId(), getLevel(), _abnormalTime);
  543. }
  544. }
  545. public final void addPartySpelledIcon(PartySpelled ps)
  546. {
  547. if (_state != EffectState.ACTING)
  548. {
  549. return;
  550. }
  551. final ScheduledFuture<?> future = _currentFuture;
  552. final L2Skill sk = getSkill();
  553. if (future != null)
  554. {
  555. ps.addPartySpelledEffect(sk.getDisplayId(), getLevel(), (int) future.getDelay(TimeUnit.MILLISECONDS));
  556. }
  557. else if (_abnormalTime == -1)
  558. {
  559. ps.addPartySpelledEffect(sk.getDisplayId(), getLevel(), _abnormalTime);
  560. }
  561. }
  562. public final void addOlympiadSpelledIcon(ExOlympiadSpelledInfo os)
  563. {
  564. if (_state != EffectState.ACTING)
  565. {
  566. return;
  567. }
  568. final ScheduledFuture<?> future = _currentFuture;
  569. final L2Skill sk = getSkill();
  570. if (future != null)
  571. {
  572. os.addEffect(sk.getDisplayId(), getLevel(), (int) future.getDelay(TimeUnit.MILLISECONDS));
  573. }
  574. else if (_abnormalTime == -1)
  575. {
  576. os.addEffect(sk.getDisplayId(), getLevel(), _abnormalTime);
  577. }
  578. }
  579. public int getLevel()
  580. {
  581. return getSkill().getLevel();
  582. }
  583. public int getPeriodStartTicks()
  584. {
  585. return _periodStartTicks;
  586. }
  587. public EffectTemplate getEffectTemplate()
  588. {
  589. return _template;
  590. }
  591. public double getEffectPower()
  592. {
  593. return _effectPower;
  594. }
  595. public L2SkillType getSkillType()
  596. {
  597. return _effectSkillType;
  598. }
  599. public boolean canBeStolen()
  600. {
  601. // TODO: Unhardcode skillId
  602. return (!effectCanBeStolen() || (getEffectType() == L2EffectType.TRANSFORMATION) || getSkill().isPassive() || getSkill().isToggle() || getSkill().isDebuff() || getSkill().isHeroSkill() || getSkill().isGMSkill() || (getSkill().isStatic() && ((getSkill().getId() != 2274) && (getSkill().getId() != 2341))) || !getSkill().canBeDispeled()) ? false : true;
  603. }
  604. /**
  605. * @return {@code true} if effect itself can be stolen, {@code false} otherwise
  606. */
  607. protected boolean effectCanBeStolen()
  608. {
  609. return false;
  610. }
  611. /**
  612. * Return bit flag for current effect
  613. * @return int flag
  614. */
  615. public int getEffectFlags()
  616. {
  617. return EffectFlag.NONE.getMask();
  618. }
  619. @Override
  620. public String toString()
  621. {
  622. return "L2Effect [_skill=" + _skill + ", _state=" + _state + ", _period=" + _abnormalTime + "]";
  623. }
  624. public boolean isSelfEffectType()
  625. {
  626. return false;
  627. }
  628. public void decreaseForce()
  629. {
  630. }
  631. public void increaseEffect()
  632. {
  633. }
  634. public int getForceEffect()
  635. {
  636. return 0;
  637. }
  638. public boolean isBuffEffect()
  639. {
  640. return false;
  641. }
  642. public boolean isDebuffEffect()
  643. {
  644. return false;
  645. }
  646. @Override
  647. public boolean triggersChanceSkill()
  648. {
  649. return false;
  650. }
  651. @Override
  652. public int getTriggeredChanceId()
  653. {
  654. return 0;
  655. }
  656. @Override
  657. public int getTriggeredChanceLevel()
  658. {
  659. return 0;
  660. }
  661. @Override
  662. public ChanceCondition getTriggeredChanceCondition()
  663. {
  664. return null;
  665. }
  666. }