Merged with released L2J-Unity files.
This commit is contained in:
44
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/BalakasScope.java
vendored
Normal file
44
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/BalakasScope.java
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* TODO: Valakas affect scope implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class BalakasScope implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
// TODO Unknown affect scope.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.BALAKAS_SCOPE;
|
||||
}
|
||||
}
|
107
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadParty.java
vendored
Normal file
107
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadParty.java
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class DeadParty implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2PcInstance player = target.getActingPlayer();
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || !p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p != player)
|
||||
{
|
||||
final L2Party targetParty = p.getParty();
|
||||
if ((party == null) || (targetParty == null) || (party.getLeaderObjectId() != targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Affect object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test((L2Playable) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.DEAD_PARTY;
|
||||
}
|
||||
}
|
111
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadPartyPledge.java
vendored
Normal file
111
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadPartyPledge.java
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* Dead Party and Clan affect scope implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class DeadPartyPledge implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2Playable playable = (L2Playable) target;
|
||||
final L2PcInstance player = playable.getActingPlayer();
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || !p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p != player)
|
||||
{
|
||||
if ((p.getClanId() == 0) || (p.getClanId() != player.getClanId()))
|
||||
{
|
||||
final L2Party targetParty = p.getParty();
|
||||
if ((party == null) || (targetParty == null) || (party.getLeaderObjectId() != targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Affect object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test(playable))
|
||||
{
|
||||
action.accept(playable);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(playable, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.DEAD_PARTY_PLEDGE;
|
||||
}
|
||||
}
|
101
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadPledge.java
vendored
Normal file
101
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadPledge.java
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class DeadPledge implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2Playable playable = (L2Playable) target;
|
||||
final L2PcInstance player = playable.getActingPlayer();
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || !p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((p != player) && ((p.getClanId() == 0) || (p.getClanId() != player.getClanId())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test(playable))
|
||||
{
|
||||
action.accept(playable);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(playable, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.DEAD_PLEDGE;
|
||||
}
|
||||
}
|
119
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadUnion.java
vendored
Normal file
119
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/DeadUnion.java
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2CommandChannel;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* Dead command channel/party affect scope implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class DeadUnion implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2PcInstance player = target.getActingPlayer();
|
||||
final L2Party party = player.getParty();
|
||||
final L2CommandChannel commandChannel = party != null ? party.getCommandChannel() : null;
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || !p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p != player)
|
||||
{
|
||||
final L2Party targetParty = p.getParty();
|
||||
if ((party == null) || (targetParty == null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (party.getLeaderObjectId() != targetParty.getLeaderObjectId())
|
||||
{
|
||||
final L2CommandChannel targetCommandChannel = targetParty.getCommandChannel();
|
||||
if ((commandChannel == null) || (targetCommandChannel == null) || (commandChannel.getLeaderObjectId() != targetCommandChannel.getLeaderObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Affect object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test((L2Playable) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.DEAD_UNION;
|
||||
}
|
||||
}
|
100
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Fan.java
vendored
Normal file
100
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Fan.java
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Fan affect scope implementation. Gathers objects in a certain angle of circular area around yourself (including origin itself).
|
||||
* @author Nik
|
||||
*/
|
||||
public class Fan implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final double headingAngle = Util.convertHeadingToDegree(activeChar.getHeading());
|
||||
final int fanStartAngle = skill.getFanRange()[1];
|
||||
final int fanRadius = skill.getFanRange()[2];
|
||||
final int fanAngle = skill.getFanRange()[3];
|
||||
final double fanHalfAngle = fanAngle / 2; // Half left and half right.
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(Util.calculateAngleFrom(activeChar, c) - (headingAngle + fanStartAngle)) > fanHalfAngle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GeoData.getInstance().canSeeTarget(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, fanRadius, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.FAN;
|
||||
}
|
||||
}
|
95
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/FanPB.java
vendored
Normal file
95
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/FanPB.java
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Fan point blank affect scope implementation. Gathers objects in a certain angle of circular area around yourself without taking target into account.
|
||||
* @author Nik
|
||||
*/
|
||||
public class FanPB implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final double headingAngle = Util.convertHeadingToDegree(activeChar.getHeading());
|
||||
final int fanStartAngle = skill.getFanRange()[1];
|
||||
final int fanRadius = skill.getFanRange()[2];
|
||||
final int fanAngle = skill.getFanRange()[3];
|
||||
final double fanHalfAngle = fanAngle / 2; // Half left and half right.
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(Util.calculateAngleFrom(activeChar, c) - (headingAngle + fanStartAngle)) > fanHalfAngle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GeoData.getInstance().canSeeTarget(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, fanRadius, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.FAN_PB;
|
||||
}
|
||||
}
|
162
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Party.java
vendored
Normal file
162
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Party.java
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class Party implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2PcInstance player = target.getActingPlayer();
|
||||
final com.l2jmobius.gameserver.model.L2Party party = player.getParty();
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
// Range skills appear to not affect you unless you are the main target.
|
||||
if ((plbl == activeChar) && (target != activeChar))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p != player)
|
||||
{
|
||||
final com.l2jmobius.gameserver.model.L2Party targetParty = p.getParty();
|
||||
if ((party == null) || (targetParty == null) || (party.getLeaderObjectId() != targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Affect object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test((L2Playable) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (target.isNpc())
|
||||
{
|
||||
final L2Npc npc = (L2Npc) target;
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Npc> filter = n ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (n.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (n.isAutoAttackable(npc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, n))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the getVisibleObjects method.
|
||||
if (filter.test(npc))
|
||||
{
|
||||
action.accept(npc);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(npc, L2Npc.class, affectRange, n ->
|
||||
{
|
||||
if (n == activeChar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (filter.test(n))
|
||||
{
|
||||
action.accept(n);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.PARTY;
|
||||
}
|
||||
}
|
108
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/PartyPledge.java
vendored
Normal file
108
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/PartyPledge.java
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* Party and Clan affect scope implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class PartyPledge implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2Playable playable = (L2Playable) target;
|
||||
final L2PcInstance player = playable.getActingPlayer();
|
||||
final L2Party party = player.getParty();
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p != player)
|
||||
{
|
||||
if (((p.getClanId() == 0) && (p.getParty() == null)) || ((p.getClanId() != player.getClanId()) && (party != player.getParty())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test(playable))
|
||||
{
|
||||
action.accept(playable);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(playable, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.PARTY_PLEDGE;
|
||||
}
|
||||
}
|
100
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Pledge.java
vendored
Normal file
100
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Pledge.java
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class Pledge implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2Playable playable = (L2Playable) target;
|
||||
final L2PcInstance player = playable.getActingPlayer();
|
||||
|
||||
// Create the target filter.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Playable> filter = plbl ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance p = plbl.getActingPlayer();
|
||||
if ((p == null) || p.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((p != player) && ((p.getClanId() == 0) || (p.getClanId() != player.getClanId())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, p))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (filter.test(playable))
|
||||
{
|
||||
action.accept(playable);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(playable, L2Playable.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.PLEDGE;
|
||||
}
|
||||
}
|
112
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/PointBlank.java
vendored
Normal file
112
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/PointBlank.java
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.TargetType;
|
||||
|
||||
/**
|
||||
* Point Blank affect scope implementation. Gathers targets in specific radius except initial target.
|
||||
* @author Nik
|
||||
*/
|
||||
public class PointBlank implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GeoData.getInstance().canSeeTarget(target, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Check and add targets.
|
||||
if (skill.getTargetType() == TargetType.GROUND)
|
||||
{
|
||||
if (activeChar.isPlayable())
|
||||
{
|
||||
final Location worldPosition = activeChar.getActingPlayer().getCurrentSkillWorldPosition();
|
||||
if (worldPosition != null)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, (int) (affectRange + activeChar.calculateDistance(worldPosition, false, false)), c ->
|
||||
{
|
||||
if (!c.isInsideRadius(worldPosition, affectRange, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Character.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.POINT_BLANK;
|
||||
}
|
||||
}
|
122
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Range.java
vendored
Normal file
122
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Range.java
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.TargetType;
|
||||
|
||||
/**
|
||||
* Range affect scope implementation. Gathers objects in area of target origin (including origin itself).
|
||||
* @author Nik
|
||||
*/
|
||||
public class Range implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((c == activeChar) && (target != activeChar)) // Range skills appear to not affect you unless you are the main target.
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GeoData.getInstance().canSeeTarget(target, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Check and add targets.
|
||||
if (skill.getTargetType() == TargetType.GROUND)
|
||||
{
|
||||
if (activeChar.isPlayable())
|
||||
{
|
||||
final Location worldPosition = activeChar.getActingPlayer().getCurrentSkillWorldPosition();
|
||||
if (worldPosition != null)
|
||||
{
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, (int) (affectRange + activeChar.calculateDistance(worldPosition, false, false)), c ->
|
||||
{
|
||||
if (!c.isInsideRadius(worldPosition, affectRange, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Character.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.RANGE;
|
||||
}
|
||||
}
|
98
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/RangeSortByHp.java
vendored
Normal file
98
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/RangeSortByHp.java
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* Range sorted by lowest to highest hp percent affect scope implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class RangeSortByHp implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Range skills appear to not affect you unless you are the main target.
|
||||
if ((c == activeChar) && (target != activeChar))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
final List<L2Character> result = L2World.getInstance().getVisibleObjects(target, L2Character.class, affectRange, filter);
|
||||
|
||||
// Add object of origin since its skipped in the getVisibleObjects method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
{
|
||||
result.add((L2Character) target);
|
||||
}
|
||||
|
||||
// Sort from lowest hp to highest hp.
|
||||
//@formatter:off
|
||||
result.stream()
|
||||
.sorted(Comparator.comparingInt(L2Character::getCurrentHpPercent))
|
||||
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE)
|
||||
.forEach(action);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.RANGE_SORT_BY_HP;
|
||||
}
|
||||
}
|
96
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/RingRange.java
vendored
Normal file
96
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/RingRange.java
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* Ring Range affect scope implementation. Gathers objects in ring/donut shaped area with start and end range.
|
||||
* @author Nik
|
||||
*/
|
||||
public class RingRange implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
final int startRange = skill.getFanRange()[2];
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Targets before the start range are unaffected.
|
||||
if (c.isInsideRadius(target, startRange, false, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GeoData.getInstance().canSeeTarget(target, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Character.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.RING_RANGE;
|
||||
}
|
||||
}
|
63
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Single.java
vendored
Normal file
63
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Single.java
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.TargetType;
|
||||
|
||||
/**
|
||||
* Single target affect scope implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class Single implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
|
||||
if (target.isCharacter())
|
||||
{
|
||||
if (skill.getTargetType() == TargetType.GROUND)
|
||||
{
|
||||
action.accept(activeChar); // Return yourself to mark that effects can use your current skill's world position.
|
||||
}
|
||||
if (((affectObject == null) || affectObject.checkAffectedObject(activeChar, (L2Character) target)))
|
||||
{
|
||||
action.accept(target); // Return yourself to mark that effects can use your current skill's world position.
|
||||
}
|
||||
}
|
||||
else if (target.isItem())
|
||||
{
|
||||
action.accept(target); // Return yourself to mark that effects can use your current skill's world position.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.SINGLE;
|
||||
}
|
||||
}
|
113
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Square.java
vendored
Normal file
113
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/Square.java
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Square affect scope implementation (actually more like a rectangle).
|
||||
* @author Nik
|
||||
*/
|
||||
public class Square implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int squareStartAngle = skill.getFanRange()[1];
|
||||
final int squareLength = skill.getFanRange()[2];
|
||||
final int squareWidth = skill.getFanRange()[3];
|
||||
final int radius = (int) Math.sqrt((squareLength * squareLength) + (squareWidth * squareWidth));
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
final int rectX = activeChar.getX();
|
||||
final int rectY = activeChar.getY() - (squareWidth / 2);
|
||||
final double heading = Math.toRadians(squareStartAngle + Util.convertHeadingToDegree(activeChar.getHeading()));
|
||||
final double cos = Math.cos(-heading);
|
||||
final double sin = Math.sin(-heading);
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if inside square.
|
||||
final int xp = c.getX() - activeChar.getX();
|
||||
final int yp = c.getY() - activeChar.getY();
|
||||
final int xr = (int) ((activeChar.getX() + (xp * cos)) - (yp * sin));
|
||||
final int yr = (int) (activeChar.getY() + (xp * sin) + (yp * cos));
|
||||
if ((xr > rectX) && (xr < (rectX + squareLength)) && (yr > rectY) && (yr < (rectY + squareWidth)))
|
||||
{
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GeoData.getInstance().canSeeTarget(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, radius, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.SQUARE;
|
||||
}
|
||||
}
|
107
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/SquarePB.java
vendored
Normal file
107
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/SquarePB.java
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Square point blank affect scope implementation (actually more like a rectangle). Gathers objects around yourself except target itself.
|
||||
* @author Nik
|
||||
*/
|
||||
public class SquarePB implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int squareStartAngle = skill.getFanRange()[1];
|
||||
final int squareLength = skill.getFanRange()[2];
|
||||
final int squareWidth = skill.getFanRange()[3];
|
||||
final int radius = (int) Math.sqrt((squareLength * squareLength) + (squareWidth * squareWidth));
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
final int rectX = activeChar.getX();
|
||||
final int rectY = activeChar.getY() - (squareWidth / 2);
|
||||
final double heading = Math.toRadians(squareStartAngle + Util.convertHeadingToDegree(activeChar.getHeading()));
|
||||
final double cos = Math.cos(-heading);
|
||||
final double sin = Math.sin(-heading);
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if inside square.
|
||||
final int xp = c.getX() - activeChar.getX();
|
||||
final int yp = c.getY() - activeChar.getY();
|
||||
final int xr = (int) ((activeChar.getX() + (xp * cos)) - (yp * sin));
|
||||
final int yr = (int) (activeChar.getY() + (xp * sin) + (yp * cos));
|
||||
if ((xr > rectX) && (xr < (rectX + squareLength)) && (yr > rectY) && (yr < (rectY + squareWidth)))
|
||||
{
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GeoData.getInstance().canSeeTarget(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(activeChar, L2Character.class, radius, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.SQUARE_PB;
|
||||
}
|
||||
}
|
95
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/StaticObjectScope.java
vendored
Normal file
95
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/StaticObjectScope.java
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2StaticObjectInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* Static Object affect scope implementation. Used to detect hidden doors.
|
||||
* @author Nik
|
||||
*/
|
||||
public class StaticObjectScope implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
// Target checks.
|
||||
final AtomicInteger affected = new AtomicInteger(0);
|
||||
final Predicate<L2Character> filter = c ->
|
||||
{
|
||||
if ((affectLimit > 0) && (affected.get() >= affectLimit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (c.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(c instanceof L2DoorInstance) && !(c instanceof L2StaticObjectInstance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((affectObject != null) && !affectObject.checkAffectedObject(activeChar, c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
affected.incrementAndGet();
|
||||
return true;
|
||||
};
|
||||
|
||||
// Add object of origin since its skipped in the forEachVisibleObjectInRange method.
|
||||
if (target.isCharacter() && filter.test((L2Character) target))
|
||||
{
|
||||
action.accept(target);
|
||||
}
|
||||
|
||||
// Check and add targets.
|
||||
L2World.getInstance().forEachVisibleObjectInRange(target, L2Character.class, affectRange, c ->
|
||||
{
|
||||
if (filter.test(c))
|
||||
{
|
||||
action.accept(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.STATIC_OBJECT_SCOPE;
|
||||
}
|
||||
}
|
62
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/SummonExceptMaster.java
vendored
Normal file
62
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/SummonExceptMaster.java
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.AffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class SummonExceptMaster implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
final IAffectObjectHandler affectObject = AffectObjectHandler.getInstance().getHandler(skill.getAffectObject());
|
||||
final int affectRange = skill.getAffectRange();
|
||||
final int affectLimit = skill.getAffectLimit();
|
||||
|
||||
if (target.isPlayable())
|
||||
{
|
||||
final L2PcInstance player = target.getActingPlayer();
|
||||
//@formatter:off
|
||||
player.getServitorsAndPets().stream()
|
||||
.filter(c -> !c.isDead())
|
||||
.filter(c -> affectRange > 0 ? Util.checkIfInRange(affectRange, c, target, true) : true)
|
||||
.filter(c -> (affectObject == null) || affectObject.checkAffectedObject(activeChar, c))
|
||||
.limit(affectLimit > 0 ? affectLimit : Long.MAX_VALUE)
|
||||
.forEach(action);
|
||||
//@formatter:on
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.SUMMON_EXCEPT_MASTER;
|
||||
}
|
||||
}
|
44
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/WyvernScope.java
vendored
Normal file
44
trunk/dist/game/data/scripts/handlers/targethandlers/affectscope/WyvernScope.java
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectscope;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectScope;
|
||||
|
||||
/**
|
||||
* TODO: Wyvern affect scope.
|
||||
* @author Nik
|
||||
*/
|
||||
public class WyvernScope implements IAffectScopeHandler
|
||||
{
|
||||
@Override
|
||||
public void forEachAffected(L2Character activeChar, L2Object target, Skill skill, Consumer<? super L2Object> action)
|
||||
{
|
||||
// TODO Unknown affect scope.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectScope> getAffectScopeType()
|
||||
{
|
||||
return AffectScope.WYVERN_SCOPE;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user