Addition of item condition MaximumVitalityPoints.

Contributed by nasseka.
This commit is contained in:
MobiusDevelopment
2021-07-01 22:47:43 +00:00
parent df605dec7d
commit f1c9c24194
12 changed files with 174 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.conditions;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.items.Item;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
* @author `NasSeKa`
*/
public class ConditionMaximumVitalityPoints extends Condition
{
private final int _count;
public ConditionMaximumVitalityPoints(int count)
{
_count = count;
}
@Override
public boolean testImpl(Creature effector, Creature effected, Skill skill, Item item)
{
final PlayerInstance player = effector.getActingPlayer();
if (player != null)
{
return player.getVitalityPoints() < _count;
}
return false;
}
}

View File

@@ -49,6 +49,7 @@ import org.l2jmobius.gameserver.model.conditions.ConditionGameTime.CheckGameTime
import org.l2jmobius.gameserver.model.conditions.ConditionLogicAnd;
import org.l2jmobius.gameserver.model.conditions.ConditionLogicNot;
import org.l2jmobius.gameserver.model.conditions.ConditionLogicOr;
import org.l2jmobius.gameserver.model.conditions.ConditionMaximumVitalityPoints;
import org.l2jmobius.gameserver.model.conditions.ConditionMinDistance;
import org.l2jmobius.gameserver.model.conditions.ConditionMinimumVitalityPoints;
import org.l2jmobius.gameserver.model.conditions.ConditionPlayerActiveEffectId;
@@ -890,6 +891,12 @@ public abstract class DocumentBase
cond = joinAnd(cond, new ConditionPlayerInInstance(Boolean.parseBoolean(a.getNodeValue())));
break;
}
case "maximumvitalitypoints":
{
final int count = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionMaximumVitalityPoints(count));
break;
}
case "minimumvitalitypoints":
{
final int count = Integer.decode(getValue(a.getNodeValue(), null));