CostyKiller

reuse

Oct 28th, 2020 (edited)
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1. /*
  2.  * This file is part of the L2J Mobius project.
  3.  *
  4.  * This program is free software: you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation, either version 3 of the License, or
  7.  * (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12.  * General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16.  */
  17. package handlers.effecthandlers;
  18.  
  19. import org.l2jmobius.gameserver.model.StatSet;
  20. import org.l2jmobius.gameserver.model.actor.Creature;
  21. import org.l2jmobius.gameserver.model.effects.AbstractEffect;
  22. import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
  23. import org.l2jmobius.gameserver.model.skills.Skill;
  24. import org.l2jmobius.gameserver.util.MathUtil;
  25.  
  26. /**
  27.  * @author Sdw
  28.  */
  29. public class Reuse extends AbstractEffect
  30. {
  31.     private final int _magicType;
  32.     private final double _amount;
  33.     private final int _count;
  34.    
  35.     public Reuse(StatSet params)
  36.     {
  37.         _magicType = params.getInt("magicType", 0);
  38.         _amount = params.getDouble("amount", 0);
  39.         _count = params.getInt("count", 0);
  40.     }
  41.    
  42.     @Override
  43.     public void onStart(Creature effector, Creature effected, Skill skill, ItemInstance item)
  44.     {
  45.         effected.getStat().mergeReuseTypeValue(_magicType, (_amount / 100) + 1, _count, MathUtil::mul);
  46.     }
  47.    
  48.     @Override
  49.     public void onExit(Creature effector, Creature effected, Skill skill)
  50.     {
  51.         effected.getStat().mergeReuseTypeValue(_magicType, (_amount / 100) + 1, _count, MathUtil::div);
  52.     }
  53. }
  54.  
Add Comment
Please, Sign In to add comment