Support for additional potion bonuses.

This commit is contained in:
MobiusDevelopment
2019-03-15 18:06:37 +00:00
parent 50e26e6691
commit e02f179662
220 changed files with 2486 additions and 198 deletions

View File

@@ -37,6 +37,9 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("AbsorbDamage", AbsorbDamage::new);
EffectHandler.getInstance().registerHandler("Accuracy", Accuracy::new);
EffectHandler.getInstance().registerHandler("AddHate", AddHate::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionCp", AdditionalPotionCp::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionHp", AdditionalPotionHp::new);
EffectHandler.getInstance().registerHandler("AdditionalPotionMp", AdditionalPotionMp::new);
EffectHandler.getInstance().registerHandler("AddSkillBySkill", AddSkillBySkill::new);
EffectHandler.getInstance().registerHandler("AddTeleportBookmarkSlot", AddTeleportBookmarkSlot::new);
EffectHandler.getInstance().registerHandler("AirBind", AirBind::new);

View File

@@ -0,0 +1,31 @@
/*
* 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.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Mobius
*/
public class AdditionalPotionCp extends AbstractStatAddEffect
{
public AdditionalPotionCp(StatsSet params)
{
super(params, Stats.ADDITIONAL_POTION_CP);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Mobius
*/
public class AdditionalPotionHp extends AbstractStatAddEffect
{
public AdditionalPotionHp(StatsSet params)
{
super(params, Stats.ADDITIONAL_POTION_HP);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* @author Mobius
*/
public class AdditionalPotionMp extends AbstractStatAddEffect
{
public AdditionalPotionMp(StatsSet params)
{
super(params, Stats.ADDITIONAL_POTION_MP);
}
}

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -54,17 +55,23 @@ public final class Cp extends AbstractEffect
return;
}
int basicAmount = _amount;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
basicAmount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_CP, 0);
}
double amount = 0;
switch (_mode)
{
case DIFF:
{
amount = Math.min(_amount, effected.getMaxRecoverableCp() - effected.getCurrentCp());
amount = Math.min(basicAmount, effected.getMaxRecoverableCp() - effected.getCurrentCp());
break;
}
case PER:
{
amount = Math.min((effected.getMaxCp() * _amount) / 100.0, effected.getMaxRecoverableCp() - effected.getCurrentCp());
amount = Math.min((effected.getMaxCp() * basicAmount) / 100.0, effected.getMaxRecoverableCp() - effected.getCurrentCp());
break;
}
}

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -59,6 +60,10 @@ public final class CpHeal extends AbstractEffect
}
double amount = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
amount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_CP, 0);
}
// Prevents overheal and negative amount
amount = Math.max(Math.min(amount, effected.getMaxRecoverableCp() - effected.getCurrentCp()), 0);

View File

@@ -19,7 +19,9 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Cp Heal Over Time effect implementation.
@@ -35,7 +37,7 @@ public final class CpHealOverTime extends AbstractEffect
}
@Override
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill)
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead())
{
@@ -51,7 +53,13 @@ public final class CpHealOverTime extends AbstractEffect
return false;
}
cp += _power * getTicksMultiplier();
double power = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
power += effected.getStat().getValue(Stats.ADDITIONAL_POTION_CP, 0) / getTicks();
}
cp += power * getTicksMultiplier();
cp = Math.min(cp, maxcp);
effected.setCurrentCp(cp, false);
effected.broadcastStatusUpdate(effector);

View File

@@ -21,6 +21,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -56,6 +57,11 @@ public final class CpHealPercent extends AbstractEffect
final boolean full = (power == 100.0);
amount = full ? effected.getMaxCp() : (effected.getMaxCp() * power) / 100.0;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
amount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_CP, 0);
}
// Prevents overheal and negative amount
amount = Math.max(Math.min(amount, effected.getMaxRecoverableCp() - effected.getCurrentCp()), 0);
if (amount != 0)

View File

@@ -70,6 +70,11 @@ public final class Heal extends AbstractEffect
}
double amount = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
amount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_HP, 0);
}
double staticShotBonus = 0;
double mAtkMul = 1;
final boolean sps = skill.isMagic() && effector.isChargedShot(ShotType.SPIRITSHOTS);

View File

@@ -19,8 +19,10 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.AbnormalType;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.serverpackets.ExRegenMax;
/**
@@ -37,7 +39,7 @@ public final class HealOverTime extends AbstractEffect
}
@Override
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill)
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead() || effected.isDoor())
{
@@ -53,7 +55,13 @@ public final class HealOverTime extends AbstractEffect
return false;
}
hp += _power * getTicksMultiplier();
double power = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
power += effected.getStat().getValue(Stats.ADDITIONAL_POTION_HP, 0) / getTicks();
}
hp += power * getTicksMultiplier();
hp = Math.min(hp, maxhp);
effected.setCurrentHp(hp, false);
effected.broadcastStatusUpdate(effector);
@@ -61,11 +69,21 @@ public final class HealOverTime extends AbstractEffect
}
@Override
public void onStart(L2Character effector, L2Character effected, Skill skill)
public void onStart(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isPlayer() && (getTicks() > 0) && (skill.getAbnormalType() == AbnormalType.HP_RECOVER))
{
effected.sendPacket(new ExRegenMax(skill.getAbnormalTime(), getTicks(), _power));
double power = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
final double bonus = effected.getStat().getValue(Stats.ADDITIONAL_POTION_HP, 0);
if (bonus > 0)
{
power += bonus / getTicks();
}
}
effected.sendPacket(new ExRegenMax(skill.getAbnormalTime(), getTicks(), power));
}
}
}

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -63,6 +64,11 @@ public final class HealPercent extends AbstractEffect
final boolean full = (power == 100.0);
amount = full ? effected.getMaxHp() : (effected.getMaxHp() * power) / 100.0;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
amount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_HP, 0);
}
// Prevents overheal
amount = Math.min(amount, effected.getMaxRecoverableHp() - effected.getCurrentHp());
if (amount >= 0)

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -54,17 +55,23 @@ public final class Hp extends AbstractEffect
return;
}
int basicAmount = _amount;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
basicAmount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_HP, 0);
}
double amount = 0;
switch (_mode)
{
case DIFF:
{
amount = Math.min(_amount, effected.getMaxRecoverableHp() - effected.getCurrentHp());
amount = Math.min(basicAmount, effected.getMaxRecoverableHp() - effected.getCurrentHp());
break;
}
case PER:
{
amount = Math.min((effected.getMaxHp() * _amount) / 100.0, effected.getMaxRecoverableHp() - effected.getCurrentHp());
amount = Math.min((effected.getMaxHp() * basicAmount) / 100.0, effected.getMaxRecoverableHp() - effected.getCurrentHp());
break;
}
}

View File

@@ -59,6 +59,10 @@ public final class ManaHeal extends AbstractEffect
}
double amount = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
amount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_MP, 0);
}
if (!skill.isStatic())
{

View File

@@ -19,7 +19,9 @@ package handlers.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
/**
* Mana Heal Over Time effect implementation.
@@ -35,7 +37,7 @@ public final class ManaHealOverTime extends AbstractEffect
}
@Override
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill)
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
if (effected.isDead())
{
@@ -51,7 +53,13 @@ public final class ManaHealOverTime extends AbstractEffect
return true;
}
mp += _power * getTicksMultiplier();
double power = _power;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
power += effected.getStat().getValue(Stats.ADDITIONAL_POTION_MP, 0) / getTicks();
}
mp += power * getTicksMultiplier();
mp = Math.min(mp, maxmp);
effected.setCurrentMp(mp, false);
effected.broadcastStatusUpdate(effector);

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -63,6 +64,11 @@ public final class ManaHealPercent extends AbstractEffect
final boolean full = (power == 100.0);
amount = full ? effected.getMaxMp() : (effected.getMaxMp() * power) / 100.0;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
amount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_MP, 0);
}
// Prevents overheal
amount = Math.min(amount, effected.getMaxRecoverableMp() - effected.getCurrentMp());
if (amount != 0)

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.stats.Stats;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
@@ -54,17 +55,23 @@ public final class Mp extends AbstractEffect
return;
}
int basicAmount = _amount;
if ((item != null) && (item.isPotion() || item.isElixir()))
{
basicAmount += effected.getStat().getValue(Stats.ADDITIONAL_POTION_MP, 0);
}
double amount = 0;
switch (_mode)
{
case DIFF:
{
amount = Math.min(_amount, effected.getMaxRecoverableMp() - effected.getCurrentMp());
amount = Math.min(basicAmount, effected.getMaxRecoverableMp() - effected.getCurrentMp());
break;
}
case PER:
{
amount = Math.min((effected.getMaxMp() * _amount) / 100.0, effected.getMaxRecoverableMp() - effected.getCurrentMp());
amount = Math.min((effected.getMaxMp() * basicAmount) / 100.0, effected.getMaxRecoverableMp() - effected.getCurrentMp());
break;
}
}

View File

@@ -6,6 +6,9 @@ AbstractStatAddEffect: Abstract class for managing stat adding.
AbstractStatEffect: Abstract class for managing stats.
Accuracy: P. Accuracy stat.
AddHate: Instant effect that increases target's hate towards you.
AdditionalPotionCp: Increases the amount of CP heal gained from potions or elixirs. (l2jmobius)
AdditionalPotionHp: Increases the amount of HP heal gained from potions or elixirs. (l2jmobius)
AdditionalPotionMp: Increases the amount of MP heal gained from potions or elixirs. (l2jmobius)
AddSkillBySkill: Add skill when other skill already exists. (l2jmobius)
AddTeleportBookmarkSlot: Instant effect that increases the amount of My Teleport slots.
AirBind: Used by airbind chain skills. (l2jmobius)

View File

@@ -97,16 +97,35 @@ public abstract class AbstractEffect
}
public void onStart(L2Character effector, L2Character effected, Skill skill)
public void onStart(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
}
public void onStart(L2Character effector, L2Character effected, Skill skill)
{
onStart(effector, effected, skill, null);
}
public void onExit(L2Character effector, L2Character effected, Skill skill)
{
}
/**
* Called on each tick.<br>
* If the abnormal time is lesser than zero it will last forever.
* @param effector
* @param effected
* @param skill
* @param item
* @return if {@code true} this effect will continue forever, if {@code false} it will stop after abnormal time has passed
*/
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
return false;
}
/**
* Called on each tick.<br>
* If the abnormal time is lesser than zero it will last forever.
@@ -117,7 +136,7 @@ public abstract class AbstractEffect
*/
public boolean onActionTime(L2Character effector, L2Character effected, Skill skill)
{
return false;
return onActionTime(effector, effected, skill, null);
}
/**

View File

@@ -333,7 +333,7 @@ public final class BuffInfo
}
// Call on start.
effect.onStart(_effector, _effected, _skill);
effect.onStart(_effector, _effected, _skill, _item);
// If it's a continuous effect, if has ticks schedule a task with period, otherwise schedule a simple task to end it.
if (effect.getTicks() > 0)
@@ -360,7 +360,7 @@ public final class BuffInfo
if (_isInUse)
{
// Callback for on action time event.
continueForever = effect.onActionTime(_effector, _effected, _skill);
continueForever = effect.onActionTime(_effector, _effected, _skill, _item);
}
if (!continueForever && _skill.isToggle())

View File

@@ -68,6 +68,9 @@ public enum Stats
REGENERATE_HP_RATE("regHp", new RegenHPFinalizer()),
REGENERATE_CP_RATE("regCp", new RegenCPFinalizer()),
REGENERATE_MP_RATE("regMp", new RegenMPFinalizer()),
ADDITIONAL_POTION_HP("addPotionHp"),
ADDITIONAL_POTION_MP("addPotionMp"),
ADDITIONAL_POTION_CP("addPotionCp"),
MANA_CHARGE("manaCharge"),
HEAL_EFFECT("healEffect"),