Package com.l2jfrozen.gameserver.skills.conditions

Source Code of com.l2jfrozen.gameserver.skills.conditions.ConditionTargetWeight

package com.l2jfrozen.gameserver.skills.conditions;

import com.l2jfrozen.gameserver.model.L2Character;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.skills.Env;
import com.l2jfrozen.gameserver.skills.Stats;

/**
* The Class ConditionPlayerWeight.
* @author Kerberos
*/
public class ConditionTargetWeight extends Condition
{
        private final int _weight;
      
        /**
         * Instantiates a new condition player weight.
         * @param weight the weight
         */
        public ConditionTargetWeight(int weight)
        {
                _weight = weight;
        }
      
        @Override
        public boolean testImpl(Env env)
        {
                final L2Character targetObj = env.getTarget();
                if ((targetObj != null) && targetObj instanceof L2PcInstance)
                {
                        final L2PcInstance target = targetObj.getActingPlayer();
                        if (!target.getDietMode() && (target.getMaxLoad() > 0))
                        {
                                int weightproc = (int) (((target.getCurrentLoad() - target.calcStat(Stats.WEIGHT_PENALTY, 1, target, null)) * 100) / target.getMaxLoad());
                                return (weightproc < _weight);
                        }
                }
                return false;
        }
}
TOP

Related Classes of com.l2jfrozen.gameserver.skills.conditions.ConditionTargetWeight

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.