Pets must share their master buffs.

Thanks to petryxa.
This commit is contained in:
MobiusDevelopment
2022-10-15 01:13:51 +00:00
parent 526815fc22
commit 232c2d37aa
6 changed files with 63 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.holders.PetEvolveHolder;
import org.l2jmobius.gameserver.model.holders.PetItemHolder;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.skill.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -97,6 +98,17 @@ public class SummonPet extends AbstractEffect
final Pet pet = Pet.spawnPet(npcTemplate, player, collar);
player.setPet(pet);
pet.setShowSummonAnimation(true);
// Pets must have their master buffs upon spawn.
for (BuffInfo effect : player.getEffectList().getEffects())
{
final Skill sk = effect.getSkill();
if (!sk.isBad() && !sk.isTransformation() && skill.isSharedWithSummon())
{
sk.applyEffects(player, pet, false, effect.getTime());
}
}
if (!pet.isRespawned())
{
pet.setCurrentHp(pet.getMaxHp());

View File

@@ -1345,10 +1345,17 @@ public class Skill implements IIdentifiable
}
// Support for buff sharing feature including healing herbs.
if (_isSharedWithSummon && effected.isPlayer() && effected.hasServitors() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb))
if (_isSharedWithSummon && effected.isPlayer() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb))
{
if (effected.hasServitors())
{
effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0));
}
if (effected.hasPet())
{
applyEffects(effector, effector.getPet(), _isRecoveryHerb, 0);
}
}
}
if (self)

View File

@@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.holders.PetEvolveHolder;
import org.l2jmobius.gameserver.model.holders.PetItemHolder;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.skill.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -97,6 +98,17 @@ public class SummonPet extends AbstractEffect
final Pet pet = Pet.spawnPet(npcTemplate, player, collar);
player.setPet(pet);
pet.setShowSummonAnimation(true);
// Pets must have their master buffs upon spawn.
for (BuffInfo effect : player.getEffectList().getEffects())
{
final Skill sk = effect.getSkill();
if (!sk.isBad() && !sk.isTransformation() && skill.isSharedWithSummon())
{
sk.applyEffects(player, pet, false, effect.getTime());
}
}
if (!pet.isRespawned())
{
pet.setCurrentHp(pet.getMaxHp());

View File

@@ -1345,10 +1345,17 @@ public class Skill implements IIdentifiable
}
// Support for buff sharing feature including healing herbs.
if (_isSharedWithSummon && effected.isPlayer() && effected.hasServitors() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb))
if (_isSharedWithSummon && effected.isPlayer() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb))
{
if (effected.hasServitors())
{
effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0));
}
if (effected.hasPet())
{
applyEffects(effector, effector.getPet(), _isRecoveryHerb, 0);
}
}
}
if (self)

View File

@@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.holders.PetEvolveHolder;
import org.l2jmobius.gameserver.model.holders.PetItemHolder;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.skill.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -97,6 +98,17 @@ public class SummonPet extends AbstractEffect
final Pet pet = Pet.spawnPet(npcTemplate, player, collar);
player.setPet(pet);
pet.setShowSummonAnimation(true);
// Pets must have their master buffs upon spawn.
for (BuffInfo effect : player.getEffectList().getEffects())
{
final Skill sk = effect.getSkill();
if (!sk.isBad() && !sk.isTransformation() && skill.isSharedWithSummon())
{
sk.applyEffects(player, pet, false, effect.getTime());
}
}
if (!pet.isRespawned())
{
pet.setCurrentHp(pet.getMaxHp());

View File

@@ -1345,10 +1345,17 @@ public class Skill implements IIdentifiable
}
// Support for buff sharing feature including healing herbs.
if (_isSharedWithSummon && effected.isPlayer() && effected.hasServitors() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb))
if (_isSharedWithSummon && effected.isPlayer() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb))
{
if (effected.hasServitors())
{
effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0));
}
if (effected.hasPet())
{
applyEffects(effector, effector.getPet(), _isRecoveryHerb, 0);
}
}
}
if (self)